Have you tried cgroups, it allows you to control the CPU usage, amongst other things? http://en.wikipedia.org/wiki/Cgroups. In addition you might see it go over 20% because you have a multi core system.
Trying to limit cpu usage of apache using cpulimit, but I can see it still going over my limit
Question
I'm trying to limit all pids under apache2 by using cpulimit.
I've tried specifically calling each individual pid with:
sudo cpulimit -p 6183 -b -l 20
It tells me it has detected the process, but when I used htop
I can see the process going well over 20%.
Why is this, and is there a better way in limiting all of the apache and mysql process without targeting each pid?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow