1

let's say I have a simple htb hierarchy (See man 8 tc-htb) set up where the total bandwidth specified for child htb classes exceeds the total bandwidth specified for the root htb class:

tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 70kbps
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 70kbps
tc class add dev eth0 parent 1:1 classid 1:12 htb rate 70kbps

Here the maximum for the root htb class is 100kbps, but the collective maximum for child htb classes is 160kbps.

How would the kernel handle all three children generating traffic at their maximum rates? Can I use an intermediary sfq to ensure fair treatment of aggregate traffic in this case?

More importantly, how does the kernel decide which traffic to let through if the total traffic being generated exceeds the bandwidth of the hardware interface?

Tenders McChiken
  • 908
  • 1
  • 9
  • 24

1 Answers1

3

The general recommendation with HTB is to make sure that "the sum of the rates of the child class is equal or smaller than the rate of the parent".

If the child classes allow higher rates, then HTB would exceed the bandwidth limit. The limit on the parent is not enforced, it is merely used for "borrowing bandwidth" calculations (according to ceil rate). The actual bandwidth limitation is only enforced by the child (leaf) class.

Or at least that's how it was explained on the mailing lists, years and years ago:

If the parent class ceil is smaller than the sum of the children ceil, then the children can consume more bandwidth than the parent class appears to allow. This occurs because the parent class is never checked! The parent class is only checked if the child has exceeded rate and wishes to borrow from the parent.

https://www.spinics.net/lists/lartc/msg08619.html

This is very old documentation but it should still apply today.

frostschutz
  • 47,228
  • 5
  • 112
  • 159
  • Apologies @frostschutz. My question was poorly worded and isn't what I'm trying to find out. What I want to know is how the kernel decides which traffic to let through if the total traffic being generated exceeds the bandwidth of the interface (not only the root htb). Does it drop packets at random, or does it use some sort of hidden queue? I edited my poorly-written question to reflect this. – Tenders McChiken Aug 12 '20 at 09:23