找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1365|回复: 5

[其它] ROS这篇分层桶 探讨"原理"而已

[复制链接]
发表于 2006-12-9 00:11:49 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
Introduction to 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
interface, 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 qdisc in detail:

[ 本帖最后由 vipe 于 2006-12-9 00:19 编辑 ]
1.jpg
routeros
 楼主| 发表于 2006-12-9 00:12:59 | 显示全部楼层
HTB terms:
• queuing discipline (qdisc) - an algorithm that holds and maintains a queue of packets. It
specifies the order of the outgoing packets (it means that queuing discipline can reorder
packets). Qdisc also decides which packets to drop if there is no space for them
• filter - a procedure that classifies packets. The filter is responsible for classifying packets so
that they are put in the corresponding qdiscs
• level - position of a class in the hierarchy
• inner class - a class that has one or more child-classes attached to it. Inner classes do not store
any packets, but they do traffic shaping. The class also does not have its own priority
• leaf class - a class that has a parent but does not have any child-classes. Leaf classes are always
located at level 0 of the hierarchy. Each leaf class has a qdisc, attached to it
• self feed - an object that represents the exit for the packets from all the classes active at its level
of the hierarchy. It consists of 8 self slots
• self slot - an element of a self feed that corresponds to each particular priority. All classes,
active at the same level, of one priority are attached to one self slot that they are using to send
packets out through
• active class (at a particular level) - a class that is attached to a self slot at the given level
• inner feed - similar to self feed object, which consists of inner self slots, present on each inner
class
• inner feed slot - similar to self slot. Each inner feed consists of inner slots which represent a
priority
Each class has a parent and may have one or more children. Classes that do not have children, are
put at level 0, where queues are maintained, and are called 'leaf classes'
Each class in the hierarchy can prioritize and shape traffic. There are 2 main parameters in
RouterOS which refer to shaping and one - to prioritizing:
routeros
回复

使用道具 举报

 楼主| 发表于 2006-12-9 00:14:23 | 显示全部楼层
• 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)
• priority - order in which classes are served at the same level (8 is the lowest priority, 1 is the
highest)
Each HTB class can be in one of 3 states, depending on data rate that it consumes:
• 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!
• 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, may be 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
Priorities
When a leaf class wants to send some traffic (as they are the only classes that hold packets), HTB
checks its priority. It will begin with the highest priority and the lowest level and proceed until the
lowest priority at highest level is reached:
As you can see from the picture, leaf-classes which are at the green state, will always have a higher
priority than those which are borrowing because their priority is at a lower level (level0). In this
picture, Leaf1 will be served only after Leaf2, although it has a higher priority (7) than Leaf1 (8).
In case of equal priorities and equal states, HTB serves these classes, using round robin algorithm.
HTB Examples
Page 419 of 695
Copyright 1999-2005, MikroTik. All rights reserved. Mikrotik, RouterOS and RouterBOARD are trademarks of Mikrotikls SIA.
Other trademarks and registred trademarks mentioned herein are properties of their respective owners.

[ 本帖最后由 vipe 于 2006-12-9 00:16 编辑 ]
2.jpg
routeros
回复

使用道具 举报

 楼主| 发表于 2006-12-9 00:16:59 | 显示全部楼层
As you can see from the picture, leaf-classes which are at the green state, will always have a higher
priority than those which are borrowing because their priority is at a lower level (level0). In this
picture, Leaf1 will be served only after Leaf2, although it has a higher priority (7) than Leaf1 (8).
In case of equal priorities and equal states, HTB serves these classes, using round robin algorithm.

[ 本帖最后由 vipe 于 2006-12-9 00:23 编辑 ]
3.jpg
routeros
回复

使用道具 举报

legou 该用户已被删除
发表于 2006-12-9 14:29:03 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
routeros
回复

使用道具 举报

 楼主| 发表于 2006-12-9 17:33:04 | 显示全部楼层

回复 #5 legou 的帖子

legou 厉害,每次都被你看穿
打心底佩服你
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-9-30 13:21 , Processed in 0.256132 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表