Skip to main content
SDMastery
medium6 min readUpdated 2026-10-03

Design Reddit

Design Reddit with subreddits, voting (hot/top/controversial algorithms), threaded comment trees, and karma.

Quick answer: Design Reddit

Design Reddit is covered here as a practical system design interview problem. Design Reddit with subreddits, voting (hot/top/controversial algorithms), threaded comment trees, and karma. Use it to practice requirements, APIs, storage choices, scaling bottlenecks, data consistency, observability, and failure handling for a medium interview round.

Focus on the problem being solved, the main design choice, the failure mode, and the tradeoff you would defend in front of a senior engineer. This page is part of the DosiBridge system design knowledge graph, so it links related concepts, interview problems, tradeoffs, and references instead of leaving the topic isolated.

Diagram showing the key components and data flow in a Design Reddit system design
High-level overview of Design Reddit

Problem Statement

Design a community-driven content platform like Reddit with subreddits, post/comment voting, ranking algorithms (hot, top, new, controversial), nested comment threads, and a karma system. The system must handle viral posts with millions of votes while keeping ranking scores fresh.

Requirements

System architecture diagram for Design Reddit showing how services, databases, and caches connect
System architecture for Design Reddit

Functional

  • Create subreddits with rules and moderators; subscribe/unsubscribe
  • Submit posts (text, link, image) to subreddits; upvote/downvote posts and comments
  • Rank posts by Hot (time-decayed score), Top (by time range), New, and Controversial
  • Display comment threads as nested trees with collapsible replies

Non-Functional

  • Latency: Front page and subreddit feed loads in <500ms
  • Scale: 50M DAU, 100K new posts/day, 10M comments/day, 500M votes/day
  • Consistency: Vote counts eventually consistent (1-2s delay acceptable); comment tree structure strongly consistent
  • Availability: 99.95% -- read-heavy system (100:1 read-write ratio)

Core Architecture

Step-by-step diagram showing how Design Reddit processes a request from start to finish
How Design Reddit works step by step
  1. Ranking Engine -- Computes Hot score using Reddit's formula: score = log10(max(|ups - downs|, 1)) + sign(ups - downs) * (post_timestamp - epoch) / 45000. This gives newer posts a time-based boost while heavily-upvoted posts stay visible longer. Scores are recomputed asynchronously on vote events and cached in Redis sorted sets per subreddit.

  2. Vote Processing Pipeline -- Votes are written to Kafka, deduplicated (one vote per user per item), and aggregated. A vote flipping from up to down is a delta of -2. Aggregated counts are flushed to the database every 5 seconds. Redis holds the real-time approximate count for display.

  3. Comment Tree Service -- Comments are stored with a materialized path (e.g., "c1/c2/c5") enabling efficient subtree queries. Each comment has parent_id and a depth field. Tree rendering sorts by score within each depth level. Deep threads (>5 levels) show a "Continue this thread" link and load lazily.

Data flow diagram for Design Reddit showing how requests and responses move through the system
Data flow through Design Reddit
  1. Content Moderation Pipeline -- Combines automated filters (spam detection, banned words, URL blacklist) with human moderator actions. AutoModerator rules are evaluated on post/comment creation. Reported content enters a moderation queue. ML models flag potential policy violations for human review.

Database Choice

PostgreSQL for posts, comments, subreddits, and user profiles -- relational queries for comment trees (materialized path with LIKE prefix queries) and subreddit membership. Redis sorted sets for ranked feeds per subreddit (ZADD with Hot score, ZREVRANGE for feed). Cassandra for vote records -- write-heavy (500M/day), partitioned by item_id, simple lookup pattern. Elasticsearch for post and subreddit search.

Interview preparation checklist for Design Reddit with key points to mention and mistakes to avoid
Interview tips for Design Reddit

Key API Endpoints

text
GET /api/v1/r/\{subreddit\}/\{sort\}?cursor=\{score\}&limit=25
  -> Returns: \{ posts: [\{ id, title, author, score, num_comments, created_at \}], next_cursor \}

POST /api/v1/vote
  -> Body: \{ item_id: "P-123", item_type: "post", direction: "up" \}

GET /api/v1/posts/\{post_id\}/comments?sort=top&depth=5
  -> Returns: \{ comments: [\{ id, body, score, replies: [...recursive...] \}] \}

Scaling Insight

Approximate vote counts are the key to handling Reddit's vote volume. Instead of incrementing a counter in the database for every vote, votes are buffered in Kafka and flushed in batches every 5 seconds. The displayed count is the last flushed value + an in-memory delta from Redis. Users see a near-instant response to their vote (optimistic UI update), while the backend processes votes asynchronously. This reduces database write pressure from 500M individual updates to ~10M batched updates per day.

Decision guide for when to choose Design Reddit and when alternative approaches are better
When to use Design Reddit

Key Tradeoffs

DecisionOption AOption BChosen
Comment storageAdjacency list (parent_id)Materialized path ("c1/c2/c5")Materialized path -- faster subtree queries, single query loads a full thread
Vote countingExact real-time countApproximate batched countApproximate -- 5s delay invisible to users, 50x reduction in DB writes
RankingPrecomputed scores in cacheComputed on readPrecomputed -- amortizes calculation cost, sub-ms feed reads from Redis sorted sets

Original DosiBridge notes for Design Reddit

This section is written specifically for this page, not copied from a general system-design checklist. The useful way to study Design Reddit is to connect the concept to a production service where growth exposes the first weak assumption in the original design. That framing changes the design discussion from definitions to operating choices.

What makes this topic distinct

  • Core Entity: For Design Reddit, decide the core entity before choosing tools; otherwise the design looks clean but fails when reddit changes.
  • Read/Write Path: For Design Reddit, decide the read/write path before choosing tools; otherwise the design looks clean but fails when reddit changes.
  • Contention Point: For Design Reddit, decide the contention point before choosing tools; otherwise the design looks clean but fails when reddit changes.
  • Abuse Path: For Design Reddit, decide the abuse path before choosing tools; otherwise the design looks clean but fails when reddit changes.
  • Recovery Workflow: For Design Reddit, decide the recovery workflow before choosing tools; otherwise the design looks clean but fails when reddit changes.

Design Reddit correctness boundary

For this problem, separate the user-visible action from background work. The correctness boundary is the smallest state transition that must not be duplicated, lost, or reordered. Naming that boundary makes the solution more original than a stock API/database/cache template.

Design Reddit scaling bottleneck

The first bottleneck should be described in the language of this system: a hot timeline, a contested seat, a busy wallet ledger, a media-processing queue, or a search index update delay. That bottleneck decides which component deserves the deepest interview discussion.

Production review question

If Design Reddit suddenly receives 10x traffic, which entity becomes contested first, and what queue, lock, shard, or cache protects that entity without hiding correctness bugs?

Practical metric to track

Track reddit health as a named dashboard or review item: combine one user-facing metric, one saturation metric, and one correctness metric. For Design Reddit, this keeps the discussion grounded in behavior that can be measured after deployment instead of generic advice that sounds good in an interview but never gets verified.

Sources