nginx日志中的各类耗时(time)

背景

分析nginx日志时碰到了request_time和upstream_response_time两种时间
一时没有反应过来有什么区别
于是上了度娘发现很多对这两组名词的解释
为了更好地理解又去看了看nginx的官方文档 发现原来除了这两种还有另外几类延时
记录一下备忘
参考:https://blog.csdn.net/jiujiu372/article/details/75463526

解释

1. request_time

官方文档 :http://nginx.org/en/docs/http/ngx_http_log_module.html
$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

直译过来:这个延时以秒为单位,精度为毫秒。表示从客户端读取第一个字节到将最后一个字节发送到客户端后经过的时间。 直观地说就是 1.接收请求数据 2.将数据交给后端并处理 3.将处理结果发出


2.upstream_response_time

官方文档 :http://nginx.org/en/docs/http/ngx_http_upstream_module.html
$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.

直译比较繁琐,简单地说就是包括了上面的 2.将数据交给后端并处理 3.将处理结果发出
所以这个response time 肯定是小于等于第一个request time


3.upstream_header_time

官方文档 :http://nginx.org/en/docs/http/ngx_http_upstream_module.html
$upstream_header_time
keeps time spent on receiving the response header from the upstream server (1.7.10); 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.

这个从名字就比较好理解 就是接收到后端服务器响应头花费的时间


4.upstream_connect_time

官方文档 :http://nginx.org/en/docs/http/ngx_http_upstream_module.html
$upstream_connect_time
keeps time spent on establishing a connection with the upstream server (1.9.1); the time is kept in seconds with millisecond resolution. In case of SSL, includes time spent on handshake. Times of several connections are separated by commas and colons like addresses in the $upstream_addr variable.

跟后端server建立连接的时间,如果使用SSL,则包括握手所花费的时间


5.upstream_queue_time

官方文档 :http://nginx.org/en/docs/http/ngx_http_upstream_module.html
$upstream_queue_time
keeps time the request spent in the upstream queue (1.13.9); 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.

请求保留在upstream队列中的时间

队列:如果在处理请求时无法立即选择upstream服务器,则该请求将被放入队列中。如果队列已满,或者在timeout参数指定的时间段内无法选择将请求传递给的服务器,则会将502(错误网关)错误返回给客户端。


  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值