Not always starting enough PHP-FPM processes to handle load
I have one domain that is relatively high traffic at times --- usually from bot surges.
For that account/domain, I have the following PHP-FPM Pool options set:
Max Requests: 550
Max Children: 60
Process Idle Timeout: 120
After restarting apache, it will start 5 php-fpm processes for that domain. When we get a sudden surge of bots, Apache chokes and the entire server comes to a crawl, yet CPU usage is practically nil.
apachectl status shows almost solid "R"

Checking now, I see 15 php-fpm processes running for that domain. I have seen times where there are around 60 running, but not often.
Not sure what needs to be done to fix this, because we end up getting the entire server essentially locked up several times/week.
Not sure if this is the answer:
https://docs.cpanel.net/knowledge-base/php-fpm/apache-vs-php-fpm-bottleneck-with-child-processes/
I checked and our server does say: Server MPM: prefork
If this is the way, what would would be good values for:
StartServers: 5 <IfModule prefork.c> MinSpareServers: 10 MaxSpareServers: 10 </IfModule>
The other domains on the server are typically fine with 1-5 php-fpm processes running.
These are the current settings in our Apache Global Config:

-
This is what ChatGPT thinks:
What I suspect is happening
You likely have:
- many slow bot connections
- prefork workers consumed waiting
- MaxRequestWorkers exhausted
- Apache stops accepting useful traffic
- PHP-FPM mostly idle
- CPU low because workers are blocked in network I/O
That’s textbook prefork saturation.
My recommended order
Highest impact
- Switch to
eventMPM - Set
KeepAliveTimeout 1 - Enable
RequestReadTimeout - Add Cloudflare
- Add mod_evasive or fail2ban
Those 5 together usually transform this exact situation.
I know you can't always trust their solution, so I'll wait for some in put here.
0
Please sign in to leave a comment.
Comments
1 comment