Why Apache needs so much children when almost there is no connections?

  • Posted on August 30, 2014
  • evgenyAsked by Evgeny

I’m using 1-click app Ubintu+Wordpress for a small blog on minimal configuration (with 512 MB of RAM). New, small blog, just 1 page and 2 posts. Maximum pageviews per day - 156 (2 days ago).

Yesterday I’ve experienced a problem with RAM (details are here: I’ve created a 1GB swap but it didn’t help (mysql crushed anyway at some point).

Blog was just started. There is no much visitors for the moment. I believe, I was the only visitor yesterday and today. So I though it shouldn’t be normal that 512 MB of RAM is not enough.

I found a tutorial for Apache optimization:

For example, it suggests to decrease number of children by changing parameter MaxClients in apache2.conf (for mpm_prefork_module). Actually, in my case it’s a parameter MaxRequestWorkers in mpm_prefork.conf.

Initially I changed it to 15 as it was suggested in tutorial (default setting was 150). But Apached stopped to work just after a restart. There was an error in Apache log: “server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting”.

Then I set MaxRequestWorkers to 100. But again Apache stopped to work, but in this case a little later than previously.

So service doesn’t work because of lack of memory of because of too small MaxRequestWorkers value. But if I increase MaxRequestWorkers it will eat all memory again.

What am I doing wrong? Should I be an experienced Linux user to use 1-click app Wordpress? Should I know how to fine tune Apache and MySQL. (I don’t believe 512 GB is not enough for a blog with a small number of visitors)

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

The reason was an XML-RPC attack. Here you can find an article about how to protect you WordPress site:

P.S. Sorry for keeping silence. I just did’t use my DigitalOcean account for a long time:)

I just got the same error. Apache hangs - had to restart manually. Saw this in the main error.log:

[mpm_prefork:error] [pid 10889] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

I’m not as familiar with apache and wordpress and was facing similar issues. I had this server that had enough ram and space to host a simple wordpress site but it kept running up the number of apache processes that it was allowed to create. I adjusted the MaxRequestWorkers as you had noted and still had no luck. I also noticed that even when no one was hitting my server the number of spawned child processes increased for no apparent reason.

That is until I saw this in my /etc/apache2/mods-enabled/mpm_prefork.conf:

<IfModule mpm_prefork_module> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxRequestWorkers 30 MaxConnectionsPerChild 0 </IfModule>

I overlooked it initially but the MaxConnectionsPerChild is set to ZERO for some reason… DER, no matter how many child processes are spawned, none of them will be able to connect to requests. I’ve changed that value to 10 right now and will keep monitoring the performance. Things are looking much better. Let me know if this helps.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel