How it works
Chronological ordering makes the first version easy to reason about: newest eligible posts appear first. A ranked feed changes the product goal. The candidate stage still gathers allowed posts, but a ranking stage scores a bounded set using signals such as relationship strength, freshness, and prior interactions. The score is a derived value and may change as behavior changes. If scoring takes an example 0.1 ms per post, 500 candidates use 50 ms of the page’s latency budget.
Do not rank before access checks: a high score cannot make a private post visible. A ranking system also needs diversity, quality, and abuse controls; otherwise engagement signals can amplify spam. Decide early whether you are building a chronological feed or a ranked one, because the storage and pagination choices differ. Both are defensible: Instagram moved to a ranked feed in 2016, while Mastodon’s home timeline stays chronological.
For ranked pagination, pin a feed session, snapshot the candidate set, or carry an opaque continuation token that captures enough ordering state. Recomputing all scores between pages can reorder items: a post that falls from page one to page two appears twice, and one that rises onto page one is never seen. A snapshot costs memory, about 4 KB for 500 IDs at 8 bytes each, or 4 GB for a million open sessions. Measure both relevance and freshness, not only click rate.
A product switches from newest-first to “most relevant.” Why might the old timestamp cursor produce repeated posts?
Scores can move independently of creation time. A timestamp cursor no longer describes the ranked order; use a feed-session snapshot or continuation token tied to ranking state.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Candidate selection, authorization, and ranking are distinct stages.
- Ranked pagination needs an ordering contract across successive pages.