KatInterview

Designing a Ranked Personal Content Feed at Scale

System DesignModel answer
HardModel answerSystem Designsystem designfeed designrecommendation system

Last updated

Architect a scalable, personalized news feed system that handles hybrid fanout, multi-stage recommendation pipelines, stable cursor pagination, and instant post soft-deletions.

Problem Overview

Design the architecture for an interactive, personalized home feed service (similar to LinkedIn or X). Users publish text/media updates, follow other entities, and consume an infinite-scrolling feed of ranked posts combining content from connections/followees with recommended out-of-network content.

System Requirements

Functional Requirements

  1. Publish & Delete Content: Users can publish new items and instantly delete existing ones.
  2. Social Graph Management: Support direct follow/unfollow functionality.
  3. Personalized Ranked Feed: Deliver a single stream blending in-network posts and out-of-network discoveries, sorted dynamically by predicted user engagement.
  4. Stable Pagination: Provide consistent cursor-based pagination that prevents duplicate items or skipped content as fresh posts land continuously.

Non-Functional Requirements & Metrics

  • Scale: 100 Million Daily Active Users (DAU).
  • Read/Write Ratio: Heavily read-skewed (~20:1). Average 10 feed refreshes/page requests per DAU per day (~1B total read requests/day). Approximately 50 Million new posts created per day (~580 writes/sec average, peaking at ~2,000 writes/sec).
  • Latency: p99 response time for feed generation under 200 milliseconds.
  • Data Freshness & Availability: High availability for feed reads; eventual consistency (within a few seconds) for content delivery to followee feeds.

What Your Design Should Cover

  1. High-Level Architecture & Data Stores: Detail the write ingestion path, read generation pipeline, and database selections (post storage, graph engines, and cache topologies).
  2. Hybrid Fanout Strategy: Address how to scale content distribution efficiently, taking into account normal vs. high-follower ("celebrity/influencer") accounts.
  3. ML Retrieval & Heavy Ranking Pipeline: Map out candidate generation (in-network inbox + vector ANN search), filtering (blocks, seen items, tombstones), real-time feature hydration, multi-stage model scoring, and payload hydration.
  4. Pagination & Consistency Guarantees: Define a robust cursor strategy that maintains pagination stability during active sessions, along with fast-path soft deletion/privacy enforcement.

Hints

Hint 1

Consider how write amplification changes when an account has 50 followers versus 50 million followers. Avoid blindly pushing writes to massive follower lists.

Hint 2

Decouple candidate ranking from payload hydration: scoring thousands of post IDs is cheap, but fetching rich user profiles and high-res media metadata for 2,000 items on every request will blow through your 200 ms latency budget.

Hint 3

Using simple numeric offsets for an infinitely updating feed causes items to shift positions between page requests. Think about session-based snapshots or cursor tie-breakers.