burst limit /burst Threshold/burst Time 之间的关系

burst limit /burst Threshold/burst Time

分层的令牌桶HTB


HTB (Hierarchical Token Bucket) is a classful queuing discipline that is useful for
applying different handling for different kinds of traffic. Generally, we can set only
one queue for an inte***ce, but in RouterOS queues are attached to the main
Hierarchical Token Bucket (HTB) and thus have some properties derived from that
parent queue. For example, we can set a maximum data rate for a workgroup and
then distribute that amount of traffic between the members of that workgroup.


HTB是用于流量分类控制的经典理论。通常只对一个接口进行流量控制,但ROS使用了HTB理论,
比如说,可以先限制一个工作组的流量然后在此工作组内部再一次细分流量。流量控制还挺复杂
的,神仙觉得。

Each class in the hierarchy can prioritize and shape traffic. There are 2 main 
parameters in RouterOS :
* limit-at - data rate that is guaranteed to a class (CIR)
* max-limit - maximal data rate that is allowed for a class to reach (MIR)

两个主要参数:
limit-at : 稳定速率
max-limit : 最大速率

* CIR(Committed Information Rate) - the guaranteed data rate. It means that traffic
rate, not exceeding this value should always be delivered
* MIR(Maximal Information Rate) - the maximal data rate router will provide

CIR:保底速率。不超过这个的速率总是允许的
MIR:最大速率

Each HTB class can be in one of 3 states, depending on data rate that it consumes:
每个HTB层级都有三种状态:绿、黄、红(winbox中queue可以看到三种颜色的图标)

* green - a class the actual rate of which is equal or less than limit-at. At this state,
the class is attached to self slot at the corresponding priority at its level, and is 
allowed to satisfy its limit-at limitation regardless of what limitations its parents 
have. For example, if we have a leaf class with limit-at=512000 and its parent has
max-limit=limit-at=128000, the class will get its 512kbps!

绿色:指当前速率小于或等于稳定速率(limit-at)。这个状态下,当前层级由自己自行控制,不受
上级层级控制。比如说,如果某个层级设定的稳定速率为512kbps,其上级层级的稳定速率设定为
128kbps,那么此层级在绿色状态下享受512kbps的速率

* yellow - a class the actual rate of which is greater than limit-at and equal or less
than max-limit. At this state, the class is attached to the inner slot of the 
corresponding priority of its parent's inner feed, which, in turn, maybe attached 
to either its parent's inner slot of the same priority(in case the parent is also yellow),
or to its own level self slot of the same priority (in case the parent is green). Upon
the transition to this state, the class 'disconnects' from self feed of its level, 
and 'connects' to its parent's inner feed

黄色:批当前速率大于稳定速率但不大于最大速率。这个状态下,当前层级由其上级层级控制(其
上级如果也处于黄色状态则继续此规则,即由上级的上级控制)。

* red - a class the actual rate of which exceeds max-limit. This class cannot borrow
rate from its parent class

红色:指当前速率超过了最大速率。此层级不能从其上级层级分得任何流量

Bursts
突发速率

Bursts are used to allow higher data rates for a short period of time. Every second, 
the router calculates the average data rate of each class over the last burst-time 
seconds. If this average data rate is less than burst-threshold, burst is enabled 
and the actual data rate reaches burst-limit bps, otherwise the actual data rate falls
to max-limit or limit-at.

突发速率用于短时间内的超高速率数据传送。路由器每秒种都在计算前一时间段(burst-time)的平
均速率。如果平均速率低于设定的阀值(burst-threshold),就允许其使用突发速率(burst-
limit),否则就会降低到稳定速率或最大速率

Let us consider that we have a setup, where max-limit=256000, burst-time=8, burst-
threshold=192000 and burst-limit=512000. When a user is starting to download a 
file via HTTP,we can observe such a situation: At the beginning the average data
rate over the last 8 seconds is 0bps because before applying the queue rule no 
traffic was passed, using this rule. Since this average data rate is less than burst-
threshold (192kbps), burst is allowed. After the first second, the average data rate 
is (0+0+0+0+0+0+0+512)/8 = 64kbps, which is under burst-threshold. After the 
second second, average data rate is (0+0+0+0+0+0+512+512)/8 = 128kbps. After 
the third second comes the breakpoint when the average data rate becomes larger
than burst-threshold. At this moment burst is disabled and the current data rate falls
down to max-limit(256kbps).


举例说明:

假设我们设置最大速率(max-limit)为256k,时间段(burst-time)为8秒,阀值为192k,突发速率
(burst-limit)为512k,当用户下载文件时可以观察到:
开始下载的前8秒速率为0,小于阀值192,所以允许达到突发速率即512;
1秒钟后,前8秒的平均速率为64(0+0+0+0+0+0+0+512)/8=64,仍然小于阀值192,所以继续
使用突发速率512;
2秒钟后,前8秒的平均速率为(0+0+0+0+0+0+512+512)/8=128;
3秒钟后,再次计算平均速率为(0+0+0+0+0+512+512+512)/8=192,达到了阀值192,所以,
3秒钟后此用户已不再允许使用突发速率,只能使用允许的最大速率了,即256kbps

你可能感兴趣的:(电脑网络)