HTB precision and bursts

Linux Advanced Routing and Traffic Control

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

 



Hello,

I was wondering if the community would be able to help me understand something about HTB and what to expect of its precision.

The configuration that I work with is a Linux laptop using only one wireless interface to communicate with a typical SOHO Cisco Linksys Router.
You can see the actual HTB configuration below and what Linux kernel i use. Let me know if you need any other information to better understand my system.

My Internet connection is asymmetric ADSL, 10Mbit/s down and 1Mbit/s up.

The problem. 

When egress is saturated fully ingress gets sluggish. 
Really annoying, so I try to cap egress according to what appears to be a common knowledge and best practice.

As it is a 1Mbit/s egress, I attempt to limit outgoing traffic at 75kbps. This is what I figured is a good value that doesn't hinder ingress traffic to the point where it start being sluggish.
I know that it gets sluggish because I use a torrent client almost always seeding distro ISOs and whatnot, and I just know from experience that when I use torrent client shaping capabilities capping outgoing traffic at 75kbps there's left enough room for comfortable work. 

So, I'm particularly interested in why transmission can be very precise, and if I limit outbound traffic in it to 75kbps it never goes above that value. However, if use HTB as shown below and tell transmission to get out of the way in aspect of shaping traffic, I can see that on average it is limited to 75kbps indeed but I can see intermittent bursts up to 150kbps.

You could say transmission is stupid and is showing wrong numbers in GUI, but having worked with this particular configuration on a daily basis for years literally I can really tell that when I'm using HTB these bursts can and actually do cripple ingress.

Transmission's internal shaping capabilities proved way more accurate and reliable, so I'd say what it shows in GUI is in fact accurate.

However, limiting egress with the help of transmission isn't cool enough anymore :P Seriously, my home network grows more and more complex with time and there's a real need to use a more advanced shaping solution on this Linux laptop.

So, is there a way to tune HTB to be uncompromisingly precise with no bursts above set value of 75kbps?
If yes, how would I do it?


% uname -a
Linux sega 3.4.2-2-ARCH #1 SMP PREEMPT Tue Jun 12 07:19:42 UTC 2012 i686 GNU/Linux


% tc -s -p qdisc show dev wlan0
qdisc htb 1: root refcnt 5 r2q 10 default 10 direct_packets_stat 0
Sent 55339309 bytes 68604 pkt (dropped 0, overlimits 32068 requeues 83) 
backlog 0b 0p requeues 83 
% tc -s -p class show dev wlan0
class htb 1:11 root prio 0 rate 54000Kbit ceil 54000Kbit burst 1593b cburst 1593b 
Sent 50820347 bytes 49530 pkt (dropped 0, overlimits 0 requeues 0) 
rate 912bit 1pps backlog 0b 0p requeues 0 
lended: 49530 borrowed: 0 giants: 0
tokens: 3469 ctokens: 3469

class htb 1:10 root prio 0 rate 600000bit ceil 600000bit burst 1599b cburst 1599b 
Sent 4520878 bytes 19093 pkt (dropped 0, overlimits 0 requeues 0) 
rate 6648bit 3pps backlog 0b 0p requeues 0 
lended: 19093 borrowed: 0 giants: 0
tokens: 241234 ctokens: 241234

% tc -s -p filter show dev wlan0
filter parent 1: protocol ip pref 1 u32 
filter parent 1: protocol ip pref 1 u32 fh 800: ht divisor 1 
filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:11 
 match IP src xxx.xxx.xxx.3/32
filter parent 1: protocol ip pref 1 u32 fh 800::801 order 2049 key ht 800 bkt 0 flowid 1:11 
 match IP dst xxx.xxx.xxx.3/32
filter parent 1: protocol ip pref 1 u32 fh 800::802 order 2050 key ht 800 bkt 0 flowid 1:11 
 match IP src xxx.xxx.xxx.4/32
filter parent 1: protocol ip pref 1 u32 fh 800::803 order 2051 key ht 800 bkt 0 flowid 1:11 
 match IP dst xxx.xxx.xxx.4/32
filter parent 1: protocol ip pref 1 u32 fh 800::804 order 2052 key ht 800 bkt 0 flowid 1:11 
 match IP src xxx.xxx.xxx.5/32
filter parent 1: protocol ip pref 1 u32 fh 800::805 order 2053 key ht 800 bkt 0 flowid 1:11 
 match IP dst xxx.xxx.xxx.5/32
filter parent 1: protocol ip pref 1 u32 fh 800::806 order 2054 key ht 800 bkt 0 flowid 1:11 
 match IP src xxx.xxx.xxx.6/32
filter parent 1: protocol ip pref 1 u32 fh 800::807 order 2055 key ht 800 bkt 0 flowid 1:11 
 match IP dst xxx.xxx.xxx.6/32


and this is how I get it configured via an init script

$tc qdisc del root dev $dev

	$tc qdisc add dev $dev root handle 1: htb default 10

	$tc class add dev $dev parent 1: classid 1:10 htb rate 75kbps
	$tc class add dev $dev parent 1: classid 1:11 htb rate 54mbit

	$tc filter add dev $dev protocol ip parent 1:0 prio 1 u32 \
	 match ip src xxx.xxx.xxx.xxx flowid 1:11
	$tc filter add dev $dev protocol ip parent 1:0 prio 1 u32 \
	 match ip dst xxx.xxx.xxx.xxx flowid 1:11
	
	$tc filter add dev $dev protocol ip parent 1:0 prio 1 u32 \
	 match ip src xxx.xxx.xxx.xxx flowid 1:11
	$tc filter add dev $dev protocol ip parent 1:0 prio 1 u32 \
	 match ip dst xxx.xxx.xxx.xxx flowid 1:11

	$tc filter add dev $dev protocol ip parent 1:0 prio 1 u32 \
	 match ip src xxx.xxx.xxx.xxx flowid 1:11
	$tc filter add dev $dev protocol ip parent 1:0 prio 1 u32 \
	 match ip dst xxx.xxx.xxx.xxx flowid 1:11
	
	$tc filter add dev $dev protocol ip parent 1:0 prio 1 u32 \
	 match ip src xxx.xxx.xxx.xxx flowid 1:11
	$tc filter add dev $dev protocol ip parent 1:0 prio 1 u32 \
	 match ip dst xxx.xxx.xxx.xxx flowid 1:11xxx.xxx.xxx.xxx

I have to conceal IPs, but the idea is that the Linux laptop talks to a few selected machines on the network via class 11 54mbit link, and everything else (the Internet) is capped at 75kbps, which falls into default class 10.

Ivan--
To unsubscribe from this list: send the line "unsubscribe lartc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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