PHP-FPM主进程CPU负载异常升高问题排查求助
PHP 8.2.27 FPM主进程CPU持续升高并崩溃问题
我们运行的是PHP 8.2.27版本的FPM 8,配置如下:
pm = dynamic pm.max_children = 500 pm.start_severs = 32 pm.min_spare_servers = 32 pm.max_spare_servers = 64 pm.max_requests = 1000
初始启动时FPM运行平稳,但随时间推移,即便子进程数量变化不大,主进程CPU占用仍持续上升。未出现脚本挂起情况,直到主进程CPU占用达到阈值后问题爆发:当主进程单核心CPU占用超过90%(约占总核心的24%)时,主进程频繁启停,FPM持续创建并销毁无实际用途的子进程,最终导致崩溃或挂起。日志仅记录FPM无法写入stdout。
以下是FPM挂起前monit的监控数据:
Process 'php-fpm8' status OK monitoring status Monitored monitoring mode active on reboot start pid 2977861 parent pid 1 uid 0 effective uid 0 gid 0 uptime 1d 0h 9m threads 1 children 50 cpu 98.4% cpu total 98.9% memory 0.8% [375.9 MB] memory total 25.5% [11.9 GB] security attribute kernel filedescriptors 69 [6.7% of 1024 limit] total filedescriptors 351 read bytes 21.2 kB/s [601.1 GB total] disk read bytes 0 B/s [19.2 GB total] disk read operations 55.3 reads/s [175652524 reads total] write bytes 0 B/s [53.3 GB total] disk write bytes 0 B/s [915.9 MB total] disk write operations 5.0 writes/s [14306972 writes total] data collected Fri, 07 Mar 2025 09:32:53
内容的提问来源于stack exchange,提问作者Lukas Reeves
相关产品推荐
相关产品推荐

