System design · 10 of 16
Mid
Senior
- Monitoring and alerting for 100 servicesSRE · Platform · DevOps
- Secrets management platformDevOps · Platform · SRE
- Multi-region active-active serviceSRE · Platform
- Distributed job scheduler (cron at scale)SRE · Platform
- Internal developer platform (IDP)Platform
- Multi-tenant Kubernetes platformPlatform · DevOps · SRE
- GitOps for a fleet of 100 clustersPlatform · DevOps
- ML training platform and feature storeMLOps · Platform
- LLM inference platformMLOps · Platform · SRE
SENIOR · 15 MIN · SRE · PLATFORM
Multi-region active-active service
Serve users from the nearest region, survive a whole region failing, and choose your data consistency on purpose.
- Peak load
- 50,000 req/s global
- Availability target
- 99.99%
- RTO: back up within
- 5 min
- RPO: data you can lose
- 0-1 s
← Swipe sideways to see the whole diagram →
The question
"Our service must stay up even if an entire cloud region goes down, and users in Europe and the US should get low latency. Design it."
Requirements
- Users go to the nearest healthy region.
- Lose a whole region and keep serving, ideally without losing data.
- Each region can handle 100% of traffic during a failover.
- Clear targets: for example RTO (time to recover) under 5 minutes, RPO (data you can lose) near zero.
How it works
- Global routing (GeoDNS like Route 53 latency routing, or an anycast load balancer) sends each user to the closest region.
- Each region runs the full stack across three Availability Zones, behind its own load balancer.
- Data lives in a globally replicated database (Spanner, Aurora Global Database, DynamoDB global tables or CockroachDB).
- Health checks remove a broken region from routing automatically.
- Each region is sized (or can autoscale fast enough) to carry the other's traffic.
The hard part: data
| Choice | How it behaves | Trade-off |
|---|---|---|
| Single writer region, read replicas elsewhere | simple, strong consistency | writes from far away are slow; failover needs promotion |
| Multi-writer, last-write-wins (DynamoDB global tables) | fast local writes everywhere | conflicting writes: one silently wins |
| Globally consistent (Spanner, CockroachDB) | strong consistency everywhere | writes wait for a cross-region quorum (higher latency) |
Remember it: you can't have everything during a network split (the CAP idea). Pick per data type: money needs consistency, a "last seen" timestamp doesn't.
Key decisions
- Static stability: don't depend on the control plane during a failure; keep enough capacity already running.
- Cell-based design: split users into independent cells so one bad deploy or hot shard hurts a few cells, not everyone.
- Practise failovers: regular game days where you really drain a region.
What breaks and how it heals
- Region outage: health checks fail, DNS stops sending users there (watch DNS TTLs: keep them short, 30-60 s).
- Split brain: use a database with a proper quorum instead of building your own failover logic.
- Failover overloads the other region: pre-scaled capacity and load shedding for non-critical features.
Load and capacity
| Item | Assumption | Result |
|---|---|---|
| Global traffic | 50,000 requests/s at peak | 60% US (30,000/s), 40% EU (20,000/s) |
| Failover sizing | either region must take all 50,000/s | run each region at ~60% CPU target with headroom |
| One app pod | ~500 requests/s | 100 pods per region at full load, spread over 3 AZs |
High availability and disaster recovery
| Target | Number | How it is met |
|---|---|---|
| Availability | 99.99% = 4.3 minutes per month | 2 regions × 3 AZs, both serving traffic |
| Region fails | traffic moves in ~1.5-2 minutes | health checks every 10 s, 3 failures = 30 s, plus a 60 s DNS TTL |
| RTO | 5 minutes including scale-up | each region already runs enough for 100% of traffic (or autoscales within minutes) |
| RPO | 0 with a synchronous quorum database (Spanner, CockroachDB); ~1 s with async replication (Aurora Global, DynamoDB global tables) | choose per data type |
| Cost of strong consistency | +70-100 ms per write | a US-EU round trip for the quorum |
What interviewers listen for
- Clear RTO/RPO targets and how the design meets them.
- An honest data-consistency choice with trade-offs.
- Capacity for failover, short DNS TTLs, and tested failover.