Hacker News new | ask | show | jobs
by gmazza 3365 days ago
If you don't need hierarchical classes[1], just use tbf (token bucket filter) instead of htb (hierararchy token bucket) - it's more efficient, more compact, and gives you access to delay in the same discipline as well. Compare:

  # htb
  tc qdisc add dev eth0 handle 1: root htb default 11
  tc class add dev eth0 parent 1: classid 1:1 htb rate 1kbps
  tc class add dev eth0 parent 1:1 classid 1:11 htb rate 1kbps
vs.

  # tbf
  tc qdisc add dev eth0 root tbf rate 1kbit latency 42ms burst 2k
"man htb" and "man tbf" are quite usable too.

[1] i.e. stuff like "I would like to have tcp/80 limited to 10 mbit/s, tcp/443 limited to 15 mbit/s, while sum of above should never exceed 20mbit/s, and tcp/80 should get priority when competing for that shared 20mbit/s"

EDIT: changed to "burst 2k". Having burst lower than interface MTU will delay large packets essentially forever.