Th server is running around 40 WordPress sites. Originally I'd set the server up using mod_php and mpm-prefork back when the server had 2GB of memory, and it was running comfortably well. Recently, however, I updated the server to use FastCGI, suexec and mpm-worker. Since then, I can't get Apache to keep from gobbling up all the free RAM until it starts swapping and eventually stops responding.
We bumped the server up from 2GB to 4GB in hopes of alleviating the issue, but after 7 or so hours the server had taken up all of the 4GB and was back into swap.
Under mpm-prefork, we just set the MaxClients and everything was well. For the life of me, though, under mpm-worker I can't find settings that seem to work. Any combination of MaxRequestsPerChild, ThreadsPerChild and MaxClients still results in the same thing. I've never worked with mpm-worker before, so I'm not sure how to tune this. I've spent countless hours searching on the settings in Apache2.conf, and tried dozens of settings, but they all lead down the same road of the server using up all the memory.
With a 4GB server, leaving about 400MB for other processes and knowing that each Apache child thread is running around 50MB when spawned up, what combination of settings should be comfortable to keep the server from maxing out the RAM?
<IfModule mpm_worker_module> StartServers 6 ServerLimit 25 MinSpareThreads 25 MaxSpareThreads 50 ThreadLimit 75 ThreadsPerChild 25 MaxClients 75 MaxRequestsPerChild 2000