查看: 3573| 回复: 7
跳转到指定楼层
上一主题 下一主题
收起左侧

[题目讨论] Grokking Design Messenger 讨论

全局:

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
看到Grokking the system design interview的这一段不太明白,M1不是发的早于M2吗,但是为什么User2会先看到M2?

另外那个sequence number 怎么存啊?另外为什么存messages要用Hbase而不是cassandra? cassandra不是也可以configure成highly consistency吗?

How does the messenger maintain the sequencing of the messages?
We can store a timestamp with each message, which is the time the message is received by the server.
This will still not ensure correct ordering of messages for clients.
The scenario where the server timestamp cannot determine the exact order of messages would look like this:
         1        User-1 sends a message M1 to the server for User-2.
         2        The server receives M1 at T1.
         3        Meanwhile, User-2 sends a message M2 to the server for User-1.
         4        The server receives the message M2 at T2, such that T2 > T1.
         5        The server sends message M1 to User-2 and M2 to User-1.
So User-1 will see M1 first and then M2, whereas User-2 will see M2 first and then M1.
To resolve this, we need to keep a sequence number with every message for each client.
This sequence number will determine the exact ordering of messages for EACH user.
With this solution both clients will see a different view of the message sequence,
but this view will be consistent for them on all devices.


上一篇:有意思的后台管理系统 求加米呀
下一篇:ID讨论
全局:
本帖最后由 发帖不留名 于 2019-6-5 02:43 编辑

这个课说真的很多地方讲的都不好,很多细节不讲清,有些方案具体怎么做也不讲就是一句话带过,Uber的那章也是在乱讲。这个课只能浏览一下看看idea,网上多搜搜别的资源对照着看才行。
比如YouTube上搜design Facebook messenger 有不少人都出了视频讲怎么设计,或者直接搜system design有那么几播主把常见的系统设计都讲了。放一个playlist https://www.youtube.com/playlist ... alSjVkgxV-VH6EPyvoX

评分

参与人数 3大米 +4 收起 理由
haoshenxiong + 2 这个课确实讲得很不好+1
kyzgz + 1 赞一个
14417335 + 1 欢迎分享你知道的情况,会给更多积分奖励!

查看全部评分

回复

使用道具 举报

全局:
Cassandra虽然也是列式数据库,但是用CQL规范化成了表,随意增加列了。而用hbase可以一列存一个message,column key可以是时间。

补充内容 (2019-6-4 22:01):
*不能随意增加列了
(只是形式上的限制,column key在CQL表中可以是一列数据,CQL表不方便增加列,但是column key仍然是可以作为一行数据来添加的。)
所以我觉得Cassandra也可以用。
回复

使用道具 举报

🔗
14417335 2019-6-5 03:36:48 | 只看该作者
全局:
sweetkonfyt 发表于 2019-6-4 08:52
Cassandra虽然也是列式数据库,但是用CQL规范化成了表,随意增加列了。而用hbase可以一列存一个message,co ...
不能随意增加列了


不知道我是否明白你的意思,但是Cassandra里除了List,Set,CQL在一个Partition Key下仍然是wide row所以仍然可以随意增加列。
回复

使用道具 举报

🔗
 楼主| sal12 2019-6-5 10:46:34 | 只看该作者
全局:
这篇文章说,Hbase好的原因是他用simpler consistency model:
"HBase comes with very good scalability and performance for this workload and a simpler consistency model than Cassandra. " from https://www.facebook.com/notes/f ... sages/454991608919/
回复

使用道具 举报

🔗
wliu051234 2019-6-5 10:51:38 | 只看该作者
全局:
我给作者发了很多suggestion 都没回, oop的更有问题 仅供参考
回复

使用道具 举报

全局:
14417335 发表于 2019/06/05 03:36:48


不知道我是否明白你的意思,但是Cassandra里除了List,Set,CQL在一个Partition Key下仍然是wide row所以仍然可以随意增加列。

我一开始想的是,
CQL建的表有schema, 要增加列,需要alter table.
此处的列和hbase的列不是一个概念。
Hbase的列不在schema中,其实是个sort key.

不过后来发现,Cassandra可以选一列作为sort key. hbase的增加列,就变成了cassandra的增加行。内部存储是一样的。
回复

使用道具 举报

🔗
kekekeng 2022-7-23 14:07:50 | 只看该作者
全局:
本帖最后由 kekekeng 于 2022-7-22 23:47 编辑

赞赞赞很有帮助
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表