nginx log : $upstream_response_time is larger than $request_time

mchtech nginx-forum at forum.nginx.org
Tue Apr 9 11:45:14 UTC 2019


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.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,283679,283679#msg-283679



More information about the nginx mailing list