You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "flixgithub (GitHub)" <gi...@apache.org> on 2020/04/12 02:25:56 UTC

[GitHub] [dubbo-go] flixgithub commented on issue #467: tps limit leaky bucket implementation

> 我感觉中文可能更能解释清楚我的顾虑。
> 首先是,tps strategy定义的接口,两个参数分别是rate和interval,比如说,rate=20, interval=1000就代表 20/1000ms。即一秒内只能处理20个请求。所以我认为`leakyBucketStrategyCreator`的`create`方法不能直接调用NewLeakyBucket。
> 在这种“误用”之下,lb.balance是使用了interval这个指来初始化的,本质上,interval代表的是时间段,而`water = dur * lb.rate`应该是指,这么一个间隔时间内,应该允许多少请求。将balance和water相加,从量纲上分析就是不对的。
> 最后一点是 if lb.balance >= lb.limit ,是不是反了???

 因为这个接口的定义就两个参数,所以在尽量复用接口的情况下,对接口的参数也复用了,目前rate我的理解就是表示请求的速率,limit就表示窗口总的capacity;
water = dur * lb.rate 这个表示这个速率下流出的水量,也对应可以接受的请求总量
balance 其实表示一个虚拟的水位线的概念,可以比桶的limit大,初始值为桶的limit,water流出多少,就能接收多少的流入值,达到限流的目的


[ Full content available at: https://github.com/apache/dubbo-go/pull/467 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org