NewsFeed System Design
In this lesson3 sections
NewsFeed System Design
Interview exercise: a feed during a breaking event
Design a hypothetical social feed for users who follow people, groups, and pages. A small number of publishers can have very large audiences, while most accounts have modest audiences. The feed should remain useful during a sudden surge in posting and reading.
Allow about 60 minutes. Begin with a following-only feed, then discuss recommendations as an extension. Agree on page size, ordering, acceptable feed delay, and the behavior of deleted or newly private posts before drawing components.
Start with the two expensive operations
Trace one new post to its eligible readers. Identify the authoritative post commit, the reliable event that starts feed work, and any per-recipient entries written afterward. Estimate work from the author’s active audience and posting rate, not just the total number of users.
Then trace a feed read. Show where candidate IDs come from, how details are retrieved, where access checks run, and how the next-page cursor works. Explain what happens when a cached list contains a deleted post or an author the reader no longer follows.
Choose a fanout policy
The rest of this lesson is for Premium members
Premium opens every lesson in this course, along with all questions and solutions on PracHub.