[PLUG] reducing apache memory usage

Keith Lofstrom keithl at kl-ic.com
Mon Nov 7 21:59:32 UTC 2005


I am currently running my Apache server on a virtual host at Vcolo.com,
on a UML with 64MB of memory and 128MB of swap.  Lately, the system has
been running out of memory during nightly backups, which brings down
postfix and sometimes the VPN connection.  I am getting so many
hundreds of spam attempts per minute (most of which are killed before
processing, but...) that postfix can be quite a resource hog .  
I modified the backup control script so that postfix is shut down
during the backups and restarted after (with a later restart in
the crontab in case the backups wedge).


However, Apache is also a memory hog (20 4MB child processes!!!).  I
run 7 low-usage websites on that server, but do not get too many hits
per minute - usually spiders.  I doubt I need that many child processes.
I do use viewcvs and subversion and wiki and https and a bunch of 
other enhancements running, so I can't turn off many of the modules.

To keep Apache in bounds, I went into /etc/httpd/conf/httpd.conf and
reduced some of the settings:

...
<IfModule prefork.c>
# StartServers       8
# MinSpareServers    5
# MaxSpareServers   20
# MaxClients       150
# MaxRequestsPerChild  1000
StartServers       2             
MinSpareServers    2
MaxSpareServers    3
MaxClients        15
MaxRequestsPerChild  100
</IfModule>
...

Does this look reasonable?  The sites still seem quite responsive.
Are there better ways to slim down Apache?

Keith

-- 
Keith Lofstrom          keithl at keithl.com         Voice (503)-520-1993
KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon"
Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs



More information about the PLUG mailing list