#StackBounty: #linux #networking #linux-networking #traffic-shaping How is excess bandwidth distributed in linux htb?

Bounty: 100

Say I have 100kbps bandwidth

                - Root - 100kbps
                /       
               /         
              /           
             /             
            /               
           /                 
Assured  30kbps             10kbps

And I assure Class A 30kbps, and Class B 10kbps. 60kbps are the reserve or the excess bandwidth

In the HTB manual it says

Any unused bandwidth can be used by any class which needs it (in proportion of its allocated share).

However when I run the following test, which is illustrated in the above ascii art:

tc qdisc add dev eno1 root handle 1: htb
tc class add dev eno1 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps
tc class add dev eno1 parent 1:1 classid 1:10 htb rate 10kbps ceil 100kbps
tc class add dev eno1 parent 1:1 classid 1:20 htb rate 30kbps ceil 100kbps
tc filter add dev eno1 protocol ip parent 1:0 prio 1 u32 match ip dport 8000 0xffff flowid 1:10
tc filter add dev eno1 protocol ip parent 1:0 prio 1 u32 match ip dport 8001 0xffff flowid 1:20

I get the following results: 56kbps for Class A and 37kbps for Class B

Which is a ratio of ~1.5, whereas I expected the ratio to be 3:1, as the early allocation.

It seems that the 30 and 10 were served, then the excess was divided equally between the two classes which makes sense as in the code it says that the RedBlack tree holding these two classes, the scheduler does a RR on them.

My question, is the excess bandwidth divided equally as results and code suggest? (perhaps I misunderstood the code)

Or should I be expecting a 3:1 ratio between class A and B ?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.