Index/gRPC

SponsorGitHub
Key technologyInternal RPC3 min

gRPC

Typed, binary, streaming RPC over HTTP/2 — the default for service-to-service calls behind the edge.

At a glance

Contract
A .proto file; clients and servers are generated from it
Encoding
Protocol Buffers — a half to a third the size of JSON
Transport
HTTP/2: multiplexed calls on one connection, flow control
Call shapes
Unary, server streaming, client streaming, bidirectional
Failure handling
Deadlines propagate down the chain; cancellation is real
Browsers
Not directly — gRPC-Web plus a proxy, or REST at the edge

Key concepts and capabilities

The short listwhat it gives you
The schema is the contract — generated clients in every language, and field numbers on the wire
Evolution rules — add fields with new numbers, reserve retired ones, never renumber or change a type
Protobuf is compact — a half to a third of JSON, and much faster to parse, which shows up in a fan-out p99
HTTP/2 multiplexing — many concurrent calls on one connection, with no HTTP-level head-of-line blocking
Deadlines propagate — one budget travels the whole chain, so five hops all know how long is left
Cancellation is real — a client that goes away stops downstream work instead of paying for it
Interceptors — auth, tracing, retries and metrics in one place per service
One connection defeats L4 balancing — you need client-side balancing or an L7 proxy or mesh
REST or GraphQL at the edge, gRPC between services, a log when it need not be synchronous

Use cases

Service-to-service calls with one deadline

Behind the edge, where payload size and parse cost show up in the p99 and every caller is your own code. The deadline set at the gateway travels with the call, so the fifth hop knows how much budget is left and abandons work nobody is waiting for.

Queue / streamFocusClick a node for details

Changing a message without breaking a caller

Field numbers, not names, are on the wire, so an old server ignores a field it has never heard of and a new server reads an old message fine. That is the property that makes a polyglot estate with dozens of services survivable.

FocusClick a node for details

Streaming telemetry between backends

Bidirectional streaming over one connection is what makes continuous flows — driver locations, metrics, live model scores — cheap: no per-message request overhead, and flow control that pushes back when the consumer falls behind.

Queue / streamFocusClick a node for details

Balancing load across one long connection

The trap that separates reading about gRPC from running it: HTTP/2 keeps a single connection, so a connection-level balancer pins a client to one backend forever. Balance per request instead — in the client, or in an L7 proxy or mesh.

FocusClick a node for details