savchenko.tech / software engineering blog by Maryna Savchenko

Is gRPC a better choice over REST?

2022-02-04

Communication protocols play essential role in every modern software system. With increasing popularity of Microservice architecture inter-process communication techniques become even more important.

The most common way to build request-response style communication is RESTful services. However, REST can be inefficient and error-prone to use in microservices. We would need something more scalable, loosely coupled and efficient. That is where gRPC will shine.

gRPC (the ā€œgā€ stands for something different in every gRPC release) is an inter-process communication technology that allows you to connect, invoke, operate, and debug distributed heterogeneous applications as easily as making a local function call.

To develop gRPC application you need to create a service interface using IDL (Interface Definition Language). From this service interface you can generate server-side (server skeleton) and client-side (client stub) code with protocol buffer.

Protocol buffer is a language-agnostic, platform-neutral, extensible mechanism to serializing structured data.

grpc2.png

Why would you choose gRPC over REST or any other communication protocol?

Advantages of gRPC

Disadvantages of gRPC

So, the question is why don’t you use gRPC yet? I am going to. Coming soon … example of gRPC application.

Sources:

  1. gRPC: Up and Running by Kasun Indrasiri and Danesh Kuruppu
  2. Building Microservices by Sam Newman