Netperf
Netperf is a cool little utility that I discovered while working with Crossbow. It's technically a network benchmarking tool, but it's fun to use to hammer your network with load and test out Crossbow's bandwidth control features.
Simply click the link to install netperf
, which will launch the Package Manager Web Installer:

To verify the installation, first start the benchmark server:
bleonard@opensolaris:~$ netserver Starting netserver at port 12865 Starting netserver at hostname 0.0.0.0 port 12865 and family AF_UNSPEC
Then run netperf, which will run a TCP_STREAM test of 10 seconds over the loopback interface:
bleonard@opensolaris:~$ netperf TCP STREAM TEST from ::ffff:0.0.0.0 (0.0.0.0) port 0 AF_INET to opensolaris (127.0.0.1) port 0 AF_INET Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 49152 49152 49152 10.00 4895.46
Now that we know Netperf is set up correctly, we can use it to test bulk data transfer performance between 2 hosts (or 2 zones). TCP stream performance is the default test type and it's simply performed by running the command:
netperf -H <remotehost>
which will run a 10 second test between the local and remote system.
So I'm going to use netperf to run some tests between the global zone and a local zone, which has been set up to use a Crossbow virtual NIC exclusively. To create such a configuration on your own, see the blog entry Zones and Crossbow.
The local zone, myzone, is currently up and running:
bleonard@opensolaris:~$ zoneadm list -cv ID NAME STATUS PATH BRAND IP 0 global running / native shared - myzone running /zones/myzone ipkg excl
The first thing I'm going to do is copy the netserver program over to the local zone:
pfexec cp /opt/csw/bin/netserver /zones/myzone/root/var/tmp/.
And then start the netserver:
bleonard@opensolaris:~$ pfexec zlogin myzone /var/tmp/netserver en_US.UTF-8: unknown locale en_US.UTF-8: unknown locale Starting netserver at port 12865 Starting netserver at hostname 0.0.0.0 port 12865 and family AF_UNSPEC
Now let's test the connection between the global and local zone:
bleonard@opensolaris:~$ netperf -H 10.0.1.25 TCP STREAM TEST from ::ffff:0.0.0.0 (0.0.0.0) port 0 AF_INET to ::ffff:10.0.1.25 (10.0.1.25) port 0 AF_INET Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 49152 49152 49152 10.00 1130.01
Here we can see the throughput between my zones is 1130 Mbit/s. Now let's reduce the max bandwidth of the virtual NIC to 500 Mbit/s and try the test again:
bleonard@opensolaris:~$ pfexec dladm set-linkprop -p maxbw=500 myzone0 bleonard@opensolaris:~$ dladm show-vnic LINK OVER SPEED MACADDRESS MACADDRTYPE VID myzone0 e1000g0 500 2:8:20:59:0:b5 random 0 bleonard@opensolaris:~$ netperf -H 10.0.1.25 TCP STREAM TEST from ::ffff:0.0.0.0 (0.0.0.0) port 0 AF_INET to ::ffff:10.0.1.25 (10.0.1.25) port 0 AF_INET Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 49152 49152 49152 10.00 486.22
Or at a ridiculously low 2 Mbit/s:
bleonard@opensolaris:~$ pfexec dladm set-linkprop -p maxbw=2 myzone0 bleonard@opensolaris:~$ netperf -H 10.0.1.25 TCP STREAM TEST from ::ffff:0.0.0.0 (0.0.0.0) port 0 AF_INET to ::ffff:10.0.1.25 (10.0.1.25) port 0 AF_INET Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 49152 49152 49152 10.25 1.09
Good stuff.
I've just scratched the surface of Netperf, but this simple introduction suits my purposes for testing Crossbow. For more fun check out the Netperf manual.
What about uperf, from Solaris.
How they compare and why Netperf is better for this job?
Tahnks
- Pablo
Posted by Pablo on October 08, 2009 at 01:11 AM GMT #
Hi Pablo,
I think this blog sums the comparison up nicely: http://blogs.sun.com/eh/entry/a_handy_tool_for_network . I'm not familiar with uperf, from the looks up it I need to first define a profile in XML - yuk! Overkill for my needs, but depending on the type of benchmarking you want to perform, it has its place.
/Brian
Posted by Brian Leonard on October 08, 2009 at 03:31 PM GMT #
Uperf allows you to model more realistic network loads as well as benchmarks. There are prebuilt XML profiles for what netperf does. You can do multiple protocols, multiple hosts etc.
Posted by Neelakanth Nadgir on October 08, 2009 at 04:37 PM GMT #
Netperf is also available in Open Solaris /contrib repository.
Posted by Robert Milkowski on October 08, 2009 at 09:22 PM GMT #
Indeed, there is much much more to netperf than just the TCP_STREAM test :) I find the TCP_RR test to be very enlightening as well.
I would be curious to know which version of netperf is distributed from those repositories - the most recent version is 2.4.5. The very latest netperf bits can be had via subversion from http://www.netperf.org/svn/netperf2/trunk - one of the things being worked-on are the "omni" tests which are "two routines to measure it all" in an attempt to eliminate much of the code in src/nettest_bsd.c and src/nettest_sctp.c, while enabling DCCP, SDP and perhaps even RDS. Another "feature" of the "omni" tests is configurable output in either "human," "CSV," or "keyval" output, the main intention of the latter to enable the straightforward creation of a netperf results database, once I can either learn enough MySQL/python/whatnot to do it, or find another sufficiently motivated person to do so :)
netperf-talk from netperf.org is always ready and waiting for further questions/discussions - to deal with spam I've had to be somewhat heavy-handed and restrict posting to subscribers, but the traffic volume is rather low, so subscribing is unlikely to exhaust anyone's inbox quotas :)
Posted by rick jones on October 21, 2009 at 01:24 AM GMT #
Hi Rick, good to hear from you. I'll tell you the version numbers if you can tell me how to find it. I didn't see a -version option to either the netperf or netserver commands.
Posted by Brian Leonard on October 21, 2009 at 01:04 PM GMT #
Kids today, forgetting the Tao of Unix :) Netperf and netserver have what strings embedded in them, so "what netperf" and "what netserver"
Having said that, starting with 2.4.something, there is also a -V option for emitting a version string.
Posted by rick jones on October 21, 2009 at 04:18 PM GMT #
Hey, I grow up a bit every day :-). It looks like the version at Blastwave is 2.3. The version at Contrib is 2.4.4. I'll update the entry to refer folks to Contrib over Blastwave. It's a much nicer install experience anyhow.
Posted by Brian Leonard on October 21, 2009 at 05:35 PM GMT #