iperf Tuning Guide

To get the maximum performance on iPerf, you can optimize several parameters depending on your network and hardware. Here are some recommendations:

  1. Use the latest version of iPerf: Ensure you are using the latest version of iPerf (iPerf3 is the most recent major version). The latest version usually has performance improvements and bug fixes.
  2. Increase the number of parallel streams: You can use the P flag to specify the number of parallel client streams to run simultaneously. This is useful for saturating high-bandwidth connections.
iperf -c <server_ip> -P 4

  1. Adjust the TCP window size: The TCP window size affects the amount of data that can be in transit before requiring an acknowledgment. Adjust the window size using the w flag to find the optimal value for your network.
iperf -c <server_ip> -w 1M

  1. Use longer test durations: To get more accurate results, run the test for a longer duration using the t flag.
iperf -c <server_ip> -t 60

  1. Disable Nagle’s Algorithm: Nagle’s Algorithm can cause delays in sending small packets by combining them. To disable it and potentially improve performance, use the N flag.
iperf -c <server_ip> -N

  1. Use the appropriate protocol: By default, iPerf uses TCP, but you can also use UDP or SCTP if it suits your needs better. Use the u flag for UDP or -sctp for SCTP.
iperf -c <server_ip> -u

  1. Change the interval for periodic reports: Adjust the interval for periodic reports using the i flag to monitor the performance more closely.
iperf -c <server_ip> -i 1

  1. Use multiple server threads: If you have a multi-core system, you can run multiple iPerf server threads by using the s flag with the P flag on the server side.
iperf -s -P 4

  1. Bind the iPerf process to a specific core (Linux): On Linux systems, you can use the taskset command to bind the iPerf process to a specific core, potentially improving performance.
taskset -c <core_number> iperf -c <server_ip>

Replace <core_number> with the core number you want to bind the iPerf process to.

Remember that every network environment is unique, and the optimal parameters for iPerf might vary depending on your specific situation. It is recommended to experiment with different options to find the best configuration for your network.

Example

Assuming your iperf server address is 192.168.0.1, and you want to test the bandwidth between your client and server which is supposed to hit 32Gbps, you can run the following command on the client side:

[root@iZt4ncyjhn8ckzs950bdlfZ ~]# iperf -c 192.168.0.1
------------------------------------------------------------
Client connecting to 192.168.0.1, TCP port 5001
TCP window size:  646 KByte (default)
------------------------------------------------------------
[  3] local 192.168.0.2 port 33688 connected with 192.168.0.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  10.7 GBytes  9.22 Gbits/sec

By increasing the number of parallel streams, you can get a higher bandwidth:

[root@iZt4ncyjhn8ckzs950bdlfZ ~]# iperf -c 192.168.0.1 -P 4
------------------------------------------------------------
Client connecting to 192.168.0.1, TCP port 5001
TCP window size:  272 KByte (default)
------------------------------------------------------------
[  4] local 192.168.0.2 port 33704 connected with 192.168.0.1 port 5001
[  3] local 192.168.0.2 port 33702 connected with 192.168.0.1 port 5001
[  5] local 192.168.0.2 port 33708 connected with 192.168.0.1 port 5001
[  6] local 192.168.0.2 port 33706 connected with 192.168.0.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec  5.44 GBytes  4.67 Gbits/sec
[  3]  0.0-10.0 sec  6.71 GBytes  5.76 Gbits/sec
[  5]  0.0-10.0 sec  5.44 GBytes  4.67 Gbits/sec
[  6]  0.0-10.0 sec  6.73 GBytes  5.78 Gbits/sec
[SUM]  0.0-10.0 sec  24.3 GBytes  20.9 Gbits/sec
Ziji SHI(史子骥)
Ziji SHI(史子骥)
Ph.D. candidate

My research interests include distributed machine learning and high-performance computing.

Related