* [LARTC] htb2 with link sharing - the bandwidth dividing question
@ 2002-07-22 8:44 Lumir Unzeitig
2002-07-22 14:38 ` Stef Coene
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Lumir Unzeitig @ 2002-07-22 8:44 UTC (permalink / raw)
To: lartc
Hi
I have flat structure of traffic control - 8 children can borrow from a
parent.
Problem: The rest bandwidth is not divided to children how I expect.
The ISP line is 64kbit/s,therefore, I'm working with 56kbit/s.
(the config is in the end of the mail)
I set up a test environment -
1\ 3 PCs, each of them in different subclass
2\ minimal bandwidth (RATE)
PC1 - 4kbit/s class 1:10
PC2 - 4kbit/s class 1:40
PC3 - 15kbit/s class 1:80
maximal bandwith (CEIL) 56kbit/s
3\ all of the PCs download the same big file from ISP ftp server by Windows
Commander.
I supposed "the rest of bandwidth is divided to the PCs in ratio of their
RATE values". But it isn't.
Calculation
====
the rest: 56 - 4 - 4 - 15 = 33 kbit/s
desired PC1 bw: 4 + 33/(4+4+15) * 4 = 9,74 kbit/s < real
PC1 bw: 12 kbit/s
desired PC2 bw: 4 + 33/(4+4+15) * 4 = 9,74 kbit/s < real
PC2 bw: 12 kbit/s
desired PC3 bw: 15 + 33/(4+4+15) * 15 = 36,52 kbit/s > real
PC3 bw: 29.6 kbit/s
Please,can anybody tell me what's wrong in the calculation or setting?
Thanks
Lumir Unzeitig
---[ eth0: configured classes ]---------------------------
class htb 1:1 root prio 0 rate 56Kbit ceil 56Kbit burst 2Kb cburst 1670b
Sent 1912117995 bytes 2263853 pkts (dropped 0, overlimits 0)
rate 292bps 1pps
lended: 1072525 borrowed: 0 giants: 0 injects: 0
tokens: 227657 ctokens: 184572
class htb 1:10 parent 1:1 leaf 100: prio 0 rate 4Kbit ceil 56Kbit burst 2Kb
cburst 1670b
Sent 26382511 bytes 303604 pkts (dropped 0, overlimits 364)
rate 107bps
lended: 300541 borrowed: 3063 giants: 0 injects: 0
tokens: 3161600 ctokens: 182743
class htb 1:20 parent 1:1 leaf 200: prio 0 rate 9Kbit ceil 56Kbit burst 2Kb
cburst 1670b
Sent 394142012 bytes 400328 pkts (dropped 0, overlimits 10743)
lended: 138359 borrowed: 261969 giants: 0 injects: 0
tokens: 1236764 ctokens: 184572
class htb 1:40 parent 1:1 leaf 400: prio 0 rate 4Kbit ceil 56Kbit burst 2Kb
cburst 1670b
Sent 5245504 bytes 4490 pkts (dropped 0, overlimits 67)
lended: 1627 borrowed: 2863 giants: 0 injects: 0
tokens: 3174400 ctokens: 183658
class htb 1:50 parent 1:1 leaf 500: prio 0 rate 6Kbit ceil 56Kbit burst 2Kb
cburst 1670b
Sent 186581247 bytes 273327 pkts (dropped 0, overlimits 3118)
lended: 144824 borrowed: 128503 giants: 0 injects: 0
tokens: 2116266 ctokens: 183658
class htb 1:60 parent 1:1 leaf 600: prio 0 rate 9Kbit ceil 56Kbit burst 2Kb
cburst 1670b
Sent 71911357 bytes 143754 pkts (dropped 0, overlimits 2096)
rate 3bps
lended: 104774 borrowed: 38980 giants: 0 injects: 0
tokens: 1190802 ctokens: 184572
class htb 1:70 parent 1:1 leaf 700: prio 0 rate 4Kbit ceil 56Kbit burst 2Kb
cburst 1670b
Sent 18277641 bytes 22099 pkts (dropped 0, overlimits 537)
lended: 5879 borrowed: 16220 giants: 0 injects: 0
tokens: 2436096 ctokens: 184572
class htb 1:80 parent 1:1 leaf 800: prio 0 rate 15Kbit ceil 56Kbit burst 2Kb
cburst 1670b
Sent 1176861863 bytes 1057644 pkts (dropped 0, overlimits 19241)
rate 285bps 1pps
lended: 471653 borrowed: 585991 giants: 0 injects: 0
tokens: 849920 ctokens: 184572
class htb 1:90 parent 1:1 leaf 900: prio 0 rate 6Kbit ceil 56Kbit burst 2Kb
cburst 1670b
Sent 32715860 bytes 58607 pkts (dropped 0, overlimits 2741)
lended: 23671 borrowed: 34936 giants: 0 injects: 0
tokens: 2116266 ctokens: 183658
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LARTC] htb2 with link sharing - the bandwidth dividing question
2002-07-22 8:44 [LARTC] htb2 with link sharing - the bandwidth dividing question Lumir Unzeitig
@ 2002-07-22 14:38 ` Stef Coene
2002-07-23 9:26 ` Lumir Unzeitig
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Stef Coene @ 2002-07-22 14:38 UTC (permalink / raw)
To: lartc
On Monday 22 July 2002 10:44, Lumir Unzeitig wrote:
> Hi
> I have flat structure of traffic control - 8 children can borrow from a
> parent.
> Problem: The rest bandwidth is not divided to children how I expect.
> I supposed "the rest of bandwidth is divided to the PCs in ratio of their
> RATE values". But it isn't.
But how is the bandwidth divided in your test ? Can be handy to know to find
a solution/answer ...
And can you post the used htb script?
Stef
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [LARTC] htb2 with link sharing - the bandwidth dividing question
2002-07-22 8:44 [LARTC] htb2 with link sharing - the bandwidth dividing question Lumir Unzeitig
2002-07-22 14:38 ` Stef Coene
@ 2002-07-23 9:26 ` Lumir Unzeitig
2002-07-23 18:49 ` Stef Coene
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Lumir Unzeitig @ 2002-07-23 9:26 UTC (permalink / raw)
To: lartc
On Monday 22 July 2002 10:44, Lumir Unzeitig wrote:
>> Hi
>> I have flat structure of traffic control - 8 children can borrow from a
>> parent.
>> Problem: The rest bandwidth is not divided to children how I expect.
>>I supposed "the rest of bandwidth is divided to the PCs in ratio of their
>>RATE values". But it isn't.
>But how is the bandwidth divided in your test ? Can be handy to know to
>find
>a solution/answer ...
>And can you post the used htb script?
>Stef
===========
1. Real measurement of bw (also in Calculation in previous mail)
In my test the downstream bw was divided:
class real bw
----------------------------------------
class 1:10-RATE=4kbit....... 12 kbit/s
class 1:40-RATE=4kbit....... 12 kbit/s
class 1:80-RATE\x15kbit...... 29.6 kbit/s
----------------------------------------
Used bw .................... 53.6 kbit/s
2. HTB script
----------------------
#!/bin/bash
# chkconfig: 2345 14 89
# description: sets up HTB traffic control and filters
#VLAN
##########
BANDV #kbit/s
BURST=2
VBAND1=4
VBAND2=9
VBAND4=4
VBAND5=6
VBAND6=9
VBAND7=4
VBAND8\x15
VBAND9=6
#########
case "$1" in
### START ###
start)
#Delete a root qdisc
#********************
tc qdisc del dev eth0 2>/dev/null
#Root handle
#************
tc qdisc add dev eth0 root handle 1: htb default 100
tc qdisc add dev eth1 root handle 1: htb default 100
#Class for 56kbps channel
#************************
tc class add dev eth0 parent 1: classid 1:1 htb \
rate ${BAND}kbit ceil ${BAND}kbit burst 2k
#VLAN #1 - subclass 1:10
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:10 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.1.0/24 flowid 1:10
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:10 handle 100: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:10 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 1 \
fw classid 1:10
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:10 handle 100: sfq
#VLAN #2 - subclass 1:20
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:20 htb \
rate ${VBAND2}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.2.0/24 flowid 1:20
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:20 handle 200 sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:20 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 2 \
fw classid 1:20
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:20 handle 200: sfq
#VLAN #4 - subclass 1:40
#-------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:40 htb \
rate ${VBAND4}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.4.0/24 flowid 1:40
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:40 handle 400: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:40 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 4 \
fw classid 1:40
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:40 handle 400: sfq
#VLAN #5 - subclass 1:50
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:50 htb \
rate ${VBAND5}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.5.0/24 flowid 1:50
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:50 handle 500: sfq
#Upstrean
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:50 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 5 \
fw classid 1:50
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:50 handle 500: sfq
#VLAN #6 - subclass 1:60
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:60 htb \
rate ${VBAND6}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.6.0/24 flowid 1:60
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:60 handle 600: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:60 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 6 \
fw classid 1:60
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:60 handle 600: sfq
#VLAN #7 - subclass 1:70
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:70 htb \
rate ${VBAND7}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.7.0/24 flowid 1:70
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:70 handle 700: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:70 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 7 \
fw classid 1:70
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:70 handle 700: sfq
#VLAN #8 - subclass 1:80
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:80 htb \
rate ${VBAND8}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.8.0/24 flowid 1:80
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:80 handle 800: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:80 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 8 \
fw classid 1:80
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:80 handle 800: sfq
#VLAN #9 - subclass 1:90
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:90 htb \
rate ${VBAND9}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.9.0/24 flowid 1:90
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:90 handle 900: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:90 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 9 \
fw classid 1:90
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:90 handle 900: sfq
;;
stop)
for dev in `ip link| sed -n '/^[0-9]/ { s/^[0-9]\+:
\([a-z0-9]\+\):.*/\1/; p; }'`; do
tc qdisc del dev $dev root &>/dev/null
done
;;
restart)
$0 stop
$0 start
;;
stats)
echo ---[ eth0: queueing
disciplines ]-------------------------
echo; tc -s qdisc show dev eth0; echo
echo ---[ eth0: configured
classes ]---------------------------
echo; tc -s class show dev eth0; echo
echo
=====================================
echo ---[ eth1: queueing
disciplines ]-------------------------
echo; tc -s qdisc show dev eth1; echo
echo ---[ eth1: configured
classes ]---------------------------
echo; tc -s class show dev eth1; echo
;;
*)
echo "HTB start|stop|restart|stats"
;;
esac
-----Original Message-----
From: lartc-admin@mailman.ds9a.nl [mailto:lartc-admin@mailman.ds9a.nl]On
Behalf Of Stef Coene
Sent: Monday, July 22, 2002 4:39 PM
To: lumir.unzeitig@gatc.com; lartc@mailman.ds9a.nl
Subject: Re: [LARTC] htb2 with link sharing - the bandwidth dividing
question
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LARTC] htb2 with link sharing - the bandwidth dividing question
2002-07-22 8:44 [LARTC] htb2 with link sharing - the bandwidth dividing question Lumir Unzeitig
2002-07-22 14:38 ` Stef Coene
2002-07-23 9:26 ` Lumir Unzeitig
@ 2002-07-23 18:49 ` Stef Coene
2002-09-23 3:29 ` Adi Nugroho
2002-09-29 20:33 ` Stef Coene
4 siblings, 0 replies; 6+ messages in thread
From: Stef Coene @ 2002-07-23 18:49 UTC (permalink / raw)
To: lartc
> 1. Real measurement of bw (also in Calculation in previous mail)
(Sorry, missed that in the prevois mail)
> In my test the downstream bw was divided:
> class real bw
> ----------------------------------------
> class 1:10-RATE=4kbit....... 12 kbit/s
> class 1:40-RATE=4kbit....... 12 kbit/s
> class 1:80-RATE=15kbit...... 29.6 kbit/s
> ----------------------------------------
> Used bw .................... 53.6 kbit/s
So class 1:10 and 1:40 get's more bandwidth then they should.
Actually, the remaining bandwidth is not divided proportional to the rate,
but to quantum. Quantum is calculated as rate / r2q with 2rq = 10. But you
can overrule r2q when you add the htb qdisc and you can overrule quantum per
class. I have more info on www.docum.org, under FAQ, HTB, quantum.
If rate = 4kbit/s and r2q = 10, then quantum = 4kbit/10 = 400 byte
If rate = 15kbit/s and r2q = 10, then quantum = 15kbit/10 = 1500 byte
Each class can send an amount of bytes equal to it's quantum. But a packet
is most of time bigger then 400 byte so for the 4kbit class, more bytes are
sended then allowed and there is no payback
Solution : decrease quantum so the smallest quantum is big enough to send the
bigest packet. So setting r2q = 2 will give better results.
tc qdisc add dev eth0 root handle 1: htb default 100 r2q 2
You will also find some errors in the log file about htb that's complaining
that the quantum is too small. This is triggered because you want to send a
packet that's bigger then the quantum.
After decreasing the r2q parameter, these errors should disappear.
The default r2q parameter is OK for classes with rates > 15kbit/s.
(thx to Devik to explain me this some time ago)
Stef
--
stef.coene@docum.org
"Using Linux as bandwidth manager"
http://www.docum.org/
#lartc @ irc.openprojects.net
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LARTC] htb2 with link sharing - the bandwidth dividing question
2002-07-22 8:44 [LARTC] htb2 with link sharing - the bandwidth dividing question Lumir Unzeitig
` (2 preceding siblings ...)
2002-07-23 18:49 ` Stef Coene
@ 2002-09-23 3:29 ` Adi Nugroho
2002-09-29 20:33 ` Stef Coene
4 siblings, 0 replies; 6+ messages in thread
From: Adi Nugroho @ 2002-09-23 3:29 UTC (permalink / raw)
To: lartc
On Wednesday 24 July 2002 02:49, Stef Coene wrote:
> Actually, the remaining bandwidth is not divided proportional to the rate,
> but to quantum.
Helo....
I would like to ask about r2q and quantum.
I'm using sfq, which has also something named quantum.
the question is....
I I want that the remaining bandwidth to be devided proportional to the rate,
which one shuld I set...
* sfq quantum?
* or htb quantum?
* or both?
Second question, how can we set r2q lower than 1? I would like to set my r2q
to 0.1.
Thank you in advance,
Adi Nugroho
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LARTC] htb2 with link sharing - the bandwidth dividing question
2002-07-22 8:44 [LARTC] htb2 with link sharing - the bandwidth dividing question Lumir Unzeitig
` (3 preceding siblings ...)
2002-09-23 3:29 ` Adi Nugroho
@ 2002-09-29 20:33 ` Stef Coene
4 siblings, 0 replies; 6+ messages in thread
From: Stef Coene @ 2002-09-29 20:33 UTC (permalink / raw)
To: lartc
On Monday 23 September 2002 05:29, Adi Nugroho wrote:
> On Wednesday 24 July 2002 02:49, Stef Coene wrote:
> > Actually, the remaining bandwidth is not divided proportional to the
> > rate, but to quantum.
>
> Helo....
> I would like to ask about r2q and quantum.
> I'm using sfq, which has also something named quantum.
> the question is....
> I I want that the remaining bandwidth to be devided proportional to the
> rate, which one shuld I set...
> * sfq quantum?
> * or htb quantum?
> * or both?
Htb quantum is used to between different classes and only for bandwidth that
remains after each class get's it's rate.
Sfq quantum is used within one class where the sfq qdisc is attached to and
determines how many bytes each flow can send when they may send.
Setting on quantum is the best.
> Second question, how can we set r2q lower than 1? I would like to set my
> r2q to 0.1.
Just try it out. I don't know if it will work.
Stef
--
stef.coene@docum.org
"Using Linux as bandwidth manager"
http://www.docum.org/
#lartc @ irc.oftc.net
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-09-29 20:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-22 8:44 [LARTC] htb2 with link sharing - the bandwidth dividing question Lumir Unzeitig
2002-07-22 14:38 ` Stef Coene
2002-07-23 9:26 ` Lumir Unzeitig
2002-07-23 18:49 ` Stef Coene
2002-09-23 3:29 ` Adi Nugroho
2002-09-29 20:33 ` Stef Coene
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.