通过下面的日志,增加 pm.max_children 数字的确可以减少 502 的发生,但是,已经加到 300 了,还是会达到这个数字。网站流量也不大,怀疑是某个 PHP 运行出了点问题,大家知道怎么定位解决吗?
# php7.1-fpm.log
[19-Mar-2020 08:07:19] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 46 idle, and 137 total children
[19-Mar-2020 08:12:44] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 48 idle, and 164 total children
[19-Mar-2020 08:17:20] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 46 idle, and 243 total children
[19-Mar-2020 08:27:04] WARNING: [pool www] server reached pm.max_children setting (300), consider raising it
# php.ini 配置
pm = dynamic
pm.max_children = 300
pm.start_servers = 75
pm.min_spare_servers = 50
pm.max_spare_servers = 100
pm.max_requests = 1000
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
https://v2ex.xtra.eu.org/t/654101
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.