I am running Apache 2.2.16 on Debian Squeeze with ISPConfig 3.0.3 and am looking to reduce my apache2 process memory footpint. Currently, running 'ps -ylC apache2 --sort:rss' gives me: Code: S 33 13100 24996 0 80 0 10452 65841 - ? 00:00:00 apache2 S 33 13089 24996 0 80 0 10724 65963 - ? 00:00:00 apache2 S 33 13088 24996 0 80 0 10728 65963 - ? 00:00:00 apache2 S 33 13087 24996 0 80 0 10740 65963 - ? 00:00:00 apache2 S 33 13090 24996 0 80 0 10824 65965 - ? 00:00:00 apache2 S 33 13096 24996 0 80 0 12212 65920 - ? 00:00:00 apache2 S 33 13065 24996 0 80 0 14848 66758 - ? 00:00:00 apache2 S 0 24996 1 0 80 0 17704 65808 - ? 00:00:01 apache2 S 33 13061 24996 0 80 0 21816 68390 - ? 00:00:00 apache2 S 33 13085 24996 1 80 0 29464 69924 - ? 00:00:00 apache2 S 33 12776 24996 0 80 0 30200 70431 - ? 00:00:00 apache2 S 33 12775 24996 0 80 0 30544 69999 - ? 00:00:00 apache2 S 33 12271 24996 0 80 0 39424 72353 - ? 00:00:00 apache2 S 33 13084 24996 1 80 0 43220 73327 - ? 00:00:00 apache2 S 33 13063 24996 1 80 0 43400 73343 - ? 00:00:01 apache2 S 33 13095 24996 2 80 0 43936 73552 - ? 00:00:00 apache2 S 33 12774 24996 0 80 0 44200 73539 - ? 00:00:00 apache2 S 33 13101 24996 3 80 0 45212 73882 - ? 00:00:00 apache2 S 33 13059 24996 1 80 0 45712 74024 - ? 00:00:00 apache2 S 33 13099 24996 3 80 0 45872 74077 - ? 00:00:00 apache2 S 33 13094 24996 4 80 0 46148 74140 - ? 00:00:00 apache2 S 33 12781 24996 1 80 0 50676 75153 - ? 00:00:01 apache2 My enabled modules are currently: Code: actions.conf authz_user.load include.load proxy.load actions.load autoindex.conf mime.conf reqtimeout.conf alias.conf autoindex.load mime.load reqtimeout.load alias.load cgi.load negotiation.conf rewrite.load auth_basic.load deflate.conf negotiation.load setenvif.conf authn_file.load deflate.load php5.conf setenvif.load authz_default.load dir.conf php5.load status.conf authz_groupfile.load dir.load proxy.conf status.load authz_host.load env.load proxy_http.load suexec.load Apache2.conf has Timeout 30, KeepAliveTimeout 15, MaxKeepAliveRequests 100 and prefork with: Code: StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 75 MaxRequestsPerChild 1000 Why are my apache processes running at 50Mb each? Regards, Lewis
Have you tried this guide? http://www.howtoforge.com/configuring_apache_for_maximum_performance Also, do you use some sort of PHP opcode cacher, e.g. eAccelerator, Xcache, or APC?
Hey falko, Thank you for getting back to me. I don't use any sort of PHP opcode cacher, and have seen the article you mentioned. I already have HostnameLookups Off, and configured MaxClients and whatnot, as specified earlier. Out of the modules that I currently have enabled, are there any known 'offenders' who use a large amount of RAM? What's the primary reason that my apache2 processes would be using 50Mb of RAM so quickly after starting? Regards, Lewis
I'm using Code: Timeout 300 MaxKeepAliveRequests 1000000 KeepAliveTimeout 2 StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxRequestsPerChild 0 Can you try these?
By setting 'MaxRequestsPerChild' to 0, the apache documentation says: 'the process will never expire' - is that really what one wants? Additionally, will any of those settings have any immediate effect on the memory footprint?
The momory footprint is ok for apache and should be no problem. What you can try is to uninstall php modules that you dont need and that you disable apache mod_proxy and mod_proxy httpd
Your guide says that the memory should be 2-3Mb, or 15Mb if using PHP, but then you tell me that it is normal that I have 50Mb processes? Also, I have already gotten rid of all the modules I believe I am not using. The rest I am unsure about. I am definitely using the proxy stuff, but is it a known memory hog?
http://www.howtoforge.com/configuring_apache_for_maximum_performance "Child process size for serving static file is about 2-3M. For dynamic content such as PHP, it may be around 15M."
Thats not a guide that I have written, please see author information. Also this refers to a separate server for static contents and not a server that serves dynamic content like your server. A server for dynamic content loads modules like PHP inside the server process. And the guide is from 2006, so it most likely for apache 1 (which uses less RAM) or a old apache 2 version and not the current apache 2.2.
Thank you for clarifying. So, my 50Mb memory usage is normal, and I should ensure that 50Mb x MaxClients is less than the total amount of free system memory I have...