Change process priority with renice

Today I discovered a very slow loading of a few website of mine. For apache, I have reading through and made some tweaks and optimization to make it perform better. On database, not much that I’ve done. I use mytop, a mysql health monitor just like top in linux system. Its shows a few queries hanging and queued.

Apache and mysql need a higher priority to serve the web faster, as fast as it could. I found a tutorial on renice, where we can change the process priority of process, and also for any process that belong to any particular user. The value varies from -20 until 19. The negative value only can be assigned by a superuser. The lower the value, higher the priority. For example, process with value -19, have a higher priority than a process with nice value -18.

to change the nice value, it could be as simple as :

nice -5 httpd
* this will change process httpd priority to 5.

You can also change the priority by user.

renice -5 -u mysql
* This will change the priority of all process that belong to user mysql to -5

renice -5 -u mysql -p 8918
* This will change the priority of all process that belong to user mysql and with PID 8918 to -5.

http://www.newlinuxuser.com/howto-change-a-running-processes-priority-with-renice/
http://jeremy.zawodny.com/mysql/mytop/
Renice – Linux man page http://linux.die.net/man/8/renice

Leave a Reply

Your email address will not be published. Required fields are marked *