- CentOS 6.4 X86_64
- Apache 2.4.4
- PHP 5.4.16 (FPM)
- 2 Intel Xeon E5-2620 @ 2.00GHz (8 core, 16 threads in each processor)
- 48GB RAM registered memory.
- 3 Hard Disk 15RPM 145GB in RAID0 (by BIO
<IfModule mpm_event_module> StartServers 2 ThreadLimit 196 MinSpareThreads 96 MaxSpareThreads 192 ThreadsPerChild 96 MaxRequestWorkers 192 MaxConnectionsPerChild 96 </IfModule>
We had the same problem on Apache 2.4.6. After monitoring the server and adjusting the setting for several hours it appears to us that Apache may have a bug. What appears to happen is that the server processes occasionally goes into the
G state (Gracefully finishing) and restarts to accept new requests, that’s normal. What is not normal is that for some reason this can take up to a few minutes to restart. If you only have a few server process running and they all go into the
G state at the same time then your scoreboard fills up and you won’t be able to server any more requests.
What we did was increase the number of servers so there is a less of a chance that they will all go into the
G state at the same time. Also make sure you allocate at least 25 threads (
MaxRequestWorkers) for each server process because that appears to be the default (i.e. if 5
Servers x 25
ThreadsPerChild = 125
MaxRequestWorkers). You can change
ThreadsPerChild if you like, we left it at default. If you don’t allocate enough threads the additional servers will not start. We left
MinSpareThreads at the default value which is 25 and the default for
MaxSpareThreads which is 75. If you do modify these settings, the value for
MaxSpareThreads must be greater than or equal to the sum of
MaxRequestWorkers must be equal to or less than the
Here is what worked for us but it might not be the best configuration for you.
StartServers 3 MinSpareServers 5 MaxSpareServers 10 ServerLimit 250 MaxRequestWorkers 250 MaxConnectionsPerChild 1000 KeepAlive Off
Edit: This is a confirmed bug in httpd’s mpm_event module which might not be fixable through configuration.
The linked bugtracker entry has a presumed patch and more discussion about how to fix this until a new version of the event module is officially released.