Original address: http://blog.itpub.net/14184018/viewspace-1797411/
PHP-FPM Process Pool Optimization method
There are two ways to PHP-FPM process pool opening process, one is static, the direct opening of a specified number of PHP-FPM process, no longer increase or decrease;
The other is dynamic, starting with a certain number of php-fpm process, when the request is large, dynamically increase the number of PHP-FPM process to the upper limit, when idle automatically release the number of idle processes to a lower limit.
These two different methods of execution can be adjusted according to the actual requirements of the server.
Some of the parameters to use are PM, Pm.max_children, Pm.start_servers, Pm.min_spare_servers, and Pm.max_spare_servers.
PM indicates that in that way, there are two values that can be selected, either static (static) or dynamic.
The following 4 parameters mean:
Pm.max_children: The number of PHP-FPM processes that are open in a static manner, and in the dynamic way he limits the maximum number of PHP-FPM processes (note that the Pm.max_spare_servers value can only be less than or equal to Pm.max_children)
Pm.start_servers: The number of starting PHP-FPM processes in dynamic mode.
Pm.min_spare_servers: The minimum number of PHP-FPM processes in dynamic idle state.
Pm.max_spare_servers: The maximum number of PHP-FPM processes in dynamic idle state.
If the DM is set to static, then only pm.max_children this parameter is in effect. The system will open the PHP-FPM process for the number of parameters set.
The
is in effect if the DM is set to dynamic,4 parameters. The system starts the Pm.start_servers PHP-FPM process at the start of the PHP-FPM run and then dynamically pm.min_spare_servers and pm.max_spare_ according to the requirements of the system Adjusts the number of PHP-FPM processes between servers.
P.S
Pm.min_spare_servers, pm.max_spare_servers these 2 parameters at first I thought it was an idle process, but then the server gave me an error:
Pm.start_servers (70) must not to less than pm.min_spare_servers (a) and not greater than-pm.max_spare_servers (a)
request Pm.start_ The servers values between Pm.min_spare_servers and pm.max_spare_servers are tested to draw the conclusion.