[LARTC] Low-priority traffic

Giovanni Bajo rasky at develer.com
Wed Oct 24 19:47:45 CEST 2007


Hello,

I'm a total tc newbie, and I'm trying to tweak the wondershaper script 
(http://lartc.org/wondershaper/) to get a slightly different result. 
Excuse me if I will not use the correct technical terms, it's a whole 
new world to me :)

wondershaper.htb creates 3 HTB classes; 1:10 is high prio, 1:20 is bulk 
(default), and 1:30 is low priority. The classes are created as follows:

==========================================================
tc class add dev $DEV parent 1:1 classid 1:10 htb \
    rate ${UPLINK}kbit \
    burst 6k prio 1

tc class add dev $DEV parent 1:1 classid 1:20 htb \
    rate $[9*$UPLINK/10]kbit ceil ${UPLINK}kbit \
    burst 6k prio 2

tc class add dev $DEV parent 1:1 classid 1:30 htb \
    rate $[1*$UPLINK/10]kbit ceil ${UPLINK}kbit \
    burst 6k prio 2
==========================================================

What I would like to do is to always give priority to traffic in class 
1:20 respect to class 1:30: basically, if there is a lot of traffic in 
class 1:20, class 1:30 shouldn't have any bandwidth allocated beside its 
minimum rate.

I'll try to clarify the above paragraph with an example; let's assume 
that if I download file A from this server, the generated traffic goes 
to class 1:20; if I download file B, the traffic goes to class 1:30. 
Let's also say that UPLINK is 1Mbit/s.

  0) Server does nothing.
  1) I start downloading B. I begin downloading it a 1Mbit/s.
  2) I then start download A while B is going. A's download totally 
steals traffic from B's download, up to its minimum rate. So, after a 
little while, I should see download B going to 10% = 100Kbit and 
download A going to 90% = 900Kbit.
  3) I stop download B. A goes up to 1Mbit.
  4) I apply a client-side limit to A's download. Now A goes to 600Kbit.
  5) I start downloading B again. B cannot steal any bandwidth to A, but 
it will get all the available bandwidth. So A will stay at 600Kbit, and 
B will go at 400Kbit.

I hope my explanation is clear.

Wondershaper does not seem to do this. In fact, when I start downloading 
A and B, they seem to equally distribute the available bandwidth (I 
verified that packets really go to the respective classes, so it's not a 
filter problem). It's not clear to me how HTB decides to allocate the 
bandwidth, and what the "rate" parameter really means.

I even tried the CBQ version of wondershaper, but I got the same results.

Do you have any suggestion about how can I achieve my expected 
behaviour? How should I modify wondershaper?

Thanks!
-- 
Giovanni Bajo


More information about the LARTC mailing list