Connection statuses
K Young
k at datadoghq.com
Thu Feb 19 02:25:01 UTC 2015
Hello, I've been reading through nginx source to understand the metrics
<http://nginx.org/en/docs/http/ngx_http_stub_status_module.html> that are
reported. I've got an idea of what is happening, but since the flow is
asynchronous, I'm not 100% confident, and would love your feedback.
Is the following correct?
- 'accepts' is incremented when a worker gets a new request for a
connection from the OS
- 'handled' is incremented when a worker gets a new connection for a
request
And then once a connection is opened:
- 'active' is incremented (actually, it is incremented right before
'handled', but will be decremented if the worker doesn't handle the
connection request).
- then the connection briefly goes into a waiting state while the
request is waiting to be processed
- then the connection goes into a short reading state while request
headers are read. Simultaneously, 'request' is incremented every time a new
request header begins to be read.
- then the connection goes into a writing state while all work is done
by nginx and by upstream components
- then if the connection will be kept alive, it goes back into waiting
state, which is synonymous with 'idle'
- finally when the connection is closed, active is decremented
The things I'm least certain of about the 'waiting' state:
- Does active always sum up to waiting+reading+writing?
- Does each new connection enter a waiting state just before it goes
into the reading state?
- While waiting for upstream responses, is the connection in writing
state or waiting state?
- While waiting for new client requests on an open connection, is the
connection in a waiting state?
Is the attached sketch of the above connection states correct? (underneath
"READ" it says "request++" to indicate that this is where the request
counter gets incremented).
[image: Inline image 1]
Thanks very much in advance for any help you can provide,
~K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150218/8c744864/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IMG_20150218_175749.jpg
Type: image/jpeg
Size: 121102 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150218/8c744864/attachment-0001.jpg>
More information about the nginx
mailing list