DEV Community

moayad khader
moayad khader

Posted on

What is the difference between http1 and http2 ?

What is the difference between HTTP and HTTP2?

To answer this question. First, we need to know the relationship between http and tcp protocol.

TCP manages the data stream, whereas HTTP describes what the data in the stream contains. So that means that we need to establish a new tcp connection between our browser and the destination web-server each time we want to perform a HTTP request.

So what is the problem with that?

The problem is that each browser has a limited number of connections to a server ( 6-10 connections based on the browser ) and doing a new request over one of those connections has to wait for the ones to complete before it can fire it off.

And here, HTTP/2 appears trying to find a solution for HOL blocking by introducing multiplexing (It does that by tagging each request) so that you can issue new requests over the same connection without having to wait for the previous ones to complete.

HTTP/2 does however still suffer from another kind of HOL, namely on the TCP level. One lost packet in the TCP stream makes all streams wait until that packet is re-transmitted and received. This HOL is being addressed with the QUIC protocol.

What is QUIC?

QUIC is a "TCP-like" protocol implemented over UDP where each stream is independent so that a lost packet only halts the particular stream to which the lost packet belongs, while the other streams can go on.

HTTP/3 is being done over QUIC instead of TCP and TLS.

Top comments (0)