10. Design an API Gateway
Route API traffic with authentication, tenant limits and safe configuration rollout.
The brief
Design an API gateway for a multi-tenant product with independently deployed backend services. Follow a request through identity checks, route selection and failure handling. Explain how route and policy changes become effective while a gateway continues serving during configuration-service downtime.
- Route 200,000 requests/second at peak across 200 backend services in two regions.
- Tenants have different quotas, and some requests stream responses for ten minutes.
- Operators update routes and policies hourly; a bad change must be reversible without restarting the fleet.
Constraints
- Gateway latency budget≤ 20 milliseconds
- Declare p95 overhead excluding backend processing and client network time.
- Trusted identity boundary
- Do not trust caller-supplied identity headers; propagate authenticated context without leaking credentials.
- Configuration outage
- Define last-known-good behavior and safe policy limits when updates cannot be fetched.
What to cover
- 01
Request lifecycle
Show authentication, quotas, routing, timeouts, streaming and response handling.
- 02
Configuration lifecycle
Describe versioned route changes, validation, canaries and rollback.
- 03
Capacity and overload
Estimate gateway and connection capacity; isolate a slow or failing backend.
- 04
Failure and retry policy
Trace a bad route and a timed-out write; explain which retries are safe.
Worked designs
Explore the architecture and decisions, then build on an example with Coach.
Review rubric
AI feedback uses these criteria. Scores are practice feedback.
Request and identity contract
Trust boundaries and request handling are explicit.
Configuration safety
Serving continuity, versioning and rollback form a workable protocol.
Failure isolation
Timeouts, backpressure and retries respect backend semantics.
Capacity reasoning
Streaming connections and peak traffic are accounted for.
Discussion
Share an approach, ask a question, or tag @Coach.
Loading discussion…