2

I have the following settings:

tc qdisc del dev $ETH0ORSIMILAR root
tc qdisc add dev $ETH0ORSIMILAR root handle 1: htb default 30
tc class add dev $ETH0ORSIMILAR parent 1: classid 1:1 htb rate 100mbps
tc class add dev $ETH0ORSIMILAR parent 1:1 classid 1:30 htb rate 5kbps
tc qdisc add dev $ETH0ORSIMILAR parent 1:30 handle 30: sfq perturb 10

What is 5kbps? Is it KiloBit per second or KiloBytes per second?

Unless I'm completely mistaken, an scp test shows me in average 294.6KB/s-500KB/s for 5kbps setting above.

I'm a bit confused how this works out.

Houman
  • 1,545
  • 4
  • 22
  • 36

1 Answers1

1

The documentation has a Units section which suggests that kbps is Kilobytes per second.

Remember this about the htb

HTB ensures that the amount of service provided to each class is at least the minimum of the amount it requests and the amount assigned to it. When a class requests less than the amount assigned, the remaining (excess) bandwidth is distributed to other classes which request service.

You are guaranteeing 5kbps to calss 1:30 but if there is spare capacity it can use up to 100mbps.

Units
Bandwidths or rates can be specified in:
kbps
Kilobytes per second

mbps
Megabytes per second

kbit
Kilobits per second

mbit
Megabits per second

bps or a bare number
Bytes per second
Amounts of data can be specified in:
kb or k
Kilobytes
mb or m
Megabytes
mbit
Megabits

kbit
Kilobits

b or a bare number
Bytes.
...
user9517
  • 115,471
  • 20
  • 215
  • 297
  • Thank you so much for your explanation. Now I understand what is happening. In my example above, if I changed `100mbps` to `5kbps`, then I would ensure that every connection gets truly `5kbps` and it won't be able to burst above it? Or will it rather cause a side effect that HTB believes the maximum capacity it has available is only 5 kbps and the next user gets 0 kbps, because there is nothing left? – Houman Jan 10 '18 at 09:37
  • They are easy experiments to perform and doing so will be of great advantage to you.. – user9517 Jan 10 '18 at 11:16
  • Indeed. If I did two `scp` processes from the same client to the server and each would upload a large file. This would count as two separate connections, which can help to test the scenario above, correct? – Houman Jan 10 '18 at 11:20