System Design Problems
Design Twitter
Twitter serves 400M+ monthly active users with 500M+ tweets daily. This design covers tweet distribution, timeline generation, trending topics, and real-time search.
- Scale â 400M MAU, 500M tweets/day, 600K QPS reads
- Timeline â Home timeline vs user timeline with fan-out
- Trends â Real-time trending topics with decay algorithms
Twitter's core challenge is the celebrity problem: a single tweet from a popular account must reach millions instantly.
Requirements Clarification
Functional Requirements
- Post tweets (text, images, videos, polls)
- View home timeline (tweets from followed users)
- View user timeline (tweets from a specific user)
- Follow/unfollow users
- Like, retweet, reply to tweets
- View trending topics
- Search tweets by keywords/hashtags
- Real-time notifications
Non-Functional Requirements
- Availability: 99.99% uptime
- Latency: Timeline loads < 200ms
- Consistency: Eventual consistency acceptable
- Durability: Tweets must never be lost
- Scale: 500M tweets/day, 600K timeline reads QPS