Welcome to the second lesson in our module on microservices. In our last session, we established a strategic framework for decomposing monolithic applications into discrete services using Domain-Driven Design. You now have the conceptual tools to identify the "seams" in a system along business-centric bounded contexts.
Having defined our service boundaries, the next critical architectural decision is how these services will communicate with each other and with the outside world. The choice of communication protocol has profound implications for performance, developer experience, and the overall evolvability of your system.
Today, we will compare the three dominant API paradigms in modern system design: REST, GraphQL, and gRPC. Our goal is to move beyond simple definitions and analyze the specific trade-offs of each, so you can confidently select the right tool for the right job—a core competency expected of senior engineers and architects. This lesson will equip you with the practical knowledge to justify your API choices in a system design interview.
1. The Contenders: Defining REST, GraphQL, and gRPC
Before diving into a detailed comparison, it's essential to understand that these three are not exactly apples-to-apples competitors. They represent different philosophies for building APIs.
A great starting point is the article "gRPC vs REST vs GraphQL: A Battle-Tested Comparison," which provides a clear, concise breakdown of what each technology is at its core.
gRPC vs REST vs GraphQL: A Battle-Tested Comparison | BirJob
This article is based on a real-world migration and offers pragmatic insights. We'll be referring to it throughout the lesson.
Start by reading the section The Fundamentals. Pay close attention to the table comparing their core aspects like type, transport, and paradigm.
As you've just read, we can summarize them as follows:
- REST (Representational State Transfer): An architectural style that has become the de facto standard for public APIs. It's resource-oriented, typically uses HTTP/1.1, and communicates via JSON. Its main strength is its ubiquity and simplicity.
- GraphQL (Graph Query Language): A query language and runtime for APIs. It allows clients to request exactly the data they need and nothing more, solving the common REST problems of over-fetching and under-fetching. It's typically served over HTTP/1.1.
- gRPC (gRPC Remote Procedure Call): A high-performance RPC framework. It's procedure-oriented (you call functions on a remote service) and contract-driven, using Protocol Buffers for serialization and requiring HTTP/2 for transport. Its primary focus is performance and type safety.
This video from Scortier provides a good visual and conceptual walkthrough of each.
REST vs GraphQL vs gRPC in Microservices | Which One Should You Use? (Explained Clearly)
This video offers a clear explanation of each protocol, which will help solidify your understanding.
Watch the following three segments: The explanation of REST, focusing on its resource-based nature. The segment on GraphQL, which highlights how it solves the over-fetching problem. The introduction to gRPC, which breaks down its three foundations: RPC, HTTP/2, and Protocol Buffers.
2. Performance: Where gRPC Shines
For scalable systems, performance is a critical factor. The choice of protocol directly impacts latency, throughput, and resource consumption. This is where the differences between the three become stark, especially for internal service-to-service communication.
Let's return to the "Battle-Tested Comparison" article for some hard numbers.
gRPC vs REST vs GraphQL: A Battle-Tested Comparison | BirJob
The author provides benchmark results from a standardized test setup.
Read the section Performance: The Numbers. The table comparing metrics like latency, throughput, and CPU usage is particularly insightful.
The key takeaways from these benchmarks are clear:
- gRPC has significantly lower latency and higher throughput. This is due to its use of the efficient Protocol Buffers binary format and the capabilities of HTTP/2, such as multiplexing (sending multiple requests over a single connection without head-of-line blocking).
- GraphQL can have higher server-side latency and CPU usage because of the need to parse and resolve complex queries. However, it is often the most network-efficient for clients, as it minimizes payload size by avoiding over-fetching.
This performance difference is not just theoretical. Let's look at a real-world case study from Uber.
Accelerating Search and Ingestion with High-Performance gRPC™ in OpenSearch™
This article from Uber's engineering blog details why and how they integrated gRPC into their search infrastructure, and the performance gains they observed.
First, read the Introduction to understand the problem they were facing with REST/JSON at scale. Then, jump to the section Performance Impact. Study the graphs and metrics—they show dramatic improvements in latency and throughput for ingestion and search workloads after adopting gRPC.
Uber's experience quantitatively demonstrates the value of gRPC for high-throughput, latency-sensitive internal services, especially for workloads with large payloads like vector search. The 60% p99 write latency reduction is a compelling figure that would be highly relevant in a system design discussion.
3. Developer Experience & Other Trade-offs
While performance is crucial, it's not the only factor. As a team lead, you know that developer experience, tooling, and architectural complexity are equally important.
Communication Style and Flexibility
The fundamental difference in their paradigms—resource-oriented (REST), graph-oriented (GraphQL), and procedure-oriented (gRPC)—greatly influences development.
gRPC vs REST vs GraphQL: A Battle-Tested Comparison | BirJob
This section contrasts the development workflow for each protocol with code examples.
Read the entire section on Developer Experience. The code snippets clearly illustrate the pain points of REST (over-fetching, multiple requests), the flexibility of GraphQL, and the type-safe, contract-first approach of gRPC.
Given your experience with Go, you'll appreciate that gRPC's use of Protocol Buffers (.proto files) to define service contracts allows for the auto-generation of strongly-typed client and server code. This eliminates an entire class of integration errors and is a significant advantage in a polyglot microservices environment.
Error Handling and Versioning
The protocols also differ significantly in how they handle common architectural concerns like errors and API evolution.
gRPC vs REST vs GraphQL: A Battle-Tested Comparison | BirJob
This article provides concise tables comparing these crucial aspects.
Quickly review the tables and explanations in the sections Error Handling Compared and Versioning Strategies.
Key points to remember:
- Error Handling: REST uses HTTP status codes. gRPC has its own set of status codes. GraphQL is unique in that it can return a
200 OKstatus with both a partial data response and anerrorsarray, which is powerful for building resilient frontends. - Versioning: REST APIs are famously versioned via URLs (
/v1,/v2), which can become cumbersome. GraphQL is designed to be "versionless" by allowing schemas to evolve gracefully by adding new fields and deprecating old ones. gRPC handles this through package versioning in its.protofiles.
4. The Hybrid Approach: Choosing the Right Tool for the Job
So, which one should you choose? The answer, as is often the case in system design, is "it depends." The most effective and common pattern in modern scalable systems is not to choose one, but to use them in combination.

This hybrid model leverages the strengths of each protocol where they matter most:
- gRPC for internal, east-west traffic between microservices, where performance, low latency, and type safety are paramount.
- GraphQL for client-facing aggregation layers (often called a Backend-for-Frontend or BFF), where client flexibility and minimizing network round-trips are key.
- REST for public-facing APIs consumed by third parties, where simplicity, familiarity, and a vast ecosystem of tools are the biggest advantages.
The "Battle-Tested Comparison" article provides a decision matrix to help guide this choice.
gRPC vs REST vs GraphQL: A Battle-Tested Comparison | BirJob
This provides a clear framework for making a decision based on the use case.
Read the sections When to Use What and The Hybrid Approach. The table is an excellent reference for interviews.
In addition to the technical use case, the organizational context can also influence the choice. The decision matrix below provides another lens, considering factors like team structure and language compatibility.

Conclusion
You've now dissected the core differences between REST, GraphQL, and gRPC across performance, developer experience, and architectural patterns. This knowledge is fundamental to designing robust, scalable, and maintainable microservice architectures.
Key Takeaways:
- REST is the universal standard, ideal for public APIs due to its simplicity and ubiquity. Its main drawbacks are performance at scale and the over/under-fetching problem.
- GraphQL provides ultimate flexibility for clients, making it perfect for BFFs that serve diverse frontends (web, mobile). This flexibility comes at the cost of increased backend complexity.
- gRPC is the performance king for internal service-to-service communication. Its use of Protocol Buffers and HTTP/2 delivers low latency and high throughput, while its contract-first approach ensures type safety.
- A hybrid approach is the professional standard. Don't think in terms of "which is best," but "which is best for this specific communication link." Use gRPC internally and expose GraphQL or REST at the edge.
In our last lesson, you learned how to define your services. Today, you learned how they should talk. In our next lesson, we will put this knowledge into practice. You'll get hands-on experience by implementing a gRPC service and client in Go, one of your preferred languages, using Protocol Buffers.