知识卡片

问题卡 · 4412

滑动日志精确约束窗口

理解等级:中级

滑动日志记录请求时间戳,每次移除窗口外记录,再计入当前请求并判断数量。它能检查任意滚动窗口,但内存随记录数量增长;书中示例连拒绝请求也留在日志,需明确统计的是尝试还是成功请求。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 限流器 · 查看原书依据

      Sliding window log algorithm As discussed previously, the fixed window counter algorithm has a major issue: it allows more requests to go through at the edges of a window. The sliding window log algorithm fixes the issue. It works as follows: •The algorithm keeps track of request timestamps. Timestamp data is usually kept in cache, such as sorted sets of Redis [8]. •When a new

    参考来源

    - 位置:《System Design Interview – An insiders guide, Second Edition》第04章《限流器》(来源项目 book-sources;源文件:extracted/System Design Interview – An insiders guide, Second Edition/_epub-src/text/part0009_split_002.html) - 结论依据:原文在该位置给出所述对象、机制或比较,支持本卡的解释;原书未展开的实现不作为已证明结论,算式与一致性边界在正文明确限定。 - 原始内容:Sliding window log algorithm As discussed previously, the fixed window counter algorithm has a major issue: it allows more requests to go through at the edges of a window. The sliding window log algorithm fixes the issue. It works as follows: •The algorithm keeps track of request timestamps. Timestamp data is usually kept in cache, such as sorted sets of Redis [8]. •When a new