← Lessons

quiz vs the machine

Gold1380

System Design

The Fan Out Service

Spreading one incoming event to many recipient feeds, choosing between write time and read time delivery.

5 min read · core · beat Gold to climb

What it is

A fan out service takes a single event, such as a new post, and delivers it to the feeds of many followers. The core design choice is when to do the work: at write time or at read time.

Fan out on write

When a post is created, the service immediately writes a copy into each follower feed.

  • Reads are fast because the feed is already built.
  • Writes are expensive when an account has millions of followers.

Fan out on read

The feed is assembled on demand by pulling recent posts from accounts the reader follows.

  • Writes are cheap because nothing is precomputed.
  • Reads are slower and heavier under load.

The hybrid

Most large systems combine both. Ordinary accounts use fan out on write, while celebrity accounts with huge follower counts use fan out on read to avoid a write explosion. The reader merges precomputed entries with a few pulled at query time.

Key idea

A fan out service decides whether to copy an event into follower feeds at write time or assemble feeds at read time, and large systems blend both to handle celebrity accounts.

Check yourself

Answer to earn rating on the learn ladder.

1. What is the main cost of fan out on write for a celebrity account?

2. Why do large systems use a hybrid fan out strategy?