Introduction

A PHP-FPM pool becomes exhausted when all available workers are busy and new requests have to wait or fail. That often shows up as 502 or 504 errors, long page loads, or warnings that the server reached pm.max_children. The fix is to identify why workers stay occupied so long before you decide whether to tune the pool, reduce concurrency pressure, or speed up the application.

Symptoms

  • Nginx or Apache returns 502 or 504 errors during traffic spikes
  • PHP-FPM logs mention server reached pm.max_children or similar saturation warnings
  • Requests queue for a long time before PHP starts processing them
  • WordPress admin or API calls become slow even when the server is not fully CPU-bound
  • Restarting PHP-FPM helps briefly, then the problem returns under load

Common Causes

  • The pool has too few workers for the actual concurrent request load
  • Slow database queries or external API calls keep workers occupied too long
  • Background tasks, cron jobs, or expensive plugins consume the same PHP-FPM pool
  • Process limits were copied from a smaller server without enough memory headroom
  • Traffic spikes hit uncached dynamic endpoints that force many concurrent PHP executions

Step-by-Step Fix

  1. Review PHP-FPM, web server, and application logs together so you can correlate worker exhaustion with specific routes or time windows.
  2. Confirm whether requests are waiting because the pool is too small or because existing workers are blocked on slow application work.
  3. Check the pool settings such as pm, pm.max_children, and related process controls against the server's real memory capacity.
  4. Inspect slow PHP transactions, database queries, and outbound calls that keep workers open longer than expected.
  5. Separate background jobs or heavy cron traffic if they compete with normal user requests on the same pool.
  6. Improve caching or reduce dynamic workload on the most expensive public routes before increasing worker counts blindly.
  7. Raise pool limits only if the server has sufficient memory and the application behavior justifies more concurrent workers.
  8. Reload PHP-FPM and retest under realistic traffic to confirm request queues shrink and gateway errors stop recurring.
  9. Keep worker saturation metrics and slow-request logging enabled so you can catch pool pressure before it turns into downtime.