Google Remote Procedure Calls gRPC

Google Remote Procedure Calls (gRPC) is an open source Remote Procedure Call (RPC) system used to provide communication between microservices. Google Remote Procedure Calls is based on the HTTP/2 protocol. It also provides various features such as authentication, blocking or nonblocking bindings, bidirectional streaming and flow control, and cancellation and timeouts.

The gRPC supports various programming languages such as C++, C#, Dart, Go, Java, Node.js, Objective-C, PHP, Python, and Ruby. It provides cross-platform clients and server bindings for any language.

So, Google started gRPC protocol to communicate between modules of a distributed microservices based application within the same intranet or within the same server, so it reduces HTTP REST calls. In the gRPC based communication, the service client directly calls methods of the server application on a different machine as similar to local method calls for the same application on the same server.

We have to define the methods in service and these methods can be called remotely with using their parameters and return types as we do in any RPC system. Similarly, on the server side, we have to implement that interface. Also, we have to run a gRPC server to handle all requests coming from clients. The client has a stub implementation same as the server has all methods and its implementations.

Google Remote Procedure Calls

The following diagram illustrates the gRPC system:

Google Remote Procedure Calls
gRPC

As you can see in the preceding diagram, the gRPC client and server are talking to each other. The client gRPC and the server gRPC have different languages. Therefore, a gRPC based protocol supports various environments and languages. You can learn more about the gRPC system at https://grpc.io/.

In gRPC a client application can directly call methods on a server application on a different machine as if it was a local object, making it easier for you to create distributed applications and services. As in many RPC systems, gRPC is based around the idea of defining a service, 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.

Learn with more details from here.

Previous
Next