News Feed
Decide when a post reaches its readers. Compare fan-out on write and on read, handle accounts with millions of followers, and paginate a feed that keeps changing underneath the reader.
Lessons
- 01Define the feed promiseAgree on who can publish, who may read, and how fresh the timeline must feel.
- 02Commit the post before fanoutKeep one canonical post, then distribute lightweight references asynchronously.
- 03Keep media off the post rowStore post metadata and media bytes in systems suited to their different access patterns.
- 04Choose where fanout happensPush common posts to inboxes, pull very large audiences at read time, and mix both when needed.
- 05Assemble one feed pageGather candidate IDs, enforce current visibility, hydrate post data, and return a stable page.
- 06Separate candidates from orderStart with recency, then add ranking without making the source of truth depend on a score.
- 07Repair derived state when rules changeTreat timeline entries as disposable pointers and recheck access at the final read boundary.
- 08Measure the feed that readers receiveWatch publish-to-visible delay, queue lag, read latency, cache behavior, and privacy failures.