SteelReed

Search

Search posts, questions…

System DesignQuestion 21 / 26

Middle

What is the difference between fan-out on write and fan-out on read when designing a news feed?

Short answer

Fan-out on write (push) inserts the post id into every follower's inbox at post time: very fast reads, expensive writes. Fan-out on read (pull) gathers posts when the feed opens: cheap writes, slow reads. Real systems use a hybrid.

noyes, celebrityNew postAuthor hashuge follower count?Push: post idinto follower inboxesPull: gather at readOpen feed: merge,cursor pagination

3 points to say:

  1. Push: fast reads, O(followers) writes; pull: one write, expensive reads; the hybrid decides by follower count and activity.
  2. Inboxes store only post ids; content is hydrated at read time.
  3. Paginate with a cursor, not offset; fan-out runs asynchronously through Kafka.

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.