System Design Series — Part 26
Imagine you're building an online food delivery platform like Swiggy or Zomato.
A customer places an order.
Behind the scenes, multiple services need to communicate:
-
Order Service
-
Payment Service
-
Restaurant Service
-
Delivery Service
-
Notification Service
These services exchange thousands of requests every second.
Now imagine every request contains:
-
Large JSON payloads
-
HTTP headers
-
Text serialization
As traffic grows, communication becomes slower.
Bandwidth increases.
Latency increases.
CPU usage increases.
Can services communicate faster?
Yes.
That's exactly why gRPC was created.
Let's understand it in the simplest way possible.
The Real Problem
Imagine your application has 50 microservices.
Every user action triggers communication between them.
Example:
User places an order.
↓
Order Service
↓
Payment Service
↓
Inventory Service
↓
Delivery Service
↓
Notification Service
If every service communicates using large JSON payloads,
millions of requests create unnecessary overhead.
Modern distributed systems need something faster.
A Simple Real-World Analogy
Imagine two friends talking.
REST API
One friend writes a complete letter.
The other reads it.
Then writes another letter.
The communication works.
But it's slow.
gRPC
Now imagine both friends are on a phone call.
They talk instantly.
No waiting.
No repeated introductions.
Communication becomes much faster.
That's exactly what gRPC offers.
What is gRPC?
gRPC stands for:
Google Remote Procedure Call
It is a high-performance communication framework developed by Google.
Unlike REST APIs,
gRPC focuses on:
-
Speed
-
Efficiency
-
Low latency
It is widely used for communication between microservices.
How gRPC Works
Step 1
Client calls a remote method.
↓
Step 2
gRPC serializes data using Protocol Buffers.
↓
Step 3
HTTP/2 transports the request.
↓
Step 4
Server executes the method.
↓
Step 5
Binary response is returned.
Everything happens extremely quickly.
REST vs gRPC
REST
Uses:
HTTP
JSON
Readable.
Easy to debug.
But larger payloads.
gRPC
Uses:
HTTP/2
Protocol Buffers (Binary)
Smaller messages.
Faster communication.
Lower bandwidth usage.
What are Protocol Buffers?
Protocol Buffers (Protobuf) are Google's binary serialization format.
Instead of sending:
Large JSON text,
gRPC sends:
Compact binary data.
Benefits:
✔ Smaller payloads
✔ Faster serialization
✔ Lower network usage
This is one reason gRPC performs so well.
Why HTTP/2 Matters
Unlike HTTP/1.1,
HTTP/2 supports:
✔ Multiplexing
✔ Header Compression
✔ Persistent Connections
✔ Better Performance
Multiple requests can travel over the same connection simultaneously.
This significantly reduces latency.
Real-World Example
Imagine Netflix.
A user starts watching a movie.
Behind the scenes,
multiple services communicate:
Authentication
↓
Recommendation
↓
Playback
↓
Analytics
↓
Billing
These internal communications happen continuously.
Using lightweight binary messages makes the entire system faster.
Another Example: Uber
When you book a ride,
multiple backend services exchange information.
Examples:
Ride Matching
Pricing
Maps
Notifications
Payments
Thousands of service-to-service requests occur every second.
gRPC helps reduce communication overhead.
Types of gRPC Communication
One of the biggest advantages of gRPC is that it supports multiple communication patterns.
Unary
One request.
One response.
Similar to REST.
Server Streaming
Client sends one request.
Server streams multiple responses.
Example:
Live order tracking.
Client Streaming
Client sends multiple messages.
Server returns one response.
Useful for uploading large files.
Bidirectional Streaming
Both client and server exchange messages continuously.
Example:
Live multiplayer games.
Real-time collaboration.
IoT devices.
Production Architecture
Modern microservice architecture:
Users
↓
API Gateway
↓
REST APIs
↓
Microservices
↓
gRPC Communication
↓
Database
Notice:
External clients often use REST.
Internal microservices use gRPC.
This combination is very common in enterprise systems.
Why Companies Use gRPC
Large companies choose gRPC because it offers:
✔ Faster communication
✔ Lower bandwidth
✔ Better scalability
✔ Efficient service-to-service communication
It's especially valuable when thousands of internal API calls occur every second.
Advantages of gRPC
✔ Extremely fast
✔ Compact binary messages
✔ HTTP/2 support
✔ Strongly typed APIs
✔ Automatic client/server code generation
✔ Supports streaming
✔ Excellent for microservices
Challenges of gRPC
Harder to Test Manually
Unlike REST,
you can't simply open a browser and call an endpoint.
Specialized tools are often required.
Less Human Readable
Binary messages aren't as easy to inspect as JSON.
Debugging may require additional tooling.
Browser Limitations
Browsers don't directly support native gRPC.
Applications often use:
gRPC-Web
or
REST APIs for frontend communication.
Learning Curve
Teams need to understand:
-
Protocol Buffers
-
Code Generation
-
Streaming
-
HTTP/2
REST vs gRPC
Choose REST when:
✔ Public APIs
✔ Mobile apps
✔ Third-party integrations
✔ Simplicity is important
Choose gRPC when:
✔ Microservices communicate internally
✔ Performance matters
✔ Low latency is critical
✔ High throughput is required
Many production systems use both.
REST externally.
gRPC internally.
Common Developer Mistakes
Using gRPC for Every API
Not every application needs maximum performance.
Ignoring Browser Support
Frontend applications usually require REST or gRPC-Web.
Large Streaming Without Monitoring
Streaming connections consume resources.
Monitor them carefully.
Poor Protobuf Design
Well-designed contracts make APIs easier to evolve.
Production-Level Insight
A common misconception is:
"gRPC replaces REST."
It doesn't.
Most enterprise systems use:
REST
for client-facing APIs.
gRPC
for internal microservice communication.
Each technology solves a different problem.
The best architects understand where each one fits.
Interview Tip
A common System Design interview question is:
"When would you choose gRPC instead of REST?"
A strong answer should mention:
-
Internal microservices
-
Binary serialization
-
Protocol Buffers
-
HTTP/2
-
Streaming
-
Low latency
-
High throughput
Interviewers want to know that you understand the trade-offs—not just the technology.
Key Takeaways
✔ gRPC is a high-performance communication framework developed by Google
✔ It uses HTTP/2 and Protocol Buffers for fast, efficient communication
✔ Binary messages are smaller than JSON payloads
✔ gRPC supports unary and streaming communication
✔ It is widely used for internal microservice communication
✔ REST and gRPC often work together in modern architectures
✔ Choose the technology based on performance requirements and use cases
One of the biggest lessons in System Design is this:
As systems grow, the communication between services becomes just as important as the services themselves.
That's why many of the world's largest companies rely on gRPC to power high-performance distributed systems.
This is Part 26 of the System Design Simplified series.
Next Article: Part 27 — API Versioning Explained Simply
If this article helped you understand gRPC better, consider sharing it with fellow developers.
#SystemDesign #gRPC #Microservices #BackendDevelopment #SoftwareArchitecture #DistributedSystems #RESTAPI #ProtocolBuffers #Scalability #CloudComputing #SoftwareEngineering #SystemDesignInterview #BackendEngineer #Programming #TechArchitecture