An RPC Workflow
RPC is easy to understand . A basic RPC process can be broadly separated into five stages: “origination,” “marshaling,” “broadcast,” “reception,” “processing,” and “response.”
- Origination: In this stage, the client calls what is known as a “Client Stub.” This stub is a local procedure or subroutine process that is called as a normal, local process. Once this process has been called, it moves to the second step of this stage, known as “marshaling.”
- Marshaling: The Client Stub, having been passed a set of parameters, packs the call and parameters and issues a system call to send the message.
- Broadcast: With the packaged set of call and parameters, the local operating system sends the packaged message from the client to the server.
- Reception: The package of the call and parameters is received by the server from the client. These packets of data are assembled and passed to what is called the “Server Stub.” This stub functions just as the Client Stub.
- Processing: Now that the server stub has received the data packet, it is unpacked in a process called “unmarshaling.” The call is extracted along with the parameters, and is then considered a local process or subroutine.
- Response: The server calls the local unpacked process or subroutine. The results are then sent back in the opposite fashion, moving from Response to Processing and so on until it is delivered to the Origination stage client.
Why RPC?
Protobufs and Compiling
Idiomatic and Open Source
Efficient and Scalable
HTTP/2 enables bi-directional streaming in its transport specification
Baked In Authentication Support and Solutions
the elements of gRPC:
Protocol Buffer
Protocol buffer is a form of Interface Definition Language for structured data serialization and de-serialization between two parties. They are transmitted over a network in binary forms.
HTTP/2
Hypertext Transfer Protocol Version 2 (HTTP/2) is defined by RFC 7540 provide better performance for HTTP traffic with bi-directional streaming and flow control on a single TCP connection. This website demonstrates the performance difference between HTTP and HTTP/2.
Multi-language Support
gRPC has a command line compiler to generate stubs and code in different languages that can be used for the gRPC client and server. This feature facilitates gRPC to get up and running rapidly.