Use the PHP-FPM Status page to observe the current PHP-FPM state

Source: Internet
Author: User
For php-fpm parameter settings, in many cases there is a doubt that the built-in parameters such as pm.max_children,pm.start_servers, such as the number of parameters such as how much this setting is appropriate. In fact, these parameters often depend on the current number of connections, and in most cases, it is difficult to determine whether the current number of connections to our PM and other parameters are appropriate. So with the help of the PHP-FPM status page, it is very convenient to tell us whether the settings of these parameters are appropriate.

To turn on the PHP-FPM status page is actually very simple to add in 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 required, but these are sensitive information that is generally not visible to others, so there is a certification. Open in php-fpm.conf:
Pm.status_path =/status

Then open the Localhost/status in the browser to see 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 role of each parameter is described below:
POOL:PHP-FPM pool name, generally should be www
Process manage: Management of processes, PHP-FPM support three management methods, respectively static,dynamic and OnDemand, generally dynamic
Start time:php-fpm start time, either restart or reload will update the time here
Start SINCE:PHP-FPM the elapsed time since it was started, the default is seconds.
Accepted Conn: Number of connections currently received
Listen queue: The number of requests waiting for a connection in the queue, if this number is not 0, it is better to increase the number of FPM in the process
Max Listen queue: The maximum number of pending connection requests in the queue since FPM started
Listen queue Len: The size of socket queues waiting for a connection
Idle processes: Number of idle processes
Active processes: Number of active processes
Total processes: Number of processes
Max Active Processes: The maximum number of active processes since FPM started, and if this value is less than the current Max_children, you can lower this value
Max children reached: When PM tries to start more processes, it does not start more processes because of the max_children limit. If this value is not 0, then the number of FPM processes can be increased appropriately
Slow requests: The number of slow requests, generally if this value is not 0, then there may be slow PHP process, generally a bad MySQL query is the biggest culprit.

If you want to see more detailed information, you can use Localhost/status?full to view the additional information for each subprocess, taking one of the sub-processes to illustrate:
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

Here are better understand, mainly look at the content length and user
Content Length: The contents of the POST request are recorded here.
User: If the php_auth_user is set, the value is displayed, otherwise 0 is displayed.

It is important to note that if state is idle, then the relevant information will be related to the last requested service, otherwise the information depends on the service currently requested.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.