I understand how nginx's request_time can be larger than upstream_response_time, it simply means that the network connection was slow between nginx and the client.
What I don't understand is how request_time
can be less?
I've analysed an nginx log where nginx is in front of an API. There were about 2.6 millions lines, thus I believe it's a good sample (only API requests were analysed, no static files.)
Ratios were calculated like:
ratio = request_time / upstream_response_time
The mean of the ratios is 1.04, thus on average request_time
is a tiny bit larger than upstream_response_time
, which sounds reasonable.
I made a histogram to visualise this. What I don't understand is the left side of the histogram, where values are < 1.0.