uwsgi_send_timeout
Sets the timeout for reading the response from a uWSGI peer.
Description
The uwsgi_send_timeout directive in NGINX specifies the time limit for sending a request to a uWSGI server. This directive is particularly useful for ensuring that NGINX does not wait indefinitely for the uWSGI server to send a response back. If the response is not sent within the specified timeout duration, NGINX will close the connection and return an error response to the client.
The directive takes one argument representing the timeout value, which can be specified in various time units, such as seconds or milliseconds. It is crucial to set this value appropriately to avoid negative impacts on the user experience, such as prolonged waits during high load scenarios. This directive can be placed in different contexts, including 'http', 'server', or 'location'.
By default, if uwsgi_send_timeout is not explicitly set, there is no timeout applied, which means NGINX will wait indefinitely. However, specifying this directive allows for better resource management and responsiveness of the web server, especially when dealing with potentially slow backend uWSGI applications.
Config Example
location /app {
uwsgi_pass 127.0.0.1:9000;
uwsgi_send_timeout 30s;
}Setting the timeout too low can result in dropped requests during peak load periods, leading to errors for users.
If the backend uWSGI application has variable response times, fine-tuning this value may be necessary for optimal performance.