nginx日志request_time 和upstream_response_time区别
笔者在根据nginx的accesslog中$request_time进行程序优化时,发现有个接口,直接返回数据,平均的$request_time也比较大。原来$request_time包含了用户数据接收时间,而真正程序的响应时间应该用$upstream_response_time。
下面介绍下2者的差别:
1、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 。
指的就是从接受用户请求的第一个字节到发送完响应数据的时间,即包括接收请求数据时间、程序响应时间、输出
响应数据时间。
2、upstream_response_time
官网描述:keeps times of responses obtained from upstream servers; times are kept in seconds with a milliseconds resolution. Several response times are separated by commas and colons like addresses in the $upstream_addr variable
是指从Nginx向后端(php-cgi)建立连接开始到接受完数据然后关闭连接为止的时间。
从上面的描述可以看出,$request_time肯定比$upstream_response_time值大,特别是使用POST方式传递参数时,因为Nginx会把request body缓存住,接受完毕后才会把数据一起发给后端。所以如果用户网络较差,或者传递数据较大时,$request_time会比$upstream_response_time大很多。
所以如果使用nginx的accesslog查看php程序中哪些接口比较慢的话,记得在log_format中加入$upstream_response_time。
nginx日志request_time 和upstream_response_time区别的更多相关文章
- Nginx - request_time和upstream_response_time的区别
request_time 官网描述:request processing time in seconds with a milliseconds resolution; time elapsed be ...
- nginx 日志打印响应时间 request_time 和 upstream_response_time
设置log_format,添加request_time,$upstream_response_time,位置随意 og_format main '"$request_time" ...
- apache与nginx日志文件的区别(转载)
apache与nginx日志文件的区别 转载:http://www.xfcodes.com/apache/log/3270.htm 导读:apache与nginx日志文件的区别,在apache与ngi ...
- 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
1.request_time 官网描述:request processing time in seconds with a milliseconds resolution; time elapsed ...
- 使用 Heka 导入自定义的nginx日志到Elasticsearch
重置Heka执行进度 heka的进度配置文件存在配置项 base_dir 设置的目录,只需要删除这个文件夹下面的内容,就可以完全重置heka的进度. base_dir 配置项默认是在下面目录: '/v ...
- Nginx日志中的金矿 -- 好文收藏
转:http://www.infoq.com/cn/articles/nignx-log-goldmine Nginx(读作Engine-X)是现在最流行的负载均衡和反向代理服务器之一.如果你是一名中 ...
- nginx 日志相关配置总结
设置位于nginx.conf: log_format main '$server_name $remote_addr - $remote_user [$time_local] &q ...
- 使用elk+redis搭建nginx日志分析平台
elk+redis 搭建nginx日志分析平台 logstash,elasticsearch,kibana 怎么进行nginx的日志分析呢?首先,架构方面,nginx是有日志文件的,它的每个请求的状态 ...
随机推荐
- php分享二十六:读写日志
一:读写日志注意事项: 1:fgets取出日志行后,注意用trim过滤下 2:explode(“\t", $line) 拆分后,注意判断下个数是否正确,如果不正确,怎么处理? 如果某一列 ...
- Traefik Kubernetes 初试
traefik 是一个前端负载均衡器,对于微服务架构尤其是 kubernetes 等编排工具具有良好的支持:同 nginx 等相比,traefik 能够自动感知后端容器变化,从而实现自动服务发现:今天 ...
- Windows平台JDK安装
原文链接:http://android.eoe.cn/topic/android_sdk 下载Java的开发包JDK JDK有好几个类型版本,我们只需要选择Java SE类型的版本就行了.进入网页:h ...
- Using ADB and fastboot
What is adb? The Android Debug Bridge (adb) is a development tool that facilitates communication bet ...
- nginx configure fastdfs + SSL
./configure \ --prefix=/usr/local/nginx \ --with-http_stub_status_module \ --with-http_ssl_module \ ...
- jQuery页面引导插件 jquery-pagewalkthrough
http://jwarby.github.io/jquery-pagewalkthrough/ 源码 https://github.com/jwarby/jquery-pagewalkthrough
- 菜鸟学EJB(一)——第一个实例
EJB用了那么长时间了,从来没写过关于它的东西,挺对不住它的.今天先写一个简单的小实例,虽然小但是却能体现出EJB的核心——分布式.我们可以将业务逻辑的接口跟实现部署到一台机器上,将调用它们的客户端部 ...
- android---笔记 AppContext extends Application
package com.fuda; import org.apache.http.client.CookieStore; import com.fuda.model.StudentInfoModel; ...
- 支付宝对账单下载Java正式商户调用
package code; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; impo ...
- 深入HBase架构解析(二)【转】
转自:http://www.blogjava.net/DLevin/archive/2015/08/22/426950.html 前言 这是<深入HBase架构解析(一)>的续,不多废话, ...