29 agosto 2013

How to test network performance with Netperf

As we can read at the offcial webpage: "Netperf is a benchmark that can be used to measure the performance of many different types of networking. It provides tests for both unidirecitonal throughput, and end-to-end latency"

It´s so usefull to test network performance between two virtual machines , for example from a database server to the aplicacion client.

First, download Netperf for Linux or Windows O.S and install or unzip it:


    Linux:  http://www.netperf.org/netperf/DownloadNetperf.html

    Windows: https://i18n-zh.googlecode.com/files/NetPerf-2.4.5-w32.zip



See a Windows example:

-Start server side. You can specified a port with -p





-Start client side. With -h you can see all the options.









In this case, we get a test with the result 524,55 Mbit/s (Mbps) between two virtual machines.


The simple test run for 10seconds, but this can be changed to. Netperf -h:

E:\datos\NetPerf-2.4.5-w32>netperf -h

Usage: netperf [global options] -- [test options]

Global options:
    -a send,recv      Set the local send,recv buffer alignment
    -A send,recv      Set the remote send,recv buffer alignment
    -B brandstr       Specify a string to be emitted with brief output
    -c [cpu_rate]     Report local CPU usage
    -C [cpu_rate]     Report remote CPU usage
    -d                Increase debugging output
    -D [secs,units] * Display interim results at least every secs seconds
                      using units as the initial guess for units per second
    -f G|M|K|g|m|k    Set the output units
    -F fill_file      Pre-fill buffers with data from fill_file
    -h                Display this text
    -H name|ip,fam *  Specify the target machine and/or local ip and family
    -i max,min        Specify the max and min number of iterations (15,1)
    -I lvl[,intvl]    Specify confidence level (95 or 99) (99)
                      and confidence interval in percentage (10)
    -l testlen        Specify test duration (>0 secs) (<0 bytes="" font="" trans="">
    -L name|ip,fam *  Specify the local ip|name and address family
    -o send,recv      Set the local send,recv buffer offsets
    -O send,recv      Set the remote send,recv buffer offset
    -n numcpu         Set the number of processors for CPU util
    -N                Establish no control connection, do 'send' side only
    -p port,lport*    Specify netserver port number and/or local port
    -P 0|1            Don't/Do display test headers
    -r                Allow confidence to be hit on result only
    -t testname       Specify test to perform
    -T lcpu,rcpu      Request netperf/netserver be bound to local/remote cpu
    -v verbosity      Specify the verbosity level
    -W send,recv      Set the number of send,recv buffers
    -v level          Set the verbosity level (default 1, min 0)
    -V                Display the netperf version and exit

For those options taking two parms, at least one must be specified;
specifying one value without a comma will set both parms to that
value, specifying a value with a leading comma will set just the second
parm, a value with a trailing comma will set just the first. To set
each parm to unique values, specify both and separate them with a
comma.
* For these options taking two parms, specifying one value with no comma
will only set the first parms and will leave the second at the default
value. To set the second value it must be preceded with a comma or be a
comma-separated pair. This is to retain previous netperf behaviour.
E:\datos\NetPerf-2.4.5-w32>


Take care with the units (about caudal, no about velocity):

106 bit = 1 000 000 bit/s = 1 Mbit/s

1 megabyte/s = 8 megabit/s

1 megabit/s = 1000 kilobit/s = 125 kilobyte/s

UnitBitsBits / 1,000,000
Mega-bit1,000,0001.0
Mebi-bit1,048,5761.05
Mega-byte8,000,0008.0
Mebi-byte8,388,6088.39
Links: