簡體   English   中英

uWSGI 的 socket-timeout/http-timeout/harakiri 有什么區別?

[英]What's the difference between uWSGI's socket-timeout/http-timeout/harakiri?

我編寫了一個由 uWSGI 提供服務的簡單 WSGI 應用程序(使用 Flask)(即沒有其他 HTTP 服務器,而是 uWSGI),它只支持單個 PUT 路由,客戶端可以使用該路由上傳文件(大小可能約為 400MB),並在服務器上進行處理然后送回去。

在 uWSGI 日志中,一段時間后我注意到兩種超時錯誤。 通常是發送響應時超時:

Feb 02 20:46:30 myserv uwsgi[18948]: uwsgi_response_sendfile_do() TIMEOUT !!!
Feb 02 20:46:30 myserv uwsgi[18948]: OSError: write error
Feb 02 20:46:30 myserv uwsgi[18948]: [pid: 18954|app: 0|req: 1795/3935] aa.bb.cc.dd () {32 vars in 455 bytes} [Fri Feb  2 20:46:06 2018] PUT /sample.exe => generated 0 bytes in 24314 msecs via sendfile() (HTTP/1.1 200) 6 headers in 258 bytes (3353 switches on core 0)

但有時,接收 PUT 請求時也會超時:

Feb 03 20:18:32 signserv uwsgi[18948]: [pid: 18953|app: 0|req: 2975/5670] aa.bb.cc.dd () {32 vars in 455 bytes} [Sat Feb  3 20:18:02 2018] PUT /samplefile.exe => generated 0 bytes in 29499 msecs via sendfile() (HTTP/1.1 200) 6 headers in 258 bytes (2930 switches on core 0)
Feb 03 20:20:30 signserv uwsgi[18948]: [uwsgi-body-read] Timeout reading 16384 bytes. Content-Length: 354414781 consumed: 0 left: 354414781

一些調試表明,這通常發生在非常慢(即具有高負載)的客戶端上。

我想通過增加一些超時來緩解這種情況,但 uWSGI 似乎支持過多的超時,我不清楚其中哪些是相關的。 我確定了三個超時,聽起來我可能想增加它們,但我很難找到有關它們如何不同的文檔:

  • socket-timeout
  • http-timeout
  • harakiri

任何人都可以闡明這些超時的影響,它們的默認值是什么以及應該調整哪些(如果有)以避免上述問題?

簡單來說, harakiri是 uWSGI 超時, http-timeoutsocket-timeout是平衡器/代理服務器超時。

當這些參數不同時,日志中可能會出現混淆。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM