我确实在服务器上更新了php7.3-fpm要得到http2工作正常。设置好所有需要的东西,h2 运行良好,所有网站都正常运行。但是每隔 5 分钟,服务器就会卡在这些错误上,直到我重新启动 apache。
我检查了所有配置,尝试计算 MaxRequestWorkers、maxclients、pm.max_children、pm.start_servers、pm.min_spare_servers、pm.max_spare_servers。每次更改都会使情况变得更糟或持续更长时间。
服务器配置
- Debian 10
- 阿帕奇 2.4.38
- php 7.3.14
- 5.8GB 内存
- 2 个英特尔 (R) 至强 (R) CPU E3-1585L v5 @ 3.00GHz
服务器统计
- 大约 100-200 名在线用户
- https://i.stack.imgur.com/kKxLh.png(无法发布图片,无回复)
错误
[Tue Nov 03 15:30:07.450356 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31148 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:07.450391 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31149 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:07.450397 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5692 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:07.450401 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5860 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:07.450406 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5982 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:07.450410 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 6138 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452520 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31148 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452556 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31149 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452562 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5692 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452567 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5860 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452573 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5982 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:09.452578 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 6138 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454710 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31148 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454739 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 31149 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454744 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5692 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454760 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5860 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454764 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 5982 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:11.454768 2020] [core:warn] [pid 31147:tid 139885881660544] AH00045: child process 6138 still did not exit, sending a SIGTERM
[Tue Nov 03 15:30:13.456926 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 31148 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:13.456983 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 31149 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:13.457006 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 5692 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:13.457028 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 5860 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:13.457059 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 5982 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:13.457094 2020] [core:error] [pid 31147:tid 139885881660544] AH00046: child process 6138 still did not exit, sending a SIGKILL
[Tue Nov 03 15:30:14.458349 2020] [mpm_event:notice] [pid 31147:tid 139885881660544] AH00491: caught SIGTERM, shutting down
服务器mpm-事件.conf
<IfModule mpm_event_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
感谢你的支持,
答案1
您可能需要将 MPM 从事件切换到 prefork。大多数版本的 PHP 仍然不是线程安全的,并且唯一可以安全地与非线程安全代码一起使用的 MPM 是 prefork,因为它会创建新的进程(而不是线程)来处理新请求。