System Design Interview Roadmap

System Design Interview Roadmap

System Design Walkthrough

Design Reddit’s Front Page — Walkthrough

Oct 06, 2026
∙ Paid

The probe

Reddit’s front page is community-aggregated content ranked by the “hot” algorithm. The interesting system design question is: how do you maintain a ranked list across thousands of subreddits with millions of concurrent voters, without recomputing the full ranking on every vote?

The Hot Algorithm

Reddit’s hot score for a post: score = log10(max(abs(ups - downs), 1)) + sign(ups - downs) * seconds_since_epoch / 45000

This decays old posts naturally without a cron job — the time term shrinks the relative contribution of votes as a post ages. An hour-old post needs 10× more upvotes to rank above a brand-new post.

Architecture

- Vote events:

User upvotes → Kafka → vote aggregation worker → update posts.score in the posts table

- Front page:

Precomputed per-subreddit sorted lists in Redis ZSETs, score = hot algorithm value. On vote: re-score the post and ZADD with new score. Front page read = ZREVRANGE /r/all 0 24 — O(log N)

- The r/all problem:

r/all aggregates top posts from all subreddits. At peak, millions of posts compete. Maintain a separate ZSET for r/all, updated when any subreddit post’s score enters the top-1000 of its subreddit

- New posts:

Use a separate new ZSET per subreddit sorted by created_at. New tab = ZREVRANGE on this set. No algorithm needed.

- Award/controversy:

Track controversiality score (high upvotes AND high downvotes) in a separate sorted set for the controversial sort

Get Access to GitHub Repo


User's avatar

Continue reading this post for free, courtesy of System Design Roadmap.

Or purchase a paid subscription.
© 2026 SystemDR Inc · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture