VeryNice is a tool for dynamically adjusting the nice-level of processes under UNIX-like operating systems. It can also be used to kill off runaway processes and increase the priority of multimedia applications, while properly handling both batch computation jobs and interactive applications with long periods of high CPU usage.
Unlike most other process re-nice tools, VeryNice is not only capable of lowering a CPU bound process's priority (raising the nice level), but it is also capable of raising the priority back up when the process is no longer heavily using the CPU. It is also configurable, so it can detect different users and different programs and act accordingly. For example, it can be configured to detect and kill certain programs (such as netscape) that have a tendency to die with 100% cpu usage, but the program will only be killed under stringent conditions so that it is very unlikely that it would be killed improperly.
VeryNice is known to be very stable. The 0.8 release was solid enough to run for more than 6 months without any problems. 1.0 and 1.1 seem be at least as reliable, although only time will tell.
The VeryNice webpage is http://thermal.cnde.iastate.edu/~sdh4/verynice/.
VeryNice can be downloaded via http from http://thermal.cnde.iastate.edu/~sdh4/verynice/down
rpm -i verynice-[VERSION]-1.i386.rpm will install VeryNice in /usr. It will automatically start on the next bootup. You can start it immedately with /etc/rc.d/init.d/verynice.init start
Install the RPM and start the daemon (as above). This daemon, in the default configuration will:
Once you unarchive the tarball, you need to configure VeryNice. Fortunately, this is quite simple. The parameters are listed below, and can be set either by changing the Makefile, or by passing them on the make command line when you do your make and make install (e.g. make PREFIX=/usr and make install PREFIX=/usr)
|PREFIX||/usr/local||/usr, /usr/local/pub, /opt, etc.||Prefix for installation. Binary will go in PREFIX/sbin. Documentation will go in PREFIX/share/doc. Configuration file will go in PREFIX/etc unless PREFIX is /usr, in which case the configuration file will go in /etc.|
|TARGET||linux||solaris||Operating system to compile for|
Often on Solaris you will need to add INSTALL=/usr/ucb/install for the make install to work properly.
Just type (as root) make [opts] ; make install [opts] and VeryNice will compile and install.
You will usually want to run VeryNice as root and in the background, e.g. /usr/local/sbin/verynice &. Typically, you will want to install it to run automatically on startup, either from (/etc/rc.d/)rc.local or from a SYSV-style init script placed in /etc/rc.d/init.d with appropriate symbolic links in /etc/rc.d/rc*.d. If you give it a "-d [pidfilename]" option on the command line, it will automatically background itself and write it's process id to the specified file (this option also automatically inhibits writing. error messages to stderr in addition to syslogd)
(tested on RedHat. You may want to change PREFIX in the Makefile and in verynice.init first.)
make clean ; make ; make install cp verynice.init /etc/rc.d/init.d chkconfig --add verynice.initchkconfig verynice.init on
You can use the kill(1) command to send signals to VeryNice that will change it's execution.
|SIGTERM, SIGINT, SIGQUIT||Un-renice processes and exit|
|SIGHUP||Restart, clearing all nice levels|
|SIGUSR1||Dump process database to syslog|
|SIGUSR2||Reread configuration files (does not affect already-running processes)|
VeryNice automatically reads configuration information both from a central location (usually /etc/verynice.conf or /usr/local/etc/verynice.conf, depending on your PREFIX) and from the home directories of individual users, in the ~/.verynicerc file. The format of both kinds of configuration files is the same. More restrictive settings in the global configuration generally take precedence over individual users' settings. Of course the settings in a user's ~/.verynicerc file only affect that user's processes. A sample verynice.conf file is usually installed in /etc/verynice.conf or /usr/local/etc/verynice.conf.
|notnice||Set the nice-level of "goodexe" processes||-4||Any negative number greater than -20||Central||no|
|batchjob||Set the nice-level of "badexe" processes||18||Any positive number less than 20||Central||no|
|runaway||Set the bad karma (nice) level at which runawayexe processes are killed with SIGTERM||20||Any positive number||Central||no|
|kill||Set the bad karma (nice) level at which runawayexe processes are killed with SIGKILL||22||Any positive number||Central||no|
|badkarmarate||Set the amount of bad karma generated per second of 100% cpu usage (for small bad karma levels)||.0167||Any positive real number||Central||no|
|badkarmarestorationrate||Set the amount of bad karma removed per second of 0% cpu usage||.0167||Any positive real number||Central||no|
|periodicity||Set the approximate number of seconds between iterations through the process analysis code of VeryNice||60||Any positive integer. Large values use less CPU. Small values give more precise performance.||Central||no|
|rereadcfgperiodicity||Set the approximate number of program cycles (periodicities, above) between attempts to reread the configuration files of VeryNice||60||Any positive integer. Be aware that reconfiguring requires looking up the .verynicerc file in each user's home directory and does not affect existing processes.||Central||no|
|immuneuser||Inhibit VeryNice from modifying the nice level of a user's processes, except for "goodexe", below, if set in the central config file.||(none)||Any user name, unquoted||Central||yes|
|immuneexe||Inhibit VeryNice from modifying the nice level of certain executables||(none)||Any substring of the complete path to the executable, quoted with double quotes ("). If it begins with '/', it must match the complete path precisely.||Central/User||yes|
|badexe||Force the nice level of an executable to the BATCHJOB level||(none)||(As above)||Central/User||yes|
|goodexe||Force the nice level of an executable to the NOTNICE level. This is typically used for real-time multimedia applications which need high priority||(none)||(As above)||Central/User||yes|
|runawayexe||Mark an executable as a potential runaway process. Only processes specially marked will ever be killed by VeryNice||(none)||(As above)||Central/User||yes|
|hungryexe||Mark an executable as "assumed to be CPU hungry". Such a process will be treated as if it were using 100% of the CPU, regardless of its actual CPU usage. This is appropriate for programs that do their real work in lots of short-lived subprocesses, such as make(1).||(none)||(As above)||Central/User||yes|
Processes are tracked and reniced according to their "bad karma". Bad karma is accumulated whenever the process hogs the CPU, and is reduced if the process is idle. "goodexe" processes have negative bad karma (i.e. good karma).
VeryNice was written with security in mind, nevertheless is is impossible to guarantee that there aren't any holes. Users in general CAN use VeryNice to renice their processes to negative nice values, up to the centrally configured "notnice" value (default -4). Remember, VeryNice runs as root on the local host and does not support network access. However, it does access and read information from individual users' configuration files. For security reasons, the configuration files will be used only if they are regular files and are not symbolic links.
VeryNice should scale without any trouble to extremely large networks with very large numbers of users.
|VeryNice sets all processes (even root-owned) to nice-level zero on startup||VeryNice cannot find it's configuration file. Try a 'make clean' and rebuilding it with the proper PREFIX, then a make install with the same PREFIX. Make sure you're not running an old copy that was installed in another directory|
|Processes aren't identified properly on Solaris||VeryNice can currently only identify the filename of the executables on Solaris, not their complete paths. However, you can use a leading slash in the configuration file to force a precise match of the filename. For example "X" will match both "X" and "Xserver", but "/X" will only match "X" and not "Xserver".|
|I'm confused about what VeryNice is doing||Try looking at VeryNice's process database. This will give renice levels, karma levels, and configuration flags. It can be dumped with kill -USR1 [verynice_process_id].|