[Unit] # Time series of PHP-FPM pool occupancy and worker memory. # A looping service rather than a 15s systemd timer: one long-lived process # instead of 5,760 spawns a day, and it can hold the tick counter that paces # the expensive PSS walk. Description=PHP-FPM pool metrics sampler After=php8.3-fpm.service Wants=php8.3-fpm.service [Service] Type=simple ExecStart=/usr/local/bin/fpm-sample.sh Restart=always RestartSec=10 # Reads /proc//smaps_rollup for www-data-owned workers, and talks to both # pool sockets (mode 0660, owner www-data). User=root # Never let monitoring compete with the thing it is monitoring. Nice=10 IOSchedulingClass=idle # Environment=INTERVAL=15 # Environment=PSS_EVERY=20 # Environment=SATURATION_PCT=50 [Install] WantedBy=multi-user.target