Help Center/ Elastic Cloud Server/ FAQs/ Network Configuration/ How Can I Test the Network Performance of Linux ECSs?
Updated on 2026-04-21 GMT+08:00

How Can I Test the Network Performance of Linux ECSs?

Use netperf and iperf3 to test network performance between ECSs. The test operations include preparations, TCP bandwidth test, UDP PPS test, and latency test.

Background

  • Tested ECS: an ECS that is tested for network performance. Such an ECS functions as the client (TX end) or server (RX end) in netperf tests.
  • Auxiliary ECSs: an ECS that is used to exchange test data with the tested ECS. The auxiliary ECS functions as the client (TX end) or server (RX end) in netperf tests.
  • Table 1 and Table 2 list the common netperf and iperf3 parameters.
    Table 1 Common netperf parameters

    Parameter

    Description

    -p

    Port number

    -H

    IP address of the RX end

    -t

    Protocol used in packet transmitting, the value of which is TCP_STREAM in bandwidth tests

    -l

    Test duration

    -m

    Data packet size, which is suggested to be 1440 in bandwidth tests

    Table 2 Common iperf3 parameters

    Parameter

    Description

    -p

    Port number

    -c

    IP address of the RX end

    -u

    UDP packets

    -b

    TX bandwidth

    -t

    Test duration

    -l

    Data packet size, which is suggested to be 16 in PPS tests

    -A

    ID of the vCPU used by iperf3

    In this section, the maximum number of 16 vCPUs is used as an example for each ECS. If an ECS has eight vCPUs, the -A value range is from 0 to 7.

Test Preparations

  1. Prepare ECSs.

    Ensure that both type and specifications of the tested ECS and auxiliary ECSs are the same. In addition, ensure that these ECSs are deployed in the same ECS group with anti-affinity enabled.
    Table 3 Preparations

    Category

    Quantity

    Image

    Specifications

    IP Address

    Tested ECS

    1

    CentOS 7.4 64-bit (recommended)

    N/A

    192.168.2.10

    Auxiliary ECS

    2

    CentOS 7.4 64-bit (recommended)

    At least 8 vCPUs

    192.168.2.11 and 192.168.2.12

  2. Install the netperf, iperf3, and sar test tools on both the tested ECS and auxiliary ECSs.

    Table 4 lists the procedures for installing these tools.

    Table 4 Installing test tools

    Tool

    Procedure

    netperf

    1. Run the following command to install gcc:
      yum -y install unzip gcc gcc-c++
    2. Run the following command to download the netperf installation package:
      wget https://github.com/HewlettPackard/netperf/archive/refs/tags/netperf-2.7.0.zip
    3. Run the following commands to decompress the installation package and install netperf:
      unzip netperf-2.7.0.zip
      cd netperf-netperf-2.7.0/
      ./configure && make && make install

    iperf3

    1. Run the following command to download the iperf3 installation package:
      wget --no-check-certificate https://codeload.github.com/esnet/iperf/zip/master -O iperf3.zip
    2. Run the following commands to decompress the installation package and install iperf3:
      unzip iperf3.zip
      cd iperf-master/
      ./configure && make && make install

    sar

    Run the following command to install sar:

    yum -y install sysstat

TCP Bandwidth Test (Using netperf)

Perform the test on multiple flows. In the following example, 64 flows are evenly distributed to two auxiliary ECSs.

The TCP bandwidth test uses the multi-flow model.

  • When testing the TCP transmission (TX) bandwidth, use the one-to-many model to ensure that the capability of the receiver is sufficient.
  • When testing the TCP receiver (RX) bandwidth, use the many-to-one model to ensure that the capability of the sender is sufficient.
  1. Test the TCP TX bandwidth.

    1. Run the following commands on all auxiliary ECSs to start the netserver process:
      #!/bin/bash
      for port in {1..32}; do
          netserver -p $((12000 + port)) > /dev/null 2>&1 &
      done
    2. Start the netperf process on the tested ECS and specify a netserver port for each auxiliary ECS. For details about common netperf parameters, see Table 1.
      ##The IP address is for the first auxiliary ECS.
      #!/bin/bash
      server_ip=192.168.2.11 #Private IP address of the test server
      for port in {1..32}; do
          netperf -H ${server_ip} -p $((12000 + port))  -t TCP_STREAM  -l 300 -- -m 1440 > netperf_${server_ip}_$((12000 + port)).log 2>&1 &
      done
       
      ##The IP address is for the second auxiliary ECS.
      #!/bin/bash
      server_ip2=192.168.2.12 #Private IP address of the test server
      for port in {1..32}; do
          netperf -H ${server_ip2} -p $((12000 + port))  -t TCP_STREAM  -l 300 -- -m 1440 > netperf_${server_ip2}_$((12000 + port)).log 2>&1 &
      done

  2. Test the TCP RX bandwidth.

    1. Start the netserver process on the tested ECS.
      #!/bin/bash
      for port in {1..64}; do
          netserver -p $((12000 + port)) > /dev/null 2>&1 &
      done
    2. Start the netperf process on each auxiliary ECS.
      ##Log in to the first auxiliary ECS.
      #!/bin/bash
      server_ip=192.168.2.10 #Private IP address of the test server
      for port in {1..32}; do
          netperf -H ${server_ip} -p $((12000 + port))  -t TCP_STREAM  -l 300 -- -m 1440  > netperf_${server_ip}_$((12000 + port)).log  2>&1 &
      done
      ##Log in to the second auxiliary ECS.
      #!/bin/bash
      server_ip=192.168.2.10 #Private IP address of the test server
      for port in {33..64}; do
          netperf -H ${server_ip} -p $((12000 + port))  -t TCP_STREAM  -l 300 -- -m 1440  > netperf_${server_ip}_$((12000 + port)).log  2>&1 &
      done

  3. Analyze the test result.

    After the test is complete, the output of the netperf process on one TX end is shown in Figure 1. The final result is the sum of the test results of the netperf processes on all TX ends.

    Figure 1 Output of the netperf process on one TX end

    There are a large number of netperf processes. To facilitate statistics collection, it is a good practice to run the following command to view test data on the tested ECS using sar:

    sar -n DEV 1 60

UDP PPS Test (Using iperf3)

  1. Test the UDP TX PPS.

    1. Log in to an auxiliary ECS.
    2. Run the following commands on all auxiliary ECSs to start the server process:
      #!/bin/bash
      for port in {1..32}; do
          iperf3 -s -p $((12000 + port)) > /dev/null 2>&1  &
      done
    3. Start the client process on the tested ECS. For details about common iperf3 parameters, see Table 2.
      ##The first auxiliary ECS
      #!/bin/bash
      for port in {1..32}; do
      server_ip=192.168.2.11 #Private IP address of the test server
      iperf3 -c ${server_ip} -p $((12000 + port)) -u -b 0M -t 300 -l 64 -i 30 --logfile iperf_${server_ip}_$((12000 + port)).log > /dev/null 2>&1 &
      done
       
      ##The secondary auxiliary ECS
      #!/bin/bash
      for port in {1..32}; do
      server_ip2=192.168.2.12 #Private IP address of the test server
      iperf3 -c ${server_ip2} -p $((12000 + port)) -u -b 0M -t 300 -l 64 -i 30 --logfile iperf_${server_ip2}_$((12000 + port)).log > /dev/null 2>&1 &
       done

  2. Test the UDP RX PPS.

    1. Start the server process on the tested ECS. For details about common iperf3 parameters, see Table 2.
      #!/bin/bash
      for port in {1..64}; do
          iperf3 -s -p $((12000 + port))  > /dev/null 2>&1 &
      done
    2. Start the client process on all auxiliary ECSs. For details about common iperf3 parameters, see Table 2.
      ##Log in to the first auxiliary ECS.
      #!/bin/bash
      for port in {1..32}; do
      server_ip=192.168.2.10 #Private IP address of the test server
      iperf3 -c ${server_ip} -p $((12000 + port)) -u -b 0M -t 300 -l 64 -i 30 --logfile iperf_${server_ip}_$((12000 + port)).log > /dev/null 2>&1 &
      done
      
      ##Log in to the second auxiliary ECS.
      #!/bin/bash
      for port in {33..64}; do
      server_ip=192.168.2.10 #Private IP address of the test server
      iperf3 -c ${server_ip} -p $((12000 + port)) -u -b 0M -t 300 -l 64 -i 30 --logfile iperf_${server_ip}_$((12000 + port)).log > /dev/null 2>&1 &
      done

  3. Analyze the test result.

    Figure 2 shows an example of the UDP PPS test result.

    Figure 2 UDP PPS test result

    There are a large number of iperf3 processes. To facilitate statistics collection, it is a good practice to run the following command to view test data on the tested ECS using sar:

    sar -n DEV 1 60

Latency Test

  1. Run the following command to start the qperf process on the tested ECS:

    qperf &

  2. Log in to auxiliary ECS 1 and run the following command to perform a latency test:

    qperf 192.168.2.10 -m 64 -t 60 -vu udp_lat

    After the test is complete, the lat value in the command output is the latency between ECSs.