LMLPHP后院

php-fpm 是一个很难用的软件技术

maybe yes 发表于 2021-05-10 18:22

看着配置文件的描述,我硬是没有弄懂 server 和 children 都是是什么关系,是一样的东西吗!?既然 start_servers 的默认值是算出来的,为什么还需要配置啊!

pm.start_servers 配置错误导致暂停了服务,真的是太操蛋了,顺滑重启导致服务暂停,这真让人抓狂啊😫

看看官方的文档

pm = dynamic

; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; 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. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 32

; 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 = 2
pm.start_servers = 10

; 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 = 1
pm.min_spare_servers = 4

; 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 = 3
pm.max_spare_servers = 16
Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2

既然 start_servers 值是确定的,那么为什么还需要别人配置呢?上面的公式让无数人费解,➕号后面倒是打个括号啊!!!在配置文件中这样写会让人费解的,难道配置文件还遵守运算优先级???

2024-03-29 23:12:04 1711725124 0.028199