I run a little startup on a Cloud server with 512MB and monitor the CPU/memory consumption with htop and phpsysinfo. Once, the server has ran out of RAM and on some instance get as high as consuming close to 90% of RAM. htop shows apache (httpd) as the top process with some (httpd) process consuming up to 7.5% in some instance. Is this amount (7.5%) too much for a single httpd process? What are the recommendations for reducing apache memory consumption?
-
What kind of content is Apache serving? Static files or does it do any processing? – phuzion Jul 29 '09 at 13:25
-
Sorry I failed to mention. The site runs on PHP, so Apache does processing. Besides, I have gzip compression turned on but I dont think this should have that big effect on the memory. – Jul 29 '09 at 13:51
2 Answers
7.5% for a single child doesn't sound too abnormal, but it all depends on what the child is supposed to do... I run systems with apache and mod_perl and those children get huge.
Watch your apache children memory footprints over time to see if they stabilize. If not, use MaxRequestsPerChild to control how often they are restarted. Use MaxClients to limit how many concurrent children you have (to avoid swap or out of virtual memory issues).
In my experience, it's generally a memory bottleneck on the webservers.
![](../../users/profiles/5223.webp)
- 1,562
- 2
- 13
- 15
That sounds pretty normal. To reduce the memory footprint would be to figure out which modules you need and don't need and compile your own version. Although with dynamic modules maybe that doesn't help as much.
Here is a nice O'Reilly article about getting your Apache memory requirements down. Although a bit old, not sure if has the enhancements that come with Apache 2.
![](../../users/profiles/2561.webp)
- 82,107
- 71
- 302
- 444