🚀 20% OFF for new customers on Linux and Windows servers! Code: ILK20  |  Order Now →
build Troubleshooting & Automation

PHP-FPM Max_Children Warning and Definitive Solution

If you're getting a max_children warning in PHP-FPM, this article explains why and how to solve it step by step. Calculate your server resources realistically.

person
Editör
(Updated: Jul 28, 2026) schedule 3 min read visibility 3 views

If you're using PHP-FPM on your server, you might have encountered this warning, especially during traffic spikes: “WARNING: [pool www] seems busy (you may need to increase pm.start_servers, pm.min_spare_servers, pm.max_spare_servers, or pm.max_children)”. This is a topic where the solution is often misunderstood. As HostingServer.com.tr, I felt the need to write this article because it's a common question. Instead of just cranking up max_children, we'll calculate your actual needs and provide a permanent fix.

Why Does the Warning Occur?

PHP-FPM creates a separate child process for each request. pm.max_children sets the maximum number of processes that can run simultaneously. When this value is reached, new requests are queued and processed as processes become free. If the queue grows too large, the server slows down and errors occur. Default settings are often insufficient. For example, on a DigitalOcean virtual server with 2 GB RAM, the default max_children is typically between 5 and 10. But if you have 30-40 concurrent visitors, that value is far too low.

Definitive Solution: Resource Calculation

To find the correct max_children value, you need to know how much RAM each PHP-FPM process consumes. You can find out with this command: ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%dMB", sum/1024) }'. This command outputs the total RAM used by all PHP-FPM processes in MB. Then divide by the total number of processes to get the average memory usage per process. For example, if 10 processes use 512 MB, that's about 51 MB per process. Remember that your server runs other services too. Keep a safe margin and allocate up to 80% of total RAM to PHP-FPM. 80% of 2 GB RAM = 1.6 GB = 1638 MB. 1638 / 51 ≈ 32. So max_children = 32. Also adjust pm.max_spare_servers and pm.min_spare_servers accordingly. My recommendation: min_spare = 5, max_spare = 15.

Alternative Method: pm.status Monitoring

Another approach is to enable the pm.status page and monitor live data. Set pm.status_path = /status, then run curl http://localhost/status?full to see the current process count and request queue. If the 'listen queue' is consistently above zero, you need to increase max_children. But be careful: simply raising the value isn't enough; if the server has started swapping, it means insufficient RAM. In that case, either add more RAM or optimize your application.

Changing PHP-FPM Settings

To change the settings, edit the file /etc/php/8.x/fpm/pool.d/www.conf. Default values look like: pm = dynamic, pm.max_children = 5, pm.start_servers = 2, pm.min_spare_servers = 1, pm.max_spare_servers = 3. Write your calculated values and restart the service: systemctl restart php8.2-fpm (adjust version as needed). Monitor for a day; if the warning persists, recalculate.

Things to Remember

  • Not every process uses the same memory; it depends on your application. A WordPress site might use 30 MB, while Magento could consume 100 MB.
  • Other services running on the server, like MySQL, Nginx, and Redis, also consume memory. Factor them in.
  • Avoid using swap; excessive swapping degrades performance.
Important: Setting max_children too high can crash your server. Always increase cautiously and with backups.

Conclusion

The PHP-FPM max_children warning, if neglected, degrades user experience. However, solving it with the right method is not as hard as it seems. Measure your server's resources, calculate realistically, and adjust settings accordingly. You can find more content on this topic at HostingServer.com.tr, and feel free to ask questions in the comments. In the next article, I'll cover live monitoring with pm.status.

Share This Article

Related Posts