微博架构Ppt5. Push
• 将feed比喻成邮件
• Inbox: 收到的微博
• Outbox: 已发表微博
• 发表:存到所有粉丝inbox(重)
• 查看:直接访问Inbox(轻)
• Offline computation
10. Cache
memory is the new disk,
and disk is the new tape.
for "real-time" web applications,
and systems that require massive scalability
- Jim Gray
12. 微博cache架构
Weibo cache arch
Inbox hot cache
Outbox Vector cache Archive cache
Social Following Followers users
Graph
Content Hot cache Total
15. Social Graph cache
• Following ids
• Followers加载开销比较大
• 上百万粉丝
• 越大的集合越容易变更
• 改变则需delete all
• 减少使用followers list场景
18. 发表流程
Update Workflow
Update status
Content cache Hot Inbox Vector Outbox vector
Content cache
replication
20. 首页feed
Home timeline Workflow
home_timeline
aggregator
Content hot
Inbox cache Outbox Vector
cache
Inbox archive Inbox archive Content cache
23. 流量
• 以打开首页时候获取Content cache为例
• multi get n 条feed(n = items/页, e.g. 50)
• cache 大小 = n * (feed长度 + 扩展字段,
e.g. 2k)
• 并发请求,如 1,000次/秒
• 总流量 = 50 * 2k * 1,000 / sec = 100MB
26. hot keys
• content cache of 姚晨
• create local cache
1. get user_yaochen_local
2. get user_yaochen
1. set user_yaochen_local:value
3. 删除时需要delete all