From 6ec76b48421746456cf78f5152f4a6073a52f538 Mon Sep 17 00:00:00 2001 From: dofl Date: Wed, 26 Jul 2017 07:51:29 +0200 Subject: [PATCH] Switch PHP's default process manager Changing from dynamic to ondemand lowers the number of idle PHP 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. Tested for a couple of months on a VPS with 1 GB and 1 CPU with 5 users. No noticeable negative loading times, but about 15% less RAM usage. Based on this article: https://ma.ttias.be/a-better-way-to-run-php-fpm/ --- setup/web.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup/web.sh b/setup/web.sh index 0d94fcfd..e7146870 100755 --- a/setup/web.sh +++ b/setup/web.sh @@ -50,7 +50,11 @@ tools/editconf.py /etc/php/7.0/fpm/php.ini -c ';' \ # Set PHPs default charset to UTF-8, since we use it. See #367. tools/editconf.py /etc/php/7.0/fpm/php.ini -c ';' \ default_charset="UTF-8" - + +# Switch from the dynamic process manager to the ondemand manager see #1215 +tools/editconf.py /etc/php/7.0/fpm/pool.d/www.conf -c ';' \ + pm = ondemand + # Bump up PHP's max_children to support more concurrent connections tools/editconf.py /etc/php/7.0/fpm/pool.d/www.conf -c ';' \ pm.max_children=8