codequest / system design
Like WhatsApp or Telegram

💬 Chat app system design

A simplified, healthy design: 10 app servers behind a load balancer, a cache (80% hit rate), an async write queue, a CDN for static files, a primary database. At 1,400 requests per second it runs at p95 49 ms with 0.0% errors for about $610/month.

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

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

How it works

  • Sending a message is a write, and people send a lot of them, so writes are a big share of traffic.
  • A queue acknowledges each message instantly; workers write it to the database in the background. It does not add database capacity.
  • Photos and stickers are static files, served from a CDN close to the user.
Try this

Push traffic to 5k requests/s. Replicas will not save you here: every write lands on one primary.

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

More systems