Stage 5 · Architecture patterns · Medium · 20 min

Event-driven fan-out: push vs pull

When someone posts, copy the post into every follower's feed at once (push), or build each feed when it is opened (pull). Learn when to mix the two.

What each interview level is expected to know

Learn first: Caching strategies, Message queues and Kafka

After this lesson you can:

  • Compare fan-out on write with fan-out on read for a news feed.
  • Explain the celebrity problem, and how a mixed design solves it.
  • Handle deleted posts and out-of-order items in feeds.

Start here

See it in 60 seconds

Push a post, or pull it

A new post can be copied into every follower's feed at once, or fetched when they open the app; big apps mix both.

Scene 1 of 6 · A new post

Someone with 3 followers posts a photo, and all 3 home feeds should show it.

PosterPoster3 followersPost servicePost serviceFeed listsFeed listsFollowersFollowers
  • Poster — healthy — 3 followers
  • Post service — healthy
  • Feed lists — healthy
  • Followers — healthy
Feed writes for one post
not shown yet
Reads each time a feed opens
not shown yet
  1. A new post. Someone with 3 followers posts a photo, and all 3 home feeds should show it.
  2. Push: copy it out. With push, the post is copied into each follower's feed list right away: 3 small writes.
  3. Opening is instant. Opening the app then reads one ready-made list, so the feed appears at once.
  4. A star posts. But a star with 10,000,000 followers makes 10,000,000 feed writes for one post, which can take minutes.
  5. Pull: build on open. With pull, nothing is copied; each open asks every followed account for new posts, say 200 reads.
  6. Mix the two. So big apps push for most accounts, and pull only for the few with over 50,000 followers.
  7. Now you try. Pick how many followers the poster has. For example: 10,000,000 followers: pure push makes 10,000,000 feed writes per post; pure pull makes none, but each open reads about 200 accounts. Above about 50,000 followers, a mixed design skips the copies: each open reads its ready-made list plus this account's posts.

Scene 1 of 6: A new post. Someone with 3 followers posts a photo, and all 3 home feeds should show it.

Key points

  1. Push copies each post into every follower's feed list, so opening the app is instant.
  2. Pull copies nothing; each feed is built when its owner opens the app, which is slower.
  3. A star with millions of followers makes push write millions of feeds for one post.
  4. So many apps push for most accounts and pull only for those above about 50,000 followers.

In plain words

Say an account with 3 followers shares a photo. With push, the system writes the post into all 3 followers' feeds straight away: 3 small writes. When a opens the app, their feed is one ready list. Now a star with 10,000,000 followers posts. Push means 10,000,000 writes for that one post, and the last followers see it minutes late. With pull, nothing is copied at post time. A feed is put together only when its owner opens the app, by asking every account they follow. That makes opening slower. Copying one post out to many followers is called .

Real feeds mix the two. Posts from ordinary accounts are pushed, so most feeds are ready lists. Posts from the few huge accounts are pulled when a follower opens the app, and merged into that ready list. Where the line between ordinary and huge sits is a setting, chosen by weighing the cost of writes against the delay on reads.

The problem it solves

Feeds are read far more often than posts are written, so a feed should be ready before its owner asks. But building it ahead of time costs one write per follower for every post. For most accounts that is a few hundred writes. For a star it is millions, all for a single post.

Why it matters

A feed must open fast for every user, and a post must reach every follower. Those two goals pull against each other when one account has 10 million followers. The same choice comes up in feed, timeline and notification designs, so interviewers expect you to know both sides.

A worked example

Say an account has 200,000 followers, and writing one follower's feed entry takes about 3 ms. Push then costs about 200,000 × 3 = 600,000 ms of write work for one post, which is 600 seconds, or 10 minutes, of combined work. Pull instead adds no extra writes at post time; the feed for each follower builds only when that follower opens the app.

Think of it like…

Think of a newspaper. Push is home delivery: a copy is dropped at every reader's door, wanted or not. Pull is a newsstand: nothing is delivered, and each reader walks over when they want one.

Where this analogy stops working

Work at sending time against work at reading time is the useful part. But a newspaper is the same for everyone. A feed is different for each reader. With pull, the system must gather posts from every account the reader follows. Real feeds mix both: push for most accounts, pull for the largest.

Try it

See it working

Case study · Live model

How a news feed is built

1,000 users each follow 20 others, and most follow 2 celebrities. Build feeds by push, pull or a mix, then let a celebrity post, and compare reads, copies and delays.

Try it

Lab time 3.0 s
workers copyreadsPosting users, 4 posts/sPosting users4 posts/s14 postsPost store, all postsPost storeall posts14 storedFan-out queue, 300 copies/sFan-out queue300 copies/s0 copies waitingFeed store, a feed per userFeed storea feed per user271 copies writtenFeed service, PushFeed servicePush1.0 reads per loadReading users, 20 loads/sReading users20 loads/s30% of users active
  • Posting users — 4 posts/s — healthy — 14 posts
  • Post store — all posts — healthy — 14 stored
  • Fan-out queue — 300 copies/s — healthy — 0 copies waiting
  • Feed store — a feed per user — healthy — 271 copies written
  • Feed service — Push — healthy — 1.0 reads per load
  • Reading users — 20 loads/s — healthy — 30% of users active
  • New post
  • Copies queued
  • Copies written
  • Feed opened
  • Database read
  • Feed shown
Reads per feed load
1.0
Feed load time
13 ms
illustrative: 10 ms + 3 ms a read
Copies written
94/s
Fan-out backlog
0
copies waiting; 0 posts not yet everywhere
Slowest post delivery
0.14 s
normal posts finished in the last 5 s
Copies for users who never read
70%
Watch: last 5 s

Numbers add up:271 copies queued = 271 written + 0 waiting; every stored feed holds only posts by accounts its user followsThe lab checks this sum as it runs, so a counting mistake would show here.

Controls

How feeds are built
Strategy

Fan-out on write: each new post is copied into every follower's stored feed.

300 copies a second

How fast the fan-out workers write copies into stored feeds.

Users
4 a second
20 a second
30%

Only active users ever open their feed.

Fan-out backlog (copies waiting)
012.52537.5501s2s3s
Show data table
TimeBacklog
1s30
1s0
2s0
2s0
3s0
3s7
Copies written per second
0501001502001s2s3s
Show data table
TimeCopies/s
1s35
1s121
2s142
2s56
3s15
3s87

What just happened

Nothing yet. Start traffic or run an experiment.

What this model simplifies
  • 1,000 users, each following 20 others at random. Real follow graphs are far more uneven, with many accounts in between normal users and celebrities.
  • Celebrities post only when you press the button. A pulled feed reads each followed account once; real systems cache those reads.
  • Feed load times are illustrative: 10 ms plus 3 ms per database read. Real pull reads run side by side, so the true cost is database load and slow outliers more than adding up.
  • Push copies a post to every follower. Real systems skip followers who have not logged in for a while, and keep only the newest few hundred posts in each feed.

Also try: Kafka: partitions, replication & delivery

Mechanics

How it works

The pictures follow this page's numbers: 200 followers, a star with 10,000,000, and a threshold of 50,000. The workers write a stated 100,000 feed entries a second.

  1. Push model (fan-out on write)

    When a user posts, workers add the post's id to a stored feed for each follower. A user with 200 followers causes 200 small writes. Reading a feed is then one fast lookup, because the list is already built. A stored feed is often called a timeline.

  2. The celebrity problem

    Pick a case to follow below

    With this case: Pushing to 200 followers took 200 writes and 2 ms.

    Poster, shares a photoPostershares a photoPosts, by author, NOWPostsby authorsaved onceNOWWorkers, copy post idsWorkerscopy post idsStored feeds, one per userStored feedsone per userReader, follows 200Readerfollows 200
    • Poster — shares a photo — healthy
    • Posts — by author — healthy — NOW — saved once
    • Workers — copy post ids — healthy
    • Stored feeds — one per user — healthy
    • Reader — follows 200 — healthy
    • Post or lookup
    • Feed write
    Step 1 of 2

    Step 1 of 2 · Posts

    Done: An ordinary account shares a photo

    What happens
    The post is saved once. It has 200 followers.
    Why
    Push builds each follower's feed now, so reading it later is fast.
    What changes
    The fan-out workers start copying its id into feeds.
    Next
    The workers write 200 feed entries
    Feed writes for this post
    0
    Last follower sees it after
    –
    not done yet

    Step 1 of 2: Posts. An ordinary account shares a photo. The post is saved once. It has 200 followers.

    A user with 10 million followers causes 10 million writes for one post. The workers fall behind, and followers see the post minutes late. Other users' posts wait in the same behind it.

    In the picture, a post to 200 followers takes 200 writes and 2 ms. A star's post takes 10,000,000 writes and 100 seconds, and an ordinary post made a second later waits behind it.

  3. Pull model (fan-out on read)

    Pick a case to follow below

    With this case: The stored feed opened with 1 lookup, because push had built it ahead of time.

    Poster, shares a photoPostershares a photoPosts, by authorPostsby authorWorkers, copy post idsWorkerscopy post idsStored feeds, one per user, NOWStored feedsone per user1 lookupNOWReader, follows 200Readerfollows 200
    • Poster — shares a photo — healthy
    • Posts — by author — healthy
    • Workers — copy post ids — healthy
    • Stored feeds — one per user — healthy — NOW — 1 lookup
    • Reader — follows 200 — healthy
    • Feed
    Step 1 of 1

    Step 1 of 1 · Stored feeds

    Done: The system reads one stored list

    What happens
    The reader's feed was built as each post was made.
    Why
    Push did the work when the posts were made.
    What changes
    The feed is ready to show.
    Next
    The run ends here.

    How it ended. The stored feed opened with 1 lookup, because push had built it ahead of time.

    Lookups to open the feed
    1
    ready-made list
    Merge at read time
    no

    Step 1 of 1: Stored feeds. The system reads one stored list. The reader's feed was built as each post was made.

    Nothing is stored per follower. When a user opens the app, the system fetches recent posts from everyone they follow and merges them. Posting is cheap, but every feed read does much more work: 200 lookups for a user who follows 200 accounts.

    In the picture, a reader who follows 200 accounts opens the app. With a stored feed, that is 1 lookup. With pull, it is 200 lookups and a merge, on every open.

  4. Hybrid

    Poster, shares a photoPostershares a photoPosts, by author, NOWPostsby authorsaved, not pushedNOWWorkers, copy post idsWorkerscopy post idsStored feeds, one per userStored feedsone per userReader, follows 200Readerfollows 200
    • Poster — shares a photo — healthy
    • Posts — by author — healthy — NOW — saved, not pushed
    • Workers — copy post ids — healthy
    • Stored feeds — one per user — healthy
    • Reader — follows 200 — healthy
    • Post or lookup
    • Feed
    Step 1 of 3

    Step 1 of 3 · Posts

    Done: A star posts, and nothing is pushed

    What happens
    The star has over 50,000 followers, so the post is only saved.
    Why
    Pull for stars removes the 10 million writes.
    What changes
    Ordinary accounts' posts are still pushed as before.
    Next
    The reader's stored feed holds posts from 198 accounts
    Feed writes for a star's post
    0
    Lookups to open the feed
    0
    not opened yet

    Step 1 of 3: Posts. A star posts, and nothing is pushed. The star has over 50,000 followers, so the post is only saved.

    What these pictures simplify. These pictures use a stated rate of 100,000 feed writes a second and whole lookups. Real systems add more workers, cache feeds, and tune the threshold. The news feed case study builds a whole feed system.

    Use push for most users and pull for the few with huge followings, for example over 50,000 followers. At read time, the system merges the stored feed with fresh posts from the stars that user follows. The threshold is a number you tune, not a fixed rule.

    In the picture, the reader follows 198 ordinary accounts and 2 stars. A star's post costs 0 feed writes. Opening the feed takes 3 lookups: the stored feed and one for each star.

Use it when

  • A home feed or timeline that must open fast: push builds it ahead of time, so a read is one lookup.
  • Notifications for an event many people follow, such as a goal in a match: one event is copied to every follower's device.
  • Activity lists in a shared workspace: each member sees the changes made by the people and projects they follow.
  • Accounts with very large followings, or users who rarely open the app: pull does the work only when someone reads.

Skip it when

  • A page that shows only the user's own data, such as their orders: one query answers it, and nothing needs to be copied.
  • Push for followers who never open the app: the writes and the stored feeds are wasted. Build feeds only for recently active users.
  • Pull alone when users follow thousands of accounts: every open then needs thousands of lookups.

Check yourself

With fan-out on read, when is a user's feed built?

Judgement

Trade-offs and how it fails

What you give up

Reads vs writes
Push makes reads cheap and writes costly: one write per follower, including followers who never look. Pull makes writes cheap and reads costly: every open queries each followed account.
Memory
Stored feeds take memory for every user. Keep only post ids in them, not the posts, and cap each list at a fixed length, such as a few hundred ids.

Failure modes

  • One star blocks the queue: a post to 10 million followers fills the fan-out workers, and ordinary users' posts wait behind it. Give large fan-outs their own queue, or use pull for those accounts.
  • Feeds stored for everyone: users who have not opened the app in months still take memory and writes. Keep feeds only for recently active users, and rebuild one when its owner returns.
  • A deleted post stays in feeds: its id was copied into millions of lists. Check that the post still exists when a feed is read.
  • Out-of-order feeds: the fan-out is still running, so some followers see a reply before the post it answers.

In the real world

  • Twitter engineer Raffi Krikorian gave a talk in 2012, written up on High Scalability in 2013. It gives about 300,000 timeline reads a second, home and search together, against 6,000 write requests. That gap is why Twitter built timelines at write time. Source: High Scalability: Twitter's architecture (2013) (checked 14 October 2026)
  • The same write-up says Twitter kept ready timelines only for users active in the last 30 days. It was also moving accounts with very large followings to a merge at read time. Source: High Scalability: Twitter's architecture (2013) (checked 14 October 2026)
  • LinkedIn's engineering blog (2016) describes FollowFeed, which builds each feed at read time. In LinkedIn's tests, ready-made feeds for every member needed about 62 times more data. Source: LinkedIn engineering: FollowFeed (2016) (checked 14 October 2026)

Trade-offs to be ready to discuss: Fanout push vs pull

Check yourself

Why do stored feeds usually hold only post ids, and only a few hundred of them?

Interview

What interviewers look for

  • For a feed design, give both models and then mix them: "Push for most accounts, pull for the few with very large followings."
  • Give the numbers that force the choice: "200 followers is 200 writes. 10 million followers is 10 million writes for one post."
  • Bound the cost: "We store feeds only for recently active users, and each list holds post ids only, up to a cap."
  • Say what a follower of a star sees: "Their feed is the stored list, merged with the star's recent posts at read time."

Say it out loud: How does a hybrid of push and pull solve the celebrity problem in a feed?

An account with 10 million followers posts. With fan-out on write for everyone, what goes wrong?

Expected depth by interview level

Levels describe the depth interviewers probe, not years of experience. Choose a level on the learning path to highlight it.

JuniorUseful
Events decouple services.
MidCore
Fan-out on write vs on read for feeds.
SeniorCore
The celebrity problem, hybrid fan-out, stream processing.
StaffExpected
Event-driven boundaries between teams.

Practice

Apply it

Three harder questions

The first two use the idea on a new case. The last asks you to judge a design.

Apply it

A hybrid feed uses push for accounts under 50,000 followers and pull above that. A user follows 300 accounts, and 3 of them are over the line. What happens when the user opens the feed?

Apply it

With push for everyone, 1,000 users each post once, and each has 200 followers. How many feed writes does that cause?

Judge a design

A post that breaks the rules is deleted. Its id was pushed into 3 million feeds, and a clean-up job will remove it over the next hour. What else should the design do?

Next: stream and batch processing, two ways to turn a flow of events into results.

Go deeper

Sources and further reading

First-hand sources to check this page against and to go further. They are standards, official docs, original papers, and guides from engineering and security teams. Each link was opened on 8 November 2026.