Memory Utilisation of httpd process

Hi All,

I have a RHEL 5.4 server which runs an Apache web server(2.2.23 compiled with prefork MPM).I want to find out the memory utilised by the web server.

# ps -ylC httpd | wc -l
245
# ps -ylC httpd | more
S   UID   PID  PPID  C PRI  NI   RSS    SZ WCHAN  TTY          TIME CMD
S    48   376  1074  0  75   0  4640  45817 -      ?        00:00:00 httpd

My understanding is that RSS is the amount of real memory used by a process.So am adding the RSS column to arrive at total memory used by all httpd processes.

# ps -ylC httpd |awk '{print $8}' | awk '{sum = sum + $1;} END{print sum}'
1190456
# free -m
             total       used       free     shared    buffers     cached
Mem:          1883       1677        205          0        158        990
-/+ buffers/cache:        528       1355
Swap:         4095          0       4095

So the total memory used by my web server is 1190456Kb or 1.19GB. But from "free -m" command i am getting around 1gb cached and 1.6gb used while as the total RAM is just 2GB.

Can someone point where i am wrong? Is this the right way to calculate memory utilised by a webserver?
Any other better methods?

Thanks
HG

---------- Post updated at 12:32 PM ---------- Previous update was at 12:18 PM ----------

Forgot to add this:

Output of top:

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 376 apache    15   0  178m 4784 2076 S  0.0  0.2   0:00.11 httpd
  378 apache    15   0  178m 5436 2160 S  0.0  0.3   0:00.13 httpd
  426 apache    15   0  178m 5448 2136 S  0.0  0.3   0:00.11 httpd

The top command shows something like VIRT using 178m. The documentation says VIRT = RES + Swap

SO each "httpd" process is using 178mb?? swap usage shows zero(as can be seen in "free -m) command.

:wall:

Thanks
HG