Advertisement
goodwish

Design Twitter

Sep 30th, 2019
618
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. Design Twitter
  2.  
  3. 200 million daily active users (DAU), 100 million new tweets every day.
  4.  
  5. How many favorites per day?
  6. 200M users * 5 favorites => 1B favorites
  7. How many total tweet-views will our system generate?
  8. 200M DAU * ((2 + 5) * 20 tweets) => 28B/day
  9. Storage Estimates
  10. 100M * (280 + 30) bytes => 30GB/day
  11. Bandwidth Estimates. Since total ingress is 24TB per day, this would translate into 290MB/sec.
  12.  
  13. write, new tweets, 100M/86400s => 1150 tweets per second
  14. read 28B/86400s => 325K tweets per second.
  15.  
  16. Database Schema.
  17.  
  18. table: tweet, user, user_follow, favorite(tweet_id, user_id)
  19.  
  20. What database will you choosing between SQL and NoSQL databases?
  21. - query performance, easy to maintain, reliability. etc.
  22.  
  23. 7. Data Sharding
  24.  
  25. How to shard our data to distribute our data onto multiple machines such that we can read/write it efficiently?
  26. user_id,
  27. tweet_id,
  28. tweet_create_date,
  29. ..
  30.  
  31. 8. Cache
  32.  
  33. Which cache replacement policy would best fit our needs?
  34.  
  35. How can we have a more intelligent cache?
  36.  
  37. What if we cache the latest data?
  38.  
  39. hash table + doubly linked list: owner_id + tweet_id(s)
  40.  
  41. 9. Timeline Generation
  42. see facebook newsfeed.
  43.  
  44. 12. Monitoring
  45.  
  46. What metrics/counters can be collected to get an understanding of the performance of our service?
  47.  
  48. 13. Extended Requirements
  49.  
  50. How do we serve feeds?
  51. Trending Topics?
  52. Who to follow? How to give suggestions?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement