Skip to contentSkip to conversation

Problem while using HTB bandwidth limitation

LARTC Nimit Gupta 3 participants 8 messages Sep 1, 2003 – Sep 8, 2003

lore
Share & tools
lore
#0 lore raw

Hello everyone,

I am using htb to shape bandwidth but I can see heavy ups and downs from the specified limit. I have seen users with 24Kbit limitation can reach upto 36Kbit.

Can there be any problem if I set 10 classes each restricted to 24kbit under a class which has been restricted to 128Kbit.

My point is what happens if total of child classes, is more than the parent class itself. Does it distribute fairly ie equally to all 10 classes or will there be a problem.

I want it to be this way because I know not all 10 people use it simultaneously there can be 7 people at max who will be browsing at same time.

Here are some rules:

#Creating root qdisc
tc qdisc add dev eth0 root handle 1: htb default 4000

tc c a dev eth0 parent 1: classid 1:1 htb rate 192Kbit burst 15Kbit

#Rules for default class
tc c a dev eth0 parent 1:1 classid 1:4000 htb rate 16Kbit burst 10Kbit tc q a dev eth0 parent 1:4000 handle 4000: sfq perturb 10

# Rules for each of the 10 machines
tc c a dev eth0 parent 1:1 classid 1:$C_ID htb rate 24Kbit burst 10Kbit

tc q a dev eth0 parent 1:$C_ID handle $C_ID: sfq perturb 10 tc f a dev eth0 protocol ip parent 1: prio 5 u32 match ip dst $IP classid 1:$C_ID

With regards,
Nimit

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 6 lines · Nimit Gupta

Hello everyone,

I am using htb to shape bandwidth but I can see heavy ups and downs from the specified limit. I have seen users with 24Kbit limitation can reach upto 36Kbit.

Quoted 6 lines

Can there be any problem if I set 10 classes each restricted to 24kbit under a class which has been restricted to 128Kbit.

My point is what happens if total of child classes, is more than the parent class itself. Does it distribute fairly ie equally to all 10 classes or will there be a problem.

Each class should be able to het 1/10 of 128kbit. But it can be bursty.

Quoted 15 lines

I want it to be this way because I know not all 10 people use it simultaneously there can be 7 people at max who will be browsing at same time.

Here are some rules:

#Creating root qdisc
tc qdisc add dev eth0 root handle 1: htb default 4000

tc c a dev eth0 parent 1: classid 1:1 htb rate 192Kbit burst 15Kbit

#Rules for default class
tc c a dev eth0 parent 1:1 classid 1:4000 htb rate 16Kbit burst 10Kbit tc q a dev eth0 parent 1:4000 handle 4000: sfq perturb 10

Quoted 6 lines

# Rules for each of the 10 machines
tc c a dev eth0 parent 1:1 classid 1:$C_ID htb rate 24Kbit burst 10Kbit

tc q a dev eth0 parent 1:$C_ID handle $C_ID: sfq perturb 10 tc f a dev eth0 protocol ip parent 1: prio 5 u32 match ip dst $IP classid 1:$C_ID

Try to remove the burst parameter. And if you have a 192Kbit link, you should limit all bandwidth to 188kbit so YOU are the bottleneck on the link and not the modem.

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#2 lore raw
In reply to Nimit Gupta

Hi there Nimit,

: >>Can there be any problem if I set 10 classes each restricted to 24kbit : >>under a class which has been restricted to 128Kbit.
: >>
: >>My point is what happens if total of child classes, is more than the : >>parent class itself. Does it distribute fairly ie equally to all 10 : >>classes or will there be a problem.
: >
: > Each class should be able to het 1/10 of 128kbit. But it can be bursty. :
: It can burst to some extent but I could see the rate going more than : double in some cases why is it so?

In HTB, all shaping happens in the leaf classes. For ease on the CPU (and apparently, the difficulty of the algorithm), HTB is designed to believe you when you say that each of your 10 leaf classes should get 24kbit, and it does not check the parent class to make sure the parent class is throttling all of the children.

You had used a 24kbit rate and no specified ceiling on each of these 10 classes. This means that you have the equivalent of 24kbit rate and 24kbit ceil. You are guaranteeing 24kbit at all times to every class! You might end up sending up to 240kbit (not accounting for your burst setting either).

In order to approach better your 192kbit line with 10 classes, I would recommend trying a configuration more like this. Use a rate 16kbit and ceil 24kbit for each of your classes. This means that a leaf class will consult the parent class for leftover bandwidth above 16kbit. And above 24kbit, it will cease asking the parent to borrow bandwidth.

This means that all of your classes would send a maximum of 160kbit of guaranteed traffic before consulting the parent class which has a bandwidth to divide amongst the children.

: Yes, now I have removed the burst parameter but can you explain me why : to limit all bandwidth to 188 when I have 192, I am having DSL : connection.

It is immaterial what sort of connection (speed) you have. The key (and secret) is that you must be the bottleneck. In order for you to control latency and bandwidth use, you must ensure that you are the slowest point. Annoyingly, the only successful way to identify exactly what speed to use as a bandwidth cap is experimentation. A good general suggestion is to lop off a couple of kbit and try capping your bandwidth exactly as Stef suggests. Try using 188kbit, and see if your apparent control increases.

Best of luck,

-Martin

Signature · 5 lines
Martin A. Brown --- SecurePipe, Inc. --- [email protected]

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#3 lore raw
In reply to Nimit Gupta

Hello,
Thanks for the reply, but still have few doubts.

Quoted 8 lines · Nimit Gupta
Quoted 7 lines

Hello everyone,

I am using htb to shape bandwidth but I can see heavy ups and downs from the specified limit. I have seen users with 24Kbit limitation can reach upto 36Kbit.

Quoted 8 lines
Quoted 6 lines

Can there be any problem if I set 10 classes each restricted to 24kbit under a class which has been restricted to 128Kbit.

My point is what happens if total of child classes, is more than the parent class itself. Does it distribute fairly ie equally to all 10 classes or will there be a problem.

Each class should be able to het 1/10 of 128kbit. But it can be bursty.

It can burst to some extent but I could see the rate going more than double in some cases why is it so?

Quoted 20 lines
Quoted 20 lines

I want it to be this way because I know not all 10 people use it simultaneously there can be 7 people at max who will be browsing at same time.

Here are some rules:

#Creating root qdisc
tc qdisc add dev eth0 root handle 1: htb default 4000

tc c a dev eth0 parent 1: classid 1:1 htb rate 192Kbit burst 15Kbit

#Rules for default class
tc c a dev eth0 parent 1:1 classid 1:4000 htb rate 16Kbit burst 10Kbit tc q a dev eth0 parent 1:4000 handle 4000: sfq perturb 10

# Rules for each of the 10 machines
tc c a dev eth0 parent 1:1 classid 1:$C_ID htb rate 24Kbit burst 10Kbit

Quoted 7 lines
Quoted 3 lines

tc q a dev eth0 parent 1:$C_ID handle $C_ID: sfq perturb 10 tc f a dev eth0 protocol ip parent 1: prio 5 u32 match ip dst $IP classid 1:$C_ID

Try to remove the burst parameter. And if you have a 192Kbit link, you should limit all bandwidth to 188kbit so YOU are the bottleneck on the link and not the modem.

Yes, now I have removed the burst parameter but can you explain me why to limit all bandwidth to 188 when I have 192, I am having DSL connection.

with regards,
Nimit

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#4 lore raw
In reply to Nimit Gupta

Hello,

Thanks a lot Martin & Stef for clarifying my doubts. Your detailed explaination was quiet helpful in making the things clear.

I agree that if I give 24Kbit for each leaf class they will get it without confirming about the total bandwidth available with the parent but why does it allow him to reach upto 48Kbit even when ceiling is 24Kbit?

Quoted 6 lines

In order for you to control
latency and bandwidth use, you must ensure that you are the slowest point. Annoyingly, the only successful way to identify exactly what speed to use as a bandwidth cap is experimentation. A good general suggestion is to lop off a couple of kbit and try capping your bandwidth exactly as Stef suggests. Try using 188kbit, and see if your apparent control increases.

Is there a ratio between the total available bandwidth and the amount you restrict it to or you can just arbitarily reduce by 5-7 Kbit.

with regards,
Nimit.

Ps: Is there an irc channel for lartc discussion?

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#5 lore raw
In reply to Nimit Gupta
Quoted 8 lines · Nimit Gupta

Hello,

Thanks a lot Martin & Stef for clarifying my doubts. Your detailed explaination was quiet helpful in making the things clear.

I agree that if I give 24Kbit for each leaf class they will get it without confirming about the total bandwidth available with the parent but why does it allow him to reach upto 48Kbit even when ceiling is 24Kbit?

Is this his for a short term, like a burst?

Quoted 10 lines
Quoted 7 lines

In order for you to control
latency and bandwidth use, you must ensure that you are the slowest point. Annoyingly, the only successful way to identify exactly what speed to use as a bandwidth cap is experimentation. A good general suggestion is to lop off a couple of kbit and try capping your bandwidth exactly as Stef suggests. Try using 188kbit, and see if your apparent control increases.

Is there a ratio between the total available bandwidth and the amount you restrict it to or you can just arbitarily reduce by 5-7 Kbit.

It should be quite accurate. I tested it for different rates / ceils and each time the results where allmost perfect.

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#6 lore raw
In reply to Nimit Gupta
Quoted 4 lines · Stef Coene
Quoted 2 lines · Nimit Gupta

Hello,

Quoted 8 lines
Quoted 6 lines

Thanks a lot Martin & Stef for clarifying my doubts. Your detailed explaination was quiet helpful in making the things clear.

I agree that if I give 24Kbit for each leaf class they will get it without confirming about the total bandwidth available with the parent but why does it allow him to reach upto 48Kbit even when ceiling is 24Kbit?

Is this his for a short term, like a burst?

Yeah its for a short period but it keeps happening, I mean it will reach to 48Kbit and then after few sec it will stablize at 24Kbit then again it will reach to 48 and this repeats.

can you explain how to calculate burst rates for better control and accuracy?

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

In order for you to control
latency and bandwidth use, you must ensure that you are the slowest point. Annoyingly, the only successful way to identify exactly what speed to use as a bandwidth cap is experimentation. A good general suggestion is to lop off a couple of kbit and try capping your bandwidth exactly as Stef suggests. Try using 188kbit, and see if your apparent control increases.

Quoted 5 lines
Quoted 2 lines

Is there a ratio between the total available bandwidth and the amount you restrict it to or you can just arbitarily reduce by 5-7 Kbit.

It should be quite accurate. I tested it for different rates / ceils and each time the results where allmost perfect.

So I want to know what ratio it is as you said for 192Kbit make 188Kbit thats equivalent to 2 percent, is this the way.

One more thing, Is there something like isolated(as in cbq) in htb, that is irrespective of others demand the bandwidth allocated to someone as isolated does not get affected.

Is there an irc channel for lartc discussions?

with regards,
Nimit

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#7 lore raw
In reply to Nimit Gupta
Quoted 6 lines · Nimit Gupta

Yeah its for a short period but it keeps happening, I mean it will reach to 48Kbit and then after few sec it will stablize at 24Kbit then again it will reach to 48 and this repeats.

can you explain how to calculate burst rates for better control and accuracy?

Mhh. How long is it stayig at 48Kbit? Can you plot it?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

In order for you to control
latency and bandwidth use, you must ensure that you are the slowest point. Annoyingly, the only successful way to identify exactly what speed to use as a bandwidth cap is experimentation. A good general suggestion is to lop off a couple of kbit and try capping your bandwidth exactly as Stef suggests. Try using 188kbit, and see if your apparent control increases.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is there a ratio between the total available bandwidth and the amount you restrict it to or you can just arbitarily reduce by 5-7 Kbit.

It should be quite accurate. I tested it for different rates / ceils and each time the results where allmost perfect.

So I want to know what ratio it is as you said for 192Kbit make 188Kbit thats equivalent to 2 percent, is this the way.

It's not so easy to tell. Sometimes, people lower the total bandwidth and suddenly the shaping is working.

Quoted 3 lines

One more thing, Is there something like isolated(as in cbq) in htb, that is irrespective of others demand the bandwidth allocated to someone as isolated does not get affected.

Isolated is not working in cbq. And no, there is no such option in htb.

Quoted 1 line

Is there an irc channel for lartc discussions?

Yes, #lartc @ irc.oftc.net. But you have to be lucky to find someone not-away :)

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/