Twitter News Feed Design

  1. Member Graph: 会员关系图
  2. News Feed: 每条微博或者sns里的新鲜事等我们称作feed
  3. Write Based Fanout Approach:基于写的扩散方案
  4. User Timeline: 就是一个指定的用户发布的所有tweet
  5. Home Timeline: 是你所有关注用户user timeline的一个临时合并
  6. Social Proof:社会认同(means looking at the number of retweets, favorites, and replies)

Twitter/微博最大的挑战是有大量关注者的名人发Twitter/微博时候,如何发送Twitter/微博?(These high fanout users are the biggest challenge for Twitter)

Twitter Write Flow

timeline(Stored in Redis Cluster):
 uid:long
 twitter_id:long
 Bits for status

Tweet Service, User Service, Social Graph Service 保存在MySQL集群中。

Twitter Timeline设计

  1. 把每个活跃用户相关的信息保存在内存以降低延迟。
  2. 用户Home Timeline保存在Redis集群中,有长度限制,如800条。并有多个copy保证高可用。
  3. 如果用户Home Timeline不在Redis集群,会启动一个重建过程,并存入Redis集群。
  4. 只把User Timeline数据保存到磁盘。
  5. Twitter写入是,fanout daemon将查询跟踪者IDs,把Twitter_Id插入Redis集群中相应用户的Home Timeline,写一条Twitter的时间复杂度是O(n)。(这是一个可以优化的地方,对于关注者特别多的人,可以在read的时候,merge他、她的Twitter)。

Twitter搜索设计

  1. Twitter写入时,把得到的tokens写入Lucene集群中的一台。
  2. 搜索时候用scatter-gather模式,搜索Lucene集群中的所有机器,并处理所有返回结果。

几个大型网站的Feeds(Timeline)设计简单对比

References

  1. Software Engineering Best Practices: What are the best practices for building something like a News Feed
  2. [微博feed系统的推(push)模式和拉(pull)模式和时间分区拉模式架构探讨](http://www.cnblogs.com/sunli/archive/2010/08/24/twitter_feeds_push_pull.html
  3. What are the scaling issues to keep in mind while developing a social network feed?
  4. Real-Time Systems at Twitter
  5. Timelines at Scale
  6. Real-Time Delivery Architecture at Twitter
  7. http://www.slideshare.net/XiaoJunHong/feed-26666858
  8. The Architecture Twitter Uses To Deal
  9. https://www.youtube.com/watch?v=rP9EKvWt0zo
  10. 亿级用户下的新浪微博平台架构
  11. https://github.com/tschellenbach/Stream-Framework 12. The Architecture Twitter Uses To Deal With 150M Active Users, 300K QPS, A 22 MB/S Firehose, And Send Tweets In Under 5 Seconds 13. 新浪微博Feed服务架构
  12. Case Study: Staple Yourself to a Tweet--总结比较好
  13. How Twitter Handles 3,000 Images Per Second

results matching ""

    No results matching ""