Trying to limit cpu usage of apache using cpulimit, but I can see it still going over my limit

StackOverflow https://stackoverflow.com/questions/22417562

سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top