PHP-FPM tuning looks simple until several pools share one server. A large application worker may use many times the memory of a small one, traffic snapshots can miss peak demand, and increasing every pool's pm.max_children can promise more memory than the machine has.
FPM Lens on GitHub approaches the problem as capacity planning. It discovers pools, gathers process and optional status-page evidence, records uncertainty, and produces a plan whose assumptions remain visible.
What makes the workflow useful
- Each pool gets its own measured worker-memory cost instead of sharing a generic estimate.
- Selected and unselected pools are counted inside one global memory budget.
- Low-confidence evidence does not automatically label a quiet pool as unnecessary.
- Inventory, evidence, policy, and plan artifacts can be inspected or moved to another machine.
- Rendered PHP-FPM fragments are staged for review; the tool does not install them or reload PHP-FPM.
A review-first assessment
Start by inventorying the installation and checking whether the environment is ready. Then observe a representative workload window—not just a quiet minute after login.
sudo fpm-lens inventory
sudo fpm-lens doktor
sudo fpm-lens assess --samples 180 --interval-seconds 5 \
--status-url 'shop=http://127.0.0.1/fpm-status?json'
The status endpoint supplies demand and queue evidence, while process sampling supplies per-worker memory evidence. For automation, a policy file and saved evidence can produce machine-readable plans without the terminal UI.
Review, validate, then deploy
fpm-lens validate production.plan.json
fpm-lens diff production.plan.json
fpm-lens render production.plan.json --output-dir build/review
fpm-lens validate production.plan.json --php-fpm /usr/sbin/php-fpm8.3
Inspect the staged fragments, validate with the matching PHP-FPM binary, and load-test the proposed limits. Leave room for the kernel, database, web server, caches, queues, and traffic bursts. FPM Lens deliberately keeps deployment outside its trust boundary so a human or configuration-management system remains in control.
Where it fits
The project documents Debian and Ubuntu support, build-tested RHEL-family behavior, fixtures for Remi parallel PHP, and discovery support for cPanel EA-PHP. It is especially useful when a shared server has several pools with different applications and memory profiles.
The code, releases, algorithm notes, schemas, and operating guidance are available in the FPM Lens repository under the MIT license.