Trying to set the timeout for requests in uWSGI, I'm not sure of the correct setting. There seem to be multiple timeout options (socket, interface, etc.) and it's not readily evident which setting to configure or where to set it.
The behavior I'm looking for is to extend the time a request to the resource layer of a REST application can take.
If you need threads, remember to enable them with enable-threads . Running uWSGI in multithreading mode (with the threads options) will automatically enable threading support.
uWSGI (source code), pronounced "mu wiz gee", is a Web Server Gateway Interface (WSGI) server implementation that is typically used to run Python web applications.
Post-buffering mode (uWSGI >= 2.0. This means that as soon as the uwsgi packet (read: the request headers) is parsed, it is forwarded to the backend/backends. Now, if your web-proxy is a streaming-one too (like apache, or the uWSGI http router), your app could be blocked for ages in case of a request with a body.
If you need threads, remember to enable them with enable-threads. Running uWSGI in multithreading mode (with the threads options) will automatically enable threading support. This “strange” default behaviour is for performance reasons, no shame in that. This is another option that might be the right choice for you.
You're propably looking for the harakiri parameter - if request takes longer than specified harakiri time (in seconds), the request will be dropped and the corresponding worker recycled.
For standalone uwsgi (ini config):
[uwsgi] http = 0.0.0.0:80 harakiri = 30 ...
If you have nginx proxy before uwsgi you have to increase timeout as well:
location / { proxy_pass http://my_uwsgi_upstream; proxy_read_timeout 30s; proxy_send_timeout 30s; }
If you want (for some strange reason) higher timeout than 60s, you might consider communication over uwsgi
protocol. Configuration is quite similar nginx site:
location / { uwsgi_read_timeout 120s; uwsgi_send_timeout 120s; uwsgi_pass my_upstream; include uwsgi_params; }
uwsgi:
[uwsgi] socket = 0.0.0.0:80 protocol = uwsgi harakiri = 120 ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With