Blog

PHP-FPM Max Children Reached: Find Why Workers Are Busy

Check worker use, queued requests and slow-log evidence in WatchLog before increasing pm.max_children.

A PHP-FPM pool can have every worker busy even when the host still has CPU to spare. Before increasing pm.max_children, check whether requests are actually queued and what the workers are doing while they hold those slots.

Check whether requests are waiting for a worker

Open the PHP-FPM instance in WatchLog and choose the affected pool. Compare busy workers against the limit, requests waiting, and p95 over the same period. Repeated saturation with a growing queue is stronger evidence than a single max-children event. If only one pool is affected, keep the investigation scoped to it instead of treating the whole host as overloaded.

In the WatchLog product example below, all eight workers in the www pool are busy and p95 is nine seconds, but no request is queued at the instant shown. Check the history rather than assuming this snapshot proves a sustained queue.

WatchLog’s PHP-FPM panel for pool www: 8 of 8 workers busy, 0 queued, p95 9 seconds.
WatchLog example: pool www has all 8 workers busy.

Check why a request holds a worker for so long

Open the pool drawer and look at the slow-request breakdown. When the pool’s slow log is available, WatchLog classifies where sampled slow requests were observed, such as a database call, network call, or PHP code. In this example, the slow-log sample points to execute() on orders-db. Compare that with the database’s own data. An open database socket alone does not tell you that a worker is waiting on the database.

Choose a fix that matches the bottleneck

If slow requests cluster around a database call, check database latency and connection pressure before letting the pool send more concurrent requests. If slow requests appear in PHP itself, inspect the affected work. If the pool simply has more healthy concurrent work than it can serve, compare actual worker memory use and host or container headroom before changing the limit. After a change, compare the same pool’s queue, latency and resource use under similar traffic.

Confirm which sources are available

The status page provides worker and queue counts. The slow log provides the wait classification and may be absent. Check Setup if the pool is missing or the wait breakdown is empty. Follow the configuration docs for your deployment rather than exposing the pool status path on the public proxy.

See the WatchLog PHP-FPM example and the setup guide. For suspected database pressure, see how to identify the client using the connection slots.

See your own servers in five minutes.

Free on WatchLog Cloud for 5 servers or nodes, or run it yourself, open source.