Interview's MateSystem Design
Interview's Mate

System Design

Architecture & trade-offs

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
All topics/System Design Case Studies
RELIABILITY, SECURITY & CASE STUDIES · SUBTOPIC

Case Study: Social News Feed (Twitter / Instagram)

Hybrid fan-out (push for normal users, pull for celebrities), Redis timeline caches, and cursor pagination.

IntermediatePart of System Design Case Studies
Practice in AI HLD
Subtopics in System Design Case Studies (8)
OverviewURL ShortenerNews FeedChat AppUber / Ride-HailingYouTube / StreamingDropbox / DriveWeb CrawlerNotification System

In plain words

Most users have a few hundred friends, so when they post, a worker drops the post ID into each follower’s fast Redis list. Mega-celebrities with 50M followers skip that push and get merged live when you open your feed.

Think of it like…

Delivering morning newspapers to subscribers’ mailboxes (push) while putting celebrity breaking news on a billboard everyone reads (pull).

Loading interactive diagram
Loading interactive exercise

Theory & how it works

Why storing only Post IDs in Redis timelines saves 95% RAM

Never duplicate full post text, avatars, and media URLs into 5,000 followers’ caches! Store only compact 8-byte post_ids in Redis (ZSET scored by timestamp), then hydrate the top 20 posts from a shared post:{id} cache in one MGET.

Key points & practical guide

Summary checklist

  • Hybrid fan-out solves both read speed and celebrity write storms
  • Store IDs only in timeline lists and hydrate via MGET
  • Use cursor pagination (before_post_id) instead of OFFSET

When to use it

  • Home feeds, activity streams, community timelines

Watch out for

  • Fanning out synchronously during the POST /tweet request

Quick check

Loading quiz
Previous subtopic
Case Study: URL Shortener (TinyURL / bit.ly)
Next subtopic
Case Study: Real-Time Chat (WhatsApp / Slack)