* [LARTC] HTB on loopback gives a bit rate multiplied by 8
@ 2005-06-01 19:37 Kiruthika Selvamani
2005-06-01 21:28 ` Andy Furniss
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kiruthika Selvamani @ 2005-06-01 19:37 UTC (permalink / raw)
To: lartc
Hi,
I am trying to use htb to limit bandwidth on loopback for traffic
through particular port.
Here is the script I am using.
tc qdisc add dev lo root handle 1: htb
tc class add dev lo parent 1: classid 1:1 htb rate 100kbit ceil 100kbit
tc class add dev lo parent 1:1 classid 1:10 htb rate 50kbit ceil 50kbit
tc class add dev lo parent 1:1 classid 1:11 htb rate 50kbit ceil 50kbit
tc filter add dev lo protocol ip parent 1:0 prio 0 u32 match ip sport
22 0xffff flowid 1:10
tc filter add dev lo protocol ip parent 1:0 prio 0 u32 match ip dport
22 0xffff flowid 1:11
When this script is applied across eth0 (when I do a sftp to another
machine) the bandwidth limitation is applied correctly. However if I
use this in loopback (sftp to another directory in the same machine)
then I get bit rate approx 400kbit - i.e. usually it roughly
multiplies the bit rate by 8. Why does this happen? Does HTB work
differently in loopback? Any clue regarding this would be mostl
helpful.
Thanks
Kiruthika
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LARTC] HTB on loopback gives a bit rate multiplied by 8
2005-06-01 19:37 [LARTC] HTB on loopback gives a bit rate multiplied by 8 Kiruthika Selvamani
@ 2005-06-01 21:28 ` Andy Furniss
2005-06-02 13:40 ` Kiruthika Selvamani
2005-06-02 19:32 ` Andy Furniss
2 siblings, 0 replies; 4+ messages in thread
From: Andy Furniss @ 2005-06-01 21:28 UTC (permalink / raw)
To: lartc
Kiruthika Selvamani wrote:
> Hi,
>
> I am trying to use htb to limit bandwidth on loopback for traffic
> through particular port.
>
> Here is the script I am using.
>
> tc qdisc add dev lo root handle 1: htb
> tc class add dev lo parent 1: classid 1:1 htb rate 100kbit ceil 100kbit
> tc class add dev lo parent 1:1 classid 1:10 htb rate 50kbit ceil 50kbit
> tc class add dev lo parent 1:1 classid 1:11 htb rate 50kbit ceil 50kbit
> tc filter add dev lo protocol ip parent 1:0 prio 0 u32 match ip sport
> 22 0xffff flowid 1:10
> tc filter add dev lo protocol ip parent 1:0 prio 0 u32 match ip dport
> 22 0xffff flowid 1:11
>
> When this script is applied across eth0 (when I do a sftp to another
> machine) the bandwidth limitation is applied correctly. However if I
> use this in loopback (sftp to another directory in the same machine)
> then I get bit rate approx 400kbit - i.e. usually it roughly
> multiplies the bit rate by 8. Why does this happen? Does HTB work
> differently in loopback? Any clue regarding this would be mostl
> helpful.
It's because the MTU on lo is big and htb uses a small one when it asks
tc to make it's rate lookup tables.
if you do a tc -s class ls dev lo you will see there is a giants counter
, giant packets are only limited as if they are the size of the biggest
slot in the lookup table.
To fix specify the mtu of lo on the htb classes or set the mtu on lo to
1500.
Andy.
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LARTC] HTB on loopback gives a bit rate multiplied by 8
2005-06-01 19:37 [LARTC] HTB on loopback gives a bit rate multiplied by 8 Kiruthika Selvamani
2005-06-01 21:28 ` Andy Furniss
@ 2005-06-02 13:40 ` Kiruthika Selvamani
2005-06-02 19:32 ` Andy Furniss
2 siblings, 0 replies; 4+ messages in thread
From: Kiruthika Selvamani @ 2005-06-02 13:40 UTC (permalink / raw)
To: lartc
Hi Andy,
Thanks for the suggestion. I changed the MTU to 1500 and it started
working. Is this because HTB shapes traffic based on packet rate
rather than bit rate? How does it use the rate lookup tables?
Thanks
Kiruthika
On 6/1/05, Andy Furniss <andy.furniss@dsl.pipex.com> wrote:
> Kiruthika Selvamani wrote:
> > Hi,
> >
> > I am trying to use htb to limit bandwidth on loopback for traffic
> > through particular port.
> >
> > Here is the script I am using.
> >
> > tc qdisc add dev lo root handle 1: htb
> > tc class add dev lo parent 1: classid 1:1 htb rate 100kbit ceil 100kbit
> > tc class add dev lo parent 1:1 classid 1:10 htb rate 50kbit ceil 50kbit
> > tc class add dev lo parent 1:1 classid 1:11 htb rate 50kbit ceil 50kbit
> > tc filter add dev lo protocol ip parent 1:0 prio 0 u32 match ip sport
> > 22 0xffff flowid 1:10
> > tc filter add dev lo protocol ip parent 1:0 prio 0 u32 match ip dport
> > 22 0xffff flowid 1:11
> >
> > When this script is applied across eth0 (when I do a sftp to another
> > machine) the bandwidth limitation is applied correctly. However if I
> > use this in loopback (sftp to another directory in the same machine)
> > then I get bit rate approx 400kbit - i.e. usually it roughly
> > multiplies the bit rate by 8. Why does this happen? Does HTB work
> > differently in loopback? Any clue regarding this would be mostl
> > helpful.
>
> It's because the MTU on lo is big and htb uses a small one when it asks
> tc to make it's rate lookup tables.
>
> if you do a tc -s class ls dev lo you will see there is a giants counter
> , giant packets are only limited as if they are the size of the biggest
> slot in the lookup table.
>
> To fix specify the mtu of lo on the htb classes or set the mtu on lo to
> 1500.
>
> Andy.
>
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LARTC] HTB on loopback gives a bit rate multiplied by 8
2005-06-01 19:37 [LARTC] HTB on loopback gives a bit rate multiplied by 8 Kiruthika Selvamani
2005-06-01 21:28 ` Andy Furniss
2005-06-02 13:40 ` Kiruthika Selvamani
@ 2005-06-02 19:32 ` Andy Furniss
2 siblings, 0 replies; 4+ messages in thread
From: Andy Furniss @ 2005-06-02 19:32 UTC (permalink / raw)
To: lartc
Kiruthika Selvamani wrote:
> Hi Andy,
> Thanks for the suggestion. I changed the MTU to 1500 and it started
> working. Is this because HTB shapes traffic based on packet rate
> rather than bit rate? How does it use the rate lookup tables?
It's not based on packet rate as such, the lookup tables are for the
time delay for different packet lengths at the different rates. There is
one for each rate and ceil pre calculated for efficiency.
Each table has 256 slots so the mtu is needed to fill it efficiently,
with normal mtu each slot is 8 bytes apart. If you had told htb the mtu
of lo (16436) then each slot would have been calculated to cover a
bigger range of bytes.
I suppose the giants counter is a warning that these packets are not
being shaped properly as they are too big. I suppose devik decided to do
this in preference to calculating the delay for every giant so it didn't
slow things down too much.
Personally I am glad he didn't just use the interface mtu, as my dsl
ppp0 gets one of 32k - it never sees a packet bigger than 1500 though,
so if htb used 32k the shaping of small packets would be too innacurate.
Andy.
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-06-02 19:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-01 19:37 [LARTC] HTB on loopback gives a bit rate multiplied by 8 Kiruthika Selvamani
2005-06-01 21:28 ` Andy Furniss
2005-06-02 13:40 ` Kiruthika Selvamani
2005-06-02 19:32 ` Andy Furniss
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.