About the PHP-FPM Calculator

PHP-FPM keeps a pool of PHP worker processes. If pm.max_children is too high, the server runs out of memory and starts swapping; too low and requests queue up. This calculator sizes the pool from the RAM you can give to PHP and the average memory of one PHP-FPM process.

How to use

  1. Enter the total RAM of the server and how much to reserve for the OS, database, cache and other services.
  2. Enter the average memory of one PHP-FPM process. Measure it on the server with: ps --no-headers -o rss -C php-fpm | awk '{s+=$1} END {print s/NR/1024 " MB"}' (use the process name of your version, e.g. php-fpm8.3).
  3. Pick the process manager (dynamic, ondemand or static) and copy the generated settings into your pool file, e.g. /etc/php/8.3/fpm/pool.d/www.conf.
  4. Reload PHP-FPM (systemctl reload php8.3-fpm) and watch memory usage under real traffic.

Frequently asked questions

How is pm.max_children calculated?

pm.max_children = (total RAM − reserved RAM) × (1 − safety buffer) ÷ average PHP process memory. Spare servers are derived from it: min_spare ≈ 25%, max_spare ≈ 75% and start_servers sits halfway between them.

Should I use dynamic, ondemand or static?

dynamic suits most servers. ondemand saves memory on low-traffic sites by starting workers only when needed. static gives the most predictable performance on dedicated PHP servers with enough RAM.

More free tools