Keep-alive in the HTTP protocol

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.