3

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.

1 Answer 1

2

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.

2
  • 2
    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, 2011 at 3:35
  • @maug can you make this an answer, it's a bit too large for a comment Feb 13, 2011 at 19:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .