Design Twitter (Full Scale)

Hard

Design a global social media platform like Twitter. This covers high-volume ingestion, hybrid fan-out, real-time analytics, search indexing, and system reliability at the scale of 500 million tweets per day.

What to design

  1. What are the core functional requirements for Twitter?
  2. What are the non-functional requirements? Think about scale, read/write ratio, latency, availability, and consistency trade-offs.
  3. Design the core APIs — tweet creation, timeline retrieval, follow/unfollow, search, and engagement actions.
  4. Which database would you choose for storing tweets, and how would you partition and handle engagement counters (likes/retweets)?
  5. How would you design the Social Graph service to store follow relationships at scale?
  6. How will you generate unique IDs for billions of tweets across multiple data centers?
  7. How will you handle the fan-out problem for home timeline generation? Compare push vs pull models.
  8. What data structure and storage strategy would you use for the pre-computed timeline cache?
  9. How will you handle media uploads (images/videos) and serve them at low latency globally?
  10. How would you design the Search service to let users find tweets by keywords in near real-time?
  11. How do you detect and surface Trending Topics in real-time?
  12. How would you design the Notification service for mentions, likes, and new followers?