Estimation: Design WhatsApp

Example Estimation transcript covering Estimation, Fermi Problem, Capacity Planning, WhatsApp, Back-of-envelope — interview practice material from GitGrilled.

Example Conversation

Interviewer
How many messages per second does WhatsApp handle globally? Walk me through your estimate.
Candidate
I'll estimate step by step. WhatsApp has ~2 billion monthly active users. Assume each user sends ~20 messages per day on average. That's 40 billion messages per day. A day has 86,400 seconds. But traffic isn't uniform - there are peaks. Assume 3x the average during peak hours. Daily average: 40B / 86,400 ~ 463K messages/second. At 3x peak: ~1.4M messages/second. Let's sanity check: 1.4M writes/second is a lot but WhatsApp uses the Erlang-based Ejabberd server, which handles millions of concurrent connections. They also use custom infrastructure with FreeBSD and highly optimized kernels. Storage: 40B messages/day x 1KB (average message with metadata) = 40TB/day. That's ~14.6PB/year just for messages. They'd need aggressive compression and tiered storage (hot/warm/cold).
Interviewer
Now estimate the number of servers needed for that volume.
Candidate
Assume one server handles 50K concurrent connections. At 1.4M concurrent connections (peak), we'd need ~28 connection servers. But WhatsApp also has chat servers, database servers, media servers, and push notification servers. Chat servers: Each handles message routing. Assume one chat server handles 100K messages/second. At 1.4M peak, that's 14 servers. For redundancy, 3x: ~42 chat servers. Total: ~30 connection servers + 45 chat servers + database cluster (Cassandra, ~20 nodes) + media storage (likely S3-compatible) + caching (Redis/Memcache cluster). Rough estimate: 100-150 servers total plus cloud storage. Of course, in reality WhatsApp uses a custom infrastructure with sharded databases and a lot of in-house tooling. But this order-of-magnitude estimate is reasonable.