Many times we come across a slowness or instability between two hosts, and almost always we blame the poor networking guys, just because they're an easy target. Sometimes we forget that other factors including disk bottlenecks, CPU overload or software may be the cause of the software. Conversely, network engineers may automatically discount your claims by asking you to do a PING test. It replied? Well then, there is no network problem.
We're going to provide both the infrastructure team and networking team a very useful tool to help discount potential causes - and at the same time, providing a valuable tool to measure true network throughput between two hosts.
The tool of my choice is IPERF, and this article is going to teach this.
There are many other methods in which to calculate network performance - I myself have written an application to read a file from a network share to memory to test network performance, but that in itself is a flawed test because I may be limited by the Disk I/O of the source server. Protocol overhead for storage protocols such as SMB/CIFS/NFS/NCP also affects my metering.
Some people rely purely on PING responses to test the stability of a network link, but this isn't good enough. The standard packet size for a PING is 48 bytes, and although you can increase this, the delay between pings is insufficient to catch instability.
IPERF gets rid of these potential bottlenecks and tests at a pure TCP/IP level - talking directly to the winsock layer.
How it works
Simply put, IPERF runs as a listener on one machine, and you initiate a client on another. The client will establish a communication between itself and the server, and then try to send as much data as it possibly can in a predetermined length of time (default is 10 seconds).
Here is the client:
here is the server:
As you can see the speeds are almost identical at both ends. Why the small difference? It all has to do with timing and buffering, but rest assured you're still getting a fairly accurate reading. The speed you see there seems to be very poor, but rest assured, it's quite good considering it's switched gigabit. Had these two machines been back to back hard wired (no switch involved) it would have been faster.
Playing with Options
Run iperf with the --help switch. You will see many options which may further aid in troubleshooting. For example, I can improve my performance by selecting a larger TCP Window size. A window size of 8 KB means that the client sends 8 KB of data to the server, and waits for a reply to say that the data was received. It then sends another 8 KB chunk.
Imagine what would happen if we sent a 64 KB chunk? Oh wait, we don't have to imagine, here's the result!
As you can see, the result is much truer to the actual capability of the network link.
Another option that is useful is the -t option - to increase the time of the test. We're going to combine this option with the -i option - to tell the application to report every 10 seconds. Our command line is therefore going to be this:
iperf -c <client ip address> -t 60 -i 10
the -t specifies 60 seconds, and the -i tells to report every 10 seconds.
Here is the result.
The above test can give a better averaging result - if there are occasional drops on the network, you may have to run the test for a while to track down how bad the network is affected during the problems.
Be sure that there are no firewalls blocking the machines. If there is, then open inbound TCP port 5001 to the server.
Try and avoid doing this during business hours if there is a vital link which you intend to test. Your organization will feel it.
You can install and run this as a service/daemon so that it's always running on a dedicated server
Where to Get
IPERF was originally designed for Linux, and can be obtained from http://sourceforge.net/projects/iperf/
. It may be included in your distribution - try apt-get install iperf if you have a Debian/Ubuntu distribution
IPERF is included in FreeBSD as a port - cd to /usr/ports/benchmarks/iperf and then do a make install clean
And finally, IPERF has very kindly been compiled and provided as a Win32 application by our good friends at the Computer Services & Telecommunications department of the University of Central Florida, and can be downloaded from their dedicated IPERF page, https://publishing.ucf.edu/sites/itr/cst/Pages/IPerf.aspx