FPM capacity depends on per-worker private memory, available RAM and expected concurrent requests.
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. Sizing max_children from average RSS alone can oversubscribe memory during peaks.
Example 1: Basic Operation
Set parameters in the FPM pool configuration; avoid exposing pool status publicly.
pm = dynamic
pm.max_children = 12
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 6
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
| Approach | What changes |
|---|---|
| Web server, worker and PHP CLI | The web server handles HTTP, the PHP worker executes scripts, and CLI has separate configuration and lifecycle. |
| Choosing safely | Check the effective configuration in the SAPI serving requests before changing production. |
Common Beginner Mistakes
| Mistake | Correct approach |
|---|---|
| Acknowledging a job before it finishes | Mark delivery successful only after durable processing succeeds. |
| Treating retries as harmless | Use idempotency keys and a bounded retry policy with dead-letter handling. |
| Skipping operational constraints | Sizing max_children from average RSS alone can oversubscribe memory during peaks. |
Key Takeaways
- FPM capacity depends on per-worker private memory, available RAM and expected concurrent requests.
- Correlate capacity, worker crashes and slow requests using logs and process state.
- Check the effective configuration in the SAPI serving requests before changing production.