gRPC
gRPC is an open-source Remote Procedure Call framework developed by Google that uses Protocol Buffers (protobuf) as its interface definition language and serialization format, running over HTTP/2; Developers define service methods and message types in a .proto file; gRPC is the preferred choice for internal microservice communication where throughput and latency matter
gRPC is an open-source Remote Procedure Call framework developed by Google that uses Protocol Buffers (protobuf) as its interface definition language and serialization format, running over HTTP/2. It enables efficient, strongly-typed communication between services with support for bidirectional streaming.
How it works
Developers define service methods and message types in a .proto file. The protoc compiler generates client and server stubs in the target language. At runtime, gRPC serializes messages to binary protobuf, transmits them over HTTP/2 multiplexed streams, and deserializes on the receiving end.
Key facts
- Binary protocol: Protobuf serialization is significantly more compact and faster to parse than JSON
- HTTP/2 multiplexing: Multiple RPC calls share a single connection, reducing connection overhead
- Streaming support: gRPC natively supports server-streaming, client-streaming, and bidirectional streaming RPCs
For builders
gRPC is the preferred choice for internal microservice communication where throughput and latency matter. Its strongly typed contracts also make it easier to catch breaking changes at compile time rather than in production.
Sources
- IETF. RFC 9110: HTTP Semantics. datatracker.ietf.org
- IETF. RFC 9112: HTTP/1.1. datatracker.ietf.org
- Fielding, R. (2000). Architectural Styles and the Design of Network-based Software Architectures (REST). UC Irvine. ics.uci.edu
- OWASP. API Security Top 10 (2023). owasp.org
- MDN Web Docs. HTTP reference. developer.mozilla.org