Part 1: gRPC introduce

What is gRPC?


gRPC is a robust open-source RPC (Remote Procedure Call) framework used to build scalable and fast APIs. It allows the client and server applications to communicate transparently and develop connected systems through HTTP/2. gRCP is a part of Cloud Native Computation Foundation like Docker or Kubernetes.

gRPC provides a new reality for RPC by making it interoperable, modern, and efficient using technologies like Protocol buffers and HTTP/2.

Definition


gRPC (gRPC Remote Procedure Calls) is a cross-platform high-performance remote procedure call (RPC) framework. gRPC was initially created by Google, but it is open source and is used in many organizations.  gRPC can run in any environment, and use cases range from microservices to the "last mile" of computing (mobile, web, and Internet of Things). 

gRPC uses HTTP/2 for transport, Protocol Buffers as the interface description language, can efficiently connect services in and across data centers with pluggable support for load balancing, tracing, health checking and authentication, bidirectional streaming, flow control, blocking or nonblocking bindings, and cancellation and timeouts. It generates cross-platform client and server bindings for many languages. Most common usage scenarios include connecting services in a microservices style architecture or connecting mobile device clients to backend services.

Like many RPC systems, gRPC is based on defining a service in terms of functions (methods) that can be called remotely. For each method, you define the parameters and return types. Services, parameters, and return types are defined in .proto files using Google's open-source language-neutral protocol buffers mechanism.

Use cases


We can see that, gRPC seems to be very complex by definition. So, what is it used for in software development? It is designed for use cases where low-latency and high-throughput communication is required. It is particularly well-suited for use cases such as:


As mentioned above, gRPC provides an interface for communication between the client and the server, mobile and web applications. So, what’s the difference between Restful and GraphQL? Or Microservices, what’s the difference between gRPC and event/message? In the next article, we will jump into detail.

How does gRPC work?

In gRPC, a client application can directly call a method on a server application on a different machine as if it were a local object, making it easier for you to create distributed applications and services. As in many RPC systems, gRPC is based on the idea of defining a service and specifying the methods that can be called remotely with their parameters and return types.

On the server side, the server implements this interface and runs a gRPC server to handle client calls. On the client side, the client has a stub (referred to as just a client in some languages) that provides the same methods as the server.

gRPC clients and servers can run and talk to each other in a variety of environments - from servers inside Google to your desktop - and can be written in any of gRPC’s supported languages. So, for example, you can easily create a gRPC server in Java with clients in Go, Python, or Ruby. In addition, the latest Google APIs will have gRPC versions of their interfaces, letting you easily build Google functionality into your applications.

Benefit


We are a software development company based in Vietnam.

We offer DevOps development remotely to support the growth of your business.

If there is anything we can help with, please feel free to consult us.