From b74a76a8ebe9d1668fc5a7b31efa1320f6f0a9df Mon Sep 17 00:00:00 2001 From: dofl Date: Wed, 26 Jul 2017 07:23:26 +0200 Subject: [PATCH] Switch PHP's default process manager Changing from dynamic to ondemand lowers the number of waiting processes from the default of 3 to 1. PHP automatically scales up the number of processes when required, but kills them after 10 seconds (default). I've seen PHP's memory consumption drop significantly. This should be very helpful for low-end VPS servers. Based on this article: https://ma.ttias.be/a-better-way-to-run-php-fpm/ and tested for a couple of months on a VPS with 1 GB. No noticeable negative loading times, but about 15% less RAM usage. --- setup/web.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup/web.sh b/setup/web.sh index 6a412b98..d212a170 100755 --- a/setup/web.sh +++ b/setup/web.sh @@ -47,6 +47,10 @@ tools/editconf.py /etc/php5/fpm/php.ini -c ';' \ tools/editconf.py /etc/php5/fpm/php.ini -c ';' \ default_charset="UTF-8" +# Switch from the dynamic process manager to the ondemand manager +tools/editconf.py /etc/php5/fpm/pool.d/www.conf -c ';' \ + pm = ondemand + # Bump up PHP's max_children to support more concurrent connections tools/editconf.py /etc/php5/fpm/pool.d/www.conf -c ';' \ pm.max_children=8