Where is HTTP3.0 stronger than HTTP2.0

First of all, let's introduce the HTTP2.0 transmission protocol. The HTTP2.0 transmission protocol greatly improves the performance of HTTP1.x through binary transmission, multiplexing, Header compression, Server Push and other features. However, due to the HTTP2.0 transmission The protocol is implemented based on the TCP protocol, and the characteristics of TCP itself lead to certain bottlenecks and defects.

HTTP2.0 flaws:

①Head-Of-Line Blocking: Multiple requests of the HTTP2.0 transmission protocol are carried out in one TCP connection. If packets are lost during TCP transmission, the entire TCP must wait for retransmission, which will cause Causes all requests in that TCP connection to be blocked. For example, see the image below:
TCP wireless transport protocol layer

As can be seen from the above figure, the sender sent a total of four packets, of which packet 3 was lost at the network layer. Even though packet 4 was received by the receiver's kernel, because the data in the kernel was not continuous, the application of the receiver The layer cannot be read, and the application layer can read data from the kernel only after the packet3 is retransmitted.

②TCP and TLS handshake delay:

The TCP protocol needs to establish a TCP connection through a three-way handshake to ensure the reliability of communication (1.5 RTTs). The protocol sends requests and receives responses (1 RTT) over TCP and TLS.

This means that if we want to access a server in the United States, when the RTT is about 250ms, then the time-consuming of the HTTPS request at this time is about 1s, which is relatively high.

③Connection migration requires reconnection:

A TCP connection is determined by the source IP address, source port, destination IP address, and destination port. This means that if the port or IP address changes, the TCP and TLS connections need to be reconnected. This is not suitable for scenarios where devices switch networks.

The above three problems are actually inherent problems of the TCP protocol. No matter how the HTTP/2 application layer is designed, these defects cannot be changed. To solve the fundamental problems, it is necessary to replace the transport layer protocol TCP with UDP, while HTTP 3.0 That's what it does!

HTTP3.0 communication protocol transport layer
We know that UDP is a simple, unreliable transport protocol. Of course, HTTP 3.0 not only replaces the transport protocol from TCP to UDP, but also implements a protocol called QUIC at the application layer based on UDP. This protocol has similar connection management and congestion control features as TCP, and can transform UDP into "reliable".

The advantages of the QUIC protocol are described below:

①No head-of-line blocking:

The transport protocol used by QUIC is UDP, which does not care about the order of packets or packet loss, but QUIC will ensure the reliability of packets, each packet will have a unique identifier, when a packet of a stream is lost. Other packets of this stream, even if they reach HTTP, will not be read until QUIC retransmits the lost data.

Unlike HTTP/2, other streams are not affected by this.

②The connection is established faster:

QUIC internally includes TLS_V1.3, which carries the information in TLS in the data frame. And QUIC does not require a TCP+TLS handshake like HTTP/2. Its handshake process only requires 1RTT. The purpose of the handshake is to confirm the connection IDs of both parties. Therefore, QUIC can complete the connection establishment and encryption key at the same time with only one RTT. Even when it connects for the second time, the application data packet can be sent together with the QUIC handshake information to achieve the effect of 0-RTT.

③Support connection migration:

The QUIC protocol does not use IP address and port to determine the connection, but uses the connection ID to mark both ends of the communication. Even if the IP address changes after the network of the device changes, as long as the context information (such as connection ID, TLS information) is still retained, The original connection can be seamlessly reused.

HTTP 3.0 uses QUIC as the underlying support protocol, which combines the speed and performance of UDP with the security and reliability of TCP, solves some of the shortcomings introduced in HTTP 2.0, and optimizes the Internet transmission experience. I believe that the era of HTTP 3.0 will come in the future!

Log in

or Log in using