quarta-feira, 27 de janeiro de 2010

testing Gigabit Ethernet networks with Linux laptops

How useful is to contract the implementation of a Gigabit ethernet LAN if we are unable to test its performance? It is well known that performance on LANs is easily affected by bad cabling or connector problems. Besides that, acceptance tests are part of every engineer's life.

Whereas testing a 100Mbit LAN is somewhat of a trivial task, testing Gbe is a bit trickier since harddrive to memory transfers can't keep up with such rates. Fortunately, we can put it to test using two Linux laptops with Gbe network interfaces. The process involves creating a reasonably large ramdisk on each laptop (the default size is not enough) and tranferring information between ramdisks using netcat. One laptop should be connected directly to the switch and the other one will be connected to each wall plug.

Here's a brief recipe of how to perform the test.

Preparing ramdisks on both the sender and receiver

- boot with option on lilo or grub: ramdisk_size=5000000
- login as root and issue:
mknod -m 660 /dev/ram b 1 1
mkfs.ext2 /dev/ram
mount -t ext2 /dev/ram /mnt/ramdisk
cd /mnt/ramdisk

On the sender generate a random file with dd
dd if=/dev/urandom of=/mnt/ramdisk/file.bin bs=1k count=500k
(dd will stop if the ramdisk is smaller than needed and will output the created file size)

Prepare the receiver to accept the file via netcat
nc -lp 1234 >file.bin

On the sender side push the file and measure the transfer time
time cat file.bin | nc RECEIVER_IP 1234

The send+receive steps should be repeated a number of times for each wall plug to check for stability of the measured times. The file transfer rate is then computed easily as
file transfer rate [MB/s] = (FILE SIZE [MB] ) / AVERAGE TIME

The network transfer rate is obtained by taking into account the Ethernet + TCP/IP overhead introduced by netcat, which is around 5%
network transfer rate [Mbps] = [ (FILE SIZE [MB] * 8) / AVERAGE TIME ] / 0.95

In our tests a acheived an average transfer time of 4.5s and a network transfer rate of 934 Mbps.

2 comentários:

Anónimo disse...

Não era mais simples utilizar o iperf ou outra ferramenta parecida?

Panoramix disse...

Talvez. Na próxima LAN havemos de experimentar para comparação.