Skip to content
gohacks.dev
Standard Library

PHP-FPM pm.max_children Calculator

Size a PHP-FPM pool from server memory and per-process memory: pm.max_children, start and spare servers, for dynamic, static or ondemand.

Free · No sign-up · Your inputs stay in your browser

Input

Size a PHP-FPM pool

Output

Pool settings (www.conf)

3072 MB for PHP / 60 MB per process

Note

51 workers on 2 cores

Fine for I/O-bound apps waiting on a database or API. For CPU-bound work, extra workers only queue for the CPU; a lower max_children gives faster responses.

max_children is memory for PHP divided by the size of one worker, so that a full pool never pushes the box into swap. The spare-server figures are 25% and 75% of it. static suits a server that does nothing else; ondemand suits small, mostly idle pools. pm.max_requests recycles workers to contain slow memory leaks.

Runs in this browser. Nothing you paste is sent to a server.

The constraint is memory

Each PHP-FPM worker holds its own copy of the request's memory, so pm.max_children times the average worker size must fit in the memory left after the OS, the web server and any database on the same machine. Exceed it and the box swaps, every request slows down and the pool falls further behind. Measure the size under real traffic: ps -ylC php-fpm8.4 --sort:rss lists each worker's resident memory.

Choosing a process manager

static keeps max_children running, which suits a dedicated server. dynamic keeps between the spare limits idle and grows to the maximum. ondemand starts workers only when requests arrive, which saves memory on small or mostly idle pools. The directives are documented in the PHP-FPM configuration reference.

Share

Frequently asked questions

What happens when pm.max_children is reached?
New requests wait in the listen queue, and PHP-FPM logs 'server reached pm.max_children setting'. If they wait longer than Nginx's fastcgi_read_timeout, users get a 504.
What is a typical PHP-FPM process size for Laravel?
Commonly 40 to 80 MB, depending on what a request loads. Measure your own; an import job or PDF generation can use far more.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools