link: gRPC API

Remote Procedure Call (RPC)

Overview

Remote Procedure Call (RPC) is a protocol that allows a program to request a service from another program located on a different computer within a network. It abstracts the complexities of the network details, providing a mechanism for making function calls between programs as if they were local to the same system.

RPC follows the Client-Server Model

How It Works

RPC operates by providing a communication layer capable of transmitting procedure calls and data between processes on different computers. Here’s a simplified flow:

  1. Client Stubs: When the client application calls a function, the call is directed to a local stub procedure instead of the remote function. This stub is responsible for packing the function parameters into a message and sending it to the server.

  2. Communication: The client’s message is transmitted over the network to the server. The network details are abstracted away, so the developer doesn’t need to handle the underlying network communication specifics.

  3. Server Stubs: Upon receiving the message, the server stub unpacks the parameters and calls the local server procedure. The server then executes the function as if it was triggered locally.

  4. Response Handling: After the server function completes execution, the results are packed into a message by the server stub and sent back to the client stub.

  5. Completion: The client stub receives the response message, unpacks the results of the procedure call, and returns them to the calling procedure in the client program.