Real-world Systems
12 min forge

Instagram/Twitter Feed Design

Designing a scalable news feed system that handles millions of posts and followers.

πŸ“Έ News Feed Design

1. Requirements

  • Post content (images/text)
  • View feed of followed users
  • High availability, low latency

2. Generation Models

  • Push (Fan-out on Write): Post is pushed to all followers' caches. Good for small followings.
  • Pull (Fan-out on Read): Feed is built at request time. Necessary for celebrities.
  • Hybrid: Push for regular users, Pull for celebrities.

3. Storage

  • Redis for pre-computed feeds.
  • S3 for media.
  • NoSQL for post metadata.