How it works
Fanout on write adds a post ID to each eligible follower’s timeline as the author publishes. Reads become cheap because the candidate list is ready, but a high-follower author creates many writes and inactive followers consume needless work. Fanout on read queries followed authors’ recent posts when a reader opens the feed, reducing idle writes but increasing read latency and merge cost.
As an example, an author with 2 million followers posts 10 times a day, and 5% of followers open the app that day. Pushing costs 20 million inbox writes, of which 19 million go to people who do not look today. Pulling costs no writes, but each of the 100,000 active readers must fetch and merge that author’s posts on every feed load.
A hybrid pushes ordinary authors to follower inboxes and leaves very large authors in their own recent-post indexes. At read time the feed service merges the reader’s inbox with recent posts from those high-follower authors. Twitter engineers have publicly described this kind of design. The threshold is a measured choice based on follower count, active-reader fraction, publish rate, fanout lag, and read latency. A hybrid also means two read paths to test, so a network without extreme accounts can stay with push alone.
Avoid treating a follower count as a complete cost estimate. One million inactive followers differ from one million readers refreshing now. Bound work with queue partitions, per-author limits, and backpressure. Changing an author between push and pull needs a transition rule so posts are neither absent nor shown twice.
A musician with 20 million followers publishes twice a day. Most followers open the app weekly. Which fanout choice deserves testing?
Pull the musician’s recent posts for active readers, or use a hybrid that selectively pushes to active followers. Pushing 20 million entries per post wastes work for inactive accounts; validate the resulting read merge latency.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Write fanout trades extra writes for fast reads; read fanout does the reverse.
- Hybrid fanout handles skew and must define deduplication during strategy changes.