One. HTTP protocol is a connection protocol, so that each connection to re-open a TCP HTTP socket, the short-term host to the server request will be very slow, if you can maintain the connection, you can save the socket Open,socket close and other times, Early in the http1.0 protocol appended the Keep-alive field, connection:keep-alive, the client sends HTTP contains a keepa-live segment, the S-side identifies and returns a keep-alive such a maintained link is established, All links in http1.1 are persisted by default, and the client sends a CONNECTION:CLOSE field to close the link.
#tcpdump -n host 218.1.57.236 and port 80monitoring information on Linux
Configuration on Nginx
client_header_timeout Default 60s Specifies the time-out to wait for a client to send a request header. If no request header is received within the timeout period, Nginx returns 408 request time Out
keepalive_timeout Default 75s s actively shuts down the HTTP link after 75s. If this parameter is configured, the S-end will return the header of the keep-alive, or even http1.1 will not return the header
Two. HTTP keep-alive and TCP keep-alive http keep-alive equivalent to save a connection pool, after use is not immediately destroyed but placed in the pool, the next time the use of re-use. The Keep-alive of TCP is a keepalive mechanism, Prevent the opposite server from hanging up, wasting this connection and returning the RST if it is hung.
Keep-alive in the HTTP protocol