Nginx
是什麼導致 nginx 中的 upstream_header_time 很大?
設置:
Angular / Django / Nginx in ECS. Route 53 -> ELB -> Target group ECS With Nginx proxying /api | /admin calls to Django.
我們的一些 API 請求有很大的延遲或延遲,顯示以下日誌:(為了便於閱讀,換行)
timestamp="16/Jul/2019:16:24:43 +0000" client=10.96.192.168 request="GET /api/redacted/? redacted=0& redacted=52.895649& redacted=53.226591& redacted=-2.900391& redacted=-1.873169 HTTP/1.1" request_length=919 bytes_sent=200514 body_bytes_sent=200245 referer=https://redacted.redacted.redacted.redacted.redacted/redacted user_agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36" upstream_addr=127.0.0.1:8000 upstream_status=200 request_time=19.077 upstream_response_time=19.064 upstream_connect_time=0.000 upstream_header_time=19.064 app_db_read_time=- app_db_write_time=- app_analysis_time=- app_other_time=-
引起我們注意的主要延遲是
upstream_header_time
大約upstream_response_time
20 秒!然而,作為 Nginx 的新手,我不知道從哪裡開始調試它,在本地工作一切都按預期工作,沒有這樣的延遲。
**問題:**是什麼導致瞭如此大的 20 秒上游標頭/響應時間?
配置文件:https ://gist.github.com/jackdh/4fdffe6b11799f544d7cb211cc66bfe2
謝謝
根據 NGINX 文件:
$upstream_header_timekeeps 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.
這就是你的 Python 後端需要永遠回答的問題。