On an Ubuntu server with 1Gb of RAM, an Apache 2.4.7 server with default configuration started to occasionally stop responding to request. It's used for a personal cloud + other needs and a low traffic website.
An error.log examination revealed this pattern that seem recurrent each time the problem appears:
[mpm_prefork:error] [pid 31950] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
after which access.log
doesn't log any access at all.
Then a day later:
[mpm_prefork:notice] [pid 31950] AH00171: Graceful restart requested, doing restart
which apparently didn't make any difference.
I've had to restart the server manually each time.
Now I'm looking at mpm_prefork.conf
, which is default and from the info I've been able to gather, I don't think I need to change anything.
I've started suspecting there could be some memory leak and read that MaxConnectionsPerChild 1000
is kind of a hack to prevent memory leak, so I put it to this 1000 value and will see how it behaves.
Since it's once in a while error, it's difficult to understand what's causing the problem exactly.
Do you think using MaxConnectionsPerChild
in this context is a good strategy (hoping the memory leak will be fixed in further release of the site I'm hosting), or does this just not indicate a memory leak?
NB: Having an average Apache process consuming ~20Mb of memory, I reduced the MaxRequestWorkers from 150 to 30 (considering 500Mb of mem available for Apache on the server). I have now:
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 30
MaxConnectionsPerChild 1000
</IfModule>
I don't think the memory peaked out, but as my Munin client was down, I realize now, I can't exclude it.