Home » Linux, OS Concepts and Networking » Linux Networking » Network throughput measurement using netperf

Network throughput measurement using netperf

Netperf is a benchmark that can be used to measure various aspects of networking performance. Its primary focus is on bulk data transfer and request/response performance using either TCP or UDP and the Berkeley Sockets interface. There are optional tests available to measure the performance of DLPI, Unix Domain Sockets, the Fore ATM API and the HP HiPPI LLA interface.

 $ git clone https://github.com/HewlettPackard/netperf.git
 $ cd netperf 
 $ bash autogen.sh 
 $ mkdir out 
 $ ./configure --prefix=$PWD/out 
$ make 
$ make install 
$ tree out/ 

├── bin
│   ├── netperf
│   └── netserver
└── share
├── info
│   ├── dir
│   └── netperf.info
└── man
└── man1
├── netperf.1
└── netserver.1

5 directories, 6 files

 $ cd out/bin 

To measure network through on localhost, we first need to start the server and then start the client. Once client is started it will connect to server, does some data transfer and display the network throughput as below.

Start server

$ ./netserver -D -4 -f
 Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_INET

Start client, which shows the throughput on terminal

$ ./netperf
MIGRATED TCP STREAM TEST from () port 0 AF_INET to localhost () 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.00    12028.01 

if we want to test between two remote machines,

Start server on remote machine as,

$ ./netserver -p 12865 -D -4 -d -L  -f 

Start client on local machine / embedded ARM board ( if you have cross compiled above code ) as,

 $ ./netperf -L  -H  -p 12865,12866 

Help options
$ ./netserver -h

Usage: netserver [options]

  • -h Display this text
  • -D Do not daemonize
  • -d Increase debugging output
  • -f Do not spawn chilren for each test, run serially
  • -L name,family Use name to pick listen address and family for family
  • -N No debugging output, even if netperf asks
  • -p portnum Listen for connect requests on portnum.
  • -4 Do IPv4
  • -6 Do IPv6
  • -v verbosity Specify the verbosity level
  • -V Display version information and exit
  • -Z passphrase Expect passphrase as the first thing received

$ ./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 time,[units] * Display interim results at least every time interval
  • using units as the initial guess for units per second
  • A negative value for time will make heavy use of the
  • system’s timestamping functionality
  • -f G|M|K|g|m|k Set the output units
  • -F lfill[,rfill]* Pre-fill buffers with data from specified 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)
  • -j Keep additional timing statistics
  • -l testlen Specify test duration (>0 secs) (<0 bytes|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
  • -s seconds Wait seconds between test setup and test start
  • -S Set SO_KEEPALIVE on the data connection
  • -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 -y local,remote Set the socket priority
  • -Y local,remote Set the IP_TOS. Use hexadecimal.
  • -Z passphrase Set and pass to netserver a passphrase

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. Document – https://hewlettpackard.github.io/netperf/doc/netperf.html$

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment