首页 > 其他分享 >request_time和upstream_response_time详解

request_time和upstream_response_time详解

时间:2022-09-29 10:55:56浏览次数:38  
标签:http time request nginx upstream response

下图是request_time。

 

 下图是upstream_response_time.

 

 

 

精准的描述就是:
request_time是从接收到客户端的第一个字节开始,到把所有的响应数据都发送完为止。
upstream_response_time是从与后端建立TCP连接开始到接收完响应数据并关闭连接为止。
所以,request_time会大于等于upstream_response_time。


比如,36.110.43.106 - - [12/Dec/2019:17:04:26 +0800] "GET /js/chunk-vendors.03f0a278.js HTTP/1.1" 200 2994930 "http://115.29.150.110/" "-" - - 5.325

日志格式为:
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'$upstream_addr $upstream_response_time '
'$request_time';

这就显然5.325ms都是消耗在nginx自己身上的。后端都没用时间。 js是从nginx上取的。


36.110.43.106 - - [12/Dec/2019:17:06:18 +0800] "POST /api/login HTTP/1.1" 404 132 "http://115.29.150.110/" "-" 172.31.184.226:8700 0.027 0.027

像这种的就是request和response时间一样。那nginx上就没消耗时间。都在后端消耗的时间。

 

原文链接: https://www.cnblogs.com/wx170119/p/12030545.html

 

标签:http,time,request,nginx,upstream,response
From: https://www.cnblogs.com/xingxiz/p/16740688.html

相关文章