Skip to content

Repository files navigation

fpm-tune

Sizes pm.max_children for every PHP-FPM pool on a host from what its workers cost, and reloads php-fpm when the number is worth changing.

PHP-FPM decides how many of a pool's allowed workers run right now. fpm-tune decides how many should be allowed at all: the ceiling. It measures what each pool's workers cost, divides the host's memory between the pools by that cost, keeps a 15% reserve, and says so when the host is out of capacity.

Install

curl -fsSL https://raw.githubusercontent.com/cboxdk/fpm-tune/main/install.sh | sh

Or brew install cboxdk/tap/fpm-tune, or a signed release archive. It runs on Linux; see Installation.

Try it

fpm-tune plan                    # what it would set, and why; writes nothing
sudo fpm-tune install-service    # keep measuring under systemd, in advisory mode
sudo fpm-tune mode apply         # let it act, once the plan has looked right for a day

Run it advisory first and read what it recommends. When it does act, a change is validated against a copy of the configuration, written atomically, reloaded with SIGUSR2, and rolled back if the master does not come back (how it fails safe).

Docs

1.x is stable: commands, flags, config keys, the two drop-in names, the metric names and the /history.json fields do not change within it, and a change that would break any of them bumps the major.

Built on phpfpm. MIT.

About

Sizes PHP-FPM pools against the memory a machine actually has, using the memory its workers actually use

Resources

Security policy

Stars

14 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages