QA
Intermediate LevelSystem Design & Architecture

How do you design a News Feed System (Push/Fan-out on Write vs Pull/Fan-out on Read)?

❓ Interview Prompt: Explain News Feed architecture, Fan-out on Write (Push) vs Fan-out on Read (Pull), hybrid celebrity handling, and feed ranking algorithms.

Designing a social media News Feed System (Facebook/Twitter):

2 Fan-out Strategies:

β€’
Fan-out on Write (Push): When a user posts, the system pushes post IDs directly into every follower's feed cache in Redis. Fast reads ($O(1)$), but fails for celebrities with 50 million followers!
β€’
Fan-out on Read (Pull): Followers fetch posts from followed accounts when opening the app. Fast writes, slow reads.
β€’
Hybrid Approach: Use Fan-out on Write for regular users, and Fan-out on Read for celebrity accounts!

Code Implementation Example

markdown
Hybrid News Feed Fan-Out Architecture:

[User Post] ──> [Fan-Out Worker]
                      β”œβ”€β”€ (Regular User) ──> Push to Followers' Redis Feed Caches
                      └── (Celebrity)   ──> Save to Celebrity Post DB (Pulled on Read)
πŸ’‘Hybrid Fan-out strategy for social media News Feed systems.
🎯 Interview Key Takeaway

Use a hybrid fan-out model: push posts for regular users to Redis feed caches, and pull posts dynamically for high-follower celebrity accounts.

#System Design#News Feed#Fan-out#Caching#Intermediate
Back to all System Design & Architecture Questions→

More System Design & Architecture Interview Questions

Beginner LevelSystem Design & Architecture

Explain the CAP Theorem and PACELC Theorem with real-world database examples.

Beginner LevelSystem Design & Architecture

What is Vertical Scaling (Scale Up) vs Horizontal Scaling (Scale Out)?

Beginner LevelSystem Design & Architecture

How do Load Balancers distribute traffic (Round Robin, Least Connections, IP Hash)?