PHP-FPM master exit after idle

php.internals

Adrien CLERC

4 years ago
Hi, I'm currently investigating on using socket activation for PHP-FPM (as described in https://wiki.php.net/rfc/socketactivation). Everything is running fine, and each application can have its dedicated FPM master process, protected by all the settings set in the systemd unit file. There is however one catch on the current situation: once the FPM master is started, it doesn't stop. Since systemd will maintain a listening socket, the master process could stop itself after a given idle time, defined in a new setting. This will have the benefits of freeing server resources. I have to admit that in my case, those resources are important, since I'm self-hosting quite a number of applications on a low power consumption machine. I dived a little into the FPM code, and since it already has a logic for process idle management, it should be absolutely doable to add it for the master. However… before throwing my free time into this, I'd like to gather some feedback on this. PHP is a big beast, and I know that my point of view is not The Only One That Should Count. Have a nice day! Adrien