参数解释:
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes to be created when pm is set to 'dynamic'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI.
; Note: Used when pm is set to either 'static' or 'dynamic'
; Note: This value is mandatory.
pm.max_children = 50
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 20
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 5
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 35
风格:static 此时查看进程数固定为13个
#假设设置的参数
pm = static
pm.max_children=13
[root@localhost]# ps -axu | grep php-fpm
root 4423 0.0 0.4 295680 4288 ? Ss 13:27 0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
www 4424 0.0 0.4 295680 3984 ? S 13:27 0:00 php-fpm: pool www
www 4425 0.0 0.4 295680 3984 ? S 13:27 0:00 php-fpm: pool www
www 4426 0.0 0.4 295680 3984 ? S 13:27 0:00 php-fpm: pool www
www 4427 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www
www 4428 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www
www 4429 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www
www 4430 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www
www 4431 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www
www 4432 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www
www 4433 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www
www 4434 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www
www 4435 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www
www 4436 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www
dynamic风格下必须遵守两个法则
1.pm.min_spare_servers<=pm.start_servers<=pm.max_spare_servers
2.pm.max_children>=pm.max_spare_servers
#风格:dynamic
pm = dynamic
pm.max_children=20
pm.start_servers=5
pm.min_spare_servers=5
pm.max_spare_servers=20
[root@localhost]# ps -axu | grep php-fpm
root 4423 0.0 0.4 295680 4288 ? Ss 13:27 0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
www 4424 0.0 0.4 295680 3984 ? S 13:27 0:00 php-fpm: pool www
www 4425 0.0 0.4 295680 3984 ? S 13:27 0:00 php-fpm: pool www
www 4426 0.0 0.4 295680 3984 ? S 13:27 0:00 php-fpm: pool www
www 4427 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www
www 4428 0.0 0.4 295680 3988 ? S 13:27 0:00 php-fpm: pool www