Design Reddit: the system design interview walkthrough
The request to design Reddit looks friendly — posts, upvotes, comments, done. For a small forum that is the whole thing. But the interview asks you to run thousands of communities where a single post can go viral and draw millions of votes and a comment thread tens of levels deep, rank every listing so the front page feels alive, serve the same hot listing to millions of readers without melting the database, and count a flood of votes without ever double-counting one — and that is a ranking, read-fan-out and write-aggregation problem, not a posts table. This is a classic system design interview prompt because the simple brief hides three distinct hard problems stacked on top of each other, and a Reddit system design is really the art of keeping a ranked feed, a deep comment tree, and a vote counter all fast at once.
The round turns on three decisions. First, ranking and the home feed — how you score "hot," keep a ranked list per community, and assemble one personalised front page from the communities a user follows without re-sorting the world on every request. Second, nested comment trees — how you store and render a thread that branches thousands of ways and sort it so the best replies float up. Third, voting at scale — how millions of votes become counts without a database write per click and without a user's vote being counted twice. This walkthrough follows the path a strong candidate draws on the whiteboard — requirements, estimate, API and data model, high-level design, then the deep dives — and at each step it names the follow-up the interviewer uses to tell a memorised answer from an engineer who understands the tradeoff.
How the Reddit round is actually run
A Reddit round runs about 60 minutes on a shared canvas — you draw the boxes and arrows while you talk, and the interviewer interrupts. It is a favourite because the one-line problem is really three problems wearing a trench coat: the moment you sketch "posts and comments and votes," the question becomes how do you rank the front page, how do you render a thread ten thousand comments deep, and how do you count a viral post's votes without a write per click — and each one is a deep dive on its own. Get the ranked feed, the comment tree and the vote pipeline clean and you have shown three systems in one problem.
The interviewer rarely lets "store posts, sort by votes, done" stand. "A post hits the front page and a million people load it in ten minutes, all voting and commenting — what falls over first, and how do you serve that one hot listing to everyone?" That question — a viral post as a hot key that no single row or cache entry can absorb naively — is the one a copied answer can never rehearse, and the one this round is really testing.
The rounds here are modelled on how the loop runs, not scraped from any candidate's recall. What matters for prep is the shape: a blank canvas, a clock, and a follow-up after every decision you make.
The five-step framework for any HLD round
Every high-level design answer fits the same spine. Say it out loud at the start so the interviewer knows you have a plan, then walk it:
- Clarify requirements — functional and non-functional, and what you are explicitly not building.
- Estimate — users, reads vs votes vs posts per second, and the read/write skew, to justify every later choice.
- High-level design — the boxes and arrows: client, gateway, post/comment/vote/feed services, their stores and caches.
- Deep dive — the two or three decisions that actually decide this system.
- Follow-ups — bottlenecks, failure modes, and what you would change at ten times the scale.
What the debrief measures
The score is not "right or wrong design." A good HLD debrief reads on four dimensions, and every move below maps to one: problem solving (did you serve hot listings from a precomputed ranked cache instead of sorting on read, and aggregate votes asynchronously instead of a write per click), communication (did you say why the home feed is merged on read, not fanned out on write, in a sentence), technical execution (hot ranking into a per-community sorted set, comment trees by parent id with confidence sort and lazy load, async vote aggregation with idempotent de-dup), and time management (did you spend your 60 minutes on ranking, comment trees and voting, not on the sign-up flow). Reading a walkthrough teaches the design; it does not teach you to deliver it on the clock while someone pushes back.
Step 1 — Requirements: what Reddit must do
Spend the first few minutes here. Jumping to boxes before you have scoped the problem is the fastest way to design the wrong system.
| Type | Requirement |
|---|---|
| Functional | Create communities (subreddits) and posts; upvote/downvote posts and comments; write deeply nested comments; show a ranked listing per community and a ranked home feed of the communities a user follows; sort comments by best/top/new; paginate long listings and deep threads. |
| Functional (optional) | Search, moderation and removal, notifications, awards, user profiles — call these out, then scope most of them for later. |
| Non-functional | Very read-heavy (far more views than writes); low-latency feed and post loads; votes are the highest-volume write and can spike on a viral post; counts can be eventually consistent; highly available; horizontally scalable; handle hot keys (viral posts) gracefully. |
The sentence that earns points: "This is a read-dominated ranking system with a viral hot-key problem — so listings are served from precomputed, cached ranked lists, the home feed is merged on read from the communities you follow, and the heavy write path (votes) is aggregated asynchronously, not applied one row at a time." Say that and you have framed the entire design before drawing a box.
Step 2 — Capacity estimation (back of the envelope)
Estimation here is about proving one thing: this is read-heavy with a spiky write path, and the hard parts are serving ranked listings cheaply and absorbing a vote flood, not storing posts.
| Quantity | Assumption | Result |
|---|---|---|
| Users | ~100M daily active | hundreds of millions of feed/listing loads a day |
| Reads | feed + listing + thread views | ~100k+ reads/sec at peak → must be cache-served |
| Votes | the dominant write | tens of thousands/sec, bursty on viral posts → aggregate async |
| Posts/comments | far rarer than reads/votes | modest write rate, but comment trees get deep |
| Read:write | views ≫ posts | ~100:1+ → optimise reads; make listings precomputed and cacheable |
Two conclusions fall out, and you should say both out loud. First, reads must come from cache, not a sort-on-read — you cannot re-rank a community (let alone the home feed) on every page load, so ranked lists are precomputed and cached (a sorted set per community) and the home feed is assembled by merging a user's followed communities' cached lists. Second, votes are the write bottleneck and arrive in bursts — a viral post is a hot key taking a flood of votes, so you never do a synchronous row update per vote; votes flow through a queue and are aggregated into counts asynchronously, and counts are eventually consistent. You have now pointed the interview at ranking, comment trees and voting — the real deep dives — before anyone asked.
Step 3 — API and data model
Reddit's interface is a handful of read and write calls; the design lives in how the reads are served and the writes are aggregated, not in the API surface.
| Call | Operation |
|---|---|
getFeed(user, cursor) → posts[]
|
merge the user's followed communities' cached ranked lists and page the result |
getListing(subreddit, sort, cursor) → posts[]
|
read a community's precomputed ranked list (hot/top/new) from cache |
getComments(post, sort, cursor) → tree
|
fetch the top slice of a post's comment tree, sorted; reply branches load lazily |
vote(user, target, dir) |
record an idempotent vote on a post or comment; count updates asynchronously |
submitPost / addComment
|
write a post, or a comment with a parent_id into the thread |
The data model is posts, a comment tree, votes, and the ranked lists that make reads cheap:
| Entity | Notes |
|---|---|
post |
id, subreddit, author, title, body, created_ts, denormalised score and comment_count. Sharded by subreddit. |
comment |
id, post_id, parent_id (null for top-level), author, body, created_ts, score. The tree is the parent_id edges. |
vote |
(user_id, target_id) unique, plus dir (+1/−1). Uniqueness is what makes a vote idempotent — one user, one vote per target. |
ranked_list |
per-community sorted set (e.g. Redis ZSET) of post_id → hot_score, precomputed; the home feed is a merge of several of these. |
Step 4 — High-level design: the read-heavy service split
Now the boxes. Reddit is a read-dominated system fronted by caches, with the write-heavy vote path peeled off into its own asynchronous pipeline:
- Client → CDN / gateway: static assets and even whole hot listings are cacheable at the edge; the gateway routes to services.
-
Post & comment services: serve post bodies and comment trees from their stores (posts sharded by community, comments keyed by
post_id), fronted by a cache. - Feed / ranking service: owns the precomputed ranked lists — a sorted set per community updated as posts and votes come in — and builds the home feed by merging a user's followed communities' lists on read.
- Vote service → vote stream: a vote is recorded idempotently and emitted as an event; a stream/queue carries the flood, and aggregation workers fold votes into post/comment scores and update the ranked lists — asynchronously, never a row write per click.
- Stores: a sharded post/comment database (the source of truth), a counts store for scores, and a hot cache (sorted sets for ranked lists, cached listings and threads) that absorbs the read load.
Say explicitly that the home feed is built on read, not fanned out on write — because a user follows a bounded number of communities, merging their cached ranked lists at request time is cheap, and you avoid writing every new post into millions of followers' feeds (the celebrity fan-out trap from a Twitter-style design). And say that the vote path is asynchronous — votes become counts through a stream, so a viral post's flood grows a queue and a counter, not a row-lock. Naming the merge-on-read and the async vote path unprompted is a signal the interviewer is listening for.
Deep dive: ranking and the home feed
This is the first decision that actually decides the round. A listing that re-sorts the database on every page load dies at Reddit's read volume, so ranking is precomputed and the front page is assembled from cached lists, not sorted on demand.
The hot score. Each post gets a "hot" score that blends how good it is with how new it is, so fresh posts rise and old ones sink even if they keep collecting votes. The classic Reddit formula is roughly hot = log10(max(|score|, 1)) + sign(score) × seconds_since_epoch / 45000: the log10 means the first ten votes matter far more than votes a thousand-to-a-thousand-and-ten, and the time term gives newer posts a standing boost, so "hot" is votes dampened and time-decayed, not raw score. Other sorts are just different scores over the same list — top by raw score in a window, new by time, controversial by how balanced up and down are.
The ranked list. Per community, you keep a sorted set (a Redis ZSET and the like) of post_id → hot_score; a new post or a vote update bumps one member's score, which is cheap, and reading the top N of a community is an O(log N) range read from cache — no table sort. The home feed is then a merge on read: take the cached top slices of the communities a user follows, merge them by score, and page the result. Because people follow a bounded number of communities, this merge is cheap at request time — which is exactly why you do not fan a new post out into every follower's feed the way a Twitter design would. Heavily cache the per-community lists and even whole rendered listings, since millions read the same hot page.
"A post goes viral and the front page is hammered — how do you serve that listing to millions without re-ranking on every load?" The community's ranked list is a precomputed sorted set in cache; reads are a top-N range query, and the hot listing itself is cached so millions share one copy. The home feed merges followed communities' cached lists on read. Name the precomputed sorted set and merge-on-read.
Deep dive: nested comment trees at scale
This is the decision most candidates under-think. A Reddit thread is a tree that branches thousands of ways and runs dozens of levels deep, and you can neither load it all at once nor sort it naively.
Storing the tree. Each comment carries a parent_id (null at the top), so the thread is an adjacency structure — the edges are the parent_id pointers. To render a thread you fetch the top-level comments for a post_id, then their children, and so on; for very deep threads a materialized path (storing each comment's ancestry) lets you pull a whole subtree in one range read instead of walking level by level. Either way you shard comments by post_id so one thread lives together.
Sorting and lazy loading. You never render the whole tree. You load the top N top-level comments by the chosen sort, each with a few replies, and show "load more comments" to fetch deeper branches on demand — pagination of a tree, not a list. The default best sort is a confidence sort (a Wilson-style lower bound on the up-ratio), not raw score, because raw ratio lets a 2-up/0-down comment outrank a 2,000-up/100-down one; confidence sorting pulls the genuinely-good, well-sampled comments up and keeps a brand-new lucky comment from topping the thread. And the viral thread is a hot key again — a megathread with a million comments is cached aggressively and its hot subtrees served from cache.
"A thread has a million comments nested dozens deep — how do you store it, sort it, and render it without loading the whole tree?" Comments carry a
parent_id(adjacency), sharded by post; render the top-N top-level comments by a confidence/best sort with a few replies each, and lazy-load deeper branches with 'load more'; a materialized path pulls a subtree in one read. Name the tree storage, the confidence sort, and lazy loading.
System Design
HLD · Infrastructure · 60 min
Design Reddit out loud, with follow-ups
Deep dive: voting, counts and consistency
This is the write path, and it is where naive designs lock up. Votes are the highest-volume write on the site and they concentrate on exactly the posts everyone is looking at, so a synchronous "update the score column" per click turns a viral post into a single contended row.
Aggregate asynchronously. A vote is recorded idempotently — the (user_id, target_id) pair is unique, so a repeat click flips or no-ops rather than double-counting — and then emitted as an event onto a stream. Aggregation workers consume the stream and fold votes into the post's score in batches, updating the counts store and the ranked set, so a flood of votes becomes a steadily-updated counter instead of a million row-locks. Scores are therefore eventually consistent — the number ticks up a beat behind reality, which is completely fine for Reddit and worth saying out loud. Reddit even fuzzes the displayed vote counts slightly, both to make automated vote-manipulation harder to measure and because exactness was never the point.
De-dup and hot keys. Idempotency on (user, target) is what prevents double-voting under retries and races. And the hot-key problem returns: a viral post's counter is read by millions, so the current score is cached and served from cache, refreshed as aggregation advances — reads never hit the contended write path. This is the same shape as a flash-sale counter or a trending-Top-K system: bursty writes absorbed by a stream, aggregated, and read from cache.
"A viral post takes a million votes in minutes — how do you count them without a database write per click, and without counting one user twice?" Votes are idempotent on
(user, target)and pushed to a stream; aggregation workers batch them into the score and ranked set; counts are eventually consistent and read from cache. Name async aggregation, idempotent de-dup, and eventual consistency.
System Design
HLD · Infrastructure · 60 min
Defend ranking, comment trees and voting out loud
The follow-ups that decide the Reddit round
Scan the probes from each deep dive and they rhyme. Master these five and you are ready for a version of the question that is not drawn exactly like this one.
- "A post goes viral and millions load it — how do you serve the listing?" → A precomputed per-community sorted set in cache; reads are a top-N range query and the hot listing is cached, so millions share one copy. (problem solving)
- "How is the personalised home feed built?" → Merge on read from the cached ranked lists of the communities a user follows — not fan-out on write, because you follow a bounded number of communities. (communication)
-
"A thread is a million comments deep — how do you render and sort it?" → Comments by
parent_id(adjacency / materialized path), top-N top-level by a confidence/best sort, lazy "load more" for deeper branches. (technical execution) -
"A million votes a minute on one post — how do you count them?" → Idempotent on
(user, target), pushed to a stream, batch-aggregated into an eventually-consistent score read from cache. (problem solving) - "What's the real bottleneck at scale?" → Not storage — serving hot listings/threads from cache and absorbing the vote flood; the ranked-list cache and the async vote pipeline are where this system lives. (technical execution)
Each maps to a debrief dimension. Reading this list teaches you the answers; it does not teach you to deliver them while someone interrupts — that only comes from saying them out loud.
How to prepare: a one-week plan
You do not need fifty systems. You need this one cold and the framework automatic, so the next "design X" is just new nouns in the same five steps.
- Days 1–2: Learn the five-step framework until it is reflex. Do Reddit end to end on paper — requirements, estimate, data model, the client → gateway → post/comment/vote/feed services → stores/cache split.
- Days 3–4: Drill ranking and the feed: the hot score, per-community sorted sets, merge-on-read for the home feed, and why not fan-out on write. Say each tradeoff in one sentence.
-
Days 5–6: Own comment trees and voting —
parent_idstorage and materialized paths, confidence/best sort and lazy load, idempotent votes, async aggregation and eventual consistency. Answer each of the five follow-ups out loud. - Day 7: A full timed 60-minute round, narrating the whole way, with someone (or something) interrupting. This is the rep that counts.
This post is the deep walkthrough behind one row of the broader Top 25 system design interview questions — once the Reddit design is automatic, the same spine carries the rest of the list.
Frequently asked questions
How do I design Reddit step by step?
Follow the five-step HLD framework. Clarify requirements (communities, posts, nested comments, votes, ranked community listings and a ranked home feed — read-heavy, votes the dominant and bursty write, counts eventually consistent); estimate to show reads dwarf writes and votes spike on viral posts, so listings must be cache-served and votes aggregated asynchronously; define the read/write API and the post/comment/vote/ranked_list model; draw the read-heavy service split (client → CDN → gateway → post/comment/vote/feed services → sharded stores + vote stream + ranked-list cache); then deep-dive the three decisions that matter — ranking and the home feed, nested comment trees, and voting with asynchronous counts.
How does Reddit's hot ranking algorithm work?
Each post gets a "hot" score that blends quality with freshness so the front page keeps moving. The classic formula is roughly log10(max(|score|, 1)) + sign(score) × seconds_since_epoch / 45000: the log10 term means early votes count far more than later ones (ten votes matter, the ten-thousandth barely moves it), and the time term gives newer posts a standing boost, so an old post needs vastly more votes to outrank a fresh one. That score lives in a precomputed sorted set per community, so reading the top of a listing is a cheap range query rather than a sort, and other sorts (top, new, controversial) are just different scores over the same posts.
How does Reddit store and render deeply nested comments?
Each comment stores a parent_id (null for a top-level comment), so a thread is an adjacency tree whose edges are those pointers, sharded by post_id so one thread lives together; a materialized path (each comment's ancestry) can pull a whole subtree in one range read for very deep threads. Rendering never loads the whole tree — you fetch the top N top-level comments by the chosen sort with a few replies each and show "load more comments" to lazily fetch deeper branches. The default best sort is a confidence sort (a Wilson-style lower bound on the up-ratio), not raw score, so a well-sampled good comment beats a lucky two-vote one.
How does Reddit count votes at scale without double-counting?
A vote is recorded idempotently against a unique (user_id, target_id) key, so a repeated or retried click flips or no-ops instead of counting twice, and then it is emitted as an event onto a stream. Aggregation workers consume the stream and fold votes into the post's score in batches, updating the counts store and the ranked sorted set, so a viral post's flood becomes a steadily advancing counter rather than a million synchronous row updates on one contended row. Scores are therefore eventually consistent — slightly behind reality, which is fine for Reddit — and the current count is read from cache so the hot post's reads never touch the write path.
Should the Reddit home feed be fan-out on write or on read?
On read. Because a user follows a bounded number of communities, you can assemble the home feed at request time by merging the cached top slices of those communities' precomputed ranked lists and paging the result — cheap, and always current with the latest ranking. Fan-out on write (pushing every new post into every follower's materialized feed) is the pattern a Twitter-style timeline uses to make reads O(1), but it explodes on popular communities with millions of subscribers, the same way a celebrity's followers blow up a push model. Merge-on-read sidesteps that, which is why a Reddit-shaped feed is usually pull-based with heavy caching of the per-community lists.
How do I practise a system design interview out loud?
Reading a walkthrough is not the same as defending a design while someone interrupts. On Zynter, the HLD track runs live voice rounds modelled on how real system design loops run — you talk through a shared design on the canvas, and a voice interviewer pushes with the follow-ups above one at a time, then gives you a debrief on problem solving, communication, technical execution, and time management. The score is a practice signal, not a hiring decision.
Practise it on Zynter
You can draw the posts and comments. The round is won on ranking, trees and the vote pipeline.
Pick the Reddit round, draw the read-heavy service split on the canvas, and defend it out loud to a voice interviewer that keeps asking "how do you serve a viral listing to millions?" and "how do you count a million votes without double-counting?" — then read the debrief. Zynter.ai is on-demand mock interviews modelled on real company loops, with 150+ rounds across 20 companies including the HLD system design track (Sep 2026).




Top comments (0)