Linux Network Performance Test
This document provides an overview of using network performance testing tools in a BCC Linux system. Taking Centos7.6 as an example, the main steps are outlined below (note that test parameter results are for reference only and should be evaluated in the context of the server's specific service conditions).
-
Performance Metrics
Typically, the following metrics are used to evaluate network bandwidth performance:Plain Text1- Bandwidth 2- Retr/Retransmits - Test tools
Iperf is a network performance testing tool to test TCP and UDP bandwidth quality and measure maximum TCP bandwidth, allowing tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter and packet loss. Its main functions include:
TCP - Measure network bandwidth - Report MSS/MTU size and observed read sizes. - Support for TCP window size via socket buffers. - Multi-threading is supported if pthreads or Win32 threads are available. Both client and server can handle multiple concurrent connections.
UDP - Client can create UDP streams of specified bandwidth. - Measure packet loss - Measure delay - Multicast capable - Multi-threading is supported if pthreads are available. Both client and server can handle multiple concurrent connections. (This feature does not work on Windows.)
- Tool Installation
- Download the package, extract it, and navigate to the iperf directory. For instance, using iperf-3.1.3 as an example.
1$ wget https://iperf.fr/download/source/iperf-3.1.3-source.tar.gz
2$ tar xzvf iperf-3.1.3-source.tar.gz
3$ cd iperf-3.1.3/
- Compile using the make command.
1$ ./configure
2$ make && make install
If errors occur during the make process, manually synchronize the dependency packages as detailed below.
1//error message: iperf3: error while loading shared libraries: libiperf.so.0: cannot open shared object file: No such file or directory
2$ /sbin/ldconfig
- Parameter description
After installing iperf, execute iperf3 -h to view detailed usage instructions. The iperf command line options fall into three main categories: shared options for both client and server, server-specific options, and client-specific options. The following section provides an overview of common options.
-s Start in server mode, e.g., iperf -s
-chost Start in client mode, and host is the server address, e.g.: iperf -c 222.35.11.23
- Common parameters
-f [kmKM] represents displaying report in Kbits, Mbits, KBytes or MBytes (default: Mbits), e.g.: iperf -c 222.35.11.23 -fK
-i Display report intervals in seconds, e.g., iperf -c 222.35.11.23 -i 2
-l Buffer size, default: 8KB, e.g.: iperf-c 222.35.11.23 -l 16
-m Display maximum mtu for tcp
-o Output reports and error messages to a file, e.g.: iperf-c 222.35.11.23 -o ciperflog.txt
-p Specify the port used to access the server or connected with the client, e.g.: iperf -s -p 9999;iperf -c 222.35.11.23 -p9999
-u Use udp protocol
-w Specify TCP window size (default: 8KB)
-B Bind to a specific host address or interface (this parameter is used when the host has multiple addresses or interfaces)
-C Compatible with older versions (used when the server and client versions are inconsistent)
-M Set the maximum mtu for TCP packets
-N Set TCP no delay
-V Transmit IPv6 packets
- Server-specific parameters
-D Run iperf as a service, e.g.: iperf-s -D
-R Stop iperf service (for -D), e.g.: iperf -s -R
- Client-specific parameters
-d Perform bidirectional transmission tests simultaneously
-n Specify the number of bytes to transfer, e.g.: iperf -c222.35.11.23 -n 100000
-r Perform bidirectional transmission test separately
-t Test duration, default: 10 seconds, e.g.: iperf -c222.35.11.23 -t 5
-F Specify the file to be transferred
-T Specify ttl
- Tool usage
Perform TCP testing by taking two servers as an example. The specific information is as follows:
Server: 192.168.44.9
Client: 192.168.44.12
- Server execution: iperf -s
1$ iperf3 -s
2-----------------------------------------------------------
3Server listening on 5201
4-----------------------------------------------------------
5Accepted connection from 192.168.44.12, port 60228
6[ 5] local 192.168.44.9 port 5201 connected to 192.168.44.12 port 60230
7[ ID] Interval Transfer Bandwidth
8[ 5] 0.00-1.00 sec 172 MBytes 1.44 Gbits/sec
9[ 5] 1.00-2.00 sec 179 MBytes 1.50 Gbits/sec
10[ 5] 2.00-3.00 sec 179 MBytes 1.50 Gbits/sec
11[ 5] 3.00-4.00 sec 179 MBytes 1.50 Gbits/sec
12[ 5] 4.00-5.00 sec 179 MBytes 1.50 Gbits/sec
13[ 5] 5.00-6.00 sec 179 MBytes 1.50 Gbits/sec
14[ 5] 6.00-7.00 sec 179 MBytes 1.50 Gbits/sec
15[ 5] 7.00-8.00 sec 179 MBytes 1.50 Gbits/sec
16[ 5] 8.00-9.00 sec 179 MBytes 1.50 Gbits/sec
17[ 5] 9.00-10.00 sec 179 MBytes 1.50 Gbits/sec
18[ 5] 10.00-11.00 sec 179 MBytes 1.50 Gbits/sec
19[ 5] 11.00-12.00 sec 179 MBytes 1.50 Gbits/sec
20[ 5] 12.00-13.00 sec 179 MBytes 1.50 Gbits/sec
21[ 5] 13.00-14.00 sec 179 MBytes 1.50 Gbits/sec
22[ 5] 14.00-15.00 sec 179 MBytes 1.50 Gbits/sec
23[ 5] 15.00-16.00 sec 179 MBytes 1.50 Gbits/sec
24[ 5] 16.00-17.00 sec 179 MBytes 1.50 Gbits/sec
25[ 5] 17.00-18.00 sec 179 MBytes 1.50 Gbits/sec
26[ 5] 18.00-19.00 sec 179 MBytes 1.50 Gbits/sec
27[ 5] 19.00-20.00 sec 179 MBytes 1.50 Gbits/sec
28[ 5] 20.00-20.06 sec 9.85 MBytes 1.50 Gbits/sec
29-----------------------------------------------------------
30[ ID] Interval Transfer Bandwidth
31[ 5] 0.00-20.06 sec 0.00 Bytes 0.00 bits/sec sender
32[ 5] 0.00-20.06 sec 3.50 GBytes 1.50 Gbits/sec receiver
33-----------------------------------------------------------
34Server listening on 5201
35-----------------------------------------------------------
- Client execution: iperf -c 192.168.44.9 -t 20 -i 2 -d -m
1# iperf3 -c 192.168.44.9 -t 20 -i 2
2Connecting to host 192.168.44.9, port 5201
3[ 4] local 192.168.44.12 port 60230 connected to 192.168.44.9 port 5201
4[ ID] Interval Transfer Bandwidth Retr Cwnd
5[ 4] 0.00-2.00 sec 362 MBytes 1.52 Gbits/sec 0 2.96 MBytes
6[ 4] 2.00-4.00 sec 359 MBytes 1.50 Gbits/sec 0 3.01 MBytes
7[ 4] 4.00-6.00 sec 359 MBytes 1.50 Gbits/sec 0 3.01 MBytes
8[ 4] 6.00-8.00 sec 359 MBytes 1.50 Gbits/sec 0 3.01 MBytes
9[ 4] 8.00-10.00 sec 358 MBytes 1.50 Gbits/sec 0 3.01 MBytes
10[ 4] 10.00-12.00 sec 359 MBytes 1.50 Gbits/sec 0 3.01 MBytes
11[ 4] 12.00-14.00 sec 359 MBytes 1.50 Gbits/sec 81 3.01 MBytes
12[ 4] 14.00-16.00 sec 359 MBytes 1.50 Gbits/sec 0 3.01 MBytes
13[ 4] 16.00-18.00 sec 359 MBytes 1.50 Gbits/sec 0 3.01 MBytes
14[ 4] 18.00-20.00 sec 359 MBytes 1.50 Gbits/sec 0 3.01 MBytes
15-----------------------------------------------------------
16[ ID] Interval Transfer Bandwidth Retr
17[ 4] 0.00-20.00 sec 3.51 GBytes 1.51 Gbits/sec 81 sender
18[ 4] 0.00-20.00 sec 3.50 GBytes 1.51 Gbits/sec receiver
19
20iperf Done.
The test results show the amount of data transmitted and bandwidth information during the test. In UDP testing, you can adjust test parameters based on your specific testing needs.
