vendredi 27 février 2015

httpd memory usage


Having some problems with httpd (Apache/2.2.29) memory usage.


Over time, memory usage in the httpd processes creep up until it's eventually at 100%.


Last time I restarted httpd was about 24 hours ago. Output from free -m is:



[ec2-user@www ~]$ free -m
total used free shared buffers cached
Mem: 1655 1415 239 0 202 424
-/+ buffers/cache: 788 866
Swap: 1023 4 1019


To prove that it's definitely httpd, I restarted httpd and ran free -m again:



[ec2-user@www ~]$ sudo service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[ec2-user@www ~]$ free -m
total used free shared buffers cached
Mem: 1655 760 894 0 202 360
-/+ buffers/cache: 197 1457
Swap: 1023 4 1019


So, restarting Apache takes free memory from 239 Mb to 894 Mb - which seems like a big leap.


I've been going through the list of currently enabled Apache modules (there's quite a lot) and disabled/removed mod_wsgi and mod_perl (neither of which are required for this server, which is running a PHP-based web application - Magento, specifically).


Based on http://ift.tt/1nJDy6G, I've run ps aux | grep 'httpd' | awk '{print $6/1024 " MB";}' and get the following output:


[root@www ~]# ps aux | grep 'httpd' | awk '{print $6/1024 " MB";}' 15.1328 MB 118.09 MB 127.449 MB 129.059 MB 117.734 MB 113.824 MB 125.062 MB 123.922 MB 119.855 MB 108.066 MB 136.23 MB 114.031 MB 113.27 MB 110.695 MB 102.113 MB 113.234 MB 186.816 MB 118.602 MB 0.835938 MB


Running the other suggested diagnosis tool for MaxClients which is ps aux | grep 'httpd' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB";}' returns the following:



[root@www ~]# ps aux | grep 'httpd' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB";}'
110.212 MB


This server (Amazon AWS m1.small instance) has 1.7 Gb of RAM. So, therefore:


Any further pointers/suggestions on how best to tweak the httpd settings or how to diagnose what exactly might be causing this?



Aucun commentaire:

Enregistrer un commentaire