HTTP long connections and short connections

Source: Internet
Author: User

HTTP is a stateless connection-oriented protocol, an application-layer protocol that uses TCP at the transport layer, using IP at the network layerin HTTP 1.0, a short connection is used by default, and the browser and server make a connection every time HTTP operation is made, but the end of the task interrupts the connectionThe http1.1 uses a long connection by default to maintain the connection characteristics. This line of code is added to the response header: Connection:keep-alive  When a long connection is used, the TCP connection is not closed, and if the client accesses the Web page on the server again, it will continue to use this established connection. The keep-alive has a hold time that can be set, essentially TCP's long connection and short connection. The operation steps for a short connection are:Establish connection--data transfer--close connection ... Establish connection--data transfer--close connectionthe procedure for long connections is:Establish connection--data transfer ... (Keep connected) ... Data transfer--close connection

Long connections are used to operate frequently, point-to-point communications, and the number of connections can not be too many cases.
concurrency is large, but each user needs to be short-connected without frequent operation.

HTTP long connections and short connections

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.