Lesson 3 of 17
38. Design a Chat App (WhatsApp)

38.2 How big is this, really?

3 min read+10 XP

Step 2: Estimates (5 minutes)

Assume about 100 bytes of encrypted text per message, a peak factor of 3, and 100,000 connections per gateway server (Chapter 21).

WhatWorkingResult
Messages a day500 million × 4020 billion
Messages a second20 billion ÷ 86,400≈ 231,000 average, ~700,000 at peak
Text stored a day20 billion × 100 bytes≈ 2 TB a day (more with metadata)
Open connectionsgiven200 million at peak
Gateway servers200 million ÷ 100,000≈ 2,000
A 1,024-member group, 200 messages a day1,023 × 200 deliveries; × 2 for receipts≈ 205,000 deliveries, ≈ 409,000 receipts

What the numbers say, out loud:

  • "Connections are the scaling problem: 200 million long-lived sockets need a dedicated gateway tier (Chapter 21)."
  • "Hundreds of thousands of writes a second to the message store: shard it by chat."
  • "Receipts can outnumber messages in groups; batch them."

Interviewer pushback:

  • "Do you keep messages forever?" → That's a product choice. With end-to-end encryption, many apps keep messages on the server only until all devices have them (plus a safety window), and the history lives on devices and in user-controlled backups. That cuts storage enormously. I'll design for "store until delivered, then delete".

Memory code: "Count connections first, then messages, then receipts."