Benefits of HTTP/2

Arun Kumar
Cloud Techies
3 min readFeb 9, 2021

--

Pipelining

  • Http pipelining is a technique in which multiple http requests are sent on a single TCP connection without waiting for the corresponding responses.
  • Http 1.1 supports pipelining. Only limitation was that server has to maintain the response order as requested by the client. If the client made 3 requests 1, 2 and 3 then server in its response will have to maintain the order 1, 2 and 3. If the request 1 takes longer time then it introduces the problem known as Head of line blocking.
  • In Http2, each request/response tuple is associated with a unique ID, and is called a stream. When the client sends a request, it gives it an ID, and that ID will be put in the server answer.
  • Therefore, the client knows to which request the answer is, and there is no requirement of respecting the requests’ order like in HTTP pipelining. No more Head of line blocking at the http layer.

Server Push

HTTP/2 enables multiple concurrent responses to a client’s initial GET request, a server can send a resource to a client along with the requested HTML page, providing the resource before the client asks for it.

Binary Framing Layer

HTTP/1.1 keeps all requests and responses in plain text format whereas HTTP/2 uses the binary framing layer (part of the application layer in the internet protocol stack) to encapsulate all messages in binary format.

Multiplexing

  • Multiplexing is the ability to send different signals on same communication link. HTTP/2 establishes a single connection object between the two machines.
  • Within this connection there are multiple streams of data. Each stream consists of multiple messages in the familiar request/response format.
  • Finally, each of these messages split into smaller units called frames. At the most granular level, the communication channel consists of a bunch of binary-encoded frames, each tagged to a particular stream.
  • The identifying tags allow the connection to interleave these frames during transfer and reassemble them at the other end. The interleaved requests and responses can run in parallel without blocking the messages behind them, a process called multiplexing.
  • Multiplexing resolves the head-of-line blocking issue in HTTP/1.1 by ensuring that no message has to wait for another to finish. This also means that servers and clients can send concurrent requests and responses, allowing for greater control and more efficient connection management.

Compression

  • In HTTP/1.1, programs like gzip have long been used to compress the data sent in HTTP messages, especially to decrease the size of CSS and JavaScript files.
  • The header component of a message, however, is always sent as plain text. Although each header is quite small, the burden of this uncompressed data weighs heavier and heavier on the connection as more requests are made, particularly penalizing complicated, API-heavy web applications that require many different resources and thus many different resource requests.
  • Additionally, the use of cookies can sometimes make headers much larger, increasing the need for some kind of compression. In order to solve this bottleneck, HTTP/2 uses HPACK compression to shrink the size of headers.

How to check if a website has Http/2 protocol support

In Chrome browser open Chrome Dev Tool (F12)Go to, Network → Protocol
Protocol = http/1.1 => HTTP/1.1
Protocol = h2 => HTTP/2

Note: If you cannot see the Protocol column, just right-click on any header and check the “Protocol” label.

Reference:

https://www.digitalocean.com/community/tutorials/http-1-1-vs-http-2-what-s-the-difference

--

--

Arun Kumar
Cloud Techies

Cloud Architect | AWS, GCP, Azure, Python, Kubernetes, Terraform, Ansible