API / Microservices Design Patterns Interview Questions
What is Gateway Aggregation versus Gateway Routing versus Gateway Offloading?
These three responsibilities are often all assigned to an API Gateway, but they serve distinct purposes and are worth understanding separately.
| Responsibility | What it does | Example |
|---|---|---|
| Gateway Routing | Forwards an inbound request to a single downstream service based on URL path, host, or header | GET /orders/* → Order Service; GET /products/* → Product Service |
| Gateway Aggregation | Fans a single inbound request out to multiple downstream services, waits for all responses, and merges them into one reply | A dashboard request calls Order Service, Customer Service, and Loyalty Service in parallel and returns a single combined payload |
| Gateway Offloading | Handles cross-cutting concerns on behalf of all services, so each service does not need to implement them individually | SSL/TLS termination, JWT validation, rate limiting, request logging, response compression, CORS headers |
In practice all three often live in the same gateway process, but separating them conceptually helps when deciding how to split responsibilities between a general API gateway (routing + offloading) and a BFF (aggregation + client-specific transformation).
Gateway Offloading deserves special emphasis: it prevents copy-paste of security and infrastructure code across dozens of services. A service that relies on the gateway for SSL termination, rate limiting, and JWT validation contains zero infrastructure boilerplate — only domain logic. If the JWT validation algorithm changes, one gateway configuration update covers every service instantly.
More Related questions...