|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
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:
HTB介绍
HTB(分层标记桶)是一种有助于对不同类型的流实现不同处理的分级排队规则通常,我们可以为一个界面只设置一个队列,但在RouterOS中,队列附属于主HTB
,从而带有一些来自父队列的属性。例如,我们可以为一个工作组设置最大传输率然后在工作组成员之间分配带宽。
HTB qdisc in detail:
HTB排队规则详述:
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'
HTB术语:
排队规则(qdisc):保存和保持一列数据包的算法。它确定了流出的包的次序(这意味着排队规则可以对包重新排序)。当空间已满,qdisc也确定丢弃哪个个包。
过滤器(filter):分类包的过程。filter负责把包分类,使他们放入相应的排队规则中。
层(level):在分层制中一个类所处的层次。
内部类(Inner class):包含一个或一个以上子类的类。内部类不储存包,但它们做流量调整。他们自己没有优先级。
叶类(leaf class):有父类,但是没有子类的类。Leaf class在分层制中总处于第0层(level 0),每个 leaf class都附有一个排队规则(qdisc)。
自载入流(self feed):代表从活动在它所在层的所有的类中流出包的对象。它由8个self slot组成(对应于8个优先级)。
自接口(self slot):self feed的组成部分,它对应于每个优先级。所有处于同一层次的同一优先级的类,附属于同一self slot,并通过它来送出数据包。
(在特定层中的)活动类(active class):在指定层中属于某个self slot的类。
内部载入流(inner feed):类似于self feed对象,由inner feed slot组成,是每个Inner class的入口。
内部载入接口(inner feed slot):类似于self slot。每个inner feed由代表各自优先级的inner slot们组成。
每个类有一个父类,可能有一个或一个以上的子类。没有子类的类被放在第0层(level 0),类里存有队列,并被称为“叶类”。
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:
- 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)
在层次中的每个类可以重排和调整流量。在RouteROS中有2个参数涉及调整,一个涉及到重排:
Limit-at:确保给一个类的传输率。(CIR)
Max-limit:允许一个类所能达到的最大传输率(MIR)
Priority:在同一层次中类被处理的次序(8是最低的优先级,1最高)
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
根据所耗用的带宽,每个HTB类可能处与3种状态之一。
绿色:类的实际带宽小于等于其limit-at带宽。在这种状态下,类被附在它所在层的相应优先级的inner slot上,并被允许满足其limit-at带宽,无论它父类的限制带宽是多少。例如:如果有一个leaf class的limit-at=512000,它父类的max-limit=limit-at=128000,该leaf class可以达到512kbps!
黄色:类的实际带宽大于其limit-at,但小于等于max-limit。在此状态下,类被附于它父类inner feed的与它优先级相应的inner slot上;而父类的inner feed可能附于“祖父类”的相应优先级的inner slot(在父类也是黄色状态时)或者它(父类)所在层相应优先级的self slot(在父类是绿色状态时)上。在转换为这种状态时,类与他所在层的self feed“断开”,与他父类的inner feed“连接”。
红色:类的实际带宽超过max-limit。这个类不能从其父类处借用带宽。
[ 本帖最后由 lemonl 于 2006-12-9 17:58 编辑 ] |
|