How to apply PHP-FPM pool settings for all the domains?

Created:

2017-02-11 21:29:49 UTC

Modified:

2017-08-08 13:14:21 UTC

1

Was this article helpful?


Have more questions?

Submit a request

How to apply PHP-FPM pool settings for all the domains?

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk for Linux

Question

How to apply PHP-FPM pool setting pm.max_children for all the domains?

Answer

  1. Download the script:
    # wget https://plesk.zendesk.com/hc/article_attachments/115000895634/update_max_children.sh
  2. Add execution permission for the script:
    # chmod +x ./update_max_children.sh
  3. Execute the script:
    # ./update_max_children.sh

Additional information

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

Attachments:

Have more questions? Submit a request
Please sign in to leave a comment.