写点什么

模块五作业

作者:HZ
  • 2022 年 5 月 08 日
  • 本文字数:808 字

    阅读完需:约 3 分钟

基于模块 5 第 6 课的微博实战案例,分析“微博评论”这个核心场景的业务特性,然后设计其高性能高可用计算架构,包括但不限于如下内容:

1. 计算性能预估(不需要考虑存储性能);

2. 非热点事件时的高性能计算架构,需要考虑是否要拆分独立的服务;

3. 热点事件时的高可用计算架构。


Functional Requirement

  1. Add comment to Weibo post


Capacity Estimation

In Sep 2020, Sina Weibo hosts roughly 511M monthly active users, or 224M daily active users.

Supposed each user publishes 1 post every day, and each post has 20 comments on average. Then the total number of comment posting requests per day is:

20 * 1 * 224M ==> 4.5B
复制代码

QPS for write requests:

4.5B / 86400 ==> 52K
复制代码

Peak QPS for write requests:

52K * 3 = 156K
复制代码

Supposed for each post, every user reads 10 comments on average. Then:

QPS for read requests: 26K

Peak QPS for read requests: 26K * 3 = 78K


Cache Design

Read comment:

Since comment is not static resource, CDN is not applicable for caching comment.


Load Balancer Design


High Availability Design

Read Comment

When a post becomes hot, above caching design still works. Further more, the comments of the post can be distributed and cached in multiple comment servers. Due to the significant number of comments, there is no need to show same comments to users. Showing random comments is an good option. With that in mind, each server can simply return the comments in its own cache for an incoming read request. There is no need to combine comments cached in different servers or DB.


Write Comment

When user sends a write request to add new comment, the request is stored in message queue. Each comment server picks the task from the message queue asynchronously.


用户头像

HZ

关注

还未添加个人签名 2022.03.06 加入

还未添加个人简介

评论

发布
暂无评论
模块五作业_架构实战营_HZ_InfoQ写作社区