1

在 AWS m4large 实例上运行 php7 并遇到 php7.1-fpm 问题。

它可以很好地提供单个连接,但是一旦我开始运行,即使是最少量的流量 fpm 也会开始产生很多孩子。

我只是提供一个 phpinfo 页面,所以这里没有显着的内存使用。

如果我运行,ab -n 10 -c 10 https://example.com/index.php我会立即在我的 fpm 日志中收到以下消息。

[27-Apr-2017 10:26:00] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 12 total children
[27-Apr-2017 10:26:01] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 17 total children
[27-Apr-2017 10:26:02] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 22 total children
[27-Apr-2017 10:26:03] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 27 total children
[27-Apr-2017 10:26:04] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 32 total children
[27-Apr-2017 10:26:05] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 37 total children
[27-Apr-2017 10:26:06] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 42 total children
[27-Apr-2017 10:26:07] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 47 total children
[27-Apr-2017 10:26:08] WARNING: [pool www] server reached pm.max_children setting (50), consider raising it

这是我的 fpm 设置

[global]
 pid = /var/run/php/php7.1-fpm.pid
 error_log = /var/log/php7.1-fpm.log
 syslog.ident = php-fpm
 syslog.facility = 24
 log_level = NOTICE
 process.max = 0
 process.priority = undefined
 daemonize = yes
 rlimit_files = 0
 rlimit_core = 0
 events.mechanism = epoll
 systemd_interval = 10s

[www]
 prefix = undefined
 user = www-data
 group = www-data
 listen = /var/run/php7.1-fpm.sock
 listen.backlog = -1
 listen.owner = www-data
 listen.group = www-data
 listen.mode = 0660
 listen.allowed_clients = undefined
 process.priority = undefined
 pm = dynamic
 pm.max_children = 50
 pm.start_servers = 5
 pm.min_spare_servers = 5
 pm.max_spare_servers = 35
 pm.process_idle_timeout = 10
 pm.max_requests = 0
 pm.status_path = undefined
 ping.path = undefined
 ping.response = undefined
 access.log = undefined
 access.format = %R - %u %t%m %r%s
 slowlog = /var/log/php-fpm/www-slow.log
 request_slowlog_timeout = 0s
 request_terminate_timeout = 0s
 rlimit_files = 0
 rlimit_core = 0
 chroot = undefined
 chdir = undefined
 catch_workers_output = no
 clear_env = yes
 security.limit_extensions = .php .phar

我一直在玩我的最小/最大服务器设置,它是 50 还是 100 都没关系。

有什么帮助吗?什么可能导致这崩溃?

4

1 回答 1

3

我的问题是我的代码的问题,它在内部创建了请求的无限递归。这与 fpm 无关。

于 2017-04-27T16:59:43.077 回答