🔗 URL shortener system design
A simplified, healthy design: 14 app servers behind a load balancer, a cache (90% hit rate), a primary database. At 4,000 requests per second it runs at p95 59 ms with 0.0% errors for about $730/month.
Healthy at 4,000 req/s
- p95 latency (server)
- 59 ms
- Error rate
- 0.0%
- Est. cost / month
- $730
- excl. bandwidth
App servers
400 req/s each · $40/mo
Hit rate
DB read replicas
+1,250 reads/s each · also applies every write · $120/mo
Primary DB: 1,250 queries/s (1 query per request). How the numbers work
How it works
- Creating a short link is rare; following one is constant. Reads outnumber writes many times over.
- Popular links are requested again and again, so a cache answers most redirects without touching the database.
- App servers are stateless, so you add more behind the load balancer as traffic grows.
Turn the cache off and watch the database go red.
Use the Build and Traffic tabs above. The overloaded part turns red and starts dropping requests.