All Products
Search
Document Center

Test network performance

Last Updated: Dec 15, 2020

Disclaimer: This article may contain information about third-party products. Such information is for reference only. Alibaba Cloud does not make any guarantee, express or implied, with respect to the performance and reliability of third-party products, as well as potential impacts of operations on the products.

Overview

This topic describes how to test the network performance of ECS instances.

Detail

Alibaba Cloud reminds you that:

  • When you perform operations that have risks, such as modifying instances or data, check the disaster recovery and fault tolerance capabilities of the instance to ensure data security.
  • If you modify the configurations and data of instances including but not limited to ECS and RDS instances, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted security information such as the logon account and password in the Alibaba Cloud Management console, we recommend that you modify such information in a timely manner.

The details of how to test the network performance are as follows.

Prepare the environment

Prepare the following devices.

Note: All the ECS instances must be in the same security group.

  • 1 test machine: an ECS instance is configured with the stress test network packets per second (PPS). It can be used as the Client or Server in the Netperf or iperf3 test.
    Note: assume that the IP address of the test machine is 172.0.0.1.
    • Image: centos_7_2_64_40G_base_20170222.vhd
    • Specifications: ecs.se1.14xlarge
    • Quantity: 1
    • VM name: i-test-vm (the name must be based on the actual conditions on site.)
  • Eight ECS instances: ECS instances are used as the clients or servers in the Netperf or iperf3 test. The ECS instances are connected to the test machines to pass test configuration and test results. The following table describes the specifications.
    Note: the IP addresses of eight ECS instances are from 172.0.0.2 to 172.0.0.9.
    • Image: centos_7_2_64_40G_base_20170222.vhd
    • Specifications: ecs.se1.14xlarge
    • Quantity: 8
    • Virtual machine name: i-partnerVm-{1-8}

Install Netperf

To install Netperf on the test host and sparking host, follow these steps.

  1. Run the following command to download Netperf:

    wget -c "https://codeload.github.com/HewlettPackard/netperf/tar.gz/netperf-2.5.0" -O netperf-2.5.0.tar.gz
  2. Run the following commands in sequence to install Netperf:

    tar -zxvf netperf-2.5.0.tar.gz
    cd netperf-netperf-2.5.0
    ./configure && make && make install && cd ..
  3. Run the netperf-h and netserver-h commands to check whether the module is successfully installed.

Install the iperf3

Follow these steps to install iperf3 tool on the test machine and sparring machine.

  1. Run the following commands in sequence to download iperf3:

    yum install git -y
    git clone https://github.com/esnet/iperf
  2. Run the following commands to install iperf3:
    cd iperf
    ./configure && make && make install && cd ..
    cd src
    ADD_PATH="$(pwd)"
    PATH="${APP_PATH}:${PATH}"
    export PATH
  3. Run the iperf3-h command to check whether the module is successfully installed.

Enable network interface controller multi-queue function

The network multi-queue feature is enabled by default. You do not need to enable it again. If you want to open, see configure network interface controller multi-queue.

Use Netperf to test network performance

Main parameters of Netperf

After being installed, Netperf generates two tools: netserver and netperf. The following are the main parameters of the two tools.

Tool Description Main parameter Parameters
netserver Acceptor tool (Server) -p The port number.
-D Does not run in the background.
-4 The IPv4 address.
netperf Producer tool (Client) -H The IP address of the ECS instance.
-p The port of the ECS instance.
-l Specify the running time.
-t Specify TCP_STREAM or UDP_STREAM as the protocol type. We recommend that you use UDP_STREAM.
-m Specify the packet size.
  • This value is 1 when you test the PPS function.
  • When you test BPS(bit per second), the value is 1400.

Test the inbound direction

  1. Run the following commands to start the netserver process on the test machine:
    netserver -p 11256
    netserver -p 11257
    netserver -p 11258
    netserver -p 11259
    netserver -p 11260
    netserver -p 11261
    netserver -p 11262
    netserver -p 11263
    Note:-p specifies different ports.
  2. Run the following commands to start the netperf process and specify different ports on the test machine:
    netperf -H 172.0.0.1 -p 11256 -t UDP_STREAM -l 300 -- -m 1# The first ECS instance
    netperf -H 172.0.0.1 -p 11257 -t UDP_STREAM -l 300 -- -m 1# The second ECS instance
    netperf -H 172.0.0.1 -p 11258 -t UDP_STREAM -l 300 -- -m 1# The third ECS instance
    netperf -H 172.0.0.1 -p 11259 -t UDP_STREAM -l 300 -- -m 1# The fourth ECS instance
    netperf -H 172.0.0.1 -p 11260 -t UDP_STREAM -l 300 -- -m 1# The fifth ECS instance
    netperf -H 172.0.0.1 -p 11261 -t UDP_STREAM -l 300 -- -m 1# The sixth ECS instance
    netperf -H 172.0.0.1 -p 11262 -t UDP_STREAM -l 300 -- -m 1# ECS 7
    netperf -H 172.0.0.1 -p 11263 -t UDP_STREAM -l 300 -- -m 1# eighth
  3. If BPS needs to be tested, the second step command should be changed to the following.
    netperf -H 172.0.0.1 -p 11256 -t UDP_STREAM -l 300 -- -m 1400# The first ECS instance
    netperf -H 172.0.0.1 -p 11257 -t UDP_STREAM -l 300 -- -m 1400# The second ECS instance
    netperf -H 172.0.0.1 -p 11258 -t UDP_STREAM -l 300 -- -m 1400# The third ECS instance
    netperf -H 172.0.0.1 -p 11259 -t UDP_STREAM -l 300 -- -m 1400# The fourth ECS instance
    netperf -H 172.0.0.1 -p 11260 -t UDP_STREAM -l 300 -- -m 1400# The fifth ECS instance
    netperf -H 172.0.0.1 -p 11261 -t UDP_STREAM -l 300 -- -m 1400# The sixth ECS instance
    netperf -H 172.0.0.1 -p 11262 -t UDP_STREAM -l 300 -- -m 1400# ECS 7
    netperf -H 172.0.0.1 -p 11263 -t UDP_STREAM -l 300 -- -m 1400# eighth

To test the sending direction, follow these steps:

  1. Run the following command to start a netserver process on all the ECS instances:

    netserver -p 11256
  2. Run the following commands to start eight netperf processes on the test machine and specify different IP addresses in the -H.

    netperf -H 172.0.0.2 -p 11256 -t UDP_STREAM -l 300 -- -m 1# The first ECS instance
    netperf -H 172.0.0.3 -p 11256 -t UDP_STREAM -l 300 -- -m 1# The second ECS instance
    netperf -H 172.0.0.3 -p 11256 -t UDP_STREAM -l 300 -- -m 1# The third ECS instance
    netperf -H 172.0.0.4 -p 11256 -t UDP_STREAM -l 300 -- -m 1# The fourth ECS instance
    netperf -H 172.0.0.5 -p 11256 -t UDP_STREAM -l 300 -- -m 1# The fifth ECS instance
    netperf -H 172.0.0.6 -p 11256 -t UDP_STREAM -l 300 -- -m 1# The sixth ECS instance
    netperf -H 172.0.0.7 -p 11256 -t UDP_STREAM -l 300 -- -m 1# ECS 7
    netperf -H 172.0.0.8 -p 11256 -t UDP_STREAM -l 300 -- -m 1# eighth
  3. If you need to test BPS, the previous command should be changed to the following.
    netperf -H 172.0.0.2 -p 11256 -t UDP_STREAM -l 300 -- -m 1400# The first ECS instance
    netperf -H 172.0.0.3 -p 11256 -t UDP_STREAM -l 300 -- -m 1400# The second ECS instance
    netperf -H 172.0.0.3 -p 11256 -t UDP_STREAM -l 300 -- -m 1400# The third ECS instance
    netperf -H 172.0.0.4 -p 11256 -t UDP_STREAM -l 300 -- -m 1400# The fourth ECS instance
    netperf -H 172.0.0.5 -p 11256 -t UDP_STREAM -l 300 -- -m 1400# The fifth ECS instance
    netperf -H 172.0.0.6 -p 11256 -t UDP_STREAM -l 300 -- -m 1400# The sixth ECS instance
    netperf -H 172.0.0.7 -p 11256 -t UDP_STREAM -l 300 -- -m 1400# ECS 7
    netperf -H 172.0.0.8 -p 11256 -t UDP_STREAM -l 300 -- -m 1400# eighth

Output

The final test result is output by each netperf process of the sender. The following table describes the first packet.

Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec
124928 1 10.00 4532554 0 3.63
212992 10.00 1099999 0.88

Note: generally, we recommend that you run the sar Command on the server side to count the packets actually received and use the statistics as the actual result. Specifically, run the sar-N DEV 1 320 command.

The following table describes the definitions of the fields in the output results.

Field data Description
124928 The buffer size.
1 The packet size. Unit: bytes.
10.00 The duration of the test. Unit: seconds.
4532554 Successful packets
0 Failures
3.63 The network throughput. Unit: Mbit/s.

Use iperf3 to test network performance

The parameters and testing methods for iperf3 are described as follows:

Main parameters of iperf3

Tool Description Main parameter Parameters
iperf3 All-in-one transceiver -s Indicates receiving packets as the server.
-i The time interval between two log entries. Unit: second.
-p The listening port of the service.
-u Indicates that the packet is sent over UDP. If this parameter is not specified, the packet is sent over TCP.
-l The package size. Default unit: bytes. Typically, the value is 16 in a PPS test and is 1400 in a BPS test.
-b The traffic bandwidth. Unit: k/m/g.
-t The duration of the traffic. Unit: Seconds. Default value: seconds.
-A CPU affinity. You can bind a specific iperf3 process to the logic CPU of the corresponding number to prevent the iperf3 process from being scheduled across different CPUs.

Test the inbound direction

  1. Start the iperf3 process on the test machine in the server mode.

    iperf3 -s -i 1 -p 16001
    iperf3 -s -i 1 -p 16002
    iperf3 -s -i 1 -p 16003
    iperf3 -s -i 1 -p 16004
    iperf3 -s -i 1 -p 16005
    iperf3 -s -i 1 -p 16006
    iperf3 -s -i 1 -p 16007
    iperf3 -s -i 1 -p 16008
  2. Start the iperf3 process in the client mode, specifying different ports on the test machine.

    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.1 -i 1 -p 16001 -A 1
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.1 -i 1 -p 16002 -A 2
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.1 -i 1 -p 16003 -A 3
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.1 -i 1 -p 16004 -A 4
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.1 -i 1 -p 16005 -A 5
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.1 -i 1 -p 16006 -A 6
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.1 -i 1 -p 16007 -A 7
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.1 -i 1 -p 16008 -A 8

To test the sending direction, follow these steps:

  1. Run the following command to start one iperf3 process on each ECS instance in the server mode:

    iperf3 -s -i 1 -p 16001
  2. Start eight iperf3 processes on the test machine in the client mode.

    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.2 -i 1 -p 16001 -A 1
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.3 -i 1 -p 16001 -A 2
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.4 -i 1 -p 16001 -A 3
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.5 -i 1 -p 16001 -A 4
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.6 -i 1 -p 16001 -A 5
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.7 -i 1 -p 16001 -A 6
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.8 -i 1 -p 16001 -A 7
    iperf3 -u -l 16 -b 100m -t 120 -c 172.0.0.9 -i 1 -p 16001 -A 8
    Note: specify the-c parameter as the IP address of each ECS instance.

Output

The final test result is output by each iperf3 process on the sender. The following table describes the first event notification.

[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 4] 0.00-10.00 sec 237 MBytes 199 Mbits/sec 0.027 ms 500/30352 (1.6%)
[ 4] Sent 30352 datagrams

Note: generally, we recommend that you run the sar Command on the server side to count the packets actually received and use the statistics as the actual result. Specifically, run the sar-N DEV 1 320 command.

The following table describes the definitions of the fields in the output results.

Field data Description
237 The total amount of data transmitted
199 The bandwidth.
0.027 fluctuation rate
500/30352 Packet loss /total packet count
1.6% RouterInterfaceLossRate

Application scope

  • Elastic Compute Service