What the message looks like
[29-Oct-2026 10:14:52] WARNING: [pool www] server reached pm.max_children setting (5), consider raising itCommon causes
- Slow scripts keep workers busy for long: a slow database query, a slow external API, a lock.
- A burst of traffic or bots hits uncached PHP pages.
pm.max_childrenis simply too low for the normal load of this server.- The value was raised too far in the past and PHP now exhausts RAM, so workers get killed instead (check the OOM page).
- Long-running requests such as exports or imports block workers.
Check
- Active pool settings (without comments)
grep -hE '^(pm|pm\.[a-z_]+) *=' /etc/php/*/fpm/pool.d/*.conf - How often did the pool hit the limit?
- Average memory per PHP-FPM worker
ps -eo rss,cmd | awk '/[p]hp-fpm: pool/ {s+=$1; n++} END {if (n) print n " workers, " s/n/1024 " MB average"}' - Free memory on the server
free -m
Fix
- Size the pool from memory:
pm.max_children= RAM you can give to PHP divided by the average worker size from the check above. - Set it in the pool file under
/etc/php/<version>/fpm/pool.d/www.conf, together with matchingpm.start_servers,pm.min_spare_serversandpm.max_spare_serversforpm = dynamic. - Find the slow requests: set
request_slowlog_timeout = 5sandslowlog = /var/log/php-fpm-slow.login the pool, then read the stack traces. - Reduce the load: cache pages, block abusive bots, move long jobs out of web requests.
- Restart the PHP-FPM service of your version, then watch the log for the warning.
Typical scenario
A WooCommerce shop on a 4 GB VPS normally runs without problems. During a discount campaign the PHP-FPM log fills with "server reached pm.max_children setting (5)" lines, pages load sluggishly and nginx returns the odd 504. The pool still has the package default of five workers. First measure how much memory a worker uses on average and work out how many workers fit on the server.
FAQ
Can I just set a very high pm.max_children?
No. Each worker uses memory. If the total exceeds RAM, the kernel kills processes or the server swaps, which is worse than queued requests.
Which pm mode should I use?
dynamic is a good default. ondemand saves RAM on idle servers but is slower on first requests, static is for busy servers with predictable memory.
How do I see how many workers are busy right now?
Enable pm.status_path = /fpm-status in the pool and serve the page locally only. It shows active and idle processes, the length of the queue ("listen queue") and "max children reached", meaning how often the limit was hit. A counter above 0 confirms the problem.
Does a higher pm.max_children help if the database is slow?
Hardly. More workers mean more simultaneous database queries, which makes an already overloaded database slower still. First fix the slow query or bottleneck, for example with the slow query log, and only then raise the limit in moderation.
How can I reduce the load without adding workers?
With a page cache for anonymous visitors, such as the FastCGI cache in nginx or a caching plugin. Cached pages need no PHP, leaving workers free for cart and checkout. You can also slow bots with rate limits or in robots.txt.