php-fpm pool www,Nginx使用的php-fpm的两种进程管理方式及优化

参数解释:

; 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值