[英]PHP Settings [pm.max_children, pm.start_servers, pm.min_spare_servers and pm.max_spare_servers]
[英]PHP 7.2 fails to start when pm.max_children > 506
在 Debian 10 上,当我设置pm.max_children = 507
或更多并尝试启动 php7.2-fpm 时,我收到以下错误:
-- The unit php7.2-fpm.service has entered the 'failed' state with result 'protocol'.
Sep 26 12:07:13 server.local systemd[1]: Failed to start The PHP 7.2 FastCGI Process Manager.
-- Subject: A start job for unit php7.2-fpm.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit php7.2-fpm.service has finished with a failure.
当我设置pm.max_children = 506
或更少时,一切正常。
我的 www.pool 配置:
[www]
user = www-data
group = www-data
listen = /var/run/php7-fpm.sock
listen.owner = www-data
listen.group = www-data
pm = static
pm.max_children = 506
pm.max_requests = 1000
catch_workers_output = yes
我的服务器配置:
什么会导致这种情况? 可以启动多少 php-fpm 子项是否有硬性限制? 或者这是一些系统限制? 可以以某种方式增加它吗(我有很多空闲内存)?
从长远来看,这 500 多个 php-fpm 子进程中的大多数可能会被闲置,但是如果您确实想增加数量,则主 FPM 进程和操作系统还会设置其他限制。
# in php-fpm.conf and pool.d/*.conf
rlimit_files = 131072
# the default value may be as low as 1024, and since each child will typically
# open 2 files (stdin & stdout), and there are additional files being used,
# 506*2 = 1012 +12 others seems very likely to be an issue.
您可能还需要通过编辑/etc/security/limits.conf
文件来启用 php-fpm(或其用户),以便能够使用更多的文件句柄,以及用户的硬和软限制(www-data)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.