← 返回刚才阅读的位置

知识卡片

问题卡 · 4413

滑动计数近似滚动负载

理解等级:高级

滑动计数器用当前窗口计数加上一窗口计数乘重叠比例,近似滚动窗口请求量。例:3 加 5 乘 0.7 为 6.5;原文写成 0.7% 是算式笔误。该方法省内存,但依赖上一窗流量近似均匀的假设。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 限流器 · 查看原书依据

      Assume the rate limiter allows a maximum of 7 requests per minute, and there are 5 requests in the previous minute and 3 in the current minute. For a new request that arrives at a 30% position in the current minute, the number of requests in the rolling window is calculated using the following formula: •Requests in current window + requests in the previous window

    参考来源

    - 位置:《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) - 结论依据:原文在该位置给出所述对象、机制或比较,支持本卡的解释;原书未展开的实现不作为已证明结论,算式与一致性边界在正文明确限定。 - 原始内容:Assume the rate limiter allows a maximum of 7 requests per minute, and there are 5 requests in the previous minute and 3 in the current minute. For a new request that arrives at a 30% position in the current minute, the number of requests in the rolling window is calculated using the following formula: •Requests in current window + requests in the previous window