Engineering Decisions · Senior · Question 1 of 14
A social feed serves mostly users with a few hundred followers, plus some accounts with 50M. Reads must be fast. How do you build timelines?
- 1Fan-out on write for every account, including huge ones
- 2A hybrid: fan-out on write, except for huge accounts
- 3Fan-out on read, assembling every feed when opened
Show the answer
Correct answer: A hybrid: fan-out on write, except for huge accounts
Explanation
Precomputed timelines make reads fast for most accounts, and merging huge accounts at read time avoids millions of writes per post. Pure fan-out on write fits a network with no extreme accounts, but one celebrity post would flood the write path. Pure fan-out on read fits low-read systems and stays simple, but assembling each feed on every open gets too slow at this scale.