# Benchmarking Raw Network Speed

## wswartzendruber

I'm trying to benchmark the transfer speed between two IP addresses.  I want to test the link speed between my VMs and the host/themselves.

----------

## honp

So try to copy (maybe parallel) some data frome one computer to the second and count the time. Or you can try nmon, or iftop...

----------

## cach0rr0

i dont know of any benchmarking tools (not that they dont exist, just that i dont know of them)

but what I'd personally try is some wonky netcat tunnel reading a fixed size chunk of data (make a 1GB file created from /dev/zero, or use an .iso)  - 

best way to take application latency out of the picture far as i can tell

something like:

destination host:

```

# nc -l -p 22222 | dd of=/dev/null

```

source host:

```

# dd if=/home/meat/1GBcdimage.iso | nc x.x.x.x 22222

```

where x.x.x.x is of course the IP of the netcat listener on the destination

in that order, else the listener won't be there and the if= operation fails 

result:

```

dd if=/home/civ3.iso | nc 127.0.0.1 22222

1250784+0 records in

1250784+0 records out

640401408 bytes (640 MB) copied, 4.48702 s, 143 MB/s

```

Not perfect science, and i guess not a perfect degree of parallelism, but perhaps tolerable?

EDIT: no, that doesnt work, because i dont think you have the guarantee the host has received the data over the network, only that dd has finished reading it? i think?

----------

## strubbldesign

have you tried to use mping?

as far as i know you can use mping to make a static ping-flood too the host with a definied sice for the ping-frame... there multiple NW-monitoring tools) if you are looking for somthing to monitor a lot off things i suggest you to use nagios... otherwhise may your system-hardware-monitor meet your expectation.

hope this was helpful

----------

## conte73

I recently did some simple tests after changing my 10/100 switch with a gigabit one; at first I used the same trick reported by cach0rr0 (dd and nc).

Then I found a simple program in portage, iperf, that do same raw tcp/ip benchmark; it works like the first but has some options you can change and give better measurements.

----------

## honp

Maybe you should use files that aren`t stored on local disks but rather on some kind of memory devices (like shm temp) becouse if you have really fast network and slow disks it can affect your benchmark:)

----------

## tox2ik

 *conte73 wrote:*   

> 
> 
> ...Then I found a simple program in portage, iperf, that do same raw tcp/ip benchmark; it works like the first but has some options you can change and give better measurements.

 

 net-analyzer/netperf

    Description:         Network performance benchmark including tests for TCP, UDP, sockets, ATM and more.

displays the info on the client

server:

```
# netserver

Starting netserver at port 12865

Starting netserver at hostname 0.0.0.0 port 12865 and family AF_UNSPEC

```

client:

```
$ netperf -H genja.lan

TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to genja.lan (10.3.0.4) port 0 AF_INET

Recv   Send    Send                          

Socket Socket  Message  Elapsed              

Size   Size    Size     Time     Throughput  

bytes  bytes   bytes    secs.    10^6bits/sec  

 87380  16384  16384    10.02     929.55   

```

 net-misc/iperf

     Description:         tool to measure IP bandwidth using UDP or TCP

displays the info on the server

server:

```
$ iperf -s

------------------------------------------------------------

Server listening on TCP port 5001

TCP window size: 85.3 KByte (default)

------------------------------------------------------------

[  4] local 10.3.0.4 port 5001 connected with 10.3.0.6 port 59499

[ ID] Interval       Transfer     Bandwidth

[  4]  0.0-10.0 sec  1.08 GBytes    928 Mbits/sec

```

client:

```

$ iperf  -c genja 

```

---------------

they both work, but netperf has more options and is more suited for teh internoits

----------

## wswartzendruber

I'm running into a CPU bottleneck with VirtualBox, according to top.  I would've thought the VirtIO network devices to be much faster than ~500 Mbps.

EDIT: Windows' VirtIO performance is PATHETIC: ~190 Mbps.

----------

## boerKrelis

 *honp wrote:*   

> Maybe you should use files that aren`t stored on local disks but rather on some kind of memory devices (like shm temp) becouse if you have really fast network and slow disks it can affect your benchmark:)

 

Try /dev/zero. It's a device which holds an endless supply of zeroes and of course it's frickin' fast. Sequences of zeroes compress rather well, though, so for benchmarking purposes you'll have to make sure there's no compression happening somewhere in your link, otherwise you may find you're hitting 100Mbit with your 56K6 dialup connection ;-)

----------

## wswartzendruber

 *wswartzendruber wrote:*   

> I'm running into a CPU bottleneck with VirtualBox, according to top.  I would've thought the VirtIO network devices to be much faster than ~500 Mbps.
> 
> EDIT: Windows' VirtIO performance is PATHETIC: ~190 Mbps.

 

Nevermind the complaining.  Emulating e1000 is about 1/3 the speed.

----------

## Mad Merlin

 *wswartzendruber wrote:*   

> I'm running into a CPU bottleneck with VirtualBox, according to top.  I would've thought the VirtIO network devices to be much faster than ~500 Mbps.
> 
> EDIT: Windows' VirtIO performance is PATHETIC: ~190 Mbps.

 

FWIW, with KVM I get 1.5-2 Gbits/s with virtio Linux guests to the host. 'doze will certainly be slower (in all cases), but I don't care about that. e1000 got close to a full gigabit, but virtio has lower CPU usage.

----------

