简体   繁体   English

uWSGI 的 socket-timeout/http-timeout/harakiri 有什么区别?

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

I wrote a simple WSGI application (using Flask) served by uWSGI (ie no other HTTP server but uWSGI) which only supports a single PUT route using which clients can upload a file (potentially ~400MB in size), have it processed on the server and then sent back.我编写了一个由 uWSGI 提供服务的简单 WSGI 应用程序(使用 Flask)(即没有其他 HTTP 服务器,而是 uWSGI),它只支持单个 PUT 路由,客户端可以使用该路由上传文件(大小可能约为 400MB),并在服务器上进行处理然后送回去。

In the uWSGI logs, I noticed two kinds of timeout errors after some time.在 uWSGI 日志中,一段时间后我注意到两种超时错误。 Usually it's a timeout when sending the response:通常是发送响应时超时:

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)

Sometimes though, it's also a timeout when receiving a PUT request:但有时,接收 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

Some debugging suggests that this typically happens with clients which are very slow (ie which have a high load).一些调试表明,这通常发生在非常慢(即具有高负载)的客户端上。

I'd like to alleviate this by increasing some timeouts, but uWSGI appears to support a plethora of timeouts and it's not clear to me which of them are relevant here.我想通过增加一些超时来缓解这种情况,但 uWSGI 似乎支持过多的超时,我不清楚其中哪些是相关的。 I identified three timeouts which sound like I may want to increase them, but I have trouble finding documentation on how they differ:我确定了三个超时,听起来我可能想增加它们,但我很难找到有关它们如何不同的文档:

  • socket-timeout
  • http-timeout
  • harakiri

Can anyone shed some light on what these timeouts affect, what their default values are and which (if any) of them should be adjusted to avoid above-mentioned issues?任何人都可以阐明这些超时的影响,它们的默认值是什么以及应该调整哪些(如果有)以避免上述问题?

In simple terms, the harakiri is uWSGI timeout and the http-timeout or the socket-timeout is a balancer/proxy-server timeout.简单来说, harakiri是 uWSGI 超时, http-timeoutsocket-timeout是平衡器/代理服务器超时。

When these parameters differ, there can be confusion in logs.当这些参数不同时,日志中可能会出现混淆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM