Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does send_timeout option do on Nginx?

What are the advantages and disadvantages of setting it low (10s) or high (60s) and how does it different from keepalive_timeout?

like image 529
Flutter Newbie Avatar asked Jan 08 '18 11:01

Flutter Newbie


1 Answers

From the docs:

Syntax: keepalive_timeout timeout [header_timeout];
Default: keepalive_timeout 75s;
Context: http, server, location

The first parameter sets a timeout during which a keep-alive client connection will stay open on the server side. The zero value disables keep-alive client connections.

The optional second parameter sets a value in the “Keep-Alive: timeout=time” response header field. Two parameters may differ.

The “Keep-Alive: timeout=time” header field is recognized by Mozilla and Konqueror. MSIE closes keep-alive connections by itself in about 60 seconds.


Syntax: send_timeout time;
Default: send_timeout 60s;
Context: http, server, location

Sets a timeout for transmitting a response to the client. The timeout is set only between two successive write operations, not for the transmission of the whole response. If the client does not receive anything within this time, the connection is closed.


So when using keepalive_timeout, the browser does not have to make multiple connections, but uses the already established connection. This controls how long that stays active / open.

I would suggest that if you set the send_timeout small then your web server, it will close connections quickly, which will give more overall connections available to connecting hosts.

These parameters are most likely only relevant in a high traffic webserver, both supporting the same goal: less connections and more efficient handling of requests, either putting all requests into one connection (keep alive) or closing connections quickly to handle more requests (send timeout).

like image 93
Olin Blodgett Avatar answered Nov 05 '22 21:11

Olin Blodgett