Home › Blog › Fan-out on write vs fan-out on read

Fan-out on write vs fan-out on read

The short answer: fan-out on write pre-computes each reader's feed so reads are cheap and writes are expensive; fan-out on read assembles at query time so writes are cheap and reads are expensive. Real systems at scale use both, split by how many followers an author has.

The two approaches

Fan-out on write (push)Fan-out on read (pull)
On publishInsert into every follower's feedWrite once to the author's own timeline
On readRead one pre-built listQuery all followees and merge
Read latencyLow and predictableHigher, grows with following count
Write costO(followers)O(1)
StorageDuplicated per followerSingle copy
Breaks whenAn author has millions of followersA reader follows thousands of authors

Why fan-out on write breaks at the top

An account with ten million followers generates ten million inserts per post. At any meaningful posting rate that is a write storm that dominates the cluster, and the latency of the author's own publish becomes unacceptable if it waits for completion. Doing it asynchronously helps the author but does not reduce the work - and during a spike the backlog means some followers see the post minutes late, which is its own product problem.

The number that drives the design: the follower-count distribution is extremely skewed. The overwhelming majority of accounts have few followers, and a vanishing minority have millions. That skew is exactly what makes a hybrid work.

The hybrid, which is what large systems actually run

Details that come up as follow-ups

How to answer this in an interview

State both approaches and their asymmetry, then immediately ask about the follower distribution and the read-to-write ratio, because those two numbers decide it. Proposing the hybrid without first establishing the skew reads as recalled rather than reasoned. Related designs are in design a news feed and design a notification system.

Where CoPilot Interview fits

Disclosure: we build an interview assistant, so treat this as a disclosed pitch. CoPilot Interview is a native Windows and macOS app that puts suggested answers on your own screen in about two seconds, across coding, system design and behavioral rounds, with a permanent free tier that needs no credit card.

Frequently asked questions

What is the difference between fan-out on write and fan-out on read?

Fan-out on write inserts a post into every follower's pre-built feed, making reads a single cheap lookup and writes O(followers). Fan-out on read writes once and assembles the feed by querying all followees at read time, making writes cheap and reads more expensive.

Why does fan-out on write break for large accounts?

An account with millions of followers generates millions of inserts per post, which dominates write capacity and causes backlogs where some followers receive the post minutes late. Doing the fan-out asynchronously protects the author's publish latency but does not reduce the total work.

What does a hybrid feed design look like?

Fan-out on write for ordinary accounts, since the follower distribution is heavily skewed toward small counts, combined with fan-out on read for a small number of very large accounts whose posts are merged into the feed at query time. The threshold is tuned operationally rather than being a principled constant.

How do you handle deletes with fan-out on write?

Store only post IDs in each follower's feed and resolve content at read time, so a delete or edit affects one record rather than millions of copies. The trade-off is that the read path regains a join, which partly erodes the reason for pre-computing feeds.

Walk into the round with a second pair of eyes

CoPilot Interview is a native Windows and macOS app that puts suggested answers on your own screen in about two seconds, across coding, system design and behavioral rounds. The free tier is permanent: 15 minutes a day, no credit card.

Try it free