Start Here

Tier 1 · Building Blocks

Scale Reads

Scale Writes

Database Selection

Traffic Control

Consistency & Coordination

Estimation

Tier 2 · Core Systems

Tier 3 · Location & Real-Time

Tier 4 · Infrastructure & Data

Tier 5 · Finance & Commerce

Tier 6 · Advanced & Collaborative

Phase 1 — Clarify & Scope

Interviewer: Design a distributed email service — think Gmail or a large transactional email platform like SendGrid. What do you want to clarify?

Candidate: Key questions:

  1. Are we building a user-facing email client (Gmail-style — read/compose/search), a transactional email sender (SendGrid-style — API to send emails at scale), or both?
  2. What's the storage model — do we need to store received email, or just send?
  3. What's the scale — users, messages per day?
  4. What protocols — SMTP for sending, IMAP/POP3 for retrieval?
  5. Search requirements — full-text search over email body?

Interviewer: Gmail-style — user email client with sending, receiving, storing, and searching. 1 billion users, 10 billion emails per day sent and received. Full-text search over emails. Standard protocols: SMTP in/out, IMAP for client access.

Candidate: Let me size this:

Emails/sec=10×10986,400≈115,740 emails/sec\text{Emails/sec} = \frac{10 \times 10^9}{86{,}400} \approx 115{,}740 \text{ emails/sec}

Average email size ~75 KB (headers + body + small attachment):

Storage/day=1010×75 KB=750 TB/day\text{Storage/day} = 10^{10} \times 75 \text{ KB} = 750 \text{ TB/day}

But most emails are stored for months/years. With 5-year retention:

Total storage=750 TB×365×5≈1.37 EB (exabytes)\text{Total storage} = 750 \text{ TB} \times 365 \times 5 \approx 1.37 \text{ EB (exabytes)}

Each user has a 15 GB quota (like Gmail). Average utilization 20%:

Storage per user=15 GB×0.2=3 GB average\text{Storage per user} = 15 \text{ GB} \times 0.2 = 3 \text{ GB average} Total=109×3 GB=3 EB\text{Total} = 10^9 \times 3 \text{ GB} = 3 \text{ EB}

Interviewer: What are the core requirements?

Candidate:

  • Send email: compose → queue → deliver via…

In the full tutorial

  • Phase 2 — High-Level Architecture
  • Phase 3 — Deep Dive & Evolution
  • Phase 4 — Robustness & Operations

Glossary history

Click dotted jargon to save explanations here.