iperf3-Performance Test

Official documentation: https://iperf.fr/iperf-doc.php

Install

1.apt installation

sudo apt-get install iperf3

2. Source code installation

# 按照官方说明安装
./configure
make
sudo make install

Error when executing compilation:

iperf3: error while loading shared libraries: libiperf.so.0: cannot open shared object file: No such file or directory

解决:
./configure
make
sudo ldconfig
sudo make install

The purpose of the ldconfig command is mainly to search for shareable dynamic link libraries (formats such as lib*) in the default search directories /lib and /usr/lib and the directories listed in the dynamic library configuration file /etc/ld.so.conf .so*), and then create the connection and cache files required by the dynamic loader (ld.so). The default cache file is /etc/ld.so.cache. This file saves a sorted list of dynamic link library names. In order to make the dynamic link library shared by the system, you need to run the dynamic link library management command ldconfig. This execution program Stored in the /sbin directory.

ldconfig is usually run when the system starts, but when the user installs a new dynamic link library, this command needs to be run manually.
Generate documents in the docs folder

make html
# 报错:大概是因为缺少sphinx文档的主题
ImportError: No module named sphinx_bootstrap_theme

# 安装sphinx_bootstrap_theme解决
pip install sphinx_bootstrap_theme

Instructions

Applies to server/client

-f 指定数据显示格式 [k|m|K|M] 分别表示 Kbits、Mbits、KBytes、MBytes,默认是 Mbits
-l 设置读写缓冲区的长度。TCP方式默认为8KB,UDP方式默认为1470字节。
-u 使用 udp 协议
-i 以秒为单位统计带宽值
-b,--bandwidth [K|M|G]:指定UDP模式使用的带宽,单位bits/sec,默认值是1 Mbit/sec
-m 显示最大的 TCP 数据段大小
-p 指定服务端或者客户端的端口号
-w 指定 TCP 窗口大小
-t,--time:指定数据传输的总时间,即在指定的时间内,重复发送指定长度的数据包。默认10秒
-A:CPU亲和性,可以将具体的iperf3进程绑定对应编号的逻辑CPU,避免iperf进程在不同的CPU间调度
-B 绑定道指定的主机地址或接口
-C 兼容旧版本
-M 设置 TCP 数据包的最大 MTU 值
 -V, --verbose: 更多细节输出

Optimization:

-P, –parallel:线程数。指定客户端与服务端之间使用的线程数。默认是1线程。需要客户端与服务器端同时使用此参数。

iperf principle

Before the stress test, the server and the client first use udp to negotiate the protocol (tcp/udp) and other test parameters used in the stress test. Therefore, the server does not need to formulate a stress test protocol and can directly run iperf3 -s -p 10081.

test

UDP server client uses the following command:

# 服务端
./iperf3 -s -p 10081

# 客户端
./iperf3 -c 192.168.22.123 -u -p 10081 -t 60 -f m -b50000M


[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-60.00  sec  16.2 GBytes  2321 Mbits/sec  0.000 ms  0/12453417 (0%)  sender
[  5]   0.00-60.01  sec  1.73 GBytes   248 Mbits/sec  0.043 ms  11119569/12448888 (89%)  receiver
  • Transfer: number of bytes transferred
  • Bitrate: uplink and downlink bandwidth
  • Jitter: Delay jitter (delay parameter).
    Calculation method: Assume that the client sending time of data packet i is Si and the server receiving time is Ri. Jitter of packets i and j
    D(i, j)=(Rj - Sj) - (Ri - Si)

Reference documentation

  • Introduction and use of iperf: http://www.enkichen.com/2017/06/06/iperf-introduce/
  • Linux command list: iperf https://ipcmen.com/iperf

Performance Testing

client


iperf3 -c 192.168.22.100 -p 1001 -t 30 -f m -b 10240m -p 128

Test parameters:

  • -c runs for the client and specifies the IP address of the server

  • -b indicates the test bandwidth used

  • -t means to test based on time as the test end condition, the default is 10 seconds;

  • -d prints out more detailed debugging information

  • -P The number of parallel connections to the iperf3 server. The default value is 1.

Note: (In daily testing, we will find that when the maximum throughput cannot be increased, opening multiple parallel connections will generally immediately increase the maximum throughput. Usually our first reaction is that iperf turns on multi-threading (details) See: How to view thread information in a multi-threaded process under Linux), but in fact, when multiple parallel connections are opened, iperf, whether client or server, still works in single-threaded mode (for details, see: iPerf3 -P Detailed graphic analysis of parameters), the maximum throughput mainly depends on the three capabilities of the receiver host, the sender host and the network, the maximum bandwidth, the maximum packet processing capability, and the delay. We can start a special chapter to talk about it later. Maximum throughput tests the impact of 3 capabilities of 3 nodes, and how to correctly set iperf parameters.

Usage: as shown below: means opening 3 connections

iperf3 -c 192.168.3.15 -u -P 3

result:

  • Interval: the running time of the program

  • Transfer: total amount of data transferred

  • Bandwidth: Tested bandwidth

  • Jitter: network jitter

  • Lost/Total Datagrams: Number of lost packets/Total number of packets (packet loss rate)

Insert image description here

Server

./iperf3 -s -p 1001

Insert image description here

Check if the CPU is full

htop

Insert image description here

Guess you like

Origin blog.csdn.net/sunrj_niu/article/details/132130771