🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

Design Twitter

System Design ProblemsSocial Media SystemsđŸŸĸ Free Lesson

Advertisement

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

  1. Post tweets (text, images, videos, polls)
  2. View home timeline (tweets from followed users)
  3. View user timeline (tweets from a specific user)
  4. Follow/unfollow users
  5. Like, retweet, reply to tweets
  6. View trending topics
  7. Search tweets by keywords/hashtags
  8. Real-time notifications

Non-Functional Requirements

  1. Availability: 99.99% uptime
  2. Latency: Timeline loads < 200ms
  3. Consistency: Eventual consistency acceptable
  4. Durability: Tweets must never be lost
  5. Scale: 500M tweets/day, 600K timeline reads QPS

Back-of-the-Envelope Estimation

High-Level Architecture

ClientsAPI Gateway / Load BalancerTweet ServicePost/StoreTimelineFan-outSocial GraphFollow GraphSearchIndex/TrendingMediaUpload/CDNNotificationPush/EmailMessage Queue (Kafka)Tweet Store(Cassandra)Timeline Cache(Redis Cluster)Graph Store(MySQL/Sharded)Search Index(Elasticsearch)Object Store(S3/GCS)Trending Service (Count-Min Sketch + Decay)

Timeline Generation Deep Dive

Home Timeline Architecture

User ATweetsFan-outServicePush tweet_idUser B CacheUser C CacheUser D CacheTimelineReadHydrate tweets

Celebrity Handling

Need Expert System Design Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement