I am currently learning gRPC and gRPC-Web in the .NET space. I will be posting some theoretical nuggets of info as I go along - hope this is helpful to some :)
What is it
gRPC is a modern open-source framework for microservice-to-microservice communication. It uses the HTTP/2 protocol for efficient transmission of data and uses Protocol Buffers for serializing structured data.
Tell me something I didn't already know
One of the main advantages of gRPC is its use of HTTP/2, which allows for efficient transmission of data with support for full-duplex streams, header compression, and multiplexing requests over a single TCP connection. This makes gRPC an ideal choice for high-performant microservice architectures.
How does this affect what I am already "used to doing"
In comparison to SOAP and REST, which use XML and JSON respectively, gRPC offers a more efficient and compact binary representation of data. This can result in significant performance improvements, particularly in high-traffic environments.
Er, but from a consumer (client) perspective - browsers do not support the HTTP/2 protocol...?
gRPC can be used in the browser by using a gRPC-Web client library, which provides a JavaScript library that can be used in a web application to interact with a gRPC service. This library acts as a proxy, translating between the gRPC-Web protocol and regular gRPC messages. This allows gRPC to be used in the browser, even if the browser does not natively support HTTP/2.
Bonus
Another advantage of gRPC is its support for bidirectional streaming, which allows for real-time communication between microservices. This makes it a good fit for event-driven architectures and message brokers.
Top comments (0)