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?

Current Settings:

<IfModule mpm_worker_module>
    StartServers          6
    ServerLimit          25
    MinSpareThreads      25
    MaxSpareThreads      50
    ThreadLimit          75
    ThreadsPerChild      25
    MaxClients           75
    MaxRequestsPerChild  2000

1 Answer 1


I've had good luck with mod_fcgid with mpm-prefork on a micro-sized virtual machine running on Amazon EC2. I didn't need to do any tuning, but my workload was different than yours.

But what you should do is find out what part of WordPress is taking up so much RAM. I would assume that you're using a bunch of RAM via plenty of web users and not just because Apache is running for a while.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.