Official Content
  • This documentation is valid for:

gRPC is an RPC (Remote Procedure Call) protocol developed by Google. It is based on the idea of defining a service by specifying the methods that may be called remotely with their parameters and return types. 

Unlike REST services, the message IDL (Interface Definition Language) used by gRPC is binary-format Protobuf (Protocol buffer) which is not legible by humans, though easily and quickly written and read by machines.  

The advantage of messages encoded with Protocol buffers is that they are considerably smaller (as compared to XML or JSON formats), and this yields a less intensive processing.  

gRPC uses the Protobuf as IDL along with a set of serialization tools. Its current version is proto3, which enables the use of the entire array of languages compatible with gRPC, using the full multiplatform support at the same time. 

Additionally, it uses the HTTP/2 transmission protocol that allows for several bidirectional transmissions. This means that the connection may remain open throughout several calls that may take place simultaneously, so the client and the server may read and write regardless of order. It is a fact that gRPC can accept many queries from different clients and process those requests at the same time through the information flow. 

gRPC also supports unary interactions, that is the case of a client making a single petition and a single reply is provided in return. 

Another advantage of using HTTP/2 protocol is that it does an end-to-end encoding thus guaranteeing the API’s security. To do this, gRPC uses SSL/TLS for authenticating and encoding the data exchanged between client and server. 

gRPC functions in the following manner: 

  1. The transport of data flows between distant computers is executed by means of HTTP/2.
  2. It manages data structure and distribution through the Protocol buffers.
  3. Protocol buffers are saved, as plain text files with extension .proto.
  4. Uses the compiler of protocol (protoc) buffer to complete, serialize and recover message types. 

When should you use services like gRPC?

gRPC is ideal for:

  • Efficient communication between processes in distributed client-server structures with low latency and a significant flow of data and messages. 
  • Micro services or integration of internal API thanks to its greater scalability and optimized response. 
  • Communications in real time, low-consumption and low bandwidth system, and multilanguage environments. 
  • Internal systems. It is commonly used at and between distant data centers for connecting services or micro services.  
  • Distributed data processing, since it connects devices, mobile applications and navigators with backend services.

Last update: April 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant