0

It seems like Apache always splits up the CPU usage for www-data processes out of 100 or 200. Why is this?

For example, one www-data process = 100% CPU usage:

http://i.imgur.com/mfRuOSm.png

Four www-data processes = 50% CPU usage for each:

http://i.imgur.com/GGuBPd2.png

Is this normal? If not, how can I fix this?

I'm running on Ubuntu 14.04.

0

You have two CPU cores that Apache is using, each of which is represented by 100% in the top output.

  • One thread can only run on one core, and will potentially use all of that core, up to 100%.
  • Four threads split between two cores all fighting for CPU time will be split between the cores, and get half a core (50%) each.
| improve this answer | |
  • So is that "splitting" normal? Because it ends up using 100% of my CPU. – Euser3 Jul 23 '14 at 18:43
  • @Euser3 The "splitting" is not something that's specific to Apache - if there's 4 processes (of any kind) that each need time on the CPU, and there's two CPU cores to use, then the OS scheduler will assign CPU time equally (assuming equal priority on the processes). So is your real problem that it's using too much CPU time, then? It's always going to use CPU time if it has work to do to serve requests. The high CPU usage you're seeing is almost always due to the custom code that's running within Apache as opposed to Apache itself. – Shane Madden Jul 23 '14 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.