← Lessons

quiz vs the machine

Silver1060

System Design

The News Feed Problem

Why building a social feed is hard once millions of users and follows collide.

4 min read · intro · beat Silver to climb

What a feed must do

A news feed shows each user a stream of recent posts from accounts they follow, newest and most relevant first. It sounds simple, but the scale makes it one of the classic hard problems in system design.

The core tension is between read and write. Every post by one user may need to appear in the feeds of millions of followers, and every feed open must assemble content from hundreds of followed accounts.

Why it is hard

  • Reads are constant and huge. People refresh feeds far more often than they post.
  • The follow graph is uneven. Some accounts have a handful of followers, some have tens of millions.
  • Users expect feeds to load in milliseconds, not seconds.
  • Content keeps arriving, so the feed is never a fixed result you can compute once.

The two ends of the spectrum

  • Fan out on write precomputes each user feed when a post is made.
  • Fan out on read assembles the feed fresh at request time.

Real systems blend the two and add caching and ranking on top.

Key idea

A news feed is a read heavy fan out problem where one post must reach many feeds fast, forcing tradeoffs between precomputing on write and assembling on read.

Check yourself

Answer to earn rating on the learn ladder.

1. What is the central tension in feed design?

2. Why can a feed not be computed just once?