—————– gRPC —————–
WHAT is gRPC?
-
General purpose RPC (Remote Procedure Call) an open-source API framework developed by Google.
-
Transport layer of gRPC is HTTP and implemented in HTTP/2 version.
- Protocol buffer is being used as default Interface Descriptive Language.
- Schema is defined in
.proto
file, schema determines how data is being structured. protoc
is used to generate stubs (data access classes) for selected programming language by providing respective.proto
file as input.- At runtime, messages are compressed and serialized in binary format.
- Schema is defined in
- A Client-Response model that supports Data Streaming with Event Driven Architecture.
- Uniary streaming. (Single Request-Single Response)
- Server-side streaming.
- Client-side streaming.
- Bi-directional streaming
WHY gRPC is better?
-
Efficient Parsing: Since messages are transferred in binary format which reduces size of encoded message making it less CPU-intensive for pasring. This results in faster exchange of messages even with slower CPU devices.
-
Essential Schema: By enforsing to adhere strict schema, this ensures data structure intact so that protobufs can concentrate more on serialization/deserialization.
-
Please refer Statistics for more details
HOW gRPC works?
- Client is configured with client stub and instance of RPC runtime to execute.
- Client stub will be processed by passing parameters, the request along with metadata will be packed by the client stub. Client stubs also triggers local RPC runtime to process the metadata to server stub.
- The RPC runtime manages in transmission of messages between client and server using the generated buffer code which will help in serializing/deserializing the transmitted message.
- Upon completing the server procedure call, the server stub packs the message and triggers RPC runtime to perform the transmission to client
- The transport layer (RPC Runtime) at server will send the message to RPC Runtime at client which will carry forward the deserialized message to client stub.
- The client stub unpacks the message parameters and execution process will return to caller method.
- Configuring Python environment
- Please refer Configuration to setup
Python
environment and configure gRPC service
- Please refer Configuration to setup