Nginx - request_time和upstream_response_time的区别
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。
指的就是从接受用户请求的第一个字节到发送完响应数据的时间,即$request_time包括接收客户端请求数据的时间、后端程序响应的时间、发送响应数据给客户端的时间(不包含写日志的时间)。
官方文档:http://nginx.org/en/docs/http/ngx_http_log_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.。
是指从Nginx向后端建立连接开始到接受完数据然后关闭连接为止的时间。
从上面的描述可以看出,$request_time肯定比$upstream_response_time值大;尤其是在客户端采用POST方式提交较大的数据,响应体比较大的时候。在客户端网络条件差的时候,$request_time还会被放大。
官方文档:http://nginx.org/en/docs/http/ngx_http_upstream_module.html
“other” times
除了上述的request_time和upstream_response_time比较常用,在新的Nginx版本中对整个请求各个处理阶段的耗时做了近一步的细分:
$upstream_connect_time(1.9.1):
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建立连接的时间,如果是到后端使用了加密的协议,该时间将包括握手的时间。
$upstream_header_time(1.7.10):
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.
接收后端server响应头的时间。
指导意义
所以在通过nginx的access_log来分析后端程序接口响应的时候,需要在nginx的log_format中添加$upstream_response_time字段。
Nginx - request_time和upstream_response_time的区别的更多相关文章
- nginx request_time 和upstream_response_time
1.request_time 官网描述:request processing time in seconds with a milliseconds resolution; time elapsed ...
- nginx 日志打印响应时间 request_time 和 upstream_response_time
设置log_format,添加request_time,$upstream_response_time,位置随意 og_format main '"$request_time" ...
- nginx源码层面探究request_time、upstream_response_time、upstream_connect_time与upstream_header_time指标具体含义
背景概述 最近计划着重分析一下线上各api的HTTP响应耗时情况,检查是否有接口平均耗时.99分位耗时等相关指标过大的情况,了解到nginx统计请求耗时有四个指标:request_time.upstr ...
- nginx日志request_time 和upstream_response_time区别
笔者在根据nginx的accesslog中$request_time进行程序优化时,发现有个接口,直接返回数据,平均的$request_time也比较大.原来$request_time包含了用户数据接 ...
- nginx优化之request_time 和upstream_response_time差别
笔者在根据nginx的accesslog中$request_time进行程序优化时,发现有个接口,直接返回数据,平均的$request_time也比较大.原来$request_time包含了(服务器) ...
- request_time和upstream_response_time详解
下图是request_time. 下图是upstream_response_time. 精准的描述就是:request_time是从接收到客户端的第一个字节开始,到把所有的响应数据都发送完为止.ups ...
- nginx rewrite 指令last break区别最详细的解释
转自:http://blog.sina.com.cn/s/blog_4f9fc6e10102ux0w.html http://blog.cafeneko.info/2010/10/nginx_rewr ...
- Nginx和Apache有什么区别?
Nginx抗并发,nginx 处理请求是异步非阻塞的,而apache 则是阻塞型的,在高并发下nginx 能保持低资源低消耗高性能. Apache rewrite ,比nginx 的rewrite ...
- nginx里proxy_pass有无/的区别
nginx在反向代理的时候,proxy_pass需要指定路径,有无"/"的区别,如下: location /lile { 配置一: proxy_pass http://192. ...
随机推荐
- python的super函数学习
一.为什么要用super? 在Python 2.2以前,通常的做法: class A: def __init__(self): print "enter A" print &quo ...
- C#课后练手
猜拳(三局两胜)请输入您的手势:石头用户手势:石头 电脑手势:剪刀用户胜:1 电脑胜:0 请输入您的手势:石头用户手势:石头 电脑手势:石头用户胜:1 电脑胜: ...
- 解决在控制层springmvc框架发出的400状态的错误
错误场景: 错误分析: 这也是我第一次遇到这个类型的异常,400响应状态代表:客户端发出的请求中携带的参数与服务器端接受的参数类型不匹配,进一步就是说我后台的实体类中数据类型为Date,而前台传递过来 ...
- SSD固态硬盘的GC与Trim
操作系统:其实并没有删除数据: 事实上,它只是在硬盘前的索引区里标记这块文件占用的区域为无效的, 所以等该区域被擦除后,下次数据将要再次写入的时候,可以写入这块被标记的区域. 这也就是为啥那 些所谓的 ...
- [Lua] try catch实现
参考了https://blog.csdn.net/waruqi/article/details/53649634这里的代码,但实际使用时还有些问题,修改后在此记录一下. -- 异常捕获 functio ...
- 拦截器 应用详解--SpringMVC
在实际项目中,拦截器的使用是非常普遍的,例如在购物网站中通过拦截器可以拦截未登录的用户,禁止其购买商品,或者使用它来验证已登录用户是否有相应的操作权限等,Spring MVC提供了拦截器功能,通过配置 ...
- shell编程基础(转载)
Shell编程基础 原作者 Leal:请参阅页面底部的编者列表. 授权许可: 创作共享署名协议 GNU 自由文档许可证 注意:本文仍然在持续的修订之中,且错漏之处可能较多.如果能够阅读英语的话,可以考 ...
- k8s踩坑记第2篇--3个IP折磨人的故事
例子来源于<Kubernetes实践指南>一书.问题依然没有解决,求助大神. 测试环境 Centos 7.0 docker 1.13.1 kubectl v1.5.2 etcd 3.2.1 ...
- Docker Zero Deployment and Secrets (二)
一. 健康检测: (1)定义检测信息如下(案例,在Dockerfile中定义) FROM alpine:3.6 ... HEALTHCHECK --interval=30s \ --timeo ...
- IOS上z-index和fixed定位无效
IOS上z-index和fixed定位无效 在该元素上加: -webkit-transform:translateZ(1px); -moz-transform:translateZ(1px); -o- ...