Interview Question:
Design WhatsApp.
Big system. Huge scale.
Instead of panicking, think small.
Think of a kirana store.
🏪 Meet Ramesh
Ramesh runs a kirana store in a small locality.
He doesn’t know system design — but he thinks correctly.
We will design WhatsApp using his thinking.
1️⃣ How many people will come (Users & Traffic)?
Kirana Store
- People nearby: 1,000
- Customers per day: 200
- 200 customers per day
WhatsApp (assumption)
- Daily Active Users: 500 million
- Messages per user per day: 40
- 500,000,000 × 40 = 20,000,000,000 messages per day
2️⃣ When is the rush (Peak Load)?
Kirana Store
- Shop open: 12 hours
- Evening rush: 60% customers
- 120 customers in 3 hours = 40 customers per hour (peak)
Engineers assume:
Peak traffic = 5 × average traffic
Systems break at peak, not average.
3️⃣ Do people ask more or buy more (Read vs Write)?
Kirana Store
Out of 200 customers:
Read : Write = 80 : 20
One message write causes many reads (delivery, sync, notifications).
Same ratio. Bigger scale.
4️⃣ What stays near the counter (Cache / Memory)?
Kirana Store
Fast items near counter:
- Sugar: 5 kg
- Biscuits: 20 packets
- Milk: 10 packets
Slow items go to the storeroom.
Assumptions:
- Hot users: 20%
- Recent chat data per user: 2 KB
- 100,000,000 users × 2 KB = 200 GB cache
Hot data in memory. Cold data in database.
5️⃣ How much storage is needed (Data Size)?
Kirana Store
- 20 customers × 1 kg sugar = 20 kg per day
Assumptions:
- Average message size: 500 bytes
- Messages per day: 20 billion 20,000,000,000 × 500 bytes = 10 TB per day With replication: 10 TB × 3 = 30 TB per day
6️⃣ One notebook or many (Database Choice)?
Kirana Store
- One notebook for daily sales
- One notebook for credit customers
- Messages → NoSQL
- User info → SQL
- Media → Object storage + CDN
Access pattern decides storage.
7️⃣ Should slow work happen during rush (Async & Queues)?
Kirana Store
During rush, Ramesh:
- Does not count stock
- Does not call suppliers
During peak:
- Notifications
- Media processing
- Fan-out delivery
All done asynchronously.
🧠 Final Thought
Ramesh:
- Counts people
- Plans for rush
- Keeps fast things close
- Pushes slow work away
That is system design.
🏁 One Line to Remember
Design WhatsApp like a kirana store — count users, design for peak, cache hot data, and move slow work off the critical path.
Top comments (0)