Home  >  Article  >  Backend Development  >  How to set the number of php fpm processes

How to set the number of php fpm processes

藏色散人
藏色散人Original
2020-08-10 10:06:263328browse

How to set the number of php fpm processes: first open the "php-fpm.conf" configuration file; then modify the "pm.max_children" parameter; then set the "pm.start_servers" parameter; and finally set the maximum number of idle service processes Just count.

How to set the number of php fpm processes

Recommended: "PHP Video Tutorial"

php-fpm process number setting

1.php-fpm has three management methods: static (the number of child processes is fixed), dynamic (the child process is dynamically set), and onedemand (the process is generated only when needed)

2.php-fpm The number of processes is mainly determined by the following five parameters

pm.max_children: When pm is static, it indicates the number of child processes created. When pm is dynamic, it indicates the maximum number of child processes that can be created.

pm.start_servers : Set the number of child processes created at startup, only valid when pm is dynamic.

Default value: min_spare_servers (max_spare_servers - min_spare_servers)/2

pm.min_spare_servers: Set the minimum number of idle service processes, only valid when dynamic.

pm.max_spare_servers: Set the maximum number of idle service processes, only valid when dynamic.

pm.process_idle_timeout: Number of seconds, how long it will take to end the idle process, only useful for onedemand

3.php-fpm process number setting is mainly determined by server memory. The php-fpm process occupies 20-30M of memory when running normally.

(1) If the system concurrency is not very large, it would be better to use static. The specific value is set according to the system request volume.

(2) If the system concurrency jitter is relatively large, it will be better to use dynamic. The specific value is set according to the system request concurrency and memory size.

The above is the detailed content of How to set the number of php fpm processes. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn