terminal ⚡ Interactive

PHP-FPM Pool Calculator

Calculate correct pm.max_children and spare-server values for your PHP-FPM pool from RAM and worker memory, with a ready-to-paste www.conf snippet

• Intermediate • Updated: June 21, 2026

MB — check via ps (see below)

Results

pm.max_children =
Maximum worker processes that can run at once
pm.start_servers =
Workers spawned when FPM starts
pm.min_spare_servers =
Minimum idle workers kept ready
pm.max_spare_servers =
Maximum idle workers before FPM kills some

www.conf

Most people guess at PHP-FPM pool sizes or copy values from a random blog post. The result is either wasted RAM or an out-of-memory crash under load. This calculator takes three real numbers and gives you a correct www.conf snippet.

How it works

The pool size is bounded by how much RAM you have and how much each worker actually uses:

pm.max_children = floor((RAM × (1 − buffer/100)) / worker_memory)

The safety buffer leaves headroom for the OS, the web server, and traffic spikes. The spare-server values scale off max_children.

Choosing a pm mode

The calculator outputs pm = dynamic, the right default for most sites. The mode decides which of the directives below actually apply:

ModeBehaviorDirectives usedBest for
staticFixed number of workers, always runningmax_children onlyPredictable high traffic; max throughput, no spawn latency
dynamicPool grows and shrinks between spare boundsmax_children, start_servers, min/max_spare_serversMost sites — balances RAM use and responsiveness
ondemandNo idle workers; spawn on request, reaped after a timeoutmax_children, process_idle_timeoutLow-traffic or many small pools; saves RAM at the cost of cold-start latency

max_children matters in every mode — it’s the OOM safeguard. The spare-server values only take effect under dynamic.

What each value does

  • pm.max_children — the hard cap on concurrent worker processes. This is the number that prevents OOM kills. Set it too high and a traffic spike eats all your RAM.
  • pm.start_servers — how many workers spawn when FPM starts. A quarter of the maximum is a sane warm pool.
  • pm.min_spare_servers — the minimum idle workers FPM keeps ready to absorb sudden requests without spawn latency.
  • pm.max_spare_servers — the maximum idle workers FPM tolerates before reaping them to free memory.

Finding your real worker memory

Don’t guess the per-worker figure. Measure it on a running server:

ps --no-headers -o rss -C php-fpm | awk '{sum+=$1} END {print sum/NR/1024 " MB"}'

This averages the resident set size of every php-fpm process. For a typical Shopware 6 shop, 60 MB per worker is a realistic starting point — heavier setups with many plugins can hit 100 MB or more.

Reference

Related Tools