Understanding the PHP-FPM status page

PHP-FPM has a very useful feature that allows you to setup a status page to view that status of a PHP-FPM pool, configurable using the option pm.status_path. Most people who have worked with PHP-FPM have probably heard of this setting, and maybe even used it (some tools such as Munin require it for metrics). Here is a sample of the basic output:

$ curl http://localhost/server-status
pool: default
process manager: dynamic
start time: 11/Dec/2014:17:51:33 -0500
start since: 61383
accepted conn: 4682
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 11
active processes: 1
total processes: 12
max active processes: 2
max children reached: 0
slow requests: 3

There is also the very useful full view, which gives you per-process information for every currently running FPM process in the pool:

$ curl http://localhost/server-status?full
pool: default
process manager: dynamic
start time: 11/Dec/2014:17:51:33 -0500
start since: 61418
accepted conn: 4687
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 11
active processes: 1
total processes: 12
max active processes: 2
max children reached: 0
slow requests: 3

************************
pid: 29187
state: Idle
start time: 12/Dec/2014:07:00:14 -0500
start since: 14097
requests: 112
request duration: 85
request method: GET
request URI: /watcher.php
content length: 0
user: -
script: /var/www/vhosts/www.example.com/watcher.php
last request cpu: 0.00
last request memory: 262144

This view can be somewhat difficult to understand if you’re not super familiar with PHP (and some parameters like Request Duration can be hard to understand even if you are).

Recently, I’ve been trying to find what the unit is for the request duration, and couldn’t find anything on Google. I dived into the C source code, and there was a very handy doc comment explaining each parameter, that I’ll include here.

Pool info:

  • pool – the name of the pool
  • process manager – static, dynamic or ondemand
  • start time – the date and time FPM has started
  • start since – number of seconds since FPM has started
  • accepted conn – the number of requests accepted by the pool
  • listen queue – the number of requests in the queue of pending connections
  • max listen queue – the maximum number of requests in the queue of pending connections since FPM has started
  • listen queue len – the size of the socket queue of pending connections
  • idle processes – the number of idle processes
  • active processes – the number of active processes
  • total processes – the number of idle + active processes
  • max active processes – the maximum number of active processes since FPM has started
  • max children reached – the number of times, the process limit has been reached, when pm tries to start more children (works only for pm ‘dynamic’ and ‘ondemand’)
  • slow requests – the number of requests that exceeded your request_slowlog_timeout value

Per process info:

  • pid – the PID of the process
  • state – the state of the process (Idle, Running, …)
  • start time – the date and time the process has started
  • start since – the number of seconds since the process has started
  • requests – the number of requests the process has served
  • request duration – the duration in microseconds (1 million in a second) of the current request (my own definition)
  • request method – the request method (GET, POST, …) (of the current request)
  • request URI – the request URI with the query string (of the current request)
  • content length – the content length of the request (only with POST) (of the current request)
  • user – the user (PHP_AUTH_USER) (or ‘-‘ if not set) (for the current request)
  • script – the main script called (or ‘-‘ if not set) (for the current request)
  • last request cpu – the %cpu of the last request consumed (it’s always 0 if the process is not in Idle state because CPU calculation is done when the request processing has terminated)
  • last request memory – the max amount of memory the last request consumed (it’s always 0 if the process is not in Idle state because memory calculation is done when the request processing has terminated)

5 Replies to “Understanding the PHP-FPM status page”

  1. Thanks for your post, its really hard to get official information from PHP it self ..

    Btw when using full version of status, is it display all active connection?

  2. Ajinkya Wadekar says: Reply

    Hello,

    Nice explanation. In this `curl http://localhost/server-status` where and how did you define `server-status`, also which web server are you using `Apache2` or `Nginix`?, How are you calling the connection, is it a `tcp socket` or `unix socket`?

  3. Very useful, but I found one fuzziness in that stats in every documentation.
    “accepted conn” is everywhere mentioned as accepted requests, even in official doc, while it is actually what the name suggests – accepted connections. The difference is that every connection can serve several requests. I have php-fpm in pair with apache with apache proxy setting “enablereuse=on max=64”, so every “accepted conn” number is actually 64 requests (up to, but on bigger scale it’s neglectable). I had very hard time figuring that out for my stats, to understand why the loaded server is so underrated in statistics.

  4. I have very strange condition.. even i try to open another page, my page status always shown same executed script .. does it cached?

    i’ve try to restart my php5-fpm service, but still same


    pid: 26897
    state: Idle
    start time: 22/Mar/2016:08:47:43 -0400
    start since: 343
    requests: 91
    request duration: 71306
    request method: GET
    request URI: /index.php?last_fetched_at=1458651189
    content length: 0
    user: -
    script: /home/nginx/domains/some.example.com/public_html/public/index.php
    last request cpu: 98.17
    last request memory: 3407872

    Thanks

  5. Hi, thank you for your great explanation, very helpful. I have multiple subdomain pointing to the same index.php so I need to know $_SERVER[‘HTTP_HOST’] on each process, how do I display $_SERVER[‘HTTP_HOST’] information on each process on PHP-FPM Status Page? Thank you very much in advance.

Leave a Reply