Command Palette

Search for a command to run...

PHASE 12Advanced ~7 min· topic 8 of 39Level 2

System 12.8 — News Feed

In one line

The read-path emphasis of Twitter: ranking, dedupe, pagination and the per-user inbox model.

0/39 · 0%

Think of it like this

Your Instagram or LinkedIn home page: a blended, ranked stream pulled from everyone you follow, refreshed constantly, and never showing you the exact same post twice even as you keep scrolling.

Key ideas

  1. 01

    Feed = merge of followings' recent posts, ranked by score (recency + engagement + network), deduped, paginated.

  2. 02

    Two construction views again: pull-merge (N followings, small reads) vs push-inbox (precomputed) — hybrid as before.

  3. 03

    Ranking on push: rank at read time over a small inbox horizon (last 500 events), not a global sort.

  4. 04

    Pagination: cursor-based on (time, id) — ORDER BY created DESC turns into WHERE ts < cursor — no offsets.

  5. 05

    Caching hierarchy: hottest feeds in memory (Caffeine/Redis), next in Redis Cluster, DB as fallback (usual L1/L2).

  6. 06

    Data freshness: eventual consistency; the feed may miss a just-posted item by seconds — say it.

  7. 07

    Existence as a feed-system: the same design serves LinkedIn/Reddit/IG home — naming that transfers is a senior signal.

Code & diagrams

FeedReadArchitecturediagram

Same hybrid fan-out as Twitter, with a ranking step inserted right before the response leaves the building.

Rendering diagram…

Explain without notes

01

Why is cursor pagination required at feed scale — what breaks with page=5&size=20?

Practice

01

Design ranking score (time decay + engagement) and the inbox horizon size with reasoning.

Trade-offs

  • ↔

    Push gives fast reads + write cost; pulling celebrities on read bounds the write burst. The hybrid is the interview.

Run it in production

Completion checklist

  • I can design a feed with hybrid construction, ranking, cursor pagination, and cache hierarchy.

Back to phase