Latency Simulation

From HoerupWiki
Revision as of 14:16, 7 November 2008 by 193.3.8.1 (talk) (This works!)
Jump to: navigation, search

I forbindelse med udviklingen af et overvågningssystem til Grundfos havde jeg brug for at kunne undersøge hvordan at klienten opførte sig over en langsom linie med høj latency, selv om jeg sad direkte på firmaets LAN.

Til linux er der mest udbredte værktøj NIST.

Man kan også overveje at bruge en FreeBSD og dennes dummynet

Kernel scheduler

Fra: http://ask.slashdot.org/askslashdot/04/08/20/2035211.shtml?tid=222&tid=185&tid=95&tid=4&tid=218

I'm shocked no-one has posted this!

It's been in the kernel for while, though I don't know much about using it. I never bothered even looking at it (had no need) until a coworker wanted to use it (on Thursday) to do some testing and asked me about it.

Here's the chunk of Kconfig:

config NET_SCH_DELAY
tristate "Delay simulator"
depends on NET_SCHED
help
Say Y if you want to delay packets by a fixed amount of
time. This is often useful to simulate network delay when
testing applications or protocols.

To compile this driver as a module, choose M here: the module will be called sch_delay.

Please reply to this if you have been able to get this working... the tuning parameters to tc we found give errors (and yes, we built installed the latest iproute2 tarball). Then again, we only spent a few minutes playing with it (he had to leave).


This works!

-> http://linux-net.osdl.org/index.php/Netem#Delay_distribution http://reischle.net/ReischleNet-English/Networking%20Blog/55B07C5E-3345-4F14-98ED-0B4657F5153E.html http://www.linuxfoundation.org/en/Net:Netem#Delay_distribution

Båndbredde

Hvis at man vil simulere begrænset båndbredde på linux, kan man alternativt bruge shaper modulet og det tilhørende user-level program shapecfg

modprobe shaper
shapecfg attach shaper0 eth0
shapecfg speed shaper0 9600 # in baud
ifconfig shaper0 <eth0-address> netmask <eth0-netmask>
# remote automatic route added by above
route del -net <eth0-network> netmask <eth0-netmask> dev shaper0
# add routes to be choked
route add -host <otherhost> dev shaper0
# or if going through a router
route add -net <othernet> gw <router> dev shaper0