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

相关文章

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

Qt spdlog日志模块的使用详解

《Qtspdlog日志模块的使用详解》在Qt应用程序开发中,良好的日志系统至关重要,本文将介绍如何使用spdlog1.5.0创建满足以下要求的日志系统,感兴趣的朋友一起看看吧... 目录版本摘要例子logmanager.cpp文件main.cpp文件版本spdlog版本:1.5.0采用1.5.0版本主要

SpringBoot日志配置SLF4J和Logback的方法实现

《SpringBoot日志配置SLF4J和Logback的方法实现》日志记录是不可或缺的一部分,本文主要介绍了SpringBoot日志配置SLF4J和Logback的方法实现,文中通过示例代码介绍的非... 目录一、前言二、案例一:初识日志三、案例二:使用Lombok输出日志四、案例三:配置Logback一

golang 日志log与logrus示例详解

《golang日志log与logrus示例详解》log是Go语言标准库中一个简单的日志库,本文给大家介绍golang日志log与logrus示例详解,感兴趣的朋友一起看看吧... 目录一、Go 标准库 log 详解1. 功能特点2. 常用函数3. 示例代码4. 优势和局限二、第三方库 logrus 详解1.

如何自定义Nginx JSON日志格式配置

《如何自定义NginxJSON日志格式配置》Nginx作为最流行的Web服务器之一,其灵活的日志配置能力允许我们根据需求定制日志格式,本文将详细介绍如何配置Nginx以JSON格式记录访问日志,这种... 目录前言为什么选择jsON格式日志?配置步骤详解1. 安装Nginx服务2. 自定义JSON日志格式各

SpringBoot项目使用MDC给日志增加唯一标识的实现步骤

《SpringBoot项目使用MDC给日志增加唯一标识的实现步骤》本文介绍了如何在SpringBoot项目中使用MDC(MappedDiagnosticContext)为日志增加唯一标识,以便于日... 目录【Java】SpringBoot项目使用MDC给日志增加唯一标识,方便日志追踪1.日志效果2.实现步

SQL Server清除日志文件ERRORLOG和删除tempdb.mdf

《SQLServer清除日志文件ERRORLOG和删除tempdb.mdf》数据库再使用一段时间后,日志文件会增大,特别是在磁盘容量不足的情况下,更是需要缩减,以下为缩减方法:如果可以停止SQLSe... 目录缩减 ERRORLOG 文件(停止服务后)停止 SQL Server 服务:找到错误日志文件:删除

grom设置全局日志实现执行并打印sql语句

《grom设置全局日志实现执行并打印sql语句》本文主要介绍了grom设置全局日志实现执行并打印sql语句,包括设置日志级别、实现自定义Logger接口以及如何使用GORM的默认logger,通过这些... 目录gorm中的自定义日志gorm中日志的其他操作日志级别Debug自定义 Loggergorm中的