Question presented to candidate:
"Design the home news feed for a social network like Facebook or LinkedIn. People follow friends, pages and groups, and when they open the app they should see the most relevant posts first, not just the newest. Assume a few hundred million daily users."
What a strong answer should cover:
Requirements and a capacity estimate: feed requests per second at peak, candidates per request, and why scoring every candidate with a heavy model is unaffordable
The pipeline: candidate generation (fan-out or pull from the people and pages you follow), multi-stage ranking (a cheap filter then a heavier model), then filtering (privacy, blocks, already seen) and hydration of post ids into full posts
Why a ranked feed cannot use offset pagination or a plain score cursor, and how a per-session feed snapshot gives stable pages while new posts wait behind a "new posts" banner
Seen-state and impression logging, which feed both deduplication and the ranking model
Storage choices: feed caches hold ids not post bodies, posts live in a sharded store, counters are aggregated asynchronously; what breaks first at 10x
Clarifying questions expected:
Ranked or chronological? If ranked, is there an existing model, or do we design the ranking signals too?
What sources feed the feed: only people you follow, or also groups, pages, recommendations and ads?
How fresh must it be: should a friend post appear within seconds, or is a minute fine?
Code / implementation expected: Optional โ a scoring function and a pagination demo that shows duplicates with offsets and stable pages with a snapshot; the example does both and computes the capacity numbers.
news-feed
2
Try it yourself
Sketch your approach before you read the solution. That is what the interview tests.
Stuck? Get a hint.
A short nudge toward the approach. It will not give the answer away.
3
Solution
Target Audience: Engineers preparing for a senior system design round. You know what a server, a database and a cache are; feed-specific ideas are defined as we go.
Difficulty: Hard
Verified with: Node 22.22 and Python 3.12 (both print identical output). Product facts are cited inline and were checked in October 2026.
How to read this doc: Every idea is explained in plain language first, then tagged with ๐ Interview term: so you also learn the words an interviewer expects. All numbers in the capacity and pagination sections come from the example program; the Verified section quotes its full output. The sibling question How would you design Twitter's timeline at scale? covers fan-out on write vs read in depth; this page focuses on what changes when the feed is ranked.
1. Why This Even
The solution is hidden so you can try first
16 min read ยท 16 sections
4
Read the code
Ranked news feed: capacity, scoring candidates, and offset vs keyset vs snapshot pagination when scores change between pages