9. Push(Figure)User A
UpdateActionInbox
(Append to 1’s
home timeline)Inbox
(Append to 2’s
home timeline)Inbox
(Append to 3’s
home timeline)Followers of User A
= 1, 2, 3
10. Push优点:实现简单,首选
缺点:分发量
11. Pull发表:存到自己outbox(轻)
查看:所有关注对象Inbox(重)
12. Pull
13. Pull优点:节约存储
缺点:计算量大
14. 微博是一个消息分发系统
可采取推或拉的方式实现
15. 架构挑战:峰值
- 如除夕、春节
16. 请求量如果发表量5,000万/天
平均:578条/秒
设计系统容量:2,000?
17. IO瓶颈峰值:5,000 – 10,000?
100,000?
18. 后果Latency
DB read timeout
前端 timeout (503 error)
解决方案?
19. 异步设计不同步等待
将消息存入消息队列(Message Queue)
轻量级的发表
20. MQ productsKestrel by twitter
RabbitMQ, an Erlang Queue Server
Memcacheq
在新浪微博项目大规模使用
35. Read-through and Write-throughProducts or projects
MySQL memcached UDF
Cache money for Ruby on Rails
Or wrap a proxy for the db driver, in any language
38. Multiget问题When memcached servers are CPU bound, adding more memcached servers doesn't help serve more requests.
- Jeff Rothschild, Vice President of Technology at Facebook