NotesSystem
gRPC
Also: Google RPC · gRPC-Web
Google's open-source RPC framework (2015), the successor to its internal Stubby. Its defining choice is Protocol Buffers over HTTP/2: typed, generated interfaces with streaming and deadlines built into every call.
Design choices
- RPC with the network made explicit: four call types (unary, server streaming, client streaming, bidirectional), status codes, and client and server that each decide success independently.
- Protocol Buffers for interface definitions and messages, so the encoding's tag rules govern compatibility: requests need backward, responses forward compatibility.
- HTTP/2 streams: each call is a stream, many calls multiplex over one long-lived connection.
- Deadlines: set by the client, propagated downstream, ending in
DEADLINE_EXCEEDED. No deadline is set by default.
Notable trade-offs
- Long-lived multiplexed connections defeat L4 load balancing; balance at L7 or on the client (L4 vs L7 Load Balancing).
- Browsers can't speak it directly; they need gRPC-Web through a proxy.
- Binary and schema-bound: less debuggable than JSON over HTTP, in exchange for compactness and generated types.
Connections
- Related
- L4 vs L7 Load Balancing