PHP-FPM "server reached pm.max_children": sizing your pool correctly

PHP-FPM "server reached pm.max_children": sizing your pool correctly

  1. Blog
  2. 15 November 2026
  3. 2 min read

Stefan Bogdanescu

Founder & Senior Architect

When the PHP-FPM log says WARNING: [pool www] server reached pm.max_children setting (50), consider raising it, your site did not crash - it did something worse. Every request beyond the fiftieth waited in a queue, and the ones that waited too long returned a 502 or 504. The fix is not "raise the number"; it is finding the number your RAM can actually hold.

What the warning means

PHP-FPM keeps a pool of worker processes. Each worker handles one request at a time. When all workers are busy and a new request arrives, it waits. pm.max_children is the ceiling on that pool. Reaching it under load means requests are queueing - your visitors experience it as a slow or hung site while CPU and RAM may look completely idle.

Measure before you raise

Each worker consumes memory, and a Laravel or WordPress worker under load typically uses 40-120 MB. Measure your real average on a busy server:

ps -o rss= -C php-fpm8.3 | awk '{s+=$1; n++} END {printf "%.0f MB avg over %d workers\n", s/1024/n, n}'

Say the average is 60 MB and the server has 8 GB RAM. Reserve memory for the OS, database and web server - perhaps 5 GB for PHP-FPM. Then:

pm.max_children = 5120 MB / 60 MB = ~85

That number, not the default 5 or a copied 200, is what belongs in /etc/php/8.3/fpm/pool.d/www.conf.

Pick the right process manager mode

The pm setting decides how workers scale:

pm = dynamic
pm.max_children = 85
pm.start_servers = 20
pm.min_spare_servers = 10
pm.max_spare_servers = 30

dynamic scales between the spare bounds and suits most sites. static keeps exactly max_children running at all times - lowest latency, best when the server runs only PHP. ondemand spawns workers on demand and kills them when idle; it saves RAM on quiet servers but adds spawn latency to the first request of a burst.

Recycle workers before they leak

PHP workers slowly grow as frameworks and extensions hold onto memory. pm.max_requests restarts each worker after N requests, capping the leak:

pm.max_requests = 500

If you skip this, yesterday's 60 MB average becomes next month's 150 MB average and your carefully sized pool starts swapping. Swapping PHP workers is how a busy site falls over completely.

Prove the pool is the problem next time

Enable the status page in the pool config (pm.status_path = /fpm-status, restricted to localhost) and check it during a slowdown:

curl 127.0.0.1/fpm-status?full

active processes pinned at max_children with a growing listen queue confirms saturation. If active processes are low while the site is slow, the bottleneck is elsewhere - database, external API, or CPU - and raising max_children would only multiply the damage.

Summary

Measure your real per-worker memory, divide your available RAM by it, and set pm.max_children to that number with pm.max_requests to keep it honest. Then watch the status page under load. The warning disappears because the math is right, not because the ceiling is high.

PHP-FPM Performance Server Troubleshooting

Our network