Skip to contentSkip to conversation

What is the reccomended minimum rate for leaf htb class for accurate operation?

LARTC Zviad O. Giorgadze 6 participants 12 messages Oct 6, 2004 – Oct 7, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

I'm trying to setup QoS in my TSL box. Following to mailing list reccomendations I changed PSCHED_CPU but can't get accurate shaping with HTB. I have disabled HYSTERESIS also (by setting it to 0). I have Intel Celeron 1.8Mhz (TSC supported I think).

******** My script ******
tc qdisc add dev eth0 root handle 1: htb default 22 r2q 10

# Class corresponding interface throughput
tc class add dev eth0 parent 1: classid 1:1 htb rate 100mbit ceil 100mbit

# Class for GLOBAL traffic
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 115kbit ceil 1mbit

# Classes for PC-s
tc class add dev eth0 parent 1:20 classid 1:21 htb rate 48kbit ceil 1mbit prio 2 tc class add dev eth0 parent 1:20 classid 1:22 htb rate 24kbit ceil 1mbit prio 3 tc class add dev eth0 parent 1:20 classid 1:23 htb rate 12kbit ceil 1mbit prio 5 tc class add dev eth0 parent 1:20 classid 1:24 htb rate 12kbit ceil 1mbit prio 5 tc class add dev eth0 parent 1:20 classid 1:25 htb rate 12kbit ceil 1mbit prio 5

tc qdisc add dev eth0 parent 1:21 handle 21: pfifo tc qdisc add dev eth0 parent 1:22 handle 22: pfifo tc qdisc add dev eth0 parent 1:23 handle 23: pfifo tc qdisc add dev eth0 parent 1:24 handle 24: pfifo tc qdisc add dev eth0 parent 1:25 handle 25: pfifo

# Put flow to corresponding classes
tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.1 flowid 1:21 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.2 flowid 1:22 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.3 flowid 1:23 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.4 flowid 1:24 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.5 flowid 1:25 ******** End of script *********

What is the reccomended minimum rate for leaf htb class for accurate operation? Can I change somesing in my script to get more accurate results?

Regrads,

Zviad

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

#1 lore raw

Re: [LARTC] What is the reccomended minimum rate for leaf htb class

Quoted 2 lines · Zviad O. Giorgadze

# Class for GLOBAL traffic
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 115kbit ceil 1mbit

Does different rate / ceil for the root class make sense?

Quoted 6 lines

# Classes for PC-s
tc class add dev eth0 parent 1:20 classid 1:21 htb rate 48kbit ceil 1mbit prio 2 tc class add dev eth0 parent 1:20 classid 1:22 htb rate 24kbit ceil 1mbit prio 3 tc class add dev eth0 parent 1:20 classid 1:23 htb rate 12kbit ceil 1mbit prio 5 tc class add dev eth0 parent 1:20 classid 1:24 htb rate 12kbit ceil 1mbit prio 5 tc class add dev eth0 parent 1:20 classid 1:25 htb rate 12kbit ceil 1mbit prio 5

I guess class 1:21 gets to borrow all the traffic up to 1mbit and the others get nothing at all. You really want that? These rates and prios don't make sense to me, what do you intend to do?

I'd remove the prio parameter, increase global traffic class rate to 1mbit, and increase PC class rates so that they add up to 1mbit.

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

#2 lore raw
In reply to Zviad O. Giorgadze

So what about minimum rate?
I have rate 13kbit. My connection is sometimes congested and and I have much loss of packets which are going from clients to the internet trough htb box. From box to the internet there is no any packet loss. Is this normal using HTB with congested connection?
----- Original Message -----
From: "Andreas Klauer" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, October 06, 2004 10:14 AM
Subject: Re: [LARTC] What is the reccomended minimum rate for leaf htb class for accurate operation?

Quoted 3 lines
Quoted 2 lines · Zviad O. Giorgadze

# Class for GLOBAL traffic
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 115kbit ceil

1mbit

Quoted 5 lines

Does different rate / ceil for the root class make sense?

Quoted 2 lines

# Classes for PC-s
tc class add dev eth0 parent 1:20 classid 1:21 htb rate 48kbit ceil

1mbit prio 2

Quoted 1 line
Quoted 1 line

tc class add dev eth0 parent 1:20 classid 1:22 htb rate 24kbit ceil

1mbit prio 3

Quoted 1 line
Quoted 1 line

tc class add dev eth0 parent 1:20 classid 1:23 htb rate 12kbit ceil

1mbit prio 5

Quoted 1 line
Quoted 1 line

tc class add dev eth0 parent 1:20 classid 1:24 htb rate 12kbit ceil

1mbit prio 5

Quoted 1 line
Quoted 1 line

tc class add dev eth0 parent 1:20 classid 1:25 htb rate 12kbit ceil

1mbit prio 5

Quoted 5 lines

I guess class 1:21 gets to borrow all the traffic up to 1mbit and the others get nothing at all. You really want that? These rates and prios don't make sense to me, what do you intend to do?

Quoted 7 lines

I'd remove the prio parameter, increase global traffic class rate to 1mbit, and increase PC class rates so that they add up to 1mbit.

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

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

#3 lore raw

Re: [LARTC] What is the reccomended minimum rate for leaf htb classfor

In reply to Zviad O. Giorgadze
Quoted 1 line · Zviad O. Giorgadze

My ISP provides guarantied 115kbit bandwidth for GLOBAL TRAFFIC. During the low load period (early morning, evening, night) customers can get up to 1mbit traffic.

That's download traffic we're talking about, since you seem to be shaping on your local LAN interface? Variable rate ISPs are tough to shape right, I guess...

Does this 115kbit vs. 1mbit thing solely depend on ISP load, or does it depend on day of time? In the latter case, I'd let a cron job replace the HTB class structure, so that you have 115kbit ceil during the day when you really only get 115kbit and 1mbit ceil during the night when you actually get 1mbit.

But I guess it's not that easy, huh?

Quoted 1 line

According to PRIO settings I try to give all available bandwidth (above the guarantied rate) to IP address. I think that all other IP-s get it's guarantied rate or may be I'm wrong?

You have a 100mbit line, of which you only allow 1mbit to be used (Why make a 100mbit class then?). Unknown traffic (LAN, most likely) goes to class 1:22 (Why? Shouldn't only ISP traffic go there?). There is no distinction between ISP and LAN traffic at all... does that mean that there is no other traffic than ISP from/to your HTB box?

Does anyone know how HTB performs on such a line? My guess would be that HTB doesn't have a clue that there are actually only 115kbit, and thus will allow classes to borrow too much, letting other classes starve.

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

#4 lore raw

Re: [LARTC] What is the reccomended minimum rate for leaf htb classfor accurate operation?

In reply to Zviad O. Giorgadze

Your gues is right. To get HTB work correctly you must know rate parameter for your connection also known as CIR.
Coud you tell what minimum rate your clients have?
----- Original Message -----
From: "Andreas Klauer" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, October 06, 2004 12:00 PM
Subject: Re: [LARTC] What is the reccomended minimum rate for leaf htb classfor accurate operation?

Quoted 2 lines
Quoted 1 line · Zviad O. Giorgadze

My ISP provides guarantied 115kbit bandwidth for GLOBAL TRAFFIC. During

the low load period (early morning, evening, night) customers can get up to 1mbit traffic.

Quoted 5 lines

That's download traffic we're talking about, since you seem to be shaping on your local LAN interface? Variable rate ISPs are tough to shape right, I guess...

Quoted 9 lines

Does this 115kbit vs. 1mbit thing solely depend on ISP load, or does it depend on day of time? In the latter case, I'd let a cron job replace the HTB class structure, so that you have 115kbit ceil during the day when you really only get 115kbit and 1mbit ceil during the night when you actually get 1mbit.

But I guess it's not that easy, huh?

Quoted 1 line

According to PRIO settings I try to give all available bandwidth (above

the guarantied rate) to IP address. I think that all other IP-s get it's guarantied rate or may be I'm wrong?

Quoted 7 lines

You have a 100mbit line, of which you only allow 1mbit to be used (Why make a 100mbit class then?). Unknown traffic (LAN, most likely) goes to class 1:22 (Why? Shouldn't only ISP traffic go there?). There is no distinction between ISP and LAN traffic at all... does that mean that there is no other traffic than ISP from/to your HTB box?

Quoted 8 lines

Does anyone know how HTB performs on such a line? My guess would be that HTB doesn't have a clue that there are actually only 115kbit, and thus will allow classes to borrow too much, letting other classes starve.

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

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

#5 lore raw

Re: [LARTC] What is the reccomended minimum rate for leaf htb classfor

In reply to Zviad O. Giorgadze
Quoted 3 lines · [email protected] wrote:

Your gues is right. To get HTB work correctly you must know rate parameter for your connection also known as CIR.
Coud you tell what minimum rate your clients have?

My worst HTB class has rate&ceil 778bps.

I guess the lower the rate, the less accurate the result. It can't be accurate, because the class already exceeds it's limit by sending just one single packet.

Maybe it's more accurate in the long run, but I don't have any statistics to prove that. Anyway, the traffic for that class is damn slow, and that's all I need to know. ;-)

Andreas

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

#6 lore raw

Re: [LARTC] What is the reccomended minimum rate for leaf htb class for

In reply to Zviad O. Giorgadze
Quoted 6 lines · Zviad O. Giorgadze

# Put flow to corresponding classes
tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.1 flowid 1:21 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.2 flowid 1:22 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.3 flowid 1:23 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.4 flowid 1:24 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.5 flowid 1:25

If you are NATting, there is no 192.168.0.anything because the address has been NATted.

If not, add a prio parameter to these filter lines where prio is NOT 0.

If you are NATting, use an iptables mark and filter on fwmark.

Other than that, I can't help you.

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

#7 lore raw
In reply to Zviad O. Giorgadze
Quoted 5 lines · Andreas Klauer
Quoted 2 lines · Zviad O. Giorgadze

# Class for GLOBAL traffic
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 115kbit ceil 1mbit

Does different rate / ceil for the root class make sense?

No.
Same for the classes attached to the root qdisc. They can not share bandwidth. So your basi setup should be:
root htb qdisc
htb class with ceil = rate = link bandwidth
other classes

Stef

Signature · 6 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#8 lore raw

Re: Re: [LARTC] What is the reccomended minimum rate for leaf htb class foraccurate operation?

In reply to Zviad O. Giorgadze
Quoted 10 lines
Quoted 6 lines · Zviad O. Giorgadze

# Put flow to corresponding classes
tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.1 flowid 1:21 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.2 flowid 1:22 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.3 flowid 1:23 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.4 flowid 1:24 tc filter add dev eth0 protocol ip parent 1: u32 match ip dst 192.168.0.5 flowid 1:25

If you are NATting, there is no 192.168.0.anything because the address has been NATted.

But checking via "tc -s -d class show dev eth0" shows that filter correctly recognizes packets and pust it into appropriate class. NAT is performed before the eth0.

Zviad

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

#9 lore raw
In reply to Zviad O. Giorgadze
Quoted 7 lines
Quoted 1 line

Does different rate / ceil for the root class make sense?

No.
Same for the classes attached to the root qdisc. They can not share bandwidth. So your basi setup should be:
root htb qdisc
htb class with ceil = rate = link bandwidth
other classes

So following script is reccomended?

tc qdisc add dev eth0 root handle 1: htb default 11 r2q 10

# Class corresponding external interface throughput (for 115kbit ADSL) tc class add dev eth0 parent 1: classid 1:1 htb rate 115kbit ceil 115kbit

# Classes for PC-s
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 55kbit ceil 115kbit prio 2 tc class add dev eth0 parent 1:1 classid 1:12 htb rate 48kbit ceil 115kbit prio 3 tc class add dev eth0 parent 1:1 classid 1:13 htb rate 12kbit ceil 115kbit prio 4 #End if script

What can I do if the same interface (eth0) is used for other purposes (internal traffic generated from local servers)? If HTB class has the highest ceil set to 115kbit, how can I define other classes for example for internal traffic?

Zviad

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

#10 lore raw

Re: [LARTC] What is the reccomended minimum rate for leaf htb classfor accurate operation?

In reply to Zviad O. Giorgadze
Quoted 4 lines
Quoted 1 line · [email protected] wrote:

Your gues is right. To get HTB work correctly you must know rate

parameter

Quoted 8 lines
Quoted 2 lines

for your connection also known as CIR. Coud you tell what minimum rate your clients have?

My worst HTB class has rate&ceil 778bps.

I guess the lower the rate, the less accurate the result. It can't be accurate, because the class already exceeds it's limit by sending just one single packet.

I agree. As far as I know average MTU is 1500bytes. I have rate 13kbit/825bytes so the limit should not be reached. Maybe there is overhead on ppp link and with this overhead clients gets congested? What do you think?
Any ideas?

Quoted 6 lines

Maybe it's more accurate in the long run, but I don't have any statistics to prove that. Anyway, the traffic for that class is damn slow, and that's all I need to know. ;-)

Andreas

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

#11 lore raw

Re: [LARTC] What is the reccomended minimum rate for leaf htb classfor

In reply to Zviad O. Giorgadze
Quoted 16 lines · [email protected] wrote:
Quoted 4 lines
Quoted 1 line · [email protected] wrote:

Your gues is right. To get HTB work correctly you must know rate

parameter

Quoted 8 lines
Quoted 2 lines

for your connection also known as CIR. Coud you tell what minimum rate your clients have?

My worst HTB class has rate&ceil 778bps.

I guess the lower the rate, the less accurate the result. It can't be accurate, because the class already exceeds it's limit by sending just one single packet.

Quoted 5 lines

I agree. As far as I know average MTU is 1500bytes. I have rate 13kbit/825bytes so the limit should not be reached. Maybe there is overhead on ppp link and with this overhead clients gets congested? What do you think?
Any ideas?

Low rates seem OK for me. I don't think relating packet size to rate in kbit/sec is the right way to think about things.

A class with a low rate will send a packet and then not be able to send again for an amount of time which is (pre)calculated from packet size and rate. The time may be > 1 second, so things work out in the end.

Andy.

Quoted 6 lines
Quoted 6 lines

Maybe it's more accurate in the long run, but I don't have any statistics to prove that. Anyway, the traffic for that class is damn slow, and that's all I need to know. ;-)

Andreas

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