📸 Photo sharing system design
A simplified, healthy design: 11 app servers behind a load balancer, a cache (90% hit rate), a CDN for static files, a primary database. At 8,000 requests per second it runs at p95 45 ms with 0.0% errors for about $625/month.
Healthy at 8,000 req/s
- p95 latency (server)
- 45 ms
- Error rate
- 0.0%
- Est. cost / month
- $625
- 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
- Most requests are images, served from the CDN, so your servers never see them.
- Profile and post metadata is read far more than written, so a cache handles most of it.
- Uploads are rare compared to views.
Turn off the CDN and try to fix it with app servers alone.
Use the Build and Traffic tabs above. The overloaded part turns red and starts dropping requests.