0% found this document useful (0 votes)
35 views

Why GRPC For Inter-Microservice Communication. - Knoldus Blogs

Uploaded by

Doan Thanh Hung
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Why GRPC For Inter-Microservice Communication. - Knoldus Blogs

Uploaded by

Doan Thanh Hung
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

15:03 22/5/24 Why gRPC for Inter-Microservice Communication.

- Knoldus Blogs

(/) (https://nashtechglobal.com/)

Why gRPC for Inter-Microservice


Communication.

 January 28, 2020 (https://blog.knoldus.com/why-grpc-for-inter-microservice-communication/)  munandersingh

https://blog.knoldus.com/author/munandersingh/)
 Microservices (https://blog.knoldus.com/category/tech-blogs/microservices/), Tech Blogs (https://blog.knoldus.com/category/tech-blogs/)
 GRPC (https://blog.knoldus.com/tag/grpc/), gRPV v/s REST (https://blog.knoldus.com/tag/grpv-v-s-rest/), why grpc
https://blog.knoldus.com/tag/why-grpc/)
 2 Comments (https://blog.knoldus.com/why-grpc-for-inter-microservice-communication/#comments)

Table of contents

What is gRPC?
How gRPC communicate between services?
Why gRPC is so effective?
When to use gRPC?
Conclusion
Reference
https://grpc.io/docs/guides/concepts/
Share the Knol:
Related

Reading Time: 3 minutes

https://blog.knoldus.com/why-grpc-for-inter-microservice-communication/ 1/6
15:03 22/5/24 Why gRPC for Inter-Microservice Communication. - Knoldus Blogs

i folks! In this blog we will understand why one should use gRPC for inter-service communication over other RESTful services.

What is gRPC?
is a high performance, open source universal RPC Framework. In simple words, it enables the server and client applications to communicate
ransparently
(/) and build connected systems. Google developed gRPC and made available open-source. With it, a customer can directly call methods
Get in touch (https://nashtechglobal.com/)
n a server application on a different machine as if it were a local object. gRPC is based on the foundations of conventional Remote Procedure Call
(https://nashtechglobal.com/)
RPC) technology but implemented on top of the modern technology stacks such as HTTP2, protocol buffers etc. to ensure maximum interoperability

How gRPC communicate between services?


When the client invokes the service, the client-side gRPC library uses the protocol buffer and marshals the remote procedure call, which is then sent
ver HTTP2. Server un-marshal the request and executes the respective procedure invocation using protocol buffers. The response follows a similar
xecution flow from the server to the client.

he main advantage of developing services and clients with gRPC is that your service code or client side code doesn’t need to worry about parsing
SON or similar text-based message formats (within the code or implicitly inside the underlying libraries such as Jackson, which is hidden from
ervice code). What comes in the wire is a binary format, which is unmarshalled into an object. Also, having first-class support for defining a service
nterface via an IDL is a powerful feature when we have to deal with multiple microservices and ensure and maintain interoperability.

https://blog.knoldus.com/why-grpc-for-inter-microservice-communication/ 2/6
15:03 22/5/24 Why gRPC for Inter-Microservice Communication. - Knoldus Blogs

Why gRPC is so effective?


Ability to break free from the call-and-response architecture. gRPC is built on HTTP/2, which supports traditional Request/Response
model and bidirectional streams.
Switch from JSON to protocol buffers.
Multiplexing.
Duplex Streaming.
Because of binary data format, it gets much lighter.
Polyglot.

When to use gRPC?


nitially, all micro-services were interconnected through REST APIs. One service calls either one service or two services or maybe more services and
urther those services may be calling other services.

any of the services is slow, then it will affect all the system because REST does not support features like multiplexing, duplex streaming. REST APIs
ommunicate with each other with payloads like JSON, XML and many more. This makes the process very slow, memory-consuming and non-
ompressible.

RPC has resolved all these issues. But it can be used only in those use cases where there is internal communication between services. Multiplexing,
ull duplex, proto request/response makes gRPC much faster as compared to REST. It is only available for internal services because there is no APIs
vailable for external use, but the Google team is working on gRPC-web also so that users can also use this for external services communications.

econd option is to create one Microservice using REST which can deal with external services and rest of services deal with each other internally
hrough gRPC. It used in those use cases where there is a requirement of communication between services internally. Therefore, as a general
ractice, we can use it for all synchronous communications between internal microservices. Other synchronous messaging technologies such as
ESTful services and GraphQL are more suitable for external-facing services.

Conclusion

o conclude, APIs created with gRPC gives us incredible performance improvement as compared to legacy REST API. Our response time reduces
rom 15 ms to 1.71 ms for each request, where average requests ranges from 600 rpm to 1700 rpm.

https://blog.knoldus.com/why-grpc-for-inter-microservice-communication/ 3/6
15:03 22/5/24 Why gRPC for Inter-Microservice Communication. - Knoldus Blogs

Reference
https://grpc.io/docs/guides/concepts/ (https://grpc.io/docs/guides/concepts/)

Ready to gain a competitive advantage with Future Ready Emerging


Technologies?

LET'S INITIATE A PARTNERSHIP (HTTPS://WWW.KNOLDUS.COM/CONTACT-US?


UTM_SOURCE=BLOG_KNOLDUS&UTM_MEDIUM=CTA_BEFORE_FOOTER&UTM_CAMPAIGN=TRAFFIC_FROM_BLOG)

Like 8

Written by munandersingh (https://blog.knoldus.com/author/munandersingh/)

Munander is a Software Consultant in Knoldus Software LLP. He has done b.tech from IMS Engineering college, Ghaziabad.
He has decent knowledge of C,C++,Java,Angular and Lagom. He always tries to explore new technologies. His hobbies
include playing cricket and adventure.

https://blog.knoldus.com/why-grpc-for-inter-microservice-communication/ 4/6
15:03 22/5/24 Why gRPC for Inter-Microservice Communication. - Knoldus Blogs

2 thoughts on “Why gRPC for Inter-Microservice Communication. 4 min read ”

Himanshu Gupta says:


 January 29, 2020 at 12:17 PM (https://blog.knoldus.com/why-grpc-for-inter-microservice-communication/#comment-39430)

Nice blog! Got to know a lot about gRPC.

Pingback: An Introduction to gRPC – Curated SQL (https://curatedsql.com/2020/01/29/an-introduction-to-grpc/)

omments are closed.

(https://www.knoldus.com/) (https://nashtechglobal.com/)

COMPANY

About Knoldus (https://www.knoldus.com/about/)

About NashTech (https://nashtechglobal.com/about-us/)

About Nash Squared (https://www.nashsquared.com/about)

Sign up to our newsletter

Certificates

 

Partners

 

https://blog.knoldus.com/why-grpc-for-inter-microservice-communication/ 5/6
15:03 22/5/24 Why gRPC for Inter-Microservice Communication. - Knoldus Blogs

© 2023 Knoldus, Inc. All Rights Reserved.


Part of NashTech

Privacy Policy (https://www.knoldus.com/privacy-policy) | Sitemap (https://www.knoldus.com/sitemap_index.xml)

https://blog.knoldus.com/why-grpc-for-inter-microservice-communication/ 6/6

You might also like