Discussion:
Setting max latency on classful qdiscs
Leigh Sharpe
2007-12-06 23:27:51 UTC
Permalink
Hi All,
I'm using HTB to shape traffic, a little like this:

tc qdisc add dev eth2 root handle 1:0 htb
tc qdisc add dev eth3 root handle 1:0 htb

tc filter add dev eth2 parent 1: protocol 0x8100 prio 5 u32 match u16
3000 0x0fff at 0 flowid 1:1 action ipt -j MARK --or-mark 0x01000000
tc filter add dev eth3 parent 1: protocol 0x8100 prio 5 u32 match u16
3000 0x0fff at 0 flowid 1:1 action ipt -j MARK --or-mark 0x01000000

tc class add dev eth2 parent 1:0 classid 1:1 htb rate 2000Kbit ceil
2000Kbit
tc class add dev eth3 parent 1:0 classid 1:1 htb rate 2000Kbit ceil
2000Kbit

tc qdisc add dev eth2 parent 1:1 handle 2: htb
tc qdisc add dev eth3 parent 1:1 handle 2: htb

tc class add dev eth2 parent 2:0 classid 2:1 htb rate 2000Kbit
tc class add dev eth3 parent 2:0 classid 2:1 htb rate 2000Kbit

tc filter add dev eth2 parent 2:0 protocol 0x8100 prio 2 u32 match u16
3000 0x0fff at 0 flowid 2:1 action ipt -j MARK --or-mark 0x00100000
tc filter add dev eth3 parent 2:0 protocol 0x8100 prio 2 u32 match u16
3000 0x0fff at 0 flowid 2:1 action ipt -j MARK --or-mark 0x00100000

This essentially provides a 2mbit/s rate limit on each of eth2 and eth3.
However, when I attempt to put more than 2mbps through it, It gets quite
latent (I end up with >1second latency at times). Is there any way of
specifying the maximum latency on a HTB class or qdisc? Or CBQ, for that
matter? I need to use a classful qdisc, so tbf is out of the question.
Ideally, I want to be able to specify that packets get dropped if they
are in the queue for any longer than a specified period of time.
Any ideas?

Regards,
Leigh

Leigh Sharpe
Network Systems Engineer
Pacific Wireless
Ph +61 3 9584 8966
Mob 0408 009 502
Helpdesk 1300 300 616
email ***@pacificwireless.com.au
<blocked::mailto:***@pacificwireless.com.au>
web www.pacificwireless.com.au
<blocked::http://www.pacificwireless.com.au/>
Andy Furniss
2007-12-07 13:34:05 UTC
Permalink
Post by Leigh Sharpe
Hi All,
tc qdisc add dev eth2 root handle 1:0 htb
tc qdisc add dev eth3 root handle 1:0 htb
tc filter add dev eth2 parent 1: protocol 0x8100 prio 5 u32 match u16
3000 0x0fff at 0 flowid 1:1 action ipt -j MARK --or-mark 0x01000000
tc filter add dev eth3 parent 1: protocol 0x8100 prio 5 u32 match u16
3000 0x0fff at 0 flowid 1:1 action ipt -j MARK --or-mark 0x01000000
tc class add dev eth2 parent 1:0 classid 1:1 htb rate 2000Kbit ceil
2000Kbit
tc class add dev eth3 parent 1:0 classid 1:1 htb rate 2000Kbit ceil
2000Kbit
tc qdisc add dev eth2 parent 1:1 handle 2: htb
tc qdisc add dev eth3 parent 1:1 handle 2: htb
Do you really need nested htb - I know it's allowed, but thought it was
not really meant for normal use.
Post by Leigh Sharpe
tc class add dev eth2 parent 2:0 classid 2:1 htb rate 2000Kbit
tc class add dev eth3 parent 2:0 classid 2:1 htb rate 2000Kbit
tc filter add dev eth2 parent 2:0 protocol 0x8100 prio 2 u32 match u16
3000 0x0fff at 0 flowid 2:1 action ipt -j MARK --or-mark 0x00100000
tc filter add dev eth3 parent 2:0 protocol 0x8100 prio 2 u32 match u16
3000 0x0fff at 0 flowid 2:1 action ipt -j MARK --or-mark 0x00100000
This essentially provides a 2mbit/s rate limit on each of eth2 and eth3.
However, when I attempt to put more than 2mbps through it, It gets quite
latent (I end up with >1second latency at times). Is there any way of
specifying the maximum latency on a HTB class or qdisc? Or CBQ, for that
matter? I need to use a classful qdisc, so tbf is out of the question.
Ideally, I want to be able to specify that packets get dropped if they
are in the queue for any longer than a specified period of time.
Any ideas?
The default pfifo length is picked up from the txqueuelen on the device.

If you want to control queuelengths per class just add sfq/[p|b]fifo and
use the limit parameter.

As for latency - if you are shaping then you could consider trying to
separate bulk from interactive and give interactive priority. You could
just use qlen or sfq, but that's really meant for bulk.

Policing down will give the best latency. I am glad my ISP polices
rather than buffers when it's peak time. The policers need to be per
customer though.

Andy.

Loading...