知识卡片
令牌桶约束速率与突发
桶有最大容量并按速率补充令牌,每次调用消耗令牌,允许的突发受容量约束。没有令牌时可拒绝、复用旧结果或排队;三者的业务含义不同,排队还会消耗内存。原书样例的共享令牌和定时器生命周期需要同步与退出设计,不能仅有补充令牌循环就保证正确限流。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Cloud Native Patterns · 查看原书依据
The most common algorithm for implementing rate-limiting behavior is the “token bucket3“, which uses the analogy of a bucket that can hold some maximum number of tokens. When a function is called, a token is taken from the bucket, which then refills at some fixed rate. The way that a Throttle treats requests when there
参考来源
- 位置:《Cloud Native Go》第04章《Cloud Native Patterns》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch04.xhtml)
- 结论依据:桶有最大容量并按速率补充令牌,每次调用消耗令牌,允许的突发受容量约束。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。
- 原始内容:The most common algorithm for implementing rate-limiting behavior is the “token bucket3“, which uses the analogy of a bucket that can hold some maximum number of tokens. When a function is called, a token is taken from the bucket, which then refills at some fixed rate. The way that a Throttle treats requests when there