HLD-248·Messaging & Queues
Medium · 1,000 ptsScalable Email Inbound Queue, Spam Filter & Thread Inbox
Design a Gmail / Fastmail-style inbound mail reception and mailbox storage pipeline that decouples MIME attachment blobs from per-user thread metadata, runs async spam/DKIM classification, and serves instant inbox folder views.
Max p99
≤ 55 ms
Availability
≥ 99.6%
Budget
≤ $6,200
Functional Requirements
- FR-1POST /v1/inbound/messages — Validates SPF/DKIM, offloads large MIME attachments to object storage, and enqueues spam classification.
- FR-2GET /v1/mailboxes/{mailbox_id}/threads — Returns paginated inbox/label thread summaries and unread counts in < 50 ms.
- FR-3PATCH /v1/mailboxes/{mailbox_id}/threads/{thread_id} — Updates read/archive/label flags and refreshes cached unread counters.
- FR-4Must never lose accepted inbound mail (RPO = 0 after 250 OK) when a primary mailbox metadata shard crashes.
Workload Profile
Steady Mail Traffic35,000 Inbox Read RPS / 7,500 Inbound & Flag Write RPS
Top-of-Hour Bulk Newsletter Wave90,000 Read RPS / 21,000 Inbound Write RPS
Active Working Set30 GB hot inbox first-page thread lists & unread label counters
Durability GateZero lost accepted messages + blob/metadata separation
Consistency Model
Read-after-write on user mark-as-read / archive actions; durable queued delivery for inbound SMTP receipts.
Relevant practice for
Solutions Locked
Sign in and either achieve AC or complete 3 official submissions on this question to inspect community diagrams and writeups.
Loading solutions...
Submission History (0)Select to replay
No submissions yet
Click Submit in the top bar to evaluate against all 7 judge cases and save each run here.
Click an item in Inventory above, or press B to add a component, double-click to name, C to connect.
Design Write-up
Write under ### Architecture for Diagram to take that up directly
Compulsory section · if not written yet, Diagram reads from the start of your write-up.
Architecture: required·FRs mentioned: 0/4·0 boxes · 0 edges
0 words