0

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?

Amit Nagar
  • 31
  • 1
  • 4

1 Answers1

0

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)
Mike
  • 22,310
  • 7
  • 56
  • 79