[Nottingham] Networking tip: Traffic shaping to minimise latency

Martin martin at ml1.co.uk
Tue Jun 15 20:07:32 BST 2004


Folks,

Yet another one of those 'check out a man page at random' and... Yet 
another set of first rate features already in the kernel just waiting to 
be tweaked!


For those that do a lot of file transfer over a slow link such as 
dial-up or broadband, then these little commands should help immensly:

(As root)

tc qdisc add dev eth0 root handle 1: prio
tc qdisc add dev eth0 parent 1:1 handle 10: sfq
tc qdisc add dev eth0 parent 1:2 handle 20: tbf rate 63kbit buffer 1600 
limit 3000
tc qdisc add dev eth0 parent 1:3 handle 30: sfq

Adjust "eth0" and "63kbit" as appropriate for your slow link. Each "tc" 
command is all one line. (Try "ppp0" and "35kbit" or less for dialup.)


What this does is to minimise latency for a saturated link so that high 
priority interactive stuff gets through unhindered, and low priority 
stuff gets through as and how it can.

See:
/usr/share/doc/HOWTO/HTML/en/Adv-Routing
or web equivalent for those who wish to explore further (or know better 
than to trust me (:-)).

There's lots more nice routing features to try yet! Other's are welcome 
to add their notes.


And to see the results of that little lot (other than seeing web pages 
load up faster despite a saturated uplink), use:

tc -s qdisc ls dev eth0

Just one note: Don't worry too much about dropped packets, tcp expects 
this to happen and uses handshaking. Higher level protocols deliberately 
load up a link until some packets get dropped due to saturation.


Works very well on this system.

Have fun,
Martin


-- 
----------------
Martin Lomas
martin at ml1.co.uk
----------------



More information about the Nottingham mailing list