You are here

IPERF: How to test network Speed,Performance,Bandwidth

Submitted by Sarath Pillai on Mon, 02/04/2013 - 19:59

Testing network performance in terms of speed and bandwidth is a norm in both production and non-production environment.

A detailed report of speed and bandwidth analysis is very much necessary for the deployment of network dependent application servers. Also sometimes you need to double check the speed of your network throughput while troubleshooting. All these requires a reliable network performance testing tool. This post will be concentrating on one such tool called as "iperf".

IPERF is an open source tool that can be used to test network performance. Iperf is much more reliable in its test results compared to many other online network speed test providers.

An added advantage of using IPERF for testing network performance is the fact that, it is very reliable if you have two servers, both in geographically different locations, and you want to measure network performance between them.

How to install iperf?

Installing iperf is very much easy, if you have epel yum repository enabled(in redhat system's).

How to install iperf in windows machine?

You can download iperf for windows from Iperf For windows. Now unzip this zip file to a folder named "iperf" and run the iperf.exe inside that directory.

For example i have extracted, the iperf zip in C:\iperf directory, so will open the Windows CMD, and navigate to that directory, to run the iperf.exe command.

C:\>cd C:\iperf
C:\iperf>iperf.exe

How to test the network speed between one windows machine and a linux machine?

As i told before, iperf can be used to perform speed test between remote machine's. It works in a client server model.

The operating system does not matter, while you are using iperf. The commands for using iperf on windows is exactly the same as in linux. And also other operating system. Normally in the test environment, iperf client sends data to the server for the test.

Before going ahead with the test, lets understand some networking concepts related to speed test.

Network Throughput

Transfer rate of data from one place to another with respect to time is called as throughput. Throughput is considered a quality measuring metric for hard disks,network etc. Its measured in Kbps(Kilo bits per second),Mbps(Mega bits per second),Gbps(Giga bits per second.)

TCP Window

TCP (Transmission Control Protocol), is a reliable transport layer protocol used for network communications. How TCP works, is beyond the scope of this article. TCP works on a reliable manner, by sending messages and waiting for acknowledgement from the receiver.

Whenever two machine's are communicating with each other, then each of them will inform the other, about the amount of bytes it is ready to receive at one time.

In other words, the maximum amount of data that a sender can send the other end, without an acknowledgement is called as Window Size.This TCP window size affects network throughput very badly sometimes. Lets take an example.

Suppose you want to send a 500MB of data from one machine to the other, with the tcp window size of 64KB.

Which means for sending the whole 500MB data, the sending machine has to wait 800 times for an acknowledgement from the receiver.

500MB / 64KB = 800

So you can clearly see that, if you increase the Window size a little bit to tune TCP, it can bring significant difference to the throughput achieved.

Suppose you have a windows machine and want to measure the speed between it and another Linux machine, then you need to make one as client, and another as the server. Lets see how.

We will make our windows machine the server and the Linux machine as the client.

From the above output, you can see that i got a speed of 258Mbits/sec. The ouput shows something more.

Interval: Interval specifies the time duration for which the data is transferred.

Transfer: All data transferred using iperf is through memory, and is flushed out after completing the test. So there is no need to clear the transferred file after the test. This column shows the transferred data size.

Bandwidth: This shows the rate of speed with which the data is transferred.

You can start your iperf server on your desired port with the following method.

And you can clearly see from the above output that the bandwidth for the whole transfer has increased, as we have increased the window size(I am using two virtual machine's in one physical box for this iperf demonstration, which is the reason am getting exceptional transfer rate's).

You can also tell the iperf client to show the transfer rate at an interval of 1 second, for the whole 10 second transfer, as shown below with -ioption.

Until now we have only seen the throughput of one TCP connection. Because when you run iperf, by default if only creates one TCP connection with the remote server.

You Might have noticed that some internet Download manager's are so fast while they download any content from the internet, compared to the normal operating system downloader. The main reason behind it is the fact that they work on "Parallel TCP connections." One such download manager, that i remember is "Internet Download Manager".

Let's check the throughput report by increasing the number of parallel connections using "iperf".

In the above shown example i have told iperf client to create 20 parallel TCP connections to the remote host while the data transfer. And if observe the output, you can see clearly that 20 different ports on the client is connected to the default 5001 port on the server.

And all of the connections had different transfer rate, and at the end we got a combined throughput of 266Mbits/s.(Which is much better that a single TCP connection.)

Conducting a UDP speed test in iperf

Conducting a UDP speed test using iperf will provide you with a couple of more information about your network which will be very much useful in finding network bottlenecks.

As we discussed before, not only TCP window size but network parameter's like the following also affects the throughput achieved during a connectionn.

Out of order delivery

Network Jitter

Packet loss out of total number of packets

For conduction an iperf udp test, you need to start the server with the -u option so that the UDP port 5001 is opened on the server side.

In the above example, i have used -b option to specify the bandwidth to use(because by default iperf UDP only used 1Mbps, i will recommend using your full available bandwidth to get an idea)

-u options needs to be also used on the client side for specifying UDP traffic.

The ouput tells us the following information.

Bandwidth = 81.7Mbits/sec

Network jitter = 0.167 ms (network jitter is the deviation in time for periodic arrival of data gram's. If you are doing the test with server's on the other side of the globe, then you might see higher jitter values in iperf output.)

Out of Order = 1 datagram

Lost/Total = 49/69508

0.07 percent datagram loss is not at all significant, infact you can say that you got a nice network packet loss ratio.

VOIP require's a very less datagram loss because its voice communication. A high data gram loss can drop the call altogether. So UDP testing with iperf will be very much helpful if you have VOIP or other such critical applications on your infrastructure.

You can get all the option's related to iperf with the following command.

Hi, from my testing on regular windows machines, the UDP performance when using two computers with windows , versus 1 windows > 1 linux and obviously linux-linux varies greatly, not only does windows seem to be much weaker in terms of achieving stable performance and higher speeds, above 100Mbits, also the packet loss phenomena seems to be much higher when a windows machine is involved, and also there is a big difference between using that windows machine as a server (weaker) or as i client.

When using Linux there is no packet loss. Note that for the specific testing i'm indicating, the setup is just two PCs back to back with a 2-meter ethernet cable.

If you are experiencing very high packet loss in windows machine, its probably a NIC driver issue (provided you have recently upgraded your windows or applied some hotfix..try installing the original vendor driver.). Any ways upgrade the NIC driver to the latest stable version from the official nic vendor site.

Tcpdump suggests me , there is retransmission happening once payload increases to 1464.
While re-transmission, it breaks the payload , and this works .

What i want to know:-
1) Is there any way , i can test this behaviour with iperf. I mean try to send the packets with more payload
2) DO anyone know in this situation what all things can be tried to nail down the issue ?

hi,
when i use this command iperf -c 192.168.0.100 -u -b 100m to test UDP performance, i don't get the true result. And i have this message all time "WARNING: did not receive ack of last datagram after 10 tries"

I appreciate the walkthrough. I’am going to implement this iperf tool in ubuntu. I just want to know can we able to get the hostname of the client machine. If that is possible how to achieve that? Is there any way to modify the source code to get the hostname of the client machine?