gRPC vs REST vs GraphQL Lab (Interactive)
Load each network boundary with records and requests-per-second to compute payload, CPU, and queueing per protocol. Pick mobile-edge, public-partner, or internal-mesh traffic, sweep payload size and offered load, and watch Protobuf binary encoding and HTTP/2 pull away — or saturate.
gRPC vs REST vs GraphQL Matrix
Load each network boundary with real payload, serialization, and queueing math to find the fitting protocol.
| Protocol | Payload | Ser. CPU | Transfer | Queue @ 12,000 rps | Est. latency | Edge traits |
|---|---|---|---|---|---|---|
| REST (JSON/HTTP1.1) | 840 KB | 18 ms | 112 ms | SATURATED | ∞ | browser ✓ · CDN ✓ · SSE only |
| GraphQL (JSON) | 420 KB | 22 ms | 56 ms | SATURATED | ∞ | browser ✓ · CDN ✗ · WebSocket subs |
| gRPC (Protobuf/HTTP2) FASTEST HERE | 180 KB | 2.1 ms | 24 ms | +0 ms | 26.1 ms | browser ✗ (gRPC-Web) · CDN ✗ · bi-directional |
Service-to-service in VPC: Compile-time .proto contracts, HTTP/2 multiplexing over one TCP connection, and 7-10x CPU headroom dominate here. Architectural recommendation for this boundary: gRPC.
Numbers computed live: Protobuf omits field names (integer tags + varints) so payloads shrink ~70-80% versus JSON; queueing term explodes as offered load passes each server's per-protocol request capacity.
How It Works Under the Hood
Production systems do not pick one protocol; they pick per boundary. gRPC ships binary Protocol Buffers over multiplexed HTTP/2: field names never hit the wire, so payloads shrink 70-80% and deserialization is memory unpacking rather than string scanning, yielding roughly 7-10x the throughput of JSON. REST trades raw speed for universal browsers, curl, Postman, SDK generators, and CDN-friendly GET caching. GraphQL wins frontends by letting clients fetch exact graphs in one round-trip. Queueing math makes the choice concrete: each protocol has a request capacity, and latency explodes as offered load approaches it.
Core Architectural Principles
- Protobuf integer tags plus varints make 1,000-record payloads ~180KB versus REST’s ~840KB.
- HTTP/2 multiplexes thousands of streams over one TCP connection, removing handshake starvation.
- The 3-tier standard: GraphQL for first-party clients, REST for partners, gRPC inside the VPC.
Never answer with one protocol. Present the hybrid: gRPC service-to-service for its compile-time .proto contracts and CPU headroom, REST at the public edge for tooling and caching, GraphQL for mobile screens. Justify each with numbers — serialization cost, payload size, browser reachability — and note gRPC-Web proxies as the browser caveat.
Binary speed and strict typing on gRPC versus unmatched cacheability and debuggability on plain REST JSON.