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 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>