gRPC
A high-performance RPC framework using Protocol Buffers and HTTP/2. Binary, typed, streaming — fast for internal services. Not browser-friendly (needs a gateway). Used by Google, Netflix, and for microservice communication.
Google · Created gRPC in 2015
- Internal microservice communication.
- High-performance RPC.
- Streaming APIs.
- Polyglot systems (proto codegen).
- Browser-facing APIs (use REST/GraphQL).
- When you need human-readable payloads.
- When simplicity matters more than performance.
Definition
gRPC is an RPC framework. Define services and messages in .proto files (Protocol Buffers). Codegen produces typed clients/servers. HTTP/2 for multiplexing and streaming. Unary, server-streaming, client-streaming, and bidirectional RPCs.
Why it exists
REST/JSON is verbose and untyped for internal services. gRPC provides typed contracts, binary serialization (efficient), and streaming — better for microservice-to-microservice communication.
How it works
Define .proto files (messages, services). protoc generates code for your language. Server implements the service; clients call it like a function. HTTP/2 multiplexes. Streaming for real-time data. gRPC-Web for browsers (via gateway).
Scaling limits
Not browser-native (needs grpc-web or a gateway). Binary format isn't human-readable. Smaller ecosystem for web. Debugging requires tools (no curl).
Cost shape
Free and open source.
Alternatives
- REST — Simpler, universal, slower.
- GraphQL — Flexible queries, text-based.
- JSON-RPC — Simpler, less efficient.
Failure modes
- Browser compatibility.
- Debugging difficulty.
- Proto management.
- Not human-readable.