PHP-FPM runs the PHP code behind your WordPress site. Wrong pool settings cause either wasted memory or queued requests. This guide shows how to size the pool from measured numbers instead of guessing.
How many PHP-FPM children does a WordPress server need? #
Divide the memory you can spare for PHP by the average memory one PHP worker uses. For example, 2 GB available and 60 MB per worker gives about 33 children. Start slightly below that number, then raise it only if the status page shows requests waiting in the listen queue.
Measure the average worker size #
ps --no-headers -o rss -C php-fpm8.3 | awk '{sum+=$1} END {print sum/NR/1024 " MB average"}'
Recommended pool configuration #
; /etc/php/8.3/fpm/pool.d/www.conf
pm = dynamic
pm.max_children = 30
pm.start_servers = 8
pm.min_spare_servers = 4
pm.max_spare_servers = 12
pm.max_requests = 500
request_slowlog_timeout = 5s
slowlog = /var/log/php8.3-fpm-slow.log
Choosing a process manager mode #
- dynamic: best default for most WordPress sites with steady traffic.
- ondemand: saves memory on small servers with long idle periods, but adds a start-up delay.
- static: only for large, predictable workloads with plenty of RAM.
Apply and verify #
sudo php-fpm8.3 -t
sudo systemctl reload php8.3-fpm
sudo tail -f /var/log/php8.3-fpm-slow.log