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

Source: Internet
Author: User

For PHP-FPM, there is a lot of doubt about the number of parameters that are built up, such as Pm.max_children,pm.start_servers, which is the most appropriate number of parameters for this setting. In fact, these several parameters often depend on the current number of connections, and in most cases it is very difficult to determine whether the current number of connections is appropriate for several of our PM's parameters. So with the help of the PHP-FPM status page, it is very convenient to tell us whether the settings of these several parameters are appropriate.

To turn on the PHP-FPM status page is actually very easy to add in nginx Config 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 and generally cannot be seen by others, so here is the 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 following describes the role of each of the parameters:
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, under normal circumstances are dynamic
Start time:php-fpm start time, either restart or reload will update the time here
Start since:php-fpm from start to go through time, default feel seconds
Accepted Conn: Number of connections currently received
Listen queue: The number of requests waiting for a connection in the queue, assuming that this number is not 0, then it is better to add the number of FPM for 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 processes spare
Active processes: Number of active processes
Total processes: Number of processes
Max Active Processes: The maximum number of active processes since FPM was started, assuming that this value is smaller than the current Max_children and can be adjusted smaller
Max children reached: When PM tries to start many other processes, it does not start many other processes due to the max_children limit. Assuming this value is not 0, the number of processes that can be appropriately added fpm
Slow requests: The number of slow requests, generally assuming that this value is not 0, then there may be slow PHP process, generally a bad MySQL query is the biggest culprit.

Assuming that you want to see more specific information, you can use Localhost/status?full to view the additional information for each child process, taking one of the subprocesses 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&ajaxtarge T=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: Assume that Php_auth_user is set to display the value for, otherwise it will be displayed as 0.

It is important to note that assuming that state is spare, then these related information will be related to the service that was last requested, otherwise the information depends on the service currently requested.

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

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.