php-fpm56日志文件,PHP-FPM日志告警seem busy

2023-12-21 12:40
文章标签 日志 php fpm busy 告警 seem fpm56

本文主要是介绍php-fpm56日志文件,PHP-FPM日志告警seem busy,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

没事查看了一下php日志,发现提示进程数不够,日志信息如下:

[04-Nov-2014 14:19:08] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_serve

rs), spawning 8 children, there are 0 idle, and 15 total children

[04-Nov-2014 14:29:27] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_serve

rs), spawning 8 children, there are 0 idle, and 16 total children

[04-Nov-2014 16:51:04] NOTICE: Finishing ...

[04-Nov-2014 16:51:04] NOTICE: exiting, bye-bye!

[04-Nov-2014 16:51:06] NOTICE: fpm is running, pid 31023

[04-Nov-2014 16:51:06] NOTICE: ready to handle connections

[04-Nov-2014 19:01:05] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_serve

rs), spawning 8 children, there are 0 idle, and 17 total children

[04-Nov-2014 19:54:47] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_serve

rs), spawning 8 children, there are 0 idle, and 17 total children

[04-Nov-2014 20:36:06] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_serve

rs), spawning 8 children, there are 0 idle, and 19 total children

[04-Nov-2014 21:18:56] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_serve

rs), spawning 8 children, there are 0 idle, and 17 total children

[05-Nov-2014 05:30:04] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_serve

rs), spawning 8 children, there are 0 idle, and 15 total children

[05-Nov-2014 11:01:37] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_serve

rs), spawning 8 children, there are 0 idle, and 17 total children

[05-Nov-2014 11:01:38] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_serve

rs), spawning 16 children, there are 0 idle, and 21 total children

使用下面的命令查看php进程:

[root@test ~]# ps -ef |grep php

root     25874 20907  0 11:56 pts/0    00:00:00 more index.php

www      26030 31023 32 12:02 ?        00:00:26 php-fpm: pool www

www      26037 31023 31 12:02 ?        00:00:22 php-fpm: pool www

www      26042 31023 31 12:02 ?        00:00:20 php-fpm: pool www

www      26046 31023 30 12:02 ?        00:00:17 php-fpm: pool www

www      26054 31023 30 12:02 ?        00:00:15 php-fpm: pool www

www      26059 31023 30 12:02 ?        00:00:14 php-fpm: pool www

www      26062 31023 30 12:03 ?        00:00:12 php-fpm: pool www

www      26063 31023 30 12:03 ?        00:00:09 php-fpm: pool www

www      26066 31023 30 12:03 ?        00:00:09 php-fpm: pool www

www      26089 31023 23 12:03 ?        00:00:02 php-fpm: pool www

www      26092 31023 24 12:03 ?        00:00:01 php-fpm: pool www

root     26097 25911  0 12:03 pts/1    00:00:00 grep php

root     31023     1  0 Nov04 ?        00:00:09 php-fpm: master process (/usr/local/php5/etc/php-fpm.conf)

内存占用情况:只用了2G左右的内存

[root@test etc]# free -m

total       used       free     shared    buffers     cached

Mem:         19990      19685        304          0        256      16949

-/+ buffers/cache:      2480     17509

Swap:        19999        112      19887

打开配置文件php-fpm.conf发现:pm.max_children = 5

7e875583728601787afb2538cb4ea777.png

修改成如下参数后,发现php日志中无此报警了:

; Note: This value is mandatory.

pm.max_children = 1024

; The number of child processes created on startup.

; Note: Used only when pm is set to 'dynamic'

; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2

pm.start_servers = 512

; The desired minimum number of idle server processes.

; Note: Used only when pm is set to 'dynamic'

; Note: Mandatory when pm is set to 'dynamic'

pm.min_spare_servers = 4

; The desired maximum number of idle server processes.

; Note: Used only when pm is set to 'dynamic'

; Note: Mandatory when pm is set to 'dynamic'

pm.max_spare_servers = 512

查看php-fpm的子进程数,跟配置文件里面设置的一样,等于pm.start_servers+pm.min_spare_servers

[root@test etc]# ps -ef |grep php |wc -l

515

修改php配置文件后,内存占用从2G变成了6.8G左右,增长了4.8G左右,一个php进程开销占到了8M左右,这个可以根据实际的内存情况来进行修改。

[root@localhost log]# free -m

total       used       free     shared    buffers     cached

Mem:         19990      19438        551          0        189      12414

-/+ buffers/cache:       6835     13154

Swap:        19999        129      19870

补充:

php- fpm有一个参数 max_requests,该参数指明了,每个children最多处理多少个请求后便会被关闭,默认的设置是500。因为php是把请求轮询给每个 children,在大流量下,每个childre到达max_requests所用的时间都差不多,这样就造成所有的children基本上在同一时间 被关闭,这样会导致此时nginx发给php的请求无法得到相应,会出现短时间的502.解决方法:

增加children的数量,并且将 max_requests 设置未 0 或者一个比较大的值

一般增加max_requests到102400,可能有效果。

这篇关于php-fpm56日志文件,PHP-FPM日志告警seem busy的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/520038

相关文章

SpringBoot项目配置logback-spring.xml屏蔽特定路径的日志

《SpringBoot项目配置logback-spring.xml屏蔽特定路径的日志》在SpringBoot项目中,使用logback-spring.xml配置屏蔽特定路径的日志有两种常用方式,文中的... 目录方案一:基础配置(直接关闭目标路径日志)方案二:结合 Spring Profile 按环境屏蔽关

Golang 日志处理和正则处理的操作方法

《Golang日志处理和正则处理的操作方法》:本文主要介绍Golang日志处理和正则处理的操作方法,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考... 目录1、logx日志处理1.1、logx简介1.2、日志初始化与配置1.3、常用方法1.4、配合defer

Apache 高级配置实战之从连接保持到日志分析的完整指南

《Apache高级配置实战之从连接保持到日志分析的完整指南》本文带你从连接保持优化开始,一路走到访问控制和日志管理,最后用AWStats来分析网站数据,对Apache配置日志分析相关知识感兴趣的朋友... 目录Apache 高级配置实战:从连接保持到日志分析的完整指南前言 一、Apache 连接保持 - 性

Nacos日志与Raft的数据清理指南

《Nacos日志与Raft的数据清理指南》随着运行时间的增长,Nacos的日志文件(logs/)和Raft持久化数据(data/protocol/raft/)可能会占用大量磁盘空间,影响系统稳定性,本... 目录引言1. Nacos 日志文件(logs/ 目录)清理1.1 日志文件的作用1.2 是否可以删除

SpringBoot实现文件记录日志及日志文件自动归档和压缩

《SpringBoot实现文件记录日志及日志文件自动归档和压缩》Logback是Java日志框架,通过Logger收集日志并经Appender输出至控制台、文件等,SpringBoot配置logbac... 目录1、什么是Logback2、SpringBoot实现文件记录日志,日志文件自动归档和压缩2.1、

使用nohup和--remove-source-files在后台运行rsync并记录日志方式

《使用nohup和--remove-source-files在后台运行rsync并记录日志方式》:本文主要介绍使用nohup和--remove-source-files在后台运行rsync并记录日... 目录一、什么是 --remove-source-files?二、示例命令三、命令详解1. nohup2.

MySQL精准控制Binlog日志数量的三种方案

《MySQL精准控制Binlog日志数量的三种方案》作为数据库管理员,你是否经常为服务器磁盘爆满而抓狂?Binlog就像数据库的“黑匣子”,默默记录着每一次数据变动,但若放任不管,几天内这些日志文件就... 目录 一招修改配置文件:永久生效的控制术1.定位my.cnf文件2.添加核心参数不重启热更新:高手应

Java程序进程起来了但是不打印日志的原因分析

《Java程序进程起来了但是不打印日志的原因分析》:本文主要介绍Java程序进程起来了但是不打印日志的原因分析,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Java程序进程起来了但是不打印日志的原因1、日志配置问题2、日志文件权限问题3、日志文件路径问题4、程序

Java使用SLF4J记录不同级别日志的示例详解

《Java使用SLF4J记录不同级别日志的示例详解》SLF4J是一个简单的日志门面,它允许在运行时选择不同的日志实现,这篇文章主要为大家详细介绍了如何使用SLF4J记录不同级别日志,感兴趣的可以了解下... 目录一、SLF4J简介二、添加依赖三、配置Logback四、记录不同级别的日志五、总结一、SLF4J

python logging模块详解及其日志定时清理方式

《pythonlogging模块详解及其日志定时清理方式》:本文主要介绍pythonlogging模块详解及其日志定时清理方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地... 目录python logging模块及日志定时清理1.创建logger对象2.logging.basicCo