codequest / system design
Like X (Twitter) or LinkedIn

📰 News feed system design

A simplified, healthy design: 14 app servers behind a load balancer, a cache (90% hit rate), 1 read replica, a CDN for static files, a primary database. At 6,000 requests per second it runs at p95 56 ms with 0.0% errors for about $865/month.

Healthy at 6,000 req/s
p95 latency (server)
56 ms
Error rate
0.0%
Est. cost / month
$865
excl. bandwidth
App servers
400 req/s each · $40/mo
14
Hit rate
DB read replicas
+1,250 reads/s each · also applies every write · $120/mo
1

Primary DB: 1,250 queries/s (1 query per request). How the numbers work

How it works

  • People scroll far more than they post, so the feed is read-heavy.
  • Feeds are pre-built and cached, so opening the app is a fast cache read instead of a big database query.
  • Images and avatars come from the CDN; replicas absorb the reads the cache misses.
Try this

Drop the cache hit rate to 50% and watch the primary database climb toward its limit.

Use the Build and Traffic tabs above. The overloaded part turns red and starts dropping requests.

More systems