6

I use nginx(1.15.3) as a reverse-proxy, and encounter a problem that $upstream_response_time is larger than $request_time" in log files.

According to nginx documentation,

$upstream_response_time

keeps time spent on receiving the response from the upstream server; the time is kept in seconds with millisecond resolution. Times of several responses are separated by commas and colons like addresses in the $upstream_addr variable.

$request_time

request processing time in seconds with a milliseconds resolution; time elapsed between the first bytes were read from the client and the log write after the last bytes were sent to the client

So, $request_time should include $upstream_response_time.

I had analyzed the total count of log records, of which response code is 200:

$upstream_response_time < $request_time : 35812 
$upstream_response_time = $request_time : 157043 
$upstream_response_time > $request_time : 32783

$upstream_response_time - $request_time = 0.001 : 32558 
$upstream_response_time - $request_time = 0.002 : 225 

What's the reason?

Thanks.

Community
  • 1
  • 1
mchtech
  • 91
  • 8
  • Same problem (no answer there either, though): https://stackoverflow.com/questions/53978695/how-can-request-time-be-less-than-upstream-response-time-in-nginx – lxop May 28 '19 at 15:44
  • 1
    Does this answer your question? [How can request\_time be less than upstream\_response\_time in nginx?](https://stackoverflow.com/questions/53978695/how-can-request-time-be-less-than-upstream-response-time-in-nginx) – gowthz Sep 07 '22 at 05:55

0 Answers0