PS:前段时间配置php-fpm的时候,无意中发现原来它还有两种进程管理方式。与Apache类似,它的进程数也是可以根据设置分为动态和静态的。 php-fpm目前主要又两个分支,分别对应于php-5.2.x的版本和php-5.3.x的版本。在5.2.x的版本中,php-fpm.conf使用的是xml格式,而在新的5.3.x版本中,则是和php.ini一样的配置风格。 在5.2.x版本中,php-fpm.conf中对于进程管理号称是有两种风格,一种是静态(static)的,一种是类似于apache风格(apache-like)的。 复制代码 代码如下: Process manager settings <value name=”pm”> Sets style of controling worker process count. Valid values are "static" and ‘apache-like" <value name=”style”>static</value>
按照文档的说明,如果pm的style采用apache-like,启动的进程数应该是和StartServers指定的一样。不过经过数次的尝试,会发现,实际上在这里将pm的style配置成apache-like没有起任何作用。也就是说,这里的apache-like并没有被实现。 不过,在最新的5.3.x的配套php-fpm中,apache风格的进程管理已经被实现了。 复制代码 代码如下: ; Choose how the process manager will control the number of child processes. ; Possible Values: ; static - a fixed number (pm.max_children) of child processes; ; dynamic - the number of child processes are set dynamically based on the ; following directives: ; pm.max_children - the maximum number of children that can ; be alive at the same time. ; pm.start_servers - the number of children created on startup. ; pm.min_spare_servers - the minimum number of children in "idle" ; state (waiting to process). If the number ; of "idle" processes is less than this ; number then some children will be created. ; pm.max_spare_servers - the maximum number of children in "idle" ; state (waiting to process). If the number ; of "idle" processes is greater than this ; number then some children will be killed. ; Note: This value is mandatory. ;pm = dynamic pm = static