Re: [LARTC] Low latency on large uploads - almost done but not quite.

Linux Advanced Routing and Traffic Control

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

 



Playing CounterStrike myself regurlarly and being on a LAN with a few
professional P2Pers, I had the same problem and also experienced the
non-stable pings. At first I started experimenting with the rates and
ceilings, but in practice that didn't help much.

(one of) the reasons for the unstable ping is that a packet of ~ 1500 bytes
on a 128kbit connection (like yours and mine) takes roughly a 10th of a
second to send (100ms). So at the moment a large packet is being sent and a
quake packet is next in the queue, it still has to wait 100ms (worst case).
This latency of course adds to the normal latency you already have to the
quake server.

What does seem to help a little is lowering the maximum packet size (MTU) in
your routing table:

#!/bin/sh
oldroute=`ip route | grep default | cut -d' ' -f-5`
ip route change $oldroute mtu 500

The cut takes care of removing the 'mtu xxx' from a line like this (type "ip
route": to see it)
default via a.b.c.d dev eth0  mtu 900

It only takes the first 5 words. I presume that number of words can be
different in other situations, so you might have to adapt for that. (or use
something other than 'cut' to do it properly).

Note that the MTU only effects the outgoing packetsize, so downloads are not
affected at all. Uploads do get a little less efficient (the packetheaders
consist of a larger portion of the traffic) but in practise this is still
acceptable. Game packets are pretty small anyway, so won't be affected at
all.

I'm assuming the burst and quantum settings can be optimized for smaller
packet sizes to take full advantage of this. But to be honest I haven't
really done that yet.

I use a cable connection which has a more than 10 times faster download than
upload, so for me shaping the download isn't very effective. If you want to
limit the maximum packetsize for incoming packets as well (at least for TCP)
you can simply do this:

iptables -I PREROUTING -t mangle -i eth0 -j TCPMSS --set-mss 1000 -p
TCP --tcp-flags SYN,RST SYN
iptables -I INPUT                 -t mangle -i eth0 -j TCPMSS --set-mss
1000 -p TCP --tcp-flags SYN,RST SYN

For 1000 bytes packets. You can also use --clamp-mss-to-mtu option, which
probably makes sense. Note that the MSS thing only works for new
connections.

Note: After you change the MSS value, existing connections will still use
the old size. MTU changes have effect immediately.

Also make sure you patched the kernel to use the high resolution timer (info
at www.docum.org somewhere). That helped a lot in my case (you can put the
ceilingrates closer to the actual 128kbit and therefore reduce latency as
well). I'm not sure it's still necessary on 2.4.20 and/or 2.4.21.

Jannes Faber

----- Original Message -----
From: "Thilo Schulz" <arny@xxxxxxxxxxxxxx>
To: <lartc@xxxxxxxxxxxxxxx>
Sent: Saturday, June 14, 2003 5:54 PM
Subject: [LARTC] Low latency on large uploads - almost done but not quite.


Does anyone of you have an idea how I can minimize this effect, and let
pings
be stable at 60 ms? stable 80ms delay are okay for me too, no question.
If I let the worst-priority bulkdownload class ceil up only to 10kbyte/s I
have the same effect, only when the max ceil class is put down under 6 i do
not have this changing ping effect.




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