Member-only story

HTTP/2 & gRPC — High-Performance RPC Framework

KRISHNA KISHORE V
5 min readOct 22, 2022

--

In the previous two articles, we have seen HTTP/1.1 and HTTP/2 in depth. In this article, we will look at the basics of gRPC and its architecture.

gRPC is an open-source high-performance RPC (Remote Procedure Call) framework which Google initially developed as a general-purpose RPC infrastructure to make interservice communication easier and more efficient.

gRPC is a great tool to implement service-to-service communication in a microservice world.

Two main reasons why gRPC is a high-performance framework

  1. The first reason for its high performance is the fact that it uses HTTP/2 for transportation. You know that HTTP/2 is lighter than HTTP/1.1(if you don’t please read this) as it better uses the Network bandwidth using the concept of streams.
  2. The second reason is, that gRPC uses Protocol Buffers for message exchange. The binary-based serialization/deserialization of Protocol Buffers is way faster than the conventional text-based JSON or XML serialization/deserialization.

Overview

In gRPC, as opposed to the HTTP request-response model, the client application directly calls a method on a server application. It is just like invoking a normal method on a local object but the method implementation is in a different application probably running on a different machine.

gRPC is based on the idea of a defining service. A gRPC service is simply a method implemented at the server side which can be remotely invoked by the client.

Just like a RESTful HTTP web server implements the REST methods, the gRPC server implements all the service definitions in which each service contains one or more methods known as RPCs that handle client requests. The gRPC clients invoke these RPCs just like simple method calls with the agreed parameters and return types.

NOTE: The gRPC server implements the service definitions. Each service definition contains one or more RPCs that handle the client requests.

How does method execution happen on the server side?

Okay. At this point, we know that the client calls the method as if it were calling a method on a local object. The question is, how does the call go to the server? Well, this is where the gRPC Stub comes into the picture. A gRPC stub is…

--

--

KRISHNA KISHORE V
KRISHNA KISHORE V

Written by KRISHNA KISHORE V

Full Stack Tech Lead | Software Consultant | Technical Content Writer

No responses yet