HTTP/2 — The basis for gRPC

KRISHNA KISHORE V
8 min readOct 14, 2022

In the previous article, we have seen HTTP/1.1 in detail and what the browsers perform in the background to make it faster. In this article, we will see HTTP2 in detail.

Understanding HTTP2 is very essential for every backend developer as, in the future, HTTP2 will be used widely. Today almost all web servers and browsers support HTTP2, even the browsers on mobile phones do support HTTP2.

1. Introduction

HTTP/2 is derived from the SPDY protocol which was developed by Google. At the highest level, HTTP/2 doesn’t change the semantics of HTTP/1 such as methods, status codes, headers, and URIs. But it introduces new ways of how the data is framed and transported between the client and server.

The primary goals for HTTP/2 are to reduce latency using techniques like;

  1. Request and Response Multiplexing
  2. Minimize the protocol overhead using header compression
  3. Support for request Prioritization
  4. Server push

To implement the above requirements, there are other supporting features such as new flow control, error handling and etc were implemented. But the above features are the most important that every web developer should understand. These features enable more efficient use of network resources and more efficient processing of messages through the use of binary message framing.

2. Binary Framing Layer

The Binary Framing layer is at the core of all performance enhancements of HTTP/2. It specifies how the HTTP messages are encapsulated and transferred between the client and server. This layer introduces a new optimized encoding mechanism of the message between the socket interface and the higher layer where the HTTP API is exposed to our applications. This means the HTTP semantics, such as verbs, methods, and headers, are not affected but the only thing that changes is how they are encoded in transmission.

As shown in the diagram, what happens in this layer is, in HTTP/1.1 the message is text-based and newline delimited. But in HTTP/2 the message is split into smaller messages and frames, each of which is encoded in binary format.

Fig 1. Message format change from HTTP/1.1 and HTTP/2

--

--

KRISHNA KISHORE V

Full Stack Tech Lead | Software Consultant | Technical Content Writer