Linode 512 - MPM Prefork - WordPress hosting optimization

I have a Linode that has Ubuntu loaded and am hosting a WordPress site. I would like to optimize my site so that I no longer get Out of Memory errors like the following:

Killed process 16660 (apache2) total-vm:186232kB, anon-rss:87404kB, file-rss:0kB

I have 512 MB of ram and whenever I get a spike of 500+ users trying to access the site, the site becomes unresponsive and I start getting the errors above.

Please let me know of any optimizations that I can make to help improve site performance.

Thanks in advance

11 Replies

Edit the prefork section of the config and change MaxClients to 15 or 20, and then disable KeepAlives, restart apache. Start there.


Thanks for those.

Any other optimation settings I should know of?

What are the optimum settings for the mpm prefork module?

StartServers 5

MinSpareServers 5

MaxSpareServers 20

ServerLimit 75

MaxClients 75

MaxRequestsPerChild 1000

Ok. I have applied the MaxClients of 20 and I am still getting the Out of Memory errors

Make it less then, if you have 8 PHP processes using 64MB of RAM then you're using your full 512MB, this isn't unusual with wordpress, keep lowering your MaxClients until the memory errors stop.

Where does the number 8 come from?

Just a random number, 8 PHP processes = 8 concurrent PHP pages being served.

Gotcha! I didn't know if that number came from the prefork settings or not. Please forgive me, I am new to Apache…

If you have many php pages. use this setting:

StartServers 5

MinSpareServers 5

MaxSpareServers 10

ServerLimit 75

MaxClients 75

MaxRequestsPerChild 1000

if your system used swap more then 300MB always, change MaxRequestsPerChild to 500.

MaxClients of 75 is a recipe for OOM. Reducing MaxRequestsPerChild only means a process will exit sooner, but Apache will still launch more processes than can fit into memory. If each Apache process is using 12M of RAM that's 900 MB on a 512 system.

Start by changing MaxClients to 10 or 20, disable KeepAlives, and move on from there.


You should consider nginx w/

Remove w3-cache and just use the nginx helper following … nditional/">

You may find it will considerably increase your concurrent users as it will skip php completely and serve a static html file bypassing php-fpm, except for logged in users and posting comments.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct