Linux process groups

This morning our server at work is dog slow. It appears that the nightly updatedb process has collided with an rsync that’s taking ages. Both processes wanting to use lots of disk IO is making the machine cranky.

I don’t really mind if updatedb takes a long time, so long as it stays out of the way. A simple solution to this is to renice updatedb. Something to keep in mind is that the updatedb process more than just one process; it’s updatedb + find + sort + frcode (some locate command). So, how can one renice the entire stack? One way is to dig out the PID of each process; another way is to use the process group.

I found out[1] that when a process is started, it creates a process group. Anything that process forks/executes is also in this process group. You can use this command to determine the process group:

ps -eHo "%p %P %r %n %c" | less

The third column will contain the process group id; then it’s simply a matter of running:

sudo renice 19 -g <group id>

[1] http://www.wlug.org.nz/ProcessGroup

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s