httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve <>
Subject [users@httpd] Apache leaking memory - tips on how to find the problem?
Date Mon, 21 Sep 2009 04:34:13 GMT
Hello everyone,

My prefork apache configuration is causing processes to leak lots of memory.
I'm hoping people on this list could suggest ways in me finding it, given
that I've been unsucessful in isolating the problem.

Here is a breakdown of my configuration:

Ubuntu 9.04 with 2.6 Kernel
Apache 2.2.11 with enabled modules:
 PHP 5.2.6-3ubuntu4.2 with Suhosin-Patch with modules:
pgsql (using PostgreSQL 8.3.7 on the same system)
 This runs on a fairly beefy dual quad-core Xenon Server with terabytes of
HD and 12 GB of RAM.
My website gets miminal traffic at the moment (average 5 users
simulatenously throughout the day) and yet I find I run out of memory in
less than 24 hours, I have a cron which restarts the server to band-aid the
problem. Whatever I'm leaking, I'm leaking fast - htop shows my RAM on
average going up roughly between 2-4 MB/s depending on the request, and it's
all in apache processes. I seemed to have slowed down the problem by
re-configuring my conf like so:

<IfModule mpm_prefork_module>
    StartServers        50
    MinSpareServers     20
    MaxSpareServers     50
    ServerLimit         1500
    MaxClients          1500
    MaxRequestsPerChild 1000

Which is only a temporary solution, because I except traffic to increase
from this point forward. Since my website uses ajax heavily for polling it's
worth mentioning that I have my keep-alives set very tightly as well:

Timeout 300
KeepAlive On
MaxKeepAliveRequests 0
KeepAliveTimeout 15

I do not use persistant connections between Postgres and PHP since I found
it aggrevated the problem horrendously. I've tried to get a memory map a
particular process, using pmap, but I always get 0k result:

pmap -x 12762
12762:   /usr/sbin/apache2 -k start
Address   Kbytes     RSS    Anon  Locked Mode   Mapping
-------- ------- ------- ------- -------
total kB       0       -       -       -

I've also attempted exmap, which was installed from apt as gexmap, but all I
get from is this error which I haven't found a solution that works for me:

(gexmap:14395): Gtk-WARNING **: cannot open display:

Can anyone suggest a strategy on how to isolate what exactly is going on
inside these processes and why they absorb such huge chunks of RAM? Any
advice would be appreciated.


View raw message