Diagnose PHP-FPM worker-pool saturation before raising max children
A host log saying pm.max_children was reached is a clue, not a diagnosis of the slow page you see now. PHP-FPM has separate pools, current worker and queue values, and counters that remember earlier peaks. This guide helps a site operator connect one visitor problem to the right pool and time window before changing capacity. It assumes the site actually uses PHP-FPM and that an authorized administrator can inspect private status or logs.
Boletolibre editorial team
Published
1. Confirm the PHP-FPM path and the visitor symptom
Start with the public action that is slow: the URL or route, the time with time zone, what the visitor did, and whether the result was delayed, timed out or failed. Check the hosting stack before applying PHP-FPM advice. A static page, a differently hosted API and a PHP request may traverse different paths. Ask the host which PHP-FPM pool serves the affected route if that mapping is not visible to you.[1]
Capture at least one normal comparison on the same route and region. Do not call every slow page a worker shortage: a database connection error, a per-script memory fatal, an account entry-process limit or a distant visitor can produce different evidence. Keep private paths, query strings, user identifiers and log contents out of a public support post.
2. Record the exact pool and its configured limit
For the confirmed pool, record the process-manager mode and effective pm.max_children value. In static mode that value fixes the child-process count; in dynamic or ondemand mode it is the maximum. PHP describes it as the limit on simultaneous requests served by the pool. A host may operate several pools, so the limit from another pool cannot explain this route.[1]
Note the pool start time, any configured global process.max limit, and the host's memory and CPU headroom. A higher child limit is not free capacity: more simultaneous workers can also consume more memory or move pressure to a database or remote dependency. Do not treat a blog's example number as a target for your server. A provider-managed pool may require a support request rather than a configuration edit.[1]
3. Read current status separately from historical counters
Use the authorized PHP-FPM status view for the affected pool. PHP says the status page exposes request URLs and resource information, so keep it internal or limited to known client IPs. Record its pool name, start time and process-manager mode with every snapshot. A restarted pool resets its counters, making a before/after comparison across restarts invalid.[2]
| PHP-FPM field | Time meaning | Useful interpretation |
|---|---|---|
| active / idle / total processes | Current snapshot | How many workers are busy, free and present in this pool |
| listen queue | Current snapshot | Requests waiting for a free process now |
| max listen queue / max active processes | Peak since pool start | Historical peak; pair with dated samples |
| max children reached | Historical since pool start | Limit reached sometime; not proof of a current queue |
| slow requests | Cumulative if threshold configured | Prompt to inspect private slowlog and time window |
Read the fields according to their time meaning. Listen queue is the number waiting for a free process now; active, idle and total processes describe the current pool. Max listen queue, max active processes and max children reached reflect earlier activity since pool start. A nonzero max children reached alone cannot prove this minute's visitors waited. Slow requests counts requests that met the configured slowlog threshold, if that facility is enabled.[2]
4. Match the queue to the visitor's time window
Take status snapshots during the reported visitor window, not only after traffic has quieted. A current nonzero listen queue together with no idle workers and active workers near the pool limit supports a waiting-for-workers hypothesis. A zero queue ten minutes later does not erase what happened earlier, but it does not establish today's peak either. Mark exact sample times and repeat when the next comparable peak arrives.[2]
Compare the public route's response time or failure with the same-period pool snapshot and web-server or host evidence. If the queue remains empty while the page is slow, examine application, database, external-service or network time instead of changing pm.max_children. If the status endpoint itself is slow because it shares an overloaded pool, ask the administrator about PHP's separate pm.status_listen option; do not expose the endpoint publicly as a workaround.[2]
5. Find why workers stay occupied
When workers are busy, ask what is occupying them. PHP-FPM can write a slowlog backtrace after request_slowlog_timeout if configured. That threshold is not automatically active, and the slow requests counter is cumulative rather than a per-minute rate. Compare redacted request paths and durations with the incident period; one repeatedly slow operation calls for a different fix from many ordinary requests arriving at once.[1]
A slowlog identifies a code path, not necessarily the underlying database, file or external service fault. Correlate with the responsible application's own timing before attributing cause. Preserve a small private sample, redact user data and avoid changing both application behavior and worker count in the same trial. If logs are unavailable, record that gap rather than asserting what the workers were doing.[2][1]
6. Work through a fictional eight-worker incident
Fictional example: the events pool has pm.max_children = 8. At 14:05, visitors report an eight-second programme page. An authorized status snapshot shows 8 active, 0 idle and 5 requests in listen queue. Max children reached is nonzero, but that historical flag is not the decisive observation; the same-window queue is. At 14:14, the queue is 0 and the page is fast again.
A private slowlog sample from the incident points repeatedly to a long-running report route. That does not prove its database query is the cause. The application owner checks a request trace, confirms one report operation holds workers for several seconds, and approves a bounded change to that operation. The team keeps the previous release ready to restore.
At a comparable peak after the change, the team repeats the same visitor action and pool snapshot. The fictional result is 4 active, 4 idle, queue 0 and a faster public page. That supports the repair under the tested load; it does not establish a universal worker target or guarantee performance at a larger peak.
7. Make one bounded change with a rollback
Choose the smallest change justified by the evidence. If one confirmed slow operation ties up workers, fix or limit that operation with its owner. If many normal requests fill the pool and the host has measured headroom, the hosting owner may plan a cautious pool-capacity change. Include any global process limit and downstream capacity in that review. Do not blindly raise pm.max_children to make a warning disappear.[1]
Record the prior setting or release, the one variable changed, expected effect, observation window and rollback trigger. Retest the same public route and pool at a comparable busy period; compare current queue, active/idle counts, response outcome and memory/CPU headroom. A counter that resets after an FPM restart cannot be compared as though it continued uninterrupted. If queue pressure persists or a new resource limit appears, revert or escalate with the timed evidence.[2]
8. Copy the same-window evidence worksheet
Use the editable card to keep visitor evidence, pool status and decision in one time zone. Enter unknown for unavailable private counters; do not fabricate a zero. Share only redacted values with the host or application owner, and never expose a PHP-FPM status page to collect screenshots.
| Decision branch | Evidence needed |
|---|---|
| Busy workers plus waiting queue | Same-window active/idle/queue and visitor delay |
| No queue during slow request | Application, database, external service or network timing |
| Repeated long operation | Private slowlog or request trace with owner |
| Possible capacity increase | Memory/CPU, global limit and downstream headroom |
| After one change | Same route, comparable peak, queue and rollback result |
Sources and further reading
- PHP Manual: FPM configuration and pool directivesPHP Documentation Group · Accessed
- PHP Manual: FPM status page, counters and access cautionPHP Documentation Group · Accessed