HLD-224·Search & Indexing
Medium · 1,000 ptsReal-Time Top-K Trending Topics & Bestsellers Engine
Design an Amazon Bestsellers / X Trending heavy-hitters pipeline computing sliding-window Top-K rankings (15m / 1h / 24h) from high-velocity interaction streams.
Max p99
≤ 48 ms
Availability
≥ 99.5%
Budget
≤ $5,450
Functional Requirements
- FR-1POST /events/interactions — Ingests view/purchase/hashtag stream keyed by bucket_shard.
- FR-2GET /trending/{region_id}?window=1h — Returns ranked Top-100 trending items with low tail latency.
- FR-3DELETE /events/interactions/{region_id} — Supports tenant retention TTL expiry, rule updates, or stream cleanup while keeping recent rollup caches fresh.
- FR-4Must decouple viral event floods using partitioned stream buffers and survive DB node failure.
Workload Profile
Baseline Stream26,000 Leaderboard Read RPS / 10,000 Event Write RPS
Live Event Surge75,000 Read RPS / 28,000 Event Write RPS
Active Working Set18 GB Count-Min Sketch / heap state & regional Top-K lists
Traffic DistributionSkewed reads on global/US region_id leaderboards
Consistency Model
Approximate bounded sliding-window updates (< 5s lag) acceptable using Count-Min Sketch + heap rollups.
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.
Design Write-up
0 boxes · 0 edges
0 words