Htb
-
Upload
jeromy-fu -
Category
Technology
-
view
253 -
download
5
description
Transcript of Htb
![Page 1: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/1.jpg)
htb
Jeromy Fu
![Page 2: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/2.jpg)
Agenda
• Parameters• Tc example• Link sharing• Implementation• Case study
![Page 3: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/3.jpg)
Tc Parameters
![Page 4: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/4.jpg)
Internal Parameters
![Page 5: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/5.jpg)
example1
![Page 6: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/6.jpg)
example1
![Page 7: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/7.jpg)
example1
![Page 8: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/8.jpg)
example2
![Page 9: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/9.jpg)
example2
![Page 10: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/10.jpg)
example2
![Page 11: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/11.jpg)
Basic concepts
• Classful qdisc• Assured rate(AR)• Ceil rate(CR)• Actual rate(R)• Priority• Quantum, DRR
![Page 12: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/12.jpg)
Basic concepts
• Class mode
HTB_CANT_SEND: red, R>CR
HTB_MAY_BORROW: yellow, AR<R<=CR
HTB_CAN_SEND: green, R<=AR
![Page 13: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/13.jpg)
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
![Page 14: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/14.jpg)
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
![Page 15: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/15.jpg)
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
![Page 16: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/16.jpg)
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)
![Page 17: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/17.jpg)
implementation
• A htb tree with 3 levels
- red slot (high priority)
- blue slot (lower priority)
- white slot (wait list)
![Page 18: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/18.jpg)
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.
![Page 19: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/19.jpg)
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
![Page 20: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/20.jpg)
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)
![Page 21: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/21.jpg)
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
![Page 22: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/22.jpg)
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
![Page 23: Htb](https://reader033.fdocuments.us/reader033/viewer/2022052322/55762cf1d8b42a015c8b471d/html5/thumbnails/23.jpg)
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