HLDArena
HLD-234·Messaging & Queues
Medium · 1,000 pts

Real-Time Stock & Crypto Price Threshold Alert Matcher

Design Robinhood / Coinbase’s price-alert engine matching millions of user limit-threshold rules against live market ticks without duplicate alert spam.

Max p99
≤ 48 ms
Availability
≥ 99.5%
Budget
≤ $5,550

Functional Requirements

  • FR-1POST /alerts — Registers or cancels a user price threshold rule keyed by ticker_symbol.
  • FR-2GET /alerts/{ticker_symbol}/active — Evaluates sorted threshold buckets on incoming price ticks.
  • FR-3PATCH & DELETE /alerts/{ticker_symbol} — Updates, cancels, or deletes ticker_symbol records and immediately invalidates or updates cached state (read-after-write).
  • FR-4Must absorb FOMC volatility tick storms and survive primary storage crashes.

Workload Profile

Regular Market Hours30,000 Rule Match Read RPS / 5,500 Rule/Trigger Write RPS
Fed Rate Volatility Spike86,000 Read RPS / 18,000 Trigger Write RPS
Active Working Set20 GB price-ordered range buckets per ticker
Traffic DistributionExtreme skew on BTC, ETH, NVDA, SPY ticker_symbol keys

Consistency Model

Read-after-write on alert cancellation/firing state so triggered alerts fire once and cancelled rules stop immediately.

Design Write-up
0 boxes · 0 edges
0 words
Hidden Cases #4–#7 run automatically on Submit
Case 1: Smoke & API ContractInput Workload
Read RPS
2,000 rps
Write RPS
400 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 96 ms
• Availability: ≥ 99.5%
Valid end-to-end Client → Compute → Storage topology