Hello! Welcome back to our final module on System Design & Production Readiness.
In our last lesson, we took a deep dive into the service mesh, exploring how tools like Istio fundamentally enhance security, traffic management, and observability for a fleet of microservices. You learned how a mesh uses a data plane of sidecar proxies and a control plane to manage service-to-service communication without cluttering your application code.
Today, we'll address a very common point of confusion and a frequent question in senior-level system design interviews. The learning outcome for this lesson is to compare the roles and trade-offs of using an API Gateway versus a service mesh. Moving beyond simple definitions, we'll dissect their core purposes, architectural differences, and how they can work together to create a robust, scalable, and secure system.
1. The Common Myth: North-South vs. East-West Traffic
You've likely heard the common shorthand: "API Gateways are for North-South traffic, and service meshes are for East-West traffic."
- North-South traffic refers to communication entering or leaving your cluster (e.g., from a mobile app to your backend).
- East-West traffic refers to communication between services running inside your cluster.
This model is a useful starting point, but relying on it exclusively is a fallacy that can lead to poor architectural decisions.
To see this common distinction in action, let's watch a short video clip.
Is Service Mesh a MUST-HAVE for your Microservices?
This video clip provides a clear visual explanation of the traditional North-South/East-West distinction.
Please watch the segment from 04:19 to 06:24. The speaker explains how an API Gateway sits at the edge of the cluster (North-South) while the service mesh facilitates communication between pods (East-West). This will ground us in the popular, albeit incomplete, understanding.
The problem with this model is that it's not strictly true. An API Gateway can be used to manage internal traffic, and a service mesh's ingress gateway is specifically designed to handle traffic entering the mesh from the outside. The real difference is not about the direction of traffic but about the purpose of the tool.
2. The Real Difference: Purpose and Responsibility
The most critical distinction to make in an interview is that API Gateways and Service Meshes were designed to solve fundamentally different problems.
API Gateway vs Service Mesh: Beyond the North-South ...
To properly dismantle the North-South/East-West myth, let's turn to an excellent article that reframes the entire discussion around purpose and responsibility.
Please read the introduction ('The Misconception That’s Costing Teams') and the section 'Understanding the Real Problem Each Solves'. Focus on this core distinction: API Gateway: Treats your services as API products. It is business-aware and concerned with the entire API lifecycle, from documentation to monetization and client management. Service Mesh: Provides business-agnostic connectivity infrastructure. It is purely about making service-to-service communication reliable, secure, and observable.
To summarize this crucial point:
- An API Gateway asks: "Is this user, from this mobile app, allowed to call the
/paymentsAPI, and have they exceeded their hourly quota?" It understands concepts like users, API keys, and billing tiers. - A Service Mesh asks: "Is this request claiming to be from the
Payment-Servicecryptographically proven to be so, and should it be allowed to talk to theFraud-Detection-Service?" It understands concepts like service identity, latency percentiles, and failure rates.
3. Architectural and Capability Differences
These different purposes lead to very different architectures and capabilities. An API Gateway is a centralized component, a specific chokepoint through which traffic is routed. A Service Mesh is decentralized, injecting a proxy alongside every service instance.
Let's break down how their capabilities differ in practice.
API Gateway vs Service Mesh: Beyond the North-South ...
The same article provides a fantastic side-by-side comparison of how each technology handles key cross-cutting concerns. Understanding these details will allow you to articulate specific trade-offs.
Please read the 'Capabilities Comparison' section. For each capability (e.g., Authentication, Rate Limiting), make a mental note of the difference in scope: is it client-focused (Gateway) or service-focused (Mesh)?
Here is a summary table of the key differences, which is a great resource for interview preparation:
| Capability | API Gateway | Service Mesh |
|---|---|---|
| Primary Focus | Managing client-to-service traffic (Edge) | Managing service-to-service traffic (Internal) |
| Deployment Model | Centralized reverse proxy or cluster | Decentralized sidecar proxy per service |
| Authentication | User/Client identity (OAuth2, API keys, JWT) | Service identity (mTLS certificates) |
| Authorization | Based on user roles, scopes, client tiers | Based on service identity (ServiceA can/cannot call ServiceB) |
| Load Balancing | Centralized, server-side | Decentralized, client-side (at the sidecar) |
| Rate Limiting | Per-client, per-API key (business-oriented) | Per-service (protects from internal overload) |
| Resilience | Circuit breakers at the edge | Circuit breakers, retries, timeouts for every service call, without code changes |
| Observability | Edge metrics, API usage analytics | Deep service-to-service metrics, distributed tracing for all internal calls |
| Security Model | "Castle and Moat" (strong perimeter) | "Zero-Trust" (every internal request is verified) |
| Primary User | API consumers, product managers | Platform engineers, SREs |
Test your understanding!
A developer on your team suggests removing the API Gateway because "the service mesh can handle authentication with mTLS." How would you respond to this as a senior engineer?
Show answer
This is a great opportunity to clarify the different roles of these technologies. I would explain that this suggestion confuses two different types of authentication:
-
Service Identity (mTLS): The service mesh provides this. It proves that a request genuinely came from, say, the
inventory-serviceand not a rogue application. This is crucial for internal, zero-trust security. However, it knows nothing about the end-user who initiated the original request. -
User/Client Identity (OAuth2/JWT): The API Gateway handles this. It validates the credentials of the end-user or client application (e.g., a mobile app or a partner system) to determine if they are authorized to perform an action.
Therefore, you need both. The API Gateway authenticates the external user at the edge. Once the request is inside the system, the service mesh uses mTLS to authenticate the internal services as they communicate with each other to fulfill that request. Removing the gateway would eliminate the critical step of authenticating the end-user.
4. The Decision Framework: When to Use Which? (And When to Use Both)
In a mature microservices architecture, the question isn't "API Gateway or Service Mesh?" but rather "How do we best use an API Gateway and a Service Mesh together?"
API Gateway vs Service Mesh: Beyond the North-South ...
Let's solidify our understanding with a practical decision framework. Knowing when and why to apply these patterns is what interviewers are looking for.
Please read the sections 'When to Use Each' and 'Decision Matrix: Use Both When…'. This will equip you with the reasoning to justify your architectural choices. Pay special attention to the reasons not to use a service mesh, as discussing trade-offs and complexity is a hallmark of a senior engineer.
Here is a visual representation of how these components coexist in a large-scale system.

This combined architecture leverages the strengths of both:
- The API Gateway acts as the front door, managing the API as a product. It handles user authentication, rate limiting, and presents a stable, unified interface to the outside world.
- The Service Mesh acts as the smart network plumbing inside, ensuring that all internal communication is secure, resilient, and observable, without requiring developers to write boilerplate infrastructure code.
Conclusion
Let's recap the essential takeaways for your next system design interview. When comparing an API Gateway and a service mesh, avoid the simplistic "North-South vs. East-West" trap. Instead, focus on their fundamental purpose:
- API Gateways are for managing APIs as products. They are business-aware, client-facing, and provide a centralized point of control for external access, security, and API lifecycle management.
- Service Meshes are for managing service connectivity. They are business-agnostic, internal-facing, and provide a decentralized infrastructure layer for reliability, security (zero-trust), and deep observability.
The most robust architectures often use both: an API Gateway at the edge to manage external clients and a Service Mesh in the data center to manage the complex web of internal service communications.
Preview of the Next Lesson:
In this lesson and the previous one, we've discussed how gateways and meshes are instrumental in providing observability (metrics, logs, and traces). In our next lesson, we will put this into practice by learning how to "Analyze the root cause of a simulated production incident by correlating logs, metrics, and traces." You'll learn how to use these signals to methodically diagnose and resolve issues in a complex distributed system.
Can't find a good explanation? Sign up and we'll make it for you
Sign up