Why did Google & Facebook stop using the traditional network connection?
With the increase in user base google needed to an efficient to handle the requests. Before we proceed toward answer why google stopped using the TCP connection let’s understand the basic.
As you can refer to the above diagram. There are 4 layers in the protocol layer, Let’s understand all the layer in details.
Network Access Layer:
This is the bottom-most layer in the protocol layer. This is a layer that provides the means for the system to deliver data to the other devices on a directly attached network.
This layer has an internet protocol that provides an identification and location system for computers on networks and routes traffic across the Internet.
The transport layer provides the communication services directly to the application processes running on different hosts. Here we have two types of Protocol TCP and UDP.
- TCP: This is the protocol that follows the 3-way handshake principle. In this Client send a request to the server and the server send a response, after the client again send an acknowledgement that it has received the response. If the server doesn't get the acknowledgement from the client then it will send the response again, as it will consider that response is not received by the client.
- UDP: In this protocol, the client establishes a connection and send a request and the server send the response. The response can be sent in multiple segments. And the client doesn’t send an acknowledgement that it has received the response. So the server doesn’t care if the client gets the response or not, it just sends the response.
An application layer is an abstraction layer that specifies the shared communications protocols and interface methods used by hosts in a communications network.
Now you get a basic idea of the network layers, now let’s see what’s the difference between HTTP1.1 and HTTP2. Which is the part of the application layer. The HTTP protocol is used to transmit hypermedia documents, such as HTML. It was designed to make communication possible between web browsers and web servers.
HTTP 1.1 vs HTTP 2
In HTTP 1.1 protocol one TCP connection is established for each request call. Whereas in HTTP 2 protocol works as a stream, it establishes one TCP connection in which multiple request and response send and received by the client.
Why HTTP 2?
In HTTP 1.1 for each request call, one connection is established. And suppose a website has 1 million users, and for a particular page, there is 20 request call need. If all 1 million users open that page at the same time then it requires 20 million connections to be established at the same time. Which could lead to a DOS attack.
So to prevent this browser has limited the request to 6 request call at a time, which mean 6 connections can be established by the browser at a time for each page opened. If any connection is closed then only a new connection will be established.
With HTTP2 in a single connection, multiple requests can be sent at the same time. Which mean in single connection I can perform 20 request call at once. Because of this page will also be loaded in less time.
The drawback of HTTP 2
As HTTP 2 use the streaming concept, a problem is that if the client doesn’t receive a response for a particular request, the client won’t call that request again.
Here comes the twist, HTTP 3 is implemented over QUIC. QUIC is a protocol designed by Google to take the best of TCP+TLS and optimise the performance of HTTP protocol.
TCP + TLS takes about 6 round trip for a connection. On the other side QUIC over UDP takes about 1–2 round trip. QUIC includes loss control, congestion feedback.
But as QUIC is implemented over UDP you may get the disadvantage by earlier points, if a packet is lost then it’s lost.
QUIC has one more feature that it doesn’t build a connection between client and server but client IP: port and server IP: port. QUIC make a connection’s UUID which is independent of IPs. By this, you get the advantage that you can switch your internet connections without losing the data and the connection could stay live.
TLS is used for encryption purpose. It helps to encrypt and decrypt the package.
Google and Facebook switched to QUIC which is more optimised, faster and large bandwidth compared to traditional HTTP connections protocols. Which automatically reduce the processing cost and improves the performance experience for the user.