Connection = keep alive and close

Source: Internet
Author: User
Tags keep alive

The browser and the server need to shake hands three times when establishing an HTTP connection. In a high-concurrency environment, a three-way handshake for each connection consumes too much service resources, this is essentially because HTTP is stateless. the connection = close mode is enabled by default in http1.0, which means both the server and the client need to close the TCP connection, and the client determines whether the response is received by judging whether the connection is closed. The connection = keep-alive mode (persistent connection) is enabled by default in http1.1. It is mainly used to solve the High-concurrency access to server resources in the browser, and the connection can be reused for each access, thus improving the response speed. However, you also need to note that the browser cannot determine whether the binary code stream currently sent is terminated, that is, the so-called stick packet problem. Therefore, in the keep-alive mode, the Content-Length returned by the server is used to determine whether a complete response ends Based on the code stream length.


Connection = keep alive and close

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.