Adjusting the PHP Setting pm.max_children

Introduction

The PHP setting pm.max_children defines the maximum number of PHP child processes that can be active at the same time. If your website has a high number of users, multiple PHP-FPM processes must be running to handle the requests. This setting ensures that the number of concurrently running processes is monitored and optimized to prevent the server from becoming overloaded, for example, due to high user traffic.


If too many PHP child processes are running simultaneously, this can cause the server to become overloaded and impair the operation of your website. We recommend optimizing this setting so that, when multiplied by the defined memory_limit, it does not exceed the amount of memory (MiB) available to PHP-FPM.


To adjust the PHP setting pm.max_children, first log in to our Customer Center at account.creoline.com using your login credentials.


Use the navigation menu to select the server under Server for which you want to change the PHP settings. Then open the Plesk Control Panel via the Plesk Control Panel menu item.


If this menu item is not displayed on your server, you can find additional ways to log in in the article Logging In to the Plesk Control Panel.



Customizing Settings for a Single Domain

Once you’re logged in to Plesk, you can select the domain using the global search or the Websites & Domains menu item.



Using the PHP Settings button, you can adjust the general PHP settings and the PHP setting pm.max_children.



The pm.max_children value defines the maximum number of concurrent PHP processes. This value can be set freely and is specified in the unit “number.”



Calculating pm.max_children (Maximum)

The maximum possible value for pm.max_children can be calculated using the following formula:

(RAM - 2 GiB) / Memory Limit = Maximum value for pm.max_children
 ^ ^ ^ 
 | | |
      | | |
 | | └ Defined PHP memory limit value
 | └ Memory reserved for other services (value may vary)
 └ Total server memory



We recommend calculating the number of pm.max_children using the following formula:

(RAM - 2 GiB) / PHP process size = Recommended value for pm.max_children
      ^ ^ ^ 
 | | |
 | | |
 | | └ Average PHP process size
 | └ Memory reserved for other services (value may vary)
 └ Total server RAM


The average PHP process size can be determined, for example, using a PHP profiler. We recommend using Tideways for PHP profiling. A Tideways license can be purchased directly through our support team; see also: Price List for Additional and Special Services.


Once the settings have been saved, the web server automatically reloads the configuration using a graceful restart, so that existing requests are not terminated but rather paused.



Example Calculation for pm.max_children

Parameter Value Explanation
Server RAM 16,384 MiB 16 GiB
Reserved RAM 6,144 MiB 6 GiB
Average PHP process size 100 MiB


# Calculating the available memory for PHP
16,384 MiB - 6,144 MiB = 10,240 MiB

# Calculating the recommended value for pm.max_children
10,240 MiB / 100 MiB = ~102 pm.max_children



Additional Configuration Options

The PHP settings also allow you to adjust pm.max_requests, the desired pm process manager, or pm.start_servers, pm.min_spare_servers, and pm.max_spare_servers.


PHP Setting Description
pm Determines how the process manager manages the number of child processes.
Possible values: static, ondemand, dynamic – This setting is mandatory.

static – the number of child processes is fixed by pm.max_children

ondemand – child processes are started as soon as they are needed, unlike dynamic, where pm.start_servers processes are started at the beginning.

dynamic – The number of child processes is set dynamically based on the following settings:
pm.max_children, pm.start_servers, pm.min_spare_servers, pm.max_spare_servers
pm.start_servers The number of child processes created at startup. Used only if pm is set to dynamic.

Default value: min_spare_servers + (max_spare_serversmin_spare_servers) / 2
pm.min_spare_servers The desired minimum number of idle server processes. Used only if pm is set to dynamic. Also required.
pm.max_spare_servers The desired maximum number of idle server processes. Used only if pm is set to dynamic. Also required.