gRPC
What is it?
gRPC is a high-performance framework for calling functions on a remote service as if they were local, using compact binary messages.
Explain like I'm 5
Why was it created?
It was built for fast, strongly-typed communication between microservices, where text-based REST/JSON adds overhead and ambiguity.
Where is it used?
- Internal microservice communication
- Low-latency backend systems
- Polyglot service environments
- Streaming data between services
Why should developers care?
gRPC is common in performance-sensitive backend systems and service meshes. Backend and platform engineers run into it often.
How does it work?
You define services and messages in a .proto file. gRPC generates client and server code, then sends compact binary messages over HTTP/2, which also enables streaming.
Real-world example
An order service calls an inventory service's CheckStock method directly through generated client code, getting a typed response in milliseconds.
Common use cases
- Service-to-service calls
- Low-latency, high-throughput APIs
- Bidirectional streaming
- Cross-language backends
Advantages
- Fast, compact binary protocol
- Strongly typed contracts
- Built-in streaming over HTTP/2
- Auto-generated client/server code
Disadvantages
- Not natively supported in browsers
- Harder to debug than plain JSON
- More setup than REST
When should you use it?
For internal, performance-critical communication between services.
When should you avoid it?
For public browser-facing APIs where REST or GraphQL are easier to consume.
Alternatives
Related terms
Interview questions
Beginner
- What is gRPC used for?
- What is a .proto file?
Intermediate
- Why does gRPC use HTTP/2?
- What is Protocol Buffers?
Senior
- When would you choose gRPC over REST for an internal API?
- How do you handle versioning of proto contracts?
Common misconceptions
- "gRPC works directly in browsers" — browsers need a proxy layer (gRPC-Web).
- "gRPC is only for Google" — it's open-source and widely used across the industry.
Fun facts
- It uses Protocol Buffers to serialize messages compactly.
- The 'g' is often said to stand for different words in each release, as a running joke.
Timeline
- 2016 — Released as open-source by Google
Learning resources
Quick summary
gRPC is a fast, strongly-typed framework for service-to-service calls using binary messages over HTTP/2.
Cheat sheet
- Remote procedure calls (RPC)
- Binary messages via Protocol Buffers
- Runs over HTTP/2 with streaming
- Best for internal services