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

相关文章

Spring Boot整合log4j2日志配置的详细教程

《SpringBoot整合log4j2日志配置的详细教程》:本文主要介绍SpringBoot项目中整合Log4j2日志框架的步骤和配置,包括常用日志框架的比较、配置参数介绍、Log4j2配置详解... 目录前言一、常用日志框架二、配置参数介绍1. 日志级别2. 输出形式3. 日志格式3.1 PatternL

开启mysql的binlog日志步骤详解

《开启mysql的binlog日志步骤详解》:本文主要介绍MySQL5.7版本中二进制日志(bin_log)的配置和使用,文中通过图文及代码介绍的非常详细,需要的朋友可以参考下... 目录1.查看是否开启bin_log2.数据库会把日志放进logs目录中3.查看log日志总结 mysql版本5.71.查看

C++中实现调试日志输出

《C++中实现调试日志输出》在C++编程中,调试日志对于定位问题和优化代码至关重要,本文将介绍几种常用的调试日志输出方法,并教你如何在日志中添加时间戳,希望对大家有所帮助... 目录1. 使用 #ifdef _DEBUG 宏2. 加入时间戳:精确到毫秒3.Windows 和 MFC 中的调试日志方法MFC

SpringBoot如何使用TraceId日志链路追踪

《SpringBoot如何使用TraceId日志链路追踪》文章介绍了如何使用TraceId进行日志链路追踪,通过在日志中添加TraceId关键字,可以将同一次业务调用链上的日志串起来,本文通过实例代码... 目录项目场景:实现步骤1、pom.XML 依赖2、整合logback,打印日志,logback-sp

PHP执行php.exe -v命令报错的解决方案

《PHP执行php.exe-v命令报错的解决方案》:本文主要介绍PHP执行php.exe-v命令报错的解决方案,文中通过图文讲解的非常详细,对大家的学习或工作有一定的帮助,需要的朋友可以参考下... 目录执行phpandroid.exe -v命令报错解决方案执行php.exe -v命令报错-PHP War

flume系列之:查看flume系统日志、查看统计flume日志类型、查看flume日志

遍历指定目录下多个文件查找指定内容 服务器系统日志会记录flume相关日志 cat /var/log/messages |grep -i oom 查找系统日志中关于flume的指定日志 import osdef search_string_in_files(directory, search_string):count = 0

我在移动打工的日志

客户:给我搞一下录音 我:不会。不在服务范围。 客户:是不想吧 我:笑嘻嘻(气笑) 客户:小姑娘明明会,却欺负老人 我:笑嘻嘻 客户:那我交话费 我:手机号 客户:给我搞录音 我:不会。不懂。没搞过。 客户:那我交话费 我:手机号。这是电信的啊!!我这是中国移动!! 客户:我不管,我要充话费,充话费是你们的 我:可是这是移动!!中国移动!! 客户:我这是手机号 我:那又如何,这是移动!你是电信!!

PHP原理之内存管理中难懂的几个点

PHP的内存管理, 分为俩大部分, 第一部分是PHP自身的内存管理, 这部分主要的内容就是引用计数, 写时复制, 等等面向应用的层面的管理. 而第二部分就是今天我要介绍的, zend_alloc中描写的关于PHP自身的内存管理, 包括它是如何管理可用内存, 如何分配内存等. 另外, 为什么要写这个呢, 因为之前并没有任何资料来介绍PHP内存管理中使用的策略, 数据结构, 或者算法. 而在我们

php中json_decode()和json_encode()

1.json_decode() json_decode (PHP 5 >= 5.2.0, PECL json >= 1.2.0) json_decode — 对 JSON 格式的字符串进行编码 说明 mixed json_decode ( string $json [, bool $assoc ] ) 接受一个 JSON 格式的字符串并且把它转换为 PHP 变量 参数 json

如何将文件夹里的PHP代码放到一个文件里

find ./dir -name "*.php" -exec 'cat' {} \; > dir.out