gRPC is designed to be fast and high performance. It's basically can overcome performance issues caused by REST communications between different dependent microservices.
gRPC supports Binary data transfer in the form of Protocol Buffers which makes it extremely efficient in the Microservice cloud environment.
2. What is gRPC?
gRPC is an open source remote procedure call
system initially developed at Google in 2015. based
on HTTP/2 protocol using Protocol Buffers
as interface description language.
In gRPC, 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
communicate between microservices.
3. Features
• Based on HTTP/2 protocol
• Protocol Buffer message
• Persistent connection
• No serialization required
• Bi-directional streaming
• Point to point data stream
6. Key Benefits
• gRPC based on HTTP/2. which is a Binary
protocol, but HTTP 1.1 is Textual. Binary
protocol is much efficient to parse and its
safe.
• gRPC uses Protobuf messages which is
compressed binary encoded structured data.
• gRPC is multiplexing in nature so it
overcomes the Head-of-Line Blocking
problem of HTTP1.1.
• gRPC uses header compression to reduce
overhead.
• gRPC also supports Duplex Streaming.
7. Primary
Use Cases
• In microservices based application infrastructure
services/servers can talk to each other using gRPC
over persistent connection to reduce overhead of
multiple TCP handshaking.
• If application required duplex streaming with high
data volume gRPC can help due to it’s binary
encoded compress protocol buffer messaging.
8. REST
&
gRPC
REST gRPC
Based on HTTP/1.1 Based on HTTP/2
Supports XML, JSON based
textual data format
Supports Protocol buffer based
binary data format
No duplex streaming supported Duplex streaming supported
No RPC interfaces available Based on RPC interface
Handshake for every request Persistent connection to reduce
processing time
9. Websockets
&
gRPC
Websockets gRPC
Based on HTTP/1.1 Based on HTTP/2
Supports XML, JSON based
textual data format
Supports Protocol buffer based
binary data format
No duplex streaming supported Duplex streaming supported
No RPC interfaces available Based on RPC interface
Pub/Sub based data streaming Point to Point data streaming
11. Conclusion
In microservices based environment related
communication gRPC would be one of the best
probable candidate among REST & Websockets &
gRPC due to it’s
• Binary data format (Protocol Buffer)
• HTTP/2 support
• Persistent connection
• Duplex streaming