Re: Latency/burst problem with HTB

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



    Hi Toby, and thanks for your answer :)

    Excuse me for the long reply, but I wanted to put my current
settings for tc just in case. Feel free to ignore.

 * Toby <tobia.conforto@xxxxxxxx> dixit:
> DervishD wrote:
> > tc filter add dev eth0 ... ip sport 0x3000 0x3000 flowid 1:111
> > tc filter add dev eth0 ... ip sport 0x4000 0x4000 flowid 1:111
> > tc filter add dev eth0 ... ip sport 0x20 0xff flowid 1:111
> > 
> > I'm serving passive FTP only in ports from 0x3000 to 0x4fff, and
> > active FTP in port 20.
> 
> Then you should use the following port numbers in your filters:
> 
> 	0x3000 0xf000
> 	0x4000 0xf000
> 	20 0xffff
> 
> The first two of your filters were matching more ports than needed,
> while the latter WAS NOT MATCHING YOUR ACTIVE FTP TRAFFIC AT ALL.
>
> I suggest you read a tutorial on ip addresses and netmasks, that
> should cover the basis of how bitmasks work.

    I know how they work, but sometimes my brain doesn't work
correctly ;)))) The first two are a typo, in my tc setup I have masks
0xf000 and 0xf000, I don't know why I made such mistake, because I
swear I cut'n'pasted it :??? and the third one is an error, caused
because I was testing with ports 0x??20 to differentiate connections
(to test settings for different FTP servers) with a hand made client
that used different ports for active connections. I simply didn't put
the mask back to 0xffff and worst, I didn't move to 20 *decimal* and
left the 0x. I chose 0x??20 because it was easier to remeber and
fancier to read O:) than 0x??14.

    Thanks for advising, because right now I don't have active ftp
traffic and I would NEVER have spotted the errors. Thanks a lot,
really.

    And I don't understand the typo :? I've seen the output of "tc
filter show dev eth0" and shows "match 30000000/f0000000 at 20".

> > Is there any value I can tweak to make general ADSL traffic more
> > responsive?
> 
> Yes, you can make another HTB class, let's call it 1:112, for ICMP
> traffic (ie. ping, port unreachable...) and very small TCP packets
> (SYN, ACK, RST... all that stuff) and give it the highest priority.

    But all that traffic goes already through a higher priority
class. The "general ADSL traffic" has a higher priority (prio 0) and
"ADSL outgoing FTP traffic" has prio 1 :??? Sorry but that value
doesn't show in what I posted, certainly I had a problem when cutting
and pasting... I had to modify what I cut because I took it from a
zsh script. Here is the real contents:

    TCQA="tc qdisc add dev eth0 parent"
    TCCA="tc class add dev eth0 parent"
    TCFA="tc filter add dev eth0 protocol ip parent"

    action "Starting traffic control on eth0"
    # root qdisc, defaults to ADSL other traffic
    $=TCQA root handle 1: htb default 21 r2q 1

    # hispeed class (Ethernet)
    $=TCCA 1: classid 1:1 htb rate 95Mbit ceil 95Mbit
    $=TCQA 1:1 handle 10: sfq perturb 10

    # lospeed class (ADSL)
    $=TCCA 1: classid 1:2 htb rate 256kbit ceil 256kbit burst 16384 cburst 8192

    # Other ADSL traffic 
    $=TCCA 1:2 classid 1:21 htb rate 224kbit ceil 256kbit prio 0 burst 16384 cburst 8192
    $=TCQA 1:21 handle 21: sfq perturb 10

    # FTP thru ADSL traffic 
    $=TCCA 1:2 classid 1:22 htb rate 64kbit ceil 160kbit prio 1

    # Filters
    $=TCFA 1:0 prio 1 u32 match ip dst 192.168.0.0/24 flowid 1:1
    $=TCFA 1:0 prio 2 u32 match ip sport 0x3000 0xf000 flowid 1:22
    $=TCFA 1:0 prio 2 u32 match ip sport 0x4000 0xf000 flowid 1:22
    $=TCFA 1:0 prio 2 u32 match ip sport 20 0xffff flowid 1:22

    I removed yesterday the old 1:1 class because I want no borrowing
between Ethernet general traffic and Ethernet ADSL traffic.

    If I add this as you suggest (modifiying identifiers)

    $=TCCA 1:2 classid 1:23 htb rate 1kbit ceil 256kbit prio 0

    then it will have the same priority that general traffic. I don't
undertand why it should improve responsiveness :? I'm going to test,
or course :), but I don't understand...

> By the way, I didn't invent all this, it's by Bert Hubert.
> You should check his wondershaper script: http://lartc.org/wondershaper/

    I did, but if I don't do any "borrowing" (as wondershaper seems
to do), latency is low. I want low latency when borrowing. With the
setup I've posted above (that is, reducing ftp ceil to 160kbit and
raising adsl-general rate to 250kbit) there's almost no latency, but
I would like to add a bit more of ceil to ftp traffic.

    I'll test your suggestions, which I find quite interesting, and
if I have success, I'll tell :) Thanks for your invaluable help, but
if this works I'm afraid I won't understand why, because by default
all that traffic that will be matched by the new filters will go to
the fast-adsl class anyway :?

    Would it be because it will go out of the queue *even before*
than general ADSL traffic? I think that's the reason, right?

    Well, I've finally tested your suggestion, and I've noticed only
a marginal improvement in responsiveness and latency, around 10% more
or less. Anytime I increase the "ceil" of the FTP-thru-ADSL traffic
above 160kbit (that's the value I'm currently using), the latency
skyrockets and the download speed stinks. I no longer see any
improvement, then. With values near 160kbit, messing with "burst" and
"cburst" give as slight improvement and your suggestions give a 10%
more of download bandwidth and about the same improveness in latency
(please note that except the download bandwidth, the rest of
improvements are subjetive, they represent what I feel when using my
network).

    This means that without the new class and filters I'm stuck with
160kbit max for the served FTP traffic, and with them I can raise
that limit a bit. Probably I'm making mistakes in my r2q value, the
burst and cburst values, etc. that have to be corrected, too O:)

    Thanks again, Toby :) With your suggestion I've raised from
19kbps to almost 22kbps the FTP speed (that's an extra 11MB per hour
and almost 300MB a day, and that's GOOD!), while having a decent
latency.

    BTW, this is what I have now:

    TCQA="tc qdisc add dev eth0 parent"
    TCCA="tc class add dev eth0 parent"
    TCFA="tc filter add dev eth0 protocol ip parent"

    action "Starting traffic control on eth0"
    # root qdisc, defaults to ADSL other traffic
    $=TCQA root handle 1: htb default 21 r2q 1

    # hispeed class (Ethernet)
    $=TCCA 1: classid 1:1 htb rate 95Mbit ceil 95Mbit
    $=TCQA 1:1 handle 10: sfq perturb 10

    # lospeed class (ADSL)
    $=TCCA 1: classid 1:2 htb rate 256kbit ceil 256kbit burst 16384 cburst 8192

    # Low latency ADSL traffic
    $=TCCA 1:2 classid 1:20 htb rate 4kbit ceil 256kbit prio 0 burst 16384 cburst 8194

    # Other ADSL traffic 
    $=TCCA 1:2 classid 1:21 htb rate 224kbit ceil 256kbit prio 1 burst 16384 cburst 8192
    $=TCQA 1:21 handle 21: sfq perturb 10

    # FTP thru ADSL traffic 
    $=TCCA 1:2 classid 1:22 htb rate 64kbit ceil 175kbit prio 2

    # Filters
   
    # Ethernet LAN traffic
    $=TCFA 1:0 prio 1 u32 match ip dst 192.168.0.0/24 flowid 1:1

    # Low latency traffic small TCP packets (<64 bytes)
    $=TCFA 1:0 prio 2 u32 match ip protocol 6 0xff\
                          match u8 0x05 0x0f at 0\
                          match u16 0x0000 0xffc0 at 2\
                          flowid 1:20

    # Low latency traffic, ICMP
    $=TCFA 1:0 prio 2 u32 match ip protocol 1 0xff flowid 1:20
    
    # FTP thru ADSL traffic
    $=TCFA 1:0 prio 2 u32 match ip sport 0x3000 0xf000 flowid 1:22
    $=TCFA 1:0 prio 2 u32 match ip sport 0x4000 0xf000 flowid 1:22
    $=TCFA 1:0 prio 2 u32 match ip sport 20 0xffff flowid 1:22

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux