All tasks
Mediumsystem-designqueueasync

A queue for notifications

Acceptance: —Solved by: 0

Statement

A notification service: normally 600 requests/s, half of them writes. Once a day traffic grows 6× for 20 seconds (a push campaign): 1800 writes per second, i.e. 5400 database units — no tier takes that. Route the writes through a message queue: users get an instant reply and workers drain the queue into the database at 200 messages/s per instance. Mind two things: the queue must be empty by the end of the scenario, and workers must not write faster than the database can absorb.

Constraints

  • p95 ≤ 250 ms, errors ≤ 0.1 %, queue empty by the end, budget $2800/month, ≤ 5 instances per node.

Requirements

SimulationBuild from scratch
p95
≤ 250 ms
Errors
≤ 0.10 %
Budget
$2,800/mo
Users
200,000
Your architecture costs$0 / $2,800

★ within budget · ★★ ≤ 75 % · ★★★ ≤ 50 % of the budget

Scenarios (checked in order)
  1. 1A normal dayLoad

    600 requests/s for 60 seconds: 40 % reads, 50 % writes, 10 % static.

    60 s · 600 rps · R 40 / W 50 / S 10 %

  2. 2Push campaignSpike

    From second 20, traffic grows 6× for 20 seconds (3600 requests/s); the queue must drain within the 120 seconds.

    120 s · 600 rps · R 40 / W 50 / S 10 % · ×6 from s 20 for 20 s

Blocks

Click to add, or drag onto the canvas. Connect blocks by dragging from the right handle to the left one.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.

Solve this task to unlock the editorial.