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

I want to measure memory utilization of my Apache Server. Can I use the pmap/ps command and pass all the process IDs of httpd and take that as total utilization?

In most of the blog, they suggest that ps command gives correct result for sample program but not for apache

In pmap

pmap PID1 PID2 ....

It seems that pmap gives more info than just RAM utilization. Is there any command in Unix/Perl with which I can get the correct info for memory use?

share|improve this question

My go to python script is

just run and it will tell you how much space httpd is using with all the processes it has forked off. You can't really sum up the output of ps using like res memory due to a lot of the memory that it says is in use by the process is shared between processes. So for example one of my servers a sample of apache processes are

apache    6799  0.2  0.7 590052 63064 ?        S    12:56   0:07 /usr/sbin/httpd
apache    6802  0.3  0.7 589084 60804 ?        S    12:57   0:08 /usr/sbin/httpd
apache    6803  0.2  0.7 588004 59748 ?        S    12:57   0:05 /usr/sbin/httpd

Makes one think each process is using around 60megs of ram. I have 100 of them open so one might thing it's using like 600megs of ram.

Well the real memory is 365 from the output of the script

286.6 MiB +  79.3 MiB = 365.9 MiB   httpd (38)
share|improve this answer

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.