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. ...
随机推荐
- 【SoDiaoEditor电子病历编辑器更新啦】--谨以献给那些还在医疗行业奋斗的小伙伴们
为什么推荐的人这么少~~~~ 更新(2017-4-18): 截止目前已知的已有2个三甲医院在使用该编辑器,容我内心澎湃以下,O(∩_∩)O哈哈~ 先放github地址:https://gith ...
- 利用Smith圆图设计匹配网络
要实现射频最大的功率传输,必须使负载阻抗与源阻抗相匹配(即信号源阻抗与负载阻抗共轭相等),实现匹配的通常做法是在源和负载之间插入一个匹配网络,该网络不仅仅为减少功率损耗而设计,还可减少噪声干扰.提高功 ...
- 在WebGL场景中进行棋盘操作的实验
这篇文章讨论如何在基于Babylon.js的WebGL场景中,建立棋盘状的地块和多个可选择的棋子对象,在点选棋子时显示棋子的移动范围,并且在点击移动范围内的空白地块时向目标地块移动棋子.在这一过程中要 ...
- Oracle和sqlserver数据类型对应
Sqlserver类型 Oracle类型 binary RAW(50) bit NUMBER(2) char CHAR(10) datetime DATE decima ...
- FFMS2 API 译文 [原创]
FFMS2 又称 FFmpegSource2,参阅 https://github.com/FFMS/ffms2. 原文:https://github.com/FFMS/ffms2/blob/maste ...
- 如何批量删除QQ浏览器指定历史记录和导出指定的历史记录
QQ浏览器的历史记录只有清空历史记录和删除选中项两个功能.有时我不想删除所有的历史记录,只是想删除指定的历史记录保留对自己有用的历史记录,方便自己以后查找.但是删除选中项功能只能一项一项的选择,才能批 ...
- 从零开始的Python学习 知识补充sorted
sorted()方法 sorted()可用于任何一个可迭代对象. 原型为sorted(iterable, cmp=None, key=None, reverse=False) iterable:一个可 ...
- groupadd命令详解
基础命令学习目录首页 原文链接:https://wtj6891.iteye.com/blog/2096076 groupadd创建组群 使用groupadd命令可以在系统中创建组群账户 语法: gro ...
- ssh软件及命令的使用
常用软件安装及使用目录 第1章 ssh常用用法小结 1.1 连接到远程主机: 命令格式 : ssh name@remoteserver 或者 ssh remoteserver -l name 说明:以 ...
- 【quickhybrid】组件(自定义)API的实现
前言 前文在API规划时就已经有提到过组件API这个概念,本文将会介绍它的原理以及实现 理解组件API这个概念 quick.ui.xxx quick.page.xxx 在quick hybrid中,A ...