大网数据广告活动
服务器运维问答

how to know how many children and servers set on PHP-FPM

· 52CE 我爱测

I realised a big problem today, too much traffic made my website totally down but i have a big server to host it. Here's what i got : [20-May-2019 14:23:02] WARNING: [pool www] seems busy (you may need to increase pm.start_server…

问题原文

原帖链接 · Metra · CC BY-SA 4.0

I realised a big problem today, too much traffic made my website totally down but i have a big server to host it. Here's what i got :

[20-May-2019 14:23:02] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 4 idle, and 22 total children
[20-May-2019 14:23:03] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 3 idle, and 30 total children
[20-May-2019 14:23: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 42 total children
[20-May-2019 14:23: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 57 total children
[20-May-2019 14:23: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 72 total children
[20-May-2019 14:23: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 87 total children
[20-May-2019 14:23:08] 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 102 total children
[20-May-2019 14:23:09] 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 117 total children
[20-May-2019 14:23:10] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 9 idle, and 132 total children

But i thought i have configured enough children on my fpm with this config :

  • pm.max_children = 100
  • pm.start_servers = 15
  • pm.min_spare_servers = 15
  • pm.max_spare_servers = 25

But i got this error. Do you know how many i can setup for accept more traffic ? I have 32gb of RAM and 8 cores

已采纳解答

原帖链接 · John Mahowald · CC BY-SA 4.0

That log file implies 110 processes started in 8 seconds. Note that it started multiple batches of 32 in quick succession. pm.min_spare_servers = 15 will not be able to absorb such a connection increase, response time will be terrible.

Keep enough idle processes to absorb your biggest connection spikes, and the maximums above that. If you have sufficient memory and CPU, of course. Try something like this:

pm.max_children = 500
pm.min_spare_servers = 100
pm.max_spare_servers = 200

Keep tuning this as a part of your capacity planning process. For example, you may have the resources to increase even more. Or maybe you reach a point where you do not need more php-fpm, and the resources would be better spent on other workloads on the host.

Also on Server Fault: WARNING: pool www seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-05-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。