All Products
Search
Document Center

Elastic Compute Service:Test instance network performance

Last Updated:May 08, 2026

Use Netperf and sockperf to test packet forwarding rate (PPS), network bandwidth, and network latency of ECS instances.

Important
  • To prevent data loss, test network performance on new ECS instances that do not contain data.

  • Instance type metrics are verified in a test environment. Actual performance may vary based on factors such as instance load and networking model.

Prerequisites

Preparations

  • Create ECS instances for testing. See Custom launch ECS instances.

    Important

    Use instances of the same instance type to ensure accurate and comparable test results.

  • Ensure all test instances are in the same Virtual Private Cloud (VPC), connected to the same vSwitch, and in the same security group.

Example environments

The following tables list the recommended instance types and quantities for test machines and auxiliary test machines. Select machines as servers or clients based on your test scenario.

  • Test the packet forwarding rate (Linux instances only)

    Note

    No tools are available to test the packet forwarding rate of Windows instances.

    Packet forwarding rate lower than 6,000,000 pps

    Test item

    Test machine

    Auxiliary test machine

    Instance type

    ecs.g7.large

    ecs.g7.large

    Image

    Alibaba Cloud Linux 3

    Alibaba Cloud Linux 3

    Number of instances

    1

    1

    Network

    Public IP addresses are assigned.

    Packet forwarding rate higher than 6,000,000 pps and lower than 20,000,000 pps

    Test item

    Test machine

    Auxiliary test machine

    Instance type

    ecs.g7.16xlarge

    ecs.g7.16xlarge

    Image

    Alibaba Cloud Linux 3

    Alibaba Cloud Linux 3

    Number of instances

    1

    3

    Network

    Public IP addresses are assigned.

    Packet forwarding rate higher than 20,000,000 pps

    Test item

    Test machine

    Auxiliary test machine

    Instance type

    ecs.g7.32xlarge

    ecs.g7.32xlarge

    Image

    Alibaba Cloud Linux 3

    Alibaba Cloud Linux 3

    Number of instances

    1

    3

    Network

    Public IP addresses are assigned.

  • Test network bandwidth and latency

    Linux instance

    Test item

    Test machine

    Auxiliary test machine

    Instance type

    ecs.g7.large

    ecs.g7.large

    Image

    Alibaba Cloud Linux 3

    Alibaba Cloud Linux 3

    Number of instances

    1

    1

    Network

    Public IP addresses are assigned.

    Windows instance

    Test item

    Test machine

    Auxiliary test machine

    Instance type

    ecs.g7.large

    ecs.g7.large

    Image

    Windows Server 2022

    Windows Server 2022

    Number of instances

    1

    1

    Network

    Public IP addresses are assigned.

Procedure

Test packet forwarding rate (Linux only)

Note

No tools are available to test the packet forwarding rate of Windows instances.

Packet forwarding rate lower than 6,000,000 pps

  1. Connect to the test machine and auxiliary test machines. See Log on to a Linux instance using Workbench.

  2. On both machines, download the Netperf installation package:

    wget https://benchmark-packages.oss-cn-qingdao.aliyuncs.com/netperf-2.7.0.tar.gz
  3. On both machines, install Netperf and sar.

    1. Decompress the Netperf installation package:

      sudo yum install -y gcc autoconf automake libtool sysstat
      tar -zxvf netperf-2.7.0.tar.gz
    2. Query the version number of GNU Compiler Collection (GCC).

      gcc -v 2>&1
    3. If GCC is later than V10 on either machine, perform the following operations to ensure that GCC compiles correctly. Otherwise, skip this step.

      1. Open the nettest_omni.c file.

        cd netperf
        vim src/nettest_omni.c
      2. Press i to enter Insert mode and delete the following declared variables from nettest_omni.c:

        /* different options for the sockets        */
        
        int
          loc_nodelay,    /* don't/do use NODELAY  locally    */
          rem_nodelay,    /* don't/do use NODELAY remotely  */
          loc_sndavoid,    /* avoid send copies locally    */
          loc_rcvavoid,    /* avoid recv copies locally    */
          rem_sndavoid,    /* avoid send copies remotely    */
          rem_rcvavoid;   /* avoid recv_copies remotely    */
      3. Press Esc, enter :wq, and press Enter to save and close the file.

    4. Install Netperf and sar.

      cd netperf
      sudo ./configure
      sudo make && sudo make install
  4. On the test machine, start 64 netserver services:

    #!/bin/bash
    for j in `seq 64`; do
        netserver -p $[16000+j] > server_$[16000+j].netperf > /dev/null 2>&1  &
    done
  5. Query the private IP address of the test machine:

    ifconfig || ip addr

    image.png

  6. On the auxiliary test machine, send traffic to the test machine:

    #!/bin/bash
    server_ip=<Private IP address of the test machine>
    for j in `seq 64`; do
        port=$[16000+j]
        netperf -H ${server_ip} -l ${run_time:-300} -t UDP_STREAM  -p $port  -- -m 1 -D > /dev/null 2>&1 &
    done

    Replace <Private IP address of the test machine> with the actual private IP address obtained in the previous step.

    image.png

  7. On the test machine, test the packet forwarding rate:

    sar -n DEV 1

    Check the rxpck/s column. The rxpck/s value shows packets received per second. In this example, the value is approximately 940,000.

    image.png

Packet forwarding rate higher than 6,000,000 pps and lower than 20,000,000 pps

  1. Connect to the test machine and auxiliary test machines. See Log on to a Linux instance using Workbench.

  2. On all four machines (three auxiliary + one test), install sockperf:

    sudo yum install -y autoconf automake libtool gcc-c++
    cd /opt
    sudo wget https://github.com/Mellanox/sockperf/archive/refs/tags/3.8.tar.gz
    sudo tar -zxf 3.8.tar.gz
    cd sockperf-3.8/
    sudo ./autogen.sh
    sudo ./configure
    sudo make -j `cat /proc/cpuinfo| grep process | wc -l`
    sudo make install
  3. Query the private IP address of the test machine:

    ifconfig || ip addr

    image.png

  4. On each auxiliary test machine, send traffic to the test machine:

    server_ip="<Private IP address of the test machine>"
    threads=64
    msg_size=14
    run_time=60
    
    basePort=6666
    for((i=0;i<$threads;++i));do
        nohup sockperf tp -i $server_ip --pps max -m ${msg_size} -t ${run_time} --port $[${basePort}+${i}] 2>&1 &
    done

    Replace <Private IP address of the test machine> with the actual value. run_time specifies the traffic duration.

  5. On all four machines, test the packet forwarding rate:

    sar -n DEV 1

    Check the rxpck/s column on the test machine. The rxpck/s value shows packets received per second. In this example, the value is approximately 12,000,000 pps.Received packets

Packet forwarding rate higher than 20,000,000 pps

  1. Connect to the test machine and auxiliary test machines. See Log on to a Linux instance using Workbench.

  2. On all four machines (three auxiliary + one test), install sockperf:

    sudo yum install -y autoconf automake libtool gcc-c++
    cd /opt
    sudo wget https://github.com/Mellanox/sockperf/archive/refs/tags/3.8.tar.gz
    sudo tar -zxf 3.8.tar.gz
    cd sockperf-3.8/
    sudo ./autogen.sh
    sudo ./configure
    sudo make -j `cat /proc/cpuinfo| grep process | wc -l`
    sudo make install
  3. On the test machine, bind interrupt requests (IRQs) to CPU cores.

    Binding IRQs to specific CPU cores reduces context switching and improves packet processing efficiency at high PPS.

    a=$(cat /proc/interrupts | grep virtio2-input | awk -F ':' '{print $1}')
    cpu=0
    for irq in $a; do
        echo $cpu >/proc/irq/$irq/smp_affinity_list
        let cpu+=2
    done
  4. Query the private IP address of the test machine:

    ifconfig || ip addr

    image.png

  5. On each auxiliary test machine, send traffic to the test machine:

    server_ip="<Private IP address of the test machine>"
    threads=64
    msg_size=14
    run_time=60
    
    basePort=6666
    for((i=0;i<$threads;++i));do
        nohup sockperf tp -i $server_ip --pps max -m ${msg_size} -t ${run_time} --port $[${basePort}+${i}] 2>&1 &
    done

    Replace <Private IP address of the test machine> with the actual value. run_time specifies the traffic duration.

  6. On all four machines, test the packet forwarding rate:

    sar -n DEV 1

    Check the rxpck/s column on the test machine. The rxpck/s value shows packets received per second. In this example, the value is approximately 20,000,000 pps.24 million PPS

Test network bandwidth

Linux instance

  1. Connect to the test machine and the auxiliary test machine. See Log on to a Linux instance using Workbench.

  2. On both machines, download the Netperf installation package:

    wget https://benchmark-packages.oss-cn-qingdao.aliyuncs.com/netperf-2.7.0.tar.gz
  3. On both machines, install Netperf and sar.

    1. Decompress the Netperf installation package.

      sudo yum install -y gcc autoconf automake libtool sysstat
      tar -zxvf netperf-2.7.0.tar.gz
    2. Query the version number of GCC.

      gcc -v 2>&1
    3. If GCC is later than V10 on either machine, perform the following operations to ensure that GCC compiles correctly. Otherwise, skip this step.

      1. Open the nettest_omni.c file.

        cd netperf
        vim src/nettest_omni.c
      2. Press i to enter Insert mode and delete the following declared variables from nettest_omni.c:

        /* different options for the sockets        */
        
        int
          loc_nodelay,    /* don't/do use NODELAY  locally    */
          rem_nodelay,    /* don't/do use NODELAY remotely  */
          loc_sndavoid,    /* avoid send copies locally    */
          loc_rcvavoid,    /* avoid recv copies locally    */
          rem_sndavoid,    /* avoid send copies remotely    */
          rem_rcvavoid;   /* avoid recv_copies remotely    */
      3. Press Esc, enter :wq, and press Enter to save and close the file.

    4. Install Netperf and sar.

      cd netperf
      sudo ./configure
      sudo make && sudo make install
  4. On the test machine, start 64 netserver services:

    #!/bin/bash
    for j in `seq 64`; do
        netserver -p $[16000+j] > server_$[16000+j].netperf 2>&1 &
    done
  5. Query the private IP address of the test machine:

    ifconfig || ip addr

    image.png

  6. On the auxiliary test machine, send traffic to the test machine:

    #!/bin/bash
    server_ip=<Private IP address of the test machine>
    for j in `seq 64`; do
        port=$[16000+j]
        netperf -H ${server_ip} -l ${run_time:-300} -t TCP_STREAM -p $port -- -D > /dev/null 2>&1 & 
    done

    Replace <Private IP address of the test machine> with the actual private IP address obtained in the previous step.

    image.png

  7. On the test machine, test the network bandwidth:

    sar -n DEV 1

    Check the rxkB/s column. The rxkB/s value shows received packet size in KB/s. Multiply by 8 to convert to Kbit/s for the network bandwidth value.

    image.png

Windows instance

  1. Connect to the test machine and the auxiliary test machine. See Connect to a Windows instance by using a password or a key.

  2. Install test tools and disable the firewall on both machines.

    1. Download the ntttcp.exe tool and obtain the path in which the tool is stored.

    2. Open the Run dialog box. Enter powershell and click OK to start PowerShell.

    3. Disable the firewall on both machines to prevent blocked connections:

      Set-NetFirewallProfile -Profile * -Enabled:false

      Alternatively, create an inbound firewall rule that allows NTTTCP (ntttcp.exe) on both machines:

      $ntttcpPath = "<Path of ntttcp.exe>"
      New-NetFirewallRule -DisplayName ntttcp -Protocol Any -Direction Inbound -Action Allow -Enabled True -Profile Any -Program $ntttcpPath
      Note

      Replace <Path of ntttcp.exe> with the actual value.

  3. On the test machine, configure receive side scaling (RSS) for the network adapter.

    RSS distributes received packets across multiple CPU cores to improve network performance. Set RSS queues based on CPU count:

    • If the machine has up to 16 CPU cores, set the number of RSS receive queues to the CPU core count.

    • If the machine has more than 16 CPU cores, disable RSS. Most network adapters support up to 16 RSS queues, so exceeding this limit may cause uneven resource allocation.

    $cpuNum = (Get-CimInstance -ClassName Win32_Processor).NumberOfLogicalProcessors
    if ($cpuNum -le 16) {
      Set-NetAdapterRss -Name <Name of the network adapter on the test machine> -NumberOfReceiveQueues $cpuNum
    } else {
      Disable-NetAdapterRss -Name <Name of the network adapter on the test machine>
    }
    Note
    • Replace <Name of the network adapter on the test machine> with the actual value. Run Get-NetAdapter | Select-Object Name to get adapter names.

    • Modifying RSS configuration restarts the network adapter service, which may interrupt connections. Wait for reconnection before proceeding.

  4. On the test machine, prepare to receive data:

    $serverIp = (Get-NetIPConfiguration -InterfaceAlias <Name of the network adapter on the test machine>).IPv4Address.IPAddress
    $cpuNum = (Get-CimInstance -ClassName Win32_Processor).NumberOfLogicalProcessors
    $threadNum = $cpuNum
    & <Path of ntttcp.exe on the test machine> -r -m $threadNum,0,$serverIp -t 300
    Note

    Replace <Name of the network adapter on the test machine> and <Path of ntttcp.exe on the test machine> with actual values.

  5. On the auxiliary test machine, send data:

    $serverIp = "<Private IP address of the test machine>"
    $threadNum = "<Thread number of the test machine>"
    <Path of ntttcp.exe on the auxiliary test machine> -s -m $threadNum,*,$serverIp -t 100
    Note

    Replace <Private IP address of the test machine>, <Thread number of the test machine>, and <Path of ntttcp.exe on the auxiliary test machine> with actual values. Run ipconfig to get the private IP address and $cpuNum to get the thread number.

  6. View the network bandwidth on the test machine.

    The Throughput(MB/s) value indicates the network bandwidth.

    image

Test network latency

Linux instance

  1. Connect to the test machine and the auxiliary test machine. See Log on to a Linux instance using Workbench.

  2. On both machines, install sockperf:

    sudo yum install -y autoconf automake libtool gcc-c++
    cd /opt
    sudo wget https://github.com/Mellanox/sockperf/archive/refs/tags/3.8.tar.gz
    sudo tar -zxf 3.8.tar.gz
    cd sockperf-3.8/
    sudo ./autogen.sh
    sudo ./configure
    sudo make -j `cat /proc/cpuinfo| grep process | wc -l`
    sudo make install
  3. Query the private IP address of the test machine:

    ifconfig || ip addr

    image.png

  4. On the test machine, start sockperf:

    sockperf sr --tcp --daemonize
  5. On the auxiliary test machine, send traffic to the test machine:

    sockperf pp -i <Private IP address of the test machine> --tcp -t 30 -m 14 --full-log=result.json

    Replace <Private IP address of the test machine> with the actual value from the previous step.

  6. View the network latency results.

    In the returned data:

    • avg-latency: average latency in microseconds.

    • percentile 99.000: 99th-percentile latency in microseconds.

    image.png

Windows instance

  1. Connect to the test machine and the auxiliary test machine. See Connect to a Windows instance by using a password or a key.

  2. Install test tools and disable the firewall on both machines.

    1. Download the latte.exe tool and obtain the path in which the tool is stored.

    2. Open the Run dialog box. Enter powershell and click OK to start PowerShell.

    3. Disable the firewall on both machines to prevent blocked connections:

      Set-NetFirewallProfile -Profile * -Enabled:false

      Alternatively, create an inbound firewall rule that allows Latte (latte.exe) on both machines:

      $lattePath = "<Path of latte.exe>"
      New-NetFirewallRule -DisplayName Latte -Protocol Any -Direction Inbound -Action Allow -Enabled True -Profile Any -Program $lattePath
      Note

      Replace <Path of latte.exe> with the actual value.

  3. On the test machine, prepare to receive data:

    $serverIp = (Get-NetIPConfiguration | Where-Object {$_.InterfaceAlias -eq '<Name of the network adapter on the test machine>'} | Select-Object -ExpandProperty IPv4Address).IPAddress
    $port = <Communication port>
    & "<Path of latte.exe on the test machine>" -a "$serverIp`:$port" -i 65535
    Note
    • Replace <Name of the network adapter on the test machine> and <Path of latte.exe on the test machine> with actual values. Run Get-NetAdapter | Select-Object Name to get adapter names.

    • Specify a port number for <Communication port>. Use the same port on both machines.

  4. On the auxiliary test machine, send data:

    $serverIp = "<Private IP address of the test machine>"
    $port = <Communication port>
    & "<Path of latte.exe on the auxiliary test machine>" -c -a "${serverIp}:$port" -i 65535
    Note
    • Replace <Private IP address of the test machine> and <Path of latte.exe on the auxiliary test machine> with actual values. Run ipconfig to get the private IP address.

    • Specify a port number for <Communication port>. Use the same port on both machines.

  5. View the network latency results.

    The Latency(usec) value indicates the average network latency in microseconds.

    image