How to measure network throughput with Iperf

September 3rd, 2018 | Karol Majek post_thumbnail

Do you have a data center and want to know the real throughput of the network? In this post, we will show you how to measure it using Iperf on a variety of operating systems!

In this post, you will see how to install Iperf3 and how to use it to measure the throughput of the network.

Iperf installation

In this guide, we are using the latest version of Iperf. If you want to use older one instead, install iperf instead of iperf3.

Debian/Ubuntu

The installation process on Debian based Linux distributions requires to install just one package which is iperf or iperf3. You can do it easily by running the following commands as the administrator:

apt-get update
apt-get install iperf3

Fedora/CentOS/RHEL/SL/Oracle Linux

In .rpm based distributions you can use DNF or YUM to install iperf3. Run one of those as the administrator:

dnf install iperf3

or

yum install iperf3

Iperf server

To run iperf server you need to simply type:

iperf3 -s

or iperf -s if you installed iperf instead of iperf3. By default, the server is listening on port 5201. If you prefer to change the port you can run:

iperf -s -p 2323

Iperf client node

To measure the throughput of your network you need to run iperf client node which will connect to Iperf server. You need to be sure that your firewall will let Iperf connect to the server. You can use IP or hostname to connect to Iperf server. If you changed the port to non-default, you can adjust it here with -p option.

iperf3 -c server_hostname
iperf3 -c server_hostname -p 2323
iperf3 -c mfsmaster

Iperf is by default using TCP packets, if you want to use UDP instead just add -u or –udp option:

iperf3 -c server_hostname -u
iperf3 -c server_hostname --udp

Sample results

Here are sample results for two hosts in Google Cloud. Both hosts are 1 vCPU machines located in europe-west1-b.

Server side

iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 10.132.0.2, port 43314
[ 5] local 10.132.0.3 port 5201 connected to 10.132.0.2 port 43316
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 205 MBytes 1.72 Gbits/sec 
[ 5] 1.00-2.00 sec 236 MBytes 1.98 Gbits/sec 
[ 5] 2.00-3.00 sec 236 MBytes 1.98 Gbits/sec 
[ 5] 3.00-4.00 sec 236 MBytes 1.98 Gbits/sec 
[ 5] 4.00-5.00 sec 236 MBytes 1.98 Gbits/sec 
[ 5] 5.00-6.00 sec 233 MBytes 1.96 Gbits/sec 
[ 5] 6.00-7.00 sec 229 MBytes 1.92 Gbits/sec 
[ 5] 7.00-8.00 sec 236 MBytes 1.98 Gbits/sec 
[ 5] 8.00-9.00 sec 236 MBytes 1.98 Gbits/sec 
[ 5] 9.00-10.00 sec 236 MBytes 1.98 Gbits/sec 
[ 5] 10.00-10.05 sec 12.5 MBytes 1.97 Gbits/sec 
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.05 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-10.05 sec 2.28 GBytes 1.94 Gbits/sec receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

Client side

iperf3 -c mfsmaster 
Connecting to host mfsmaster, port 5201
[ 4] local 10.132.0.2 port 43316 connected to 10.132.0.3 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 219 MBytes 1.84 Gbits/sec 1 3.01 MBytes 
[ 4] 1.00-2.00 sec 236 MBytes 1.98 Gbits/sec 0 3.01 MBytes 
[ 4] 2.00-3.00 sec 236 MBytes 1.98 Gbits/sec 0 3.01 MBytes 
[ 4] 3.00-4.00 sec 236 MBytes 1.98 Gbits/sec 0 3.01 MBytes 
[ 4] 4.00-5.00 sec 236 MBytes 1.98 Gbits/sec 0 3.01 MBytes 
[ 4] 5.00-6.00 sec 233 MBytes 1.95 Gbits/sec 0 3.01 MBytes 
[ 4] 6.00-7.00 sec 229 MBytes 1.92 Gbits/sec 0 3.01 MBytes 
[ 4] 7.00-8.00 sec 236 MBytes 1.98 Gbits/sec 0 3.01 MBytes 
[ 4] 8.00-9.00 sec 236 MBytes 1.98 Gbits/sec 0 3.01 MBytes 
[ 4] 9.00-10.00 sec 236 MBytes 1.98 Gbits/sec 0 3.01 MBytes 
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 2.28 GBytes 1.96 Gbits/sec 1 sender
[ 4] 0.00-10.00 sec 2.28 GBytes 1.95 Gbits/sec receiver

iperf Done.

Summary

We installed Iperf on a variety of operating systems. Then we ran Iperf server using default and non-default port. Finally, we benchmarked the throughput of the network using Iperf client. The result we get from the experimental setup in Google Cloud is 1.95 Gbps.

Measure your throughput to check how fast MooseFS can be in your data center!

Not yet started with MooseFS? Check the installation instructions for your operating system here!