gRPC
A high-performance RPC framework built on HTTP/2 and Protocol Buffers binary serialization for low-latency, strongly typed microservice communication
Table of Contents
Structure Diagram
Text-based · Universal browser fit
- SerializationHuman-readable JSON text
- ContractOptional via OpenAPI spec
- Best FitPublic APIs & browser clients
Binary · HTTP/2 Multiplexing
- SerializationCompact binary (smaller & faster)
- ContractStrict .proto schema & codegen
- Best FitInternal microservices & streaming
What is gRPC?
A high-performance RPC framework built on HTTP/2 and Protocol Buffers binary serialization for low-latency, strongly typed microservice communication. It is a core concept in APIs & Networking within Web Dev.
Core Principles
gRPC is a high-performance open-source RPC framework created at Google. Teams define service methods and message structures once in a .proto (Protocol Buffers) schema, then generate strongly typed server stubs and client SDKs across languages (Go, Java, TypeScript, Python, Rust).
Running natively over HTTP/2, gRPC multiplexes concurrent calls over a single connection, serializes payloads into compact binary frames, and supports four communication patterns: unary, server streaming, client streaming, and bidirectional streaming.
Practical Takeaways
- Bridge browser limitations: Standard browsers cannot expose raw HTTP/2 trailers required by gRPC. Place an Envoy proxy with gRPC-Web, ConnectRPC, or REST/JSON transcoding in front of browser clients.
- Use L7-aware load balancing: Because HTTP/2 reuses a single persistent TCP connection, naive L4 load balancers pin traffic to one backend pod. Use L7 proxies (Envoy, Istio) or client-side load balancing.
- Evolve
.protoschemas safely: Never reuse deleted field numbers—mark themreservedso rolling deployments stay backward- and forward-compatible.
Notable Examples
- Polyglot internal microservices: Connecting Go gateways, Java order systems, and Python AI inference workers with minimal serialization latency.
- Cloud-native infrastructure: Powering control planes in Kubernetes, etcd, and Envoy.