php php-fpm - php-fpm status_PHP_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > PHP > php php-fpm - php-fpm status

php php-fpm - php-fpm status

 2014/11/18 17:15:02  飞奔的熊猫  程序员俱乐部  我要评论(0)
  • 摘要:【基本介绍】这里介绍php-fpm的status.可以查看php-fpm的进程相关的信息。【基本配置】php-fpm的配置文件,使用pm.status_pat=;TheURItoviewtheFPMstatuspage.Ifthisvalueisnotset,noURIwillbe;recognizedasastatuspage.Bydefault,thestatuspageshowsthefollowing;information:;acceptedconn
  • 标签:PHP
【基本介绍】
这里介绍php-fpm的status.可以查看php-fpm的进程相关的信息。

【基本配置】
php-fpm的配置文件,使用pm.status_pat=
class="linux" name="code">
; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. By default, the status page shows the following
; information:
;   accepted conn    - the number of request accepted by the pool;
;   pool             - the name of the pool;
;   process manager  - static or dynamic;
;   idle processes   - the number of idle processes;
;   active processes - the number of active processes;
;   total processes  - the number of idle + active processes.
; The values of 'idle processes', 'active processes' and 'total processes' are
; updated each second. The value of 'accepted conn' is updated in real time.
; Example output:
;   accepted conn:   12073
;   pool:             www
;   process manager:  static
;   idle processes:   35
;   active processes: 65
;   total processes:  100
; By default the status page output is formatted as text/plain. Passing either
; 'html' or 'json' as a query string will return the corresponding output
; syntax. Example:
;   http://www.foo.bar/status
;   http://www.foo.bar/status?json
;   http://www.foo.bar/status?html
; Note: The value must start with a leading slash (/). The value can be
;       anything, but it may not be a good idea to use the .php extension or it
;       may conflict with a real PHP file.
; Default Value: not set
pm.status_path = /fpm-status


在web服务中添加配置,
例如:nginx中添加location
location ~ ^/(status|ping)$ {
     access_log off;
     allow 127.0.0.1;
     allow 1.2.3.4#your-ip;
     deny all;
     include fastcgi_params;
     fastcgi_pass 127.0.0.1:9000;


【结果分析】
http://domain/fpm-status
pool:               www      #fpm池子名称,大多数为www
process manager:    dynamic #进程管理方式,值:static, dynamic or ondemand. dynamic
start time:   17/Nov/2014:22:59:48 +0800 #启动日期,如果reload了php-fpm,时间会更新
start since:          59509  # 运行时长
accepted conn:        115850  #当前池子接受的请求数
listen queue:         0  #请求等待队列,如果这个值不为0,那么要增加FPM的进程数量
max listen queue:     1 #请求等待队列最高的数量
listen queue len:     0  #socket等待队列长度
idle processes:       14  #空闲进程数量
active processes:     2  #活跃进程数量
total processes:      16  #总进程数量
max active processes: 9  #最大的活跃进程数量(FPM启动开始算)
max children reached: 0 #大道进程最大数量限制的次数,如果这个数量不为0,
                        #那说明你的最大进程数量太小了,请改大一点。
slow requests:        3   #启用了php-fpm slow-log,缓慢请求的数量


【其他参数】
php-fpm状态页比较个性化的一个地方是它可以带参数,可以带参数json、xml、html并且前面三个参数可以分别和full做一个组合。(见参考引用链接)

full详解
pid – 进程PID,可以单独kill这个进程. You can use this PID to kill a long running process.
state – 当前进程的状态 (Idle, Running, …)
start time – 进程启动的日期
start since – 当前进程运行时长
requests – 当前进程处理了多少个请求
request duration – 请求时长(微妙)
request method – 请求方法 (GET, POST, …)
request URI – 请求URI
content length – 请求内容长度 (仅用于 POST)
user – 用户 (PHP_AUTH_USER) (or ‘-’ 如果没设置)
script – PHP脚本 (or ‘-’ if not set)
last request cpu – 最后一个请求CPU使用率。
last request memorythe – 上一个请求使用的内存


【参考引用】
http://www.ttlsa.com/php/use-php-fpm-status-page-detail/
https://rtcamp.com/tutorials/php/fpm-status-page/
发表评论
用户名: 匿名