usage of request_time and upstream_response_time in stress testing

148 阅读1分钟

Let's see the meaning of request_time and upstream_response_time in stress testing, 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

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]
(http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_addr) 
variable.

so with these two variables record in request log, we can calculate time spent in upstream server and in nginx repectively. The bottleneck may be found in nginx or upstream server. For example, if upstream_response_time is small, but request_time is very large, even timeout in some conditions, it is a hint that the nginx server working as gateway is a bottleneck.