Upload
jeromy-fu
View
253
Download
5
Tags:
Embed Size (px)
DESCRIPTION
Give a brief introduction on the internals on htb. How link sharing works etc
Citation preview
htb
Jeromy Fu
Agenda
• Parameters• Tc example• Link sharing• Implementation• Case study
Tc Parameters
Internal Parameters
example1
example1
example1
example2
example2
example2
Basic concepts
• Classful qdisc• Assured rate(AR)• Ceil rate(CR)• Actual rate(R)• Priority• Quantum, DRR
Basic concepts
• Class mode
HTB_CANT_SEND: red, R>CR
HTB_MAY_BORROW: yellow, AR<R<=CR
HTB_CAN_SEND: green, R<=AR
Link sharing• Rc = min(CRc, ARc+Bc)
- Rc, actual Rate of class c
- CRc, Ceil Rate of class c
- ARc, Assured Rate of class c
- Bc, Borrowed from parent class c
• D(p) – set of nodes
- all nodes are children of p
- all nodes are yellow, which need to borrow bandwidth from parent p
Link sharing• If there are other nodes have higher priority than node c, then those ones will be
scheduled first, thus Bc = 0.
• Otherwise, the bandwidth of parent is divided according to the quantum of the nodes, which have the same priority with node c.
- Q, quantum
- P, Priority, smaller the higher
- Rp, actual rate of parent p
if min[Pi over D(p)] >= Pc: Bc = Qc * Rp/sum[Qi over D(p) where Pi=Pc]else: Bc = 0
Principles
• Red nodes(HTB_CANT_SEND) have to wait• Yellow nodes(HTB_MAY_BORROW) will try
borrow from parent• Green nodes(HTB_CAN_SEND) will always
served first for it doesn’t borrow• Higher priority nodes are served first
implementation• Self feed
each level has one self feed, and every priority has a self slot in self feed(each slot has the same priority and level).
All classes in the same slot has the same priority and level, and are all green nodes (HTB_CAN_SEND) of this level.
• Inner feed
every inner class(node) has one inner feed
All classes in the same slot has the same priority and level, and are all yellow nodes (HTB_MAY_BORROW) that are children of current inner node.
• Wait list
each level has one wait list, which stores the nodes that are yellow (HTB_MAY_BORROW) and red (HTB_CANT_SENT)
implementation
• A htb tree with 3 levels
- red slot (high priority)
- blue slot (lower priority)
- white slot (wait list)
implementation
• Start at the lowest level, choose one green node in the highest priority self slot of this self feed.
• If it’s leaf, then schedule it.• If it’s inner node, then check its inner feed,
and choose the highest priority inner slot, find a yellow node, then schedule it.
Case study
• All nodes are initially green• Pkt arrived for C and D (thick circle)• C is lower priority (in blue self slot)• D is higher priority (in red self slot)• D is scheduled and token is
used
Case study
• D exceed AR, but not CR• D changed to yellow• D is removed from self slot(red) of level 0• D is then put to inner slot(red) of B• D will change back to green in
the future, so it also put intowait list of level 0
• C is scheduled ( D is higher priority but C doesn’t need borrow)
Case study• C exceed CR• C changed to red• C is removed from self slot(blue) of level 0• C can’t borrow so it won’t be put to the parent inner slot• C will change back to green in
the future, so it also put intowait list of level 0
• D is scheduled, and borrowed from B, and B changed to yellow
• B is removed from self slot(red) of level 1
• B is put to the parent inner slot(red) and also put to the wait list
• Only A and E are green now
Case study
• E has no pkt, so D is scheduled• A changed to red• A is removed from self slot(red) of level 2• A is put to wait list of level2• Pkt arrived for E (thick circle)• E is green and lower priority,
so put to self slot(blue) of level 0• C changed back to green, and
removed from wait list, and putto self slot(blue) of level 0
Case study
• Now both C and E are green and are of the same priority.
• DRR is used now, they’re scheduled according to quantum.
• Both C and D are changed toyellow, removed from self slot,put to inner slot and wait list
• B is added to both high and lower priority inner slot of A