Srovnávací testy

Iperf testuje propustnost sítě. Testovat můžete jak TCP tak UDP. Jak na to?

Nainstalujeme:

sudo aptitude install iperf

Na jednom stroji spustíme server:

iperf -s

a na druhém začneme posílat data (například zde 10 streamů po dobu 45s):

iperf -c 192.168.1.2 -t 45 -P 10 -w 64KB -l 128KB

Na obou koncích pak uvidíme výsledky měření:

starenka / % iperf -c 192.168.1.2 -t45 -P10 -fM                                                                                    [70% 04:55:10]
------------------------------------------------------------
Client connecting to 192.168.1.2, TCP port 5001
TCP window size: 0.02 MByte (default)
------------------------------------------------------------
[ 12] local 192.168.1.3 port 49679 connected with 192.168.1.2 port 5001
[  4] local 192.168.1.3 port 49670 connected with 192.168.1.2 port 5001
[  5] local 192.168.1.3 port 49671 connected with 192.168.1.2 port 5001
[  3] local 192.168.1.3 port 49672 connected with 192.168.1.2 port 5001
[  6] local 192.168.1.3 port 49673 connected with 192.168.1.2 port 5001
[  7] local 192.168.1.3 port 49674 connected with 192.168.1.2 port 5001
[  9] local 192.168.1.3 port 49676 connected with 192.168.1.2 port 5001
[  8] local 192.168.1.3 port 49675 connected with 192.168.1.2 port 5001
[ 10] local 192.168.1.3 port 49677 connected with 192.168.1.2 port 5001
[ 11] local 192.168.1.3 port 49678 connected with 192.168.1.2 port 5001
[ ID] Interval       Transfer     Bandwidth
[ 11]  0.0-45.3 sec  5.25 MBytes  0.12 MBytes/sec
[ 12]  0.0-45.5 sec  5.88 MBytes  0.13 MBytes/sec
[  3]  0.0-45.8 sec  3.62 MBytes  0.08 MBytes/sec
[  8]  0.0-46.2 sec  4.25 MBytes  0.09 MBytes/sec
[ 10]  0.0-46.2 sec  3.88 MBytes  0.08 MBytes/sec
[  4]  0.0-47.0 sec  4.62 MBytes  0.10 MBytes/sec
[  5]  0.0-47.2 sec  4.75 MBytes  0.10 MBytes/sec
[  9]  0.0-47.6 sec  4.75 MBytes  0.10 MBytes/sec
[  7]  0.0-47.7 sec  3.50 MBytes  0.07 MBytes/sec
[  6]  0.0-48.2 sec  3.12 MBytes  0.06 MBytes/sec
[SUM]  0.0-48.2 sec  43.6 MBytes  0.90 MBytes/sec

Program TTCP je nástroj pro testování rychlosti spojení mezi dvěma počítači. Program je od stejného autora Mike Muuss , který napsal program ping.

Instalace

Pro Ubuntu jsem bohužel žádný balíček nenašel, proto si zde tento jednoduchý prográmek zkompilujeme sami.

Před kompilací programu je nutné nainstalovat balík build-essential.

Manuální stažení a instalace:

sudo su -
mkdir /tmp/install
cd /tmp/install
wget -c http://ftp.smejdil.cz/ttcp-1.12.tgz
tar xvzf ttcp-1.12.tgz
cd ttcp
gcc ttcp.c -o ttcp
install -o root -g root -m 555 ttcp /usr/local/bin/ttcp
install -o root -g root -m 444 ttcp.1 /usr/share/man/man1/ttcp.1

Ukázka

Program se na jedné strane pusti s parametrem -r, čímž začne program naslouchat na portu 5001 a pote se na druhé strane pusti program s parametrem -t a začnou se vysílat testovací data.

====================================================================================
100baseTX <full-duplex> FreeBSD
[root@ntb ~]# ttcp -v -r -s -f M -l 25600
ttcp-r: buflen=25600, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.0.2
ttcp-r: 52428800 bytes in 4.46 real seconds = 11.22 MB/sec +++
ttcp-r: 52428800 bytes in 0.25 CPU seconds = 201.52 MB/cpu sec
ttcp-r: 36042 I/O calls, msec/call = 0.13, calls/sec = 8088.32
ttcp-r: 0.0user 0.2sys 0:04real 5% 17i+1207d 450maxrss 0+2pf 36035+69csw
ttcp-r: buffer address 0x28204000

100baseTX <full-duplex> Linux Ubuntu
root@pc# ttcp -v -t -s -f m -l 25600 192.168.0.3
ttcp-t: buflen=25600, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.0.3
ttcp-t: socket
ttcp-t: connect
ttcp-t: 52428800 bytes in 4.42 real seconds = 90.51 Mbit/sec +++
ttcp-t: 52428800 bytes in 0.06 CPU seconds = 7142.47 Mbit/cpu sec
ttcp-t: 2048 I/O calls, msec/call = 2.21, calls/sec = 463.39
ttcp-t: 0.0user 0.0sys 0:04real 1% 0i+0d 0maxrss 0+7pf 358+0csw
ttcp-t: buffer address 0x8050000

====================================================================================
100baseTX <full-duplex> FreeBSD
[root@ntb ~]# ttcp -v -r -s -f M -l 25600
ttcp-r: buflen=25600, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket
ttcp-r: accept from 192.168.0.4
ttcp-r: 52428800 bytes in 24.55 real seconds = 2.04 MB/sec +++
ttcp-r: 52428800 bytes in 0.25 CPU seconds = 197.07 MB/cpu sec
ttcp-r: 36193 I/O calls, msec/call = 0.69, calls/sec = 1474.12
ttcp-r: 0.0user 0.2sys 0:24real 1% 18i+1329d 450maxrss 0+2pf 36189+53csw
ttcp-r: buffer address 0x28204000

IEEE 802.11g Linux Ubuntu
root@ntb2:~# ttcp -v -t -s -f m -l 25600 192.168.0.2
ttcp-t: buflen=25600, nbuf=2048, align=16384/0, port=5001  tcp  -> 192.168.10.4
ttcp-t: socket
ttcp-t: connect
ttcp-t: 52428800 bytes in 24.39 real seconds = 16.40 Mbit/sec +++
ttcp-t: 52428800 bytes in 0.10 CPU seconds = 3999.76 Mbit/cpu sec
ttcp-t: 2048 I/O calls, msec/call = 12.19, calls/sec = 83.97
ttcp-t: 0.0user 0.1sys 0:24real 0% 0i+0d 0maxrss 0+8pf 353+0csw
ttcp-t: buffer address 0x608000
====================================================================================

Odstranění

sudo su -
rm /usr/local/bin/ttcp
rm /usr/share/man/man1/ttcp.1

Odkazy