Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

My go to python script is

https://raw.github.com/pixelb/scripts/master/scripts/ps_mem.py

just run ps_mem.py 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
add comment

Your Answer

 
discard

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.