{"id":1758,"date":"2022-08-16T11:15:37","date_gmt":"2022-08-16T05:45:37","guid":{"rendered":"https:\/\/ontoborn.com\/blog\/?p=1758"},"modified":"2023-03-08T12:10:38","modified_gmt":"2023-03-08T06:40:38","slug":"microservices-communication-using-grpc-protocol","status":"publish","type":"post","link":"https:\/\/ontoborn.com\/blog\/microservices-communication-using-grpc-protocol\/","title":{"rendered":"Microservices Communication Using gRPC Protocol"},"content":{"rendered":"\n
Hello everyone. In this article, we are going to learn about the gRPC protocol. gRPC has found huge success because of using HTTP\/2 instead of HTTP\/1.1 and protocol buffers instead of XML and JSON.<\/p>\n\n\n\n
gRPC is widely used for communication between internal microservices majorly due to the high performance and its polyglot nature.<\/p>\n\n\n\n
gRPC uses HTTP\/2 as its transfer protocol and hence it inherits the benefits like binary framing from HTTP\/2. As I mentioned in my previous article, HTTP\/2 is robust, lightweight to transport, and safer to decode compared to other text-based protocols. Due to its binary nature, HTTP\/2 forms a good combination with the Protobuf format.<\/p>\n\n\n\n
gRPC works in the same way as old Remote Procedure Calls(RPC). It is API oriented as opposed to REST protocol which is resource-based. Protbuf gives it support for 11 languages out of the box and all the benefits of binary protocol superpowers in terms of performance, throughput, and flexibility.<\/p>\n\n\n\n
One of the biggest advantages of microservices is the ability to use different technologies for each independent service i.e polyglot. Each microservices agrees on API to exchange data, data format, error patterns, load balancing, etc. Since gRPC allows for describing a contract in a binary format, it can be used efficiently for microservices communication independent of the languages.<\/p>\n\n\n\n