启用php-fpm状态分析
#修改配置文件: /usr/local/php7/etc/php-fpm.d/www.conf ,找到如下选项
;pm.status_path = /status #默认是注释状态,去掉前面分号即可,'status'可随便定义,但是要跟下面nginx的配置保持一致
修改nginx配置
#在某个server里面加入下述规则,'status'与上面php-fpm保持一致:
location ~ ^/(status|ping)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
include fastcgi_params;
}
重启nginx与php-fpm后访问测试
此时即可通过 ‘域名/status’ 访问php-fpm状态,可以浏览器访问也可以命令行
状态解释
pool: fpm进程池名称,大多数为www
process manager: 进程管理方式,可能值:static, dynamic, ondemand
start time: 启动日期,如果reload了php-fpm,时间会更新
start since: 运行时长,单位s
accepted conn: 当前进程池接受的请求数
listen queue: 请求等待队列,如果这个值不为0,那么要增加FPM的进程数量
max listen queue: 请求等待队列最高的数量
listen queue len: socket等待队列长度
idle processes: 空闲进程数量
active processes: 活跃进程数量
total processes: 总进程数量
max active processes: 最大的活跃进程数量(FPM启动开始算)
max children reached: 达到进程最大数量限制的次数,如果这个数量不为0,那说明你的最大进程数量太小了,请改大一点
slow requests: 启用了php-fpm slow-log,缓慢请求的数量
其他格式
http://www.域名或IP.com/status #默认纯文本
http://www.域名或IP.com/status?json #json格式
http://www.域名或IP.com/status?html #html格式
http://www.域名或IP.com/status?xml #xml格式
#full参数可查看进程详细信息
http://www.域名或IP.com/status?full
http://www.域名或IP.com/status?json&full
http://www.域名或IP.com/status?html&full
http://www.域名或IP.com/status?xml&full