Use the php-fpm status page to observe the current php-fpm status.
For php-fpm parameter settings, in many cases, there are several built-in parameters, such as pm. max_children, pm. start_servers and so on. In fact, these parameters often depend on the current number of connections. In most cases, it is difficult to determine whether the current number of connections is suitable for our pm and other parameters. Therefore, using the php-fpm status page, you can easily tell us whether the settings of these parameters are appropriate.
To enable the php-fpm status page, add the following content to the nginx configuration file:
Location/status {
Auth_basic "status page ";
Auth_basic_user_file/etc/nginx/login;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME/scripts $ fastcgi_script_name;
Include fastcgi_params;
Fastcgi_pass 127.0.0.1: 9000;
}
The above auth_basic and auth_basic_user_file are not mandatory, but they are sensitive information and cannot be seen by others. Therefore, authentication is performed here. Open in php-fpm.conf:
Pm. status_path =/status
Then open localhost/status in the browser to view the current status information.
Pool: www
Process manager: dynamic
Start time: 17/Aug/2014: 15: 25: 50-0400
Start since: 7702
Accepted conn: 1486
Listen queue: 0
Max listen queue: 129
Listen queue len: 128
Idle processes: 9
Active processes: 1
Total processes: 10
Max active processes: 20
Max children reached: 2
Slow requests: 0
The following describes the functions of each parameter:
Pool: name of the php-fpm pool, which is generally www
Process manage: process Management Method. php-fpm supports three management methods: static, dynamic, and ondemand.
Start time: the time when php-fpm is started. The time here will be updated whether it is restart or reload.
Start since: time when php-fpm starts automatically. The default value is second.
Accepted conn: Number of connections currently received
Listen queue: Number of requests waiting for connection in the queue. If this number is not 0, it is best to increase the number of fpm processes.
Max listen queue: Maximum number of connection requests waiting in the queue since fpm is started
Listen queue len: size of the socket queue waiting for connection
Idle processes: Number of idle processes
Active processes: Number of active processes
Total processes: total number of processes
Max active processes: the maximum number of active processes since fpm was started. If this value is smaller than the current max_children value, you can reduce this value.
Max children reached: When the pm tries to start more processes, but due to max_children restrictions, it does not start more processes. If this value is not 0, you can increase the number of fpm processes as appropriate.
Slow requests: the number of slow requests. Generally, if this value is not 0, there may be slow php processes. Generally, a bad mysql query is the largest timeout.
If you want to see more detailed information, you can use localhost/status? Full: view more information about each sub-process. Use one of the sub-processes to describe them:
Pid: 6917
State: Idle
Start time: 17/Aug/2014: 15: 27: 46-0400
Start since: 8399
Requests: 35
Request duration: 69295
Request method: GET
Request URI:/member. php? Mod = logging & action = login & infloat = yes & frommessage & inajax = 1 & ajaxtarget = messagelogin
Content length: 0
User :-
Script:/usr/local/nginx/html/member. php
Last request cpu: 72.16
Last request memory: 3145728
The content length and user
Content length: The content length of the POST request is recorded here.
User: If PHP_AUTH_USER is set, the corresponding value is displayed. Otherwise, the value is 0.
Note that if the state is idle, the information will be related to the service in the last request. Otherwise, the information depends on the service in the current request.