Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi there and sorry if this is too noobish. I've tried to find the answer myself as I usually do but I failed.

What is the best practice when I need to analyze which virtual hosts are consuming the most of the system resources - especially memory?

top or ps aux seems useless as all virtual hosts related processes are running under the same - apache - user

What about log analysis - is this the way? I've got access logs separated for individual virtual hosts if this information is of any value for you.

This question is definitely related but it didn't helped my issue:
Tracking Apache by VirtualHost

If you need any more info let me know ... I'll be around.
Thanks in advance.

share|improve this question
up vote 2 down vote accepted

Have a look at mod_status and in particular the extended status. It should be easy enough to match the PID given in the server-status page to the output of top and ps.

share|improve this answer
Thanks a lot for your super fast answer Niall! You've pointed me the right direction. I was able to write a piece of code that does what I need - allows for a fast check for the most memory consuming processes and their associated virtual hosts. Im not sure how much useful it will be but Im sure it could have been written in a much smarter way. Anyway it was fun. I'll post it here just in case anyone's instered: set `ps ax -o pid,user --sort -rss | grep 'www-data' | head -5 | sed 's/ www-data//g' | tr '\n' '|'`;apache2ctl fullstatus | egrep {$1} | grep -v 'server-status' – Michal Mau Jan 25 '11 at 3:35
@maug can you make this an answer, it's a bit too large for a comment – Jeff Atwood Feb 13 '11 at 19:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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