- Plesk for Linux
How to apply PHP-FPM pool setting pm.max_children for all the domains?
Warning: Increasing of pm.max_children parameter for all domains with a lack of resources can affect the server performance significantly.
Download the script, unpack it and execute:
# wget https://plesk.zendesk.com/hc/article_attachments/115004026393/update_pm.max_children.tar.gz
# tar -xvzf update_pm.max_children.tar.gz
If you need to calculate and change max_children value based on the amount of memory on the system the following command will help us to determine the memory used by each (PHP-FPM) child process:
# ps -ylC php-fpm --sort:rss
The RSS column shows non-swapped physical memory usage by PHP-FPM processes in kilo Bytes.
If on an average each PHP-FPM process takes ~85MB of RAM on your server, appropriate value for pm.max_children can be calculated as:
pm.max_children = Total RAM dedicated to the web server / Max child process size
The server has 8GB of RAM, so:
pm.max_children = 6144MB / 85MB = 72