System design · 1 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
BEGINNER · 10 MIN · DEVOPS · SRE · PLATFORM · MLOPS
A highly available web app on AWS
The classic starter design: load balancer, app servers in two zones, a database with a standby, cache and object storage.
- Peak load
- 200 req/s
- Availability target
- 99.9%
- RTO: back up within
- 1 hour (region)
- RPO: data you can lose
- 5 min
← Swipe sideways to see the whole diagram →
The question
"Design the infrastructure for a normal web app (say an online store) so it stays up if one server or one data center fails."
Requirements
- Serve web pages and an API to users over HTTPS.
- Survive one server dying and one Availability Zone (AZ, a separate data center) going down.
- Handle traffic going up and down during the day.
- Keep data safe: backups and no single database server.
Quick numbers
| Item | Assumption | Result |
|---|---|---|
| Daily users | 100,000 | about 1 request per second per 1,000 users at peak |
| Peak traffic | 10x average | ~200 requests per second |
| One app server | handles ~100 req/s | 2 needed at peak, run 4 (2 per AZ) for safety |
How it works
- Users load images, CSS and JavaScript from a CDN (CloudFront), close to them.
- API and page requests go to an Application Load Balancer in public subnets. It ends HTTPS and checks which servers are healthy.
- App servers run in private subnets in two AZs inside an Auto Scaling group. Unhealthy servers are replaced automatically, and more are added when CPU or request count rises.
- Servers read hot data from Redis and everything else from the database (RDS Multi-AZ: a primary plus a standby in another AZ).
- Uploads go to S3, not the servers' disks, so any server can be replaced at any time.
- A read replica takes reporting queries off the primary.
Remember it: keep servers stateless. Anything a user must not lose lives in the database, cache or S3, so servers are cattle, not pets.
Key decisions
| Decision | Choice | Why |
|---|---|---|
| Where state lives | DB, Redis, S3 | servers can be killed and replaced freely |
| Network | public subnets only for the load balancer | servers and DB are not reachable from the internet |
| Scaling | Auto Scaling on request count | follows real load better than CPU alone |
| Database HA | Multi-AZ standby | automatic failover in about a minute |
What breaks and how it heals
- A server dies: health checks fail, the load balancer stops sending traffic, Auto Scaling starts a new one.
- An AZ goes down: the other AZ keeps serving; the database fails over to the standby.
- A bad deploy: roll out gradually (rolling or blue-green) so you can roll back before everyone is hit.
- Database overloaded: add caching and read replicas first, then bigger instances, then split data.
Making it bigger
- Put a WAF in front for attacks and bots.
- Move to containers (ECS/EKS) when you have many services.
- Add a queue (SQS) for slow work like emails and image resizing.
High availability and disaster recovery
| Target | Number | How it is met |
|---|---|---|
| Availability | 99.9% = at most 43 minutes down per month | 2 AZs for every layer, health checks, Auto Scaling |
| One server dies | users notice nothing | load balancer stops sending traffic within ~10-30 s; Auto Scaling replaces it in ~3-5 min |
| One AZ fails | ~1-2 min of errors on writes | RDS Multi-AZ fails over to the standby in about 60-120 s; no data lost (synchronous copy) |
| Whole region fails (DR) | RTO 1 hour, RPO 5 minutes | pilot light in a second region: images copied, a cross-region read replica, Route 53 failover |
| Backups | point-in-time restore to any second in the last 7-35 days | RDS automated backups; S3 versioning + cross-region replication |
The four classic DR strategies, cheapest to most expensive:
| Strategy | What runs in the DR region | Typical RTO | Typical RPO | Extra cost |
|---|---|---|---|---|
| Backup and restore | nothing, only backups | hours (4-24 h) | hours | lowest |
| Pilot light | the database replica only | ~1 hour | minutes | low |
| Warm standby | a small copy of everything | minutes | seconds-minutes | medium |
| Multi-site active-active | full capacity serving traffic | near zero | near zero | ~2x |
Remember it: RTO = how long until you are back. RPO = how much data you can lose. Pick them with the business, then choose the cheapest strategy that meets them.
Test it: restore a backup every month and run a DR failover game day every quarter. A backup you never restored is a hope, not a plan.
What interviewers listen for
- You remove single points of failure at every layer.
- You explain stateless servers and where state goes.
- You mention health checks, Auto Scaling, backups and private subnets.