时间:2021-07-01 10:21:17 帮助过:8人阅读
# cat /usr/local/php-5.5.10/etc/php-fpm.conf | grep status_path
pm.status_path = /status
server {
listen *:80 default_server;
server_name _;
location ~ ^/(status|ping)$
{
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
}
}
service nginx restart
service php-fpm restart
# curl http://www.ttlsa.com/status
pool: www
process manager: dynamic
start time: 14/May/2014:22:40:15 +0800
start since: 58508
accepted conn: 33
listen queue: 0
max listen queue: 8
listen queue len: 0
idle processes: 2
active processes: 1
total processes: 3
max active processes: 5
max children reached: 0
slow requests: 2091
listen queue
– 请求等待队列,如果这个值不为0,那么要增加FPM的进程数量
max children reached
- 大道进程最大数量限制的次数,如果这个数量不为0,那说明你的最大进程数量太小了,请改大一点。
json
、xml
、html
并且前面三个参数可以分别和full
做一个组合。# curl http://127.0.0.1/status?json
{"pool":"www","process manager":"dynamic","start time":1400078415,"start since":59624,"accepted conn":27,"listen queue":0,"max listen queue":8,"listen queue len":0,"idle processes":2,"active processes":1,"total processes":3,"max active processes":5,"max children reached":0,"slow requests":2145}
# curl http://127.0.0.1/status?xml
<status><pool>wwwpool><process-manager>dynamicprocess-manager><start-time>1400078415start-time><start-since>59640start-since><accepted-conn>36accepted-conn><listen-queue>0listen-queue><max-listen-queue>8max-listen-queue><listen-queue-len>0listen-queue-len><idle-processes>2idle-processes><active-processes>1active-processes><total-processes>3total-processes><max-active-processes>5max-active-processes><max-children-reached>0max-children-reached><slow-requests>2145slow-requests>
# curl http://127.0.0.1/status?html
<htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en"><head><title>PHP-FPM Status Pagetitle>head><body><table><tr><th>poolth><td>wwwtd>tr><tr><th>process managerth><td>dynamictd>tr><tr><th>start timeth><td>14/May/2014:22:40:15 +0800td>tr><tr><th>start sinceth><td>59662td>tr><tr><th>accepted connth><td>8td>tr><tr><th>listen queueth><td>0td>tr><tr><th>max listen queueth><td>8td>tr><tr><th>listen queue lenth><td>0td>tr><tr><th>idle processesth><td>2td>tr><tr><th>active processesth><td>1td>tr><tr><th>total processesth><td>3td>tr><tr><th>max active processesth><td>5td>tr><tr><th>max children reachedth><td>0td>tr><tr><th>slow requeststh><td>2147td>tr>table>body>html>
# curl http://127.0.0.1/status?full
pool: www
process manager: dynamic
start time: 14/May/2014:22:40:15 +0800
start since: 59695
accepted conn: 1
listen queue: 0
max listen queue: 8
listen queue len: 0
idle processes: 2
active processes: 1
total processes: 3
max active processes: 5
max children reached: 0
slow requests: 2148
************************
pid: 29050
state: Idle
start time: 15/May/2014:15:09:32 +0800
start since: 338
requests: 62
request duration: 1025585
request method: GET
request URI: /index.php
content length: 0
user: -
script: /data/site/www.ttlsa.com/index.php
last request cpu: 45.83
last request memory: 24903680
.....省略几个PID....
php-fpm状态页非常使用,使用zabbix或者nagios监控可以考虑使用xml或者默认方式。用web的话,推荐使用html,表格会比较清晰。
以上就介绍了phpfpm使用自带的status优化步骤,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。