Feed System Basics

A feed system (e.g. news feed, timeline) shows the latest content from followed accounts. Common patterns: pull, push, hybrid. This article explains each and when to use it with a reference table.

Overview

  • Pull: On feed load, fetch follow list, then pull latest content from those accounts, aggregate and sort. Compute on read; when a celebrity has many followers, each follower read pulls that content → hot spot.
  • Push: On post, push to all followers' feed lists (write fan-out). Read is direct; when a celebrity has many followers, write amplification is high.
  • Hybrid: Push for normal users, pull for celebrities; or push for recent, pull for older. Balances read and write load.

Example

Example 1: Comparison

PatternReadWriteBest for
PullAggregate on read; can be slowSimple writeFew follows, high real-time need
PushFast; read own listWrite fan-out; hard for celebritiesFew follows, few celebrities
HybridMixedMixedMany celebrities, many followers

Example 2: Storage

  • Feed list: Redis sorted set (score = timestamp), or MongoDB, or dedicated store. Follow graph: graph DB or relation table. Content: object storage + DB metadata.

Example 3: Ordering and pagination

  • Reverse chronological; cursor-based pagination (last_id, last_ts) to avoid offset deep pagination.

Example 4: Consistency

  • Feed can be eventually consistent; push async after post; user sees it on refresh.

Core Mechanism / Behavior

  • Pull: O(follows) reads per feed load; cache follow list and content per author.
  • Push: O(followers) writes per post; store precomputed feed per user.
  • Hybrid: Push for small fan-out; pull for large (e.g. celebrity threshold).

Key Rules

  • Handle celebrities separately: Hybrid or pull-only to avoid write amplification.
  • Cold/hot split: Recent feed from cache; older from storage; load on demand.
  • Consistency: Feed can be eventual; push async; user sees on refresh.

What's Next

See Pagination, Redis ZSet, Cache Strategy. See High Concurrency Toolkit for high-concurrency design.