HLD-222·Caching & Consistency
Medium · 1,000 ptsReddit-Style Nested Comment Tree & Hot-Rank Votes
Design a threaded discussion and upvote/downvote backend serving materialized comment trees on frontpage AMA threads while coalescing vote bursts.
Max p99
≤ 58 ms
Availability
≥ 99.5%
Budget
≤ $5,500
Functional Requirements
- FR-1GET /threads/{thread_id}/comments?sort=top — Fetches ranked nested comment subtree.
- FR-2POST /threads/{thread_id}/comments — Appends reply or vote delta and updates materialized tree.
- FR-3PATCH & DELETE /threads/{thread_id}/comments — Updates, cancels, or deletes thread_id records and immediately invalidates or updates cached state (read-after-write).
- FR-4Comment authors must see their posted reply immediately (read-after-write) and survive storage brownouts.
Workload Profile
Baseline Subreddits34,000 Read RPS / 5,000 Comment & Vote Write RPS
Frontpage AMA Surge98,000 Read RPS / 15,000 Write RPS
Active Working Set26 GB hot frontpage comment trees
Traffic DistributionExtreme Zipfian skew on top 50 frontpage thread_id posts
Consistency Model
Read-after-write consistency for newly submitted comments; vote tallies eventually converge within 2s.
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