fpmtune

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 0 Imported by: 0

README

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.

Documentation

Overview

Package fpmtune sizes PHP-FPM pools against available memory.

The problem it solves is allocation, not calculation: a machine hosting many sites has many pools drawing on one budget, and the useful question is not "how many workers should a pool have" but "how should this budget be divided between pools that want different amounts".

The packages split along a deliberate line. allocate is pure computation with no I/O and no dependencies — given a budget, an inventory and a set of baselines it returns a plan, which makes it exhaustively testable and cheap for other projects to embed. Everything that touches the world (observe, apply, state, budget) sits outside it.

Directories

Path Synopsis
Package allocate divides a memory budget between competing PHP-FPM pools.
Package allocate divides a memory budget between competing PHP-FPM pools.
Package apply writes a plan to disk and asks PHP-FPM to adopt it.
Package apply writes a plan to disk and asks PHP-FPM to adopt it.
Package budget works out how much memory is actually available.
Package budget works out how much memory is actually available.
cmd
fpm-tune command
Command fpm-tune sizes PHP-FPM pools against the memory a host actually has.
Command fpm-tune sizes PHP-FPM pools against the memory a host actually has.
Package lock serialises the processes that may write PHP-FPM configuration.
Package lock serialises the processes that may write PHP-FPM configuration.
Package metrics publishes what fpm-tune knows.
Package metrics publishes what fpm-tune knows.
Package observe turns a live PHP-FPM installation into the inputs the allocator needs.
Package observe turns a live PHP-FPM installation into the inputs the allocator needs.
Package plan turns observations and remembered baselines into an allocation.
Package plan turns observations and remembered baselines into an allocation.
Package serve runs the closed loop: observe, learn, allocate, apply.
Package serve runs the closed loop: observe, learn, allocate, apply.
Package state remembers what each pool's workers actually cost.
Package state remembers what each pool's workers actually cost.
testing
loadgen command
Command loadgen puts sustained, controlled concurrency on a PHP-FPM pool.
Command loadgen puts sustained, controlled concurrency on a PHP-FPM pool.
Package top is the terminal view of a running fpm-tune daemon.
Package top is the terminal view of a running fpm-tune daemon.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL