How to Measure Network Throughput with Iperf
Before you tune MooseFS for maximum throughput, you need to know what your network is actually capable of. This post shows how to install iperf3 on Debian/Ubuntu and RHEL-family systems, run a server–client test, and interpret the results — with a real-world Google Cloud example hitting 1.95 Gbps.
Note: In this guide, we are using the latest version of Iperf. If you want to use an older version instead, install iperf instead of iperf3.
Iperf Installation
Debian/Ubuntu
The installation process on Debian-based Linux distributions requires installing just one package, which is iperf or iperf3.
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.
dnf install iperf3
or
yum install iperf3
Iperf Server
To run the iperf server you simply type:
iperf3 -s
(or iperf -s if you installed iperf instead of iperf3). By default, the server listens 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 the iperf client node, which will connect to the Iperf server.
iperf3 -c server_hostname
iperf3 -c server_hostname -p 2323
iperf3 -c mfsmaster
Iperf uses TCP packets by default. If you want to use UDP instead, add -u or --udp:
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 output
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 output
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 an Iperf server using the default and a non-default port. Finally, we benchmarked the throughput of the network using the Iperf client. The result we got 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!