[LARTC] Excess bandwidth sharing

Stef Coene stef.coene@docum.org
Wed, 8 Oct 2003 19:15:53 +0200


On Wednesday 08 October 2003 15:08, Tom Olexa wrote:
> Hello there,
>
> I do
> tc qdisc add dev eth0 root handle 1: htb r2q 1 default 12
> tc class add dev eth0 parent 1:1 classid 1:10 htb rate 64kbit
> ceil 512kbit tc class add dev eth0 parent 1:1 classid 1:11 htb
> rate 256kbit ceil 512kbit
>
> tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \
>         match ip dst 195.28.103.7 flowid 1:10
> tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \
>         match ip dst 195.28.103.5 flowid 1:11
>
> and I expect both streams to share the total 512kbit in
> proportion of their rates (1/4). Unfortunately the rates are some
> 100/120, total 512kbit.
> Can anyone tell me whatsda problem?
Your commands :

tc qdisc add dev eth0 root handle 1: htb r2q 1 default 12
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 64kbit ceil 512kbit
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 256kbit ceil 512kbit

And I think you miss this rule :
tc class add dev eth0 parent 1: classid 1:1 htb rate 512kbit ceil 512kbit

12 is your default class, but you never defined a 1:12 class.

This will happen :
1:10 : 64kbit (the configured rate)
1:11 : 256kbit (the configured rate)
Together : 320kbit

But the total is 512kbit, so 512-320 = 192kbit.
So class 1:10 get's an additional 192 * 64 / (64 + 256 ) = 38.4 kbit
So class 1:11 get's an additional 192 * 256 / (64 + 256 ) = 153.6 kbit
Actually, this is related to the quantum of the class.  But you never 
overruled the quantum, so the quantum of the class is rate / 1 (r2q 
parameter.  But 512kbit means a quantum of 512 / 8 = 64kilo byte and I think 
this is maybe too big.  Don't you have htb errors in your kernel log files ??

If you are interested in more tests and extra information, see www.docum.org 
on my tests pages.

Stef

-- 
stef.coene@docum.org
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.openprojects.net