PHP-FPM Worker Capacity Planning Checklist
PHP-FPM worker settings decide how many PHP requests can run at the same time. Too few workers can cause slow responses. Too many workers can exhaust RAM and crash the VPS.
Core principle
PHP-FPM capacity is limited by memory. Each worker consumes RAM. max_children should be based on available memory, average worker memory and other services on the server.
Checklist
- Check total server RAM.
- Check current memory usage.
- Estimate memory used by MySQL, Nginx and other services.
- Measure average PHP-FPM worker memory.
- Check current pm.max_children.
- Check whether PHP-FPM reaches max children.
- Adjust worker count conservatively.
- Restart PHP-FPM after config validation.
- Monitor RAM and response time after change.
- Document capacity estimate.
Reusable lesson
This applies to WordPress traffic spikes, WooCommerce, plugin-heavy sites, API endpoints and small VPS capacity planning.
When to Use This Checklist
Use this checklist when tuning PHP-FPM on a WordPress VPS or diagnosing slow PHP responses, 502, 504 or memory pressure.
Required Tools
SSH access, PHP-FPM pool config, top or ps, memory data, PHP-FPM logs, traffic context
Before You Start
Do not raise pm.max_children without checking RAM. More workers can make the server slower or unstable.
Structured Checklist Steps
- Check total RAM.
- Check used RAM.
- Estimate other service memory.
- Measure worker memory.
- Check max_children.
- Check max children warnings.
- Tune conservatively.
- Restart PHP-FPM.
- Monitor after change.
- Document estimate.
Verification Steps
- Worker count fits available RAM.
- No repeated max_children warning appears.
- RAM remains stable.
- Response time improves or remains safe.
- Capacity logic is documented.
Rollback Plan
If tuning causes memory pressure or OOM events, restore the previous pool config and reduce max_children before retesting.
Common Mistakes
- Increasing workers blindly.
- Ignoring MySQL memory.
- Not measuring worker size.
- Forgetting traffic spikes.
- No monitoring after tuning.
Related Commands
free -h
ps -ylC php-fpm8.2 --sort:rss
ps aux | grep php-fpm
grep -R "pm.max_children" /etc/php/*/fpm/pool.d/
sudo tail -n 100 /var/log/php8.2-fpm.log
sudo systemctl restart php8.2-fpm