php-fpm status page: what are the "queue" items in this report?
So I have a working nginx+php-fpm installation. The php-fpm status report page is activated and I get something like that (do not care about settings, it's a test server under stress tests):
pool: foobar
process manager: dynamic
start time: 31/Jan/2012:08:18:45 +0000
start since: 23592
accepted conn: 3354
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 0
active processes: 10
total processes: 10
max active processes: 10
max children reached: 25
I can't find anywhere indications on what are the listen queue:
,max listen queue:
and listen queue len
indicators. Anyone could explain?
Solution 1:
PHP-FPM connections are via a socket (TCP or file based). As such, PHP-FPM must 'listen' on that socket, and then 'accept' connections.
Since there is a finite rate at which the connections can be accepted, it is possible, under high load for there to be a delay between the time a connection is initiated and the time it is accepted. Connections in that state are 'queued'.
listen queue len: This defines the maximum number of connections that will be queued. Once this limit is reached, subsequent connections will either be refused, or ignored. As connections are accepted, the queue length will be reduced.
- This value is set by the php-fpm per pool configuration option 'listen.backlog' (default: -1=unlimited).
- Since sockets are being used, this value is also limited by the system value 'net.core.somaxconn' (default: 128 on most Linux systems).
Given the above, it stands to reason that:
- listen queue: is the number of connections that have been initiated by not yet accepted
- max listen queue: is the maximum value the listen queue has reached while php-fpm has been running.