Content · Web Development · PHP

Tuning PHP-FPM Process Pools

Choose pm mode and child limits from measured memory and traffic patterns.

1 views Published Oct 17, 2026 Updated Oct 17, 2026 Admin

Choose pm mode and child limits from measured memory and traffic patterns.

What It Does and When to Use It


Set parameters in the FPM pool configuration; avoid exposing pool status publicly. The web server handles HTTP, the PHP worker executes scripts, and CLI has separate configuration and lifecycle.

Requirements, Inputs and Expected Behavior


Confirm the runtime, extension, environment variables, and permissions before running the examples in production. Overly large max_children can trigger OOM even when request latency looks good.

Example 1: Basic Operation


Set parameters in the FPM pool configuration; avoid exposing pool status publicly.

pm = ondemand
pm.max_children = 16
pm.process_idle_timeout = 15s
pm.max_requests = 500

Example 2: Behavior and Validation


Run the matching status or validation command on the intended host.

php-fpm8.4 -tt

Practical Example: Application Use


Correlate capacity, worker crashes and slow requests using logs and process state.

sudo systemctl status php8.4-fpm --no-pager
sudo journalctl -u php8.4-fpm -n 35 --no-pager

Important Behavior and Edge Cases


The second example highlights: Run the matching status or validation command on the intended host. The practical example adds: Correlate capacity, worker crashes and slow requests using logs and process state.

Comparison with Related Approaches


ApproachWhat changes
Web server, worker and PHP CLIThe web server handles HTTP, the PHP worker executes scripts, and CLI has separate configuration and lifecycle.
Choosing safelyCheck the effective configuration in the SAPI serving requests before changing production.

Common Beginner Mistakes


MistakeCorrect approach
Checking the PHP CLI INI instead of FPMInspect phpinfo or configuration through the protected web SAPI.
Exposing worker status publiclyRestrict FPM diagnostics to localhost or a monitored private network.
Skipping operational constraintsOverly large max_children can trigger OOM even when request latency looks good.

Key Takeaways


  • Choose pm mode and child limits from measured memory and traffic patterns.
  • Correlate capacity, worker crashes and slow requests using logs and process state.
  • Check the effective configuration in the SAPI serving requests before changing production.
Share this resourceSend this page to someone who may find it useful.