Problem statement
Design the commenting backend for a high-traffic content site (think a popular news or discussion feed) where any comment can be replied to, replies can themselves be replied to, and popular articles collect tens of thousands of comments arranged into deep, branching threads.
Operating context. Comments hang off a parent entity (an article or post). A comment may reply to the entity directly (a top-level, or "root", comment) or to another comment, so a single article's comments form a forest of trees that can nest arbitrarily deep. Load is read-skewed: roughly 3,000 comment reads/sec at steady state and up to 40,000/sec when a story goes viral, against about 400 comment writes/sec. Distribution is heavily long-tailed — most articles have a handful of comments while a few hot articles hold 50,000+ comments, and within those, a few root threads attract most of the replies. A logged-in reader can vote on a comment, and each comment shows a live reply count and score.
Out of scope. Authentication and user identity, spam / abuse / moderation ML, rich-text rendering and media uploads, notifications and mentions, GDPR deletion workflows, and the article/post service itself (assume it exists and hands you a stable entity id). Do not design the frontend.
What to produce. A high-level architecture covering: the write path (post a root comment vs. a reply) and the read path (load a page of a thread); the data model and how you store the parent/child adjacency so you can both fetch one node's direct replies and render a subtree efficiently; the partitioning key and hot-partition story for a viral article; the pagination scheme for replies under a single parent and for the root list; how you rank comments within a thread (recency vs. score / "best") and keep the ordering stable across pages; how reply counts, total counts, and "hot thread" signals are maintained without recounting on every read; and where write amplification appears (counter/rollup updates, denormalized ordering keys) and how you bound it. Sketch the major components and the request flow; we will probe specifics at the checkpoints.
Requirements
This assessment is a Premium feature.
The statement above is free to read. The functional and non-functional requirements, and the graded canvas that scores your design against them, come with Premium.
Topics
- System Design HLD
- Data KV
- Scaling Read-Heavy
- Data Cache
- Reliability Replication