2

I am using Ubuntu server and when I run ps aux I get the following process table http://pastebin.com/NJsASBek as we can see apache proceess are shown like this:

www-data 26487 0.0 0.9 245476 14920 ? Sl 17:32 0:00 /usr/sbin/apache2 -k start

Where 2687 is the PID. How can I know wich of my enabled sites belong that process?

This is how my apache sites are defined http://pastebin.com/mcew79sH of course I am willing to edit my apache sites if needed.

quarry32
  • 255
  • 2
  • 11
  • As Kyle notes, the apache processes can be serving any virtual host defined your configuration. What are you actually trying to figure out? – cjc Apr 02 '12 at 18:20
  • Basically I want to know which sites (lets say the ServerName) are consuming more memory, and which consume less. – quarry32 Apr 02 '12 at 18:40

1 Answers1

6

The default MPM is prefork, which creates (as you've seen) a pre-forked Apache process that is waiting for a connection to serve a request. It does not fire off different processes for different VirtualHost declarations, so any given process could serve any of your sites.

As processes are restarted after a configurable number of requests have been served (or an idle timer passes, and the forks are cleaned up), it's possible that any given process has served pages from multiple VirtualHosts.

Kyle Smith
  • 9,683
  • 1
  • 31
  • 32
  • So... how can I know which sites are consuming more memory at a specific moment? – quarry32 Apr 02 '12 at 18:42
  • 2
    Maybe you should change the title/question or start a new one for that since the current question has been answered. – Safado Apr 02 '12 at 18:53
  • I have created a new one http://serverfault.com/questions/376054/how-may-i-know-the-ammount-of-memory-used-by-each-one-of-my-apache-sites thanks – quarry32 Apr 02 '12 at 20:06
  • 1
    This answer ignores the fact that they are using mod_wsgi and specifically mod_wsgi daemon mode with the WSGI application delegated to that separate set of processes. More specific answer which deals with that in duplicate question. – Graham Dumpleton Apr 02 '12 at 21:51
  • +1'd on your post. I'm not familiar with WSGI, clearly :-) – Kyle Smith Apr 02 '12 at 22:18