当前位置:文档之家› RouterOS winbox限速详解limit-at,max-limit,burst limit

RouterOS winbox限速详解limit-at,max-limit,burst limit

[转载]RouterOS winbox限速详解limit-at,max-limit,burst limit发表于2012 年 02 月 02 日由fang分层的令牌桶HTBHTB (Hierarchical Token Bucket) is a classful queuing discipline that is useful forapplying different handling for different kinds of traffic. Generally, we can set onlyone queue for an inte***ce, but in RouterOS queues are attached to the mainHierarchical Token Bucket (HTB) and thus have some properties derived from thatparent queue. For example, we can set a maximum data rate for a workgroup andthen 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 mainparameters 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 trafficrate, not exceeding this value should always be delivered* MIR(Maximal Information Rate) – the maximal data rate router will provideCIR:保底速率。

不超过这个的速率总是允许的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 isallowed to satisfy its limit-at limitation regardless of what limitations its parentshave. For example, if we have a leaf class with limit-at=512000 and its parent hasmax-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 lessthan max-limit. At this state, the class is attached to the inner slot of thecorresponding priority of its parent’s inner feed, which, in turn, maybe attachedto 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). Uponthe 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 borrowrate 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-timeseconds. If this average data rate is less than burst-threshold, burst is enabledand the actual data rate reaches burst-limit bps, otherwise the actual data rate fallsto 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 afile via HTTP,we can observe such a situation: At the beginning the average datarate over the last 8 seconds is 0bps because before applying the queue rule notraffic 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 rateis (0+0+0+0+0+0+0+512)/8 = 64kbps, which is under burst-threshold. After thesecond second, average data rate is (0+0+0+0+0+0+512+512)/8 = 128kbps. Afterthe third second comes the breakpoint when the average data ratebecomes largerthan burst-threshold. At this moment burst is disabled and the current data rate fallsdown 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。

相关主题