Linux – Limit CPU of single MYSQL Process

colocationlinuxMySQL

This is a relatively simple question, which hopefully has a simple answer. The almighty google isn't muchhelp on this one thus far.

I run a fairly active web hosting business. I have a client who is importing a somewhat large database (a vbulletin to ipb conversion ~ 4gb) which uses a PHP script to grab everything from the vbulletin database and slap it into the ipb software.

It essentially cripples my server while it's running.

Now I'd like ot be a good host and let him do this, but not at the consequence of the other users on my box.

Any ideas?

Best Answer

You can use [re]nice to adjust a process' priority - this won't "limit" things per-se but it will let other operations on the server continue to run. The command renice will change the priority of a running process From man renice "Useful priorities are: 20 (the affected processes will run only when nothing else in the system wants to), 0 (the ‘‘base’’ scheduling priority), anything negative (to make things go very fast)."

renice N PID

eg: renice +5 987 this will make process 987 less favorable to scheduling.

Edit: I wouldn't renice your mysql server process as that will certainly affect other users - look for the mysql client process and renice that instead.

Related Topic