← 返回刚才阅读的位置

知识卡片

问题卡 · 4477

在线心跳平滑瞬时断线

理解等级:高级

在线状态服务在一定时间内收到心跳就保留在线判断,超过阈值再标离线,避免网络短暂抖动使状态频繁闪变。心跳间隔与离线阈值是体验和检测及时性的取舍,书中秒数只是演示。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 聊天 · 查看原书依据

      We introduce a heartbeat mechanism to solve this problem. Periodically, an online client sends a heartbeat event to presence servers. If presence servers receive a heartbeat event within a certain time, say x seconds from the client, a user is considered as online. Otherwise, it is offline. In Figure 12-18, the client sends a heartbeat event to the server every 5 seconds. After sending 3

    参考来源

    - 位置:《System Design Interview – An insiders guide, Second Edition》第12章《聊天》(来源项目 book-sources;源文件:extracted/System Design Interview – An insiders guide, Second Edition/_epub-src/text/part0029_split_003.html) - 结论依据:原文在该位置给出所述对象、机制或比较,支持本卡的解释;原书未展开的实现不作为已证明结论,算式与一致性边界在正文明确限定。 - 原始内容:We introduce a heartbeat mechanism to solve this problem. Periodically, an online client sends a heartbeat event to presence servers. If presence servers receive a heartbeat event within a certain time, say x seconds from the client, a user is considered as online. Otherwise, it is offline. In Figure 12-18, the client sends a heartbeat event to the server every 5 seconds. After sending 3