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.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
