networking
gRPC vs REST
9 min read
Fully authored
Protobuf + HTTP/2 streaming vs JSON + HTTP/1.1 — when each wins.
Two dominant RPC styles for microservice communication. gRPC uses Protobuf over HTTP/2 with code-generated clients. REST uses JSON over HTTP/1.1 (or 2) with hand-written clients or OpenAPI. The right choice depends on WHO consumes the API.
| Dim | gRPC | REST |
|---|---|---|
| Wire format | Protobuf (binary) | JSON (text) |
| Size for user object | ~40 bytes | ~200 bytes |
| Latency (LAN) | ~1-3 ms | ~5-10 ms |
| Streaming | Native (bidi, server, client) | SSE or WebSocket |
| Browser support | Via grpc-web (limited) | Universal |
| Client codegen | Required + easy | Manual or OpenAPI |
| Debug tools | grpcurl, BloomRPC | curl, browser devtools |
| Best for | Internal microservice-to-microservice | Public APIs, browser clients |
The senior insight — two-tier API is the winning pattern
Public tier: REST/JSON at the gateway. Simple, browser-friendly, debuggable. Internal tier: gRPC between microservices. Fast, typed, streaming. This is what Google, Netflix, Uber all do.
Practice what you just read
Every foundation concept has a companion quiz to close the loop.