Difference between HTTP1.1 vs HTTP2

Santosh Kumar Divate
2 min readNov 5, 2020

--

HTTP is the basis for almost all web applications. HTTP is the method clients and servers use to request and send information. The first usable version of HTTP was created in 1997 and was called HTTP1.1. This version is still in use on the web. In 2015, a new version of HTTP called HTTP2 was created. HTTP2, the new web protocol aims to be faster and more efficient than its predecessor HTTP1.1. One of the ways in which HTTP2 is faster is in how it prioritizes content during the loading process.

The differences that impact the performance are as follows:

Prioritization:

Prioritization refers to the order in which pieces of content are loaded. Suppose a user visits a news website and navigates to an article. Should the photo at the top of the article load first? Should the text of the article load first? Should the banner ads load first?

In HTTP2, developers have the detailed control over prioritization. This allows them to maximize actual page load speed that was not possible in HTTP1.1.

In HTTP2, data is sent all at once. developers get to number the messages in HTTP2. They can decide if the text of a webpage loads first, or the CSS files, or the JavaScript, or whatever they feel is most important for the user experience.

Multiplexing:

HTTP1.1 loads resources one after the other, so if one resource cannot be loaded, it blocks all the other resources behind it. Whereas HTTP2 is able to use a single TCP connection to send multiple streams of data at once so that one resource will not block any other resource. HTTP2 does this by splitting data into binary-code messages and numbering these messages so that the client knows which stream each binary message belongs to.

Server push:

Typically, a server only serves content to a client if the client asks for it. However, this approach is not always practical for modern webpages, this often involves several dozen separate resources that the client must request. HTTP2 solves this problem by allowing a server to “push” content to a client before the client asks for it. The server also sends a message letting the client know what pushed content to expect — like a Table of Contents of a book before sending the whole book.

Header Compression:

Small files load more quickly than large ones. To speed up web performance, both HTTP1.1 and HTTP2 compress HTTP messages to make them smaller. But HTTP2 uses a more advanced compression method called HPACK that eliminates redundant information in HTTP header packets. This eliminates a few bytes from every HTTP packet which results in fast loading.

Other high-level differences between HTTP1 and HTTP2:

  • HTTP2 is binary, instead of textual
  • HTTP2 is fully multiplexed, instead of ordered and blocking
  • HTTP2 can use one connection for parallelism

--

--