time to read packets for HTTP query

Maxim Dounin mdounin at mdounin.ru
Fri Sep 11 12:53:40 UTC 2015


On Fri, Sep 11, 2015 at 02:15:25PM +0200, Lukas Tribus wrote:

> > Does not seem to do what the GP asked, from the docs:
> >
> > $request_time
> > request processing time in seconds with a milliseconds resolution
> > (1.3.9, 1.2.6); time elapsed since the first bytes were read from the client
> "request time" would imply the time (with our without parsing) of the
> actual HTTTP request, imho.
> In reality $request_time accounts for the complete request, response and
> logging, so yes, you are right.

While $request_time is indeed accounts for complete request time 
when used in logs, it can be accessed (and saved) at some 
intermediate point.  E.g., by using something like

    set $header_time $request_time;

one may save time since 1st bytes were read from a client till 
rewrite rule processing.  This is basically identical to "time 
necessary to read all the packets of a particular HTTP query" that 
was asked (at least as long you don't try to count reading a 
request body).

Maxim Dounin

More information about the nginx mailing list