request_time和upstream_response_time詳解



下圖是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上就沒消耗時間。都在后端消耗的時間。

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM