You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Network performance test
Using Pktgen to test network performance
Copy page
Download PDF
Using Pktgen to test network performance
This topic describes how to use Pktgen to test the network performance of ECS instances.​
Test tools​
  • To test Packets Per Second (PPS) for the performance of network small-packet transmission, Linux pktgen or DPDK-based applications are typically used as packet generators.​
  • To test Bits Per Second (BPS) for the performance of network bulk data transmission, the large-packet transmission bandwidth of TCP and UDP is typically involved.​
Procedure​
tip​
Test results provided in this topic are for reference only and do not represent the actual optimal performance of an ECS instance.​
Step 1: Prepare the environment​
Refer to the practice of purchasing an ECS instance to create a Device Under Test (DUT) and an Auxiliary test machine (Tester). Before the Pktgen-DPDK test, associate two network interfaces with each ECS instance. One network interface is for logging in and executing commands, and the other is for DPDK testing.​
The test environment provided in this topic is shown in the table below:​
​
ECS instance​
ECS Information​
Quantity​
IP address​
Description​
Device Under Test (DUT)​
  • Image: Debian 10 64 bit​
  • Specification: ecs.g1.16xlarge​
1​
192.168.222.151​
The instance under network throughput stress testing.​
Auxiliary test machine (Tester)​
  • Image: Debian 10 64 bit​
  • Specification: ecs.g1.16xlarge​
We recommend that the network performance of the Tester is no lower than that of the DUT. For details of instance types, refer to Instance types.​
1​
192.168.222.240​
The instance for creating control connections with the DUT to transmit test details and results.​
​
Step 2: Install software​
On the DUT and the Tester, perform the following steps in sequence to install the test software.​
Install dependencies​
  1. Connect to the ECS instance remotely. For more information, see Logging in to instances.​
  1. Execute the following commands to install dependencies.​
  • ​
    apt update​
    apt install -y libpcap-dev​
    apt install -y libnuma-dev​
    apt-get install python3-pip -y​
    pip3 install pyelftools -i https://mirrors.ivolces.com/pypi/simple/​
    pip3 install ninja -i https://mirrors.ivolces.com/pypi/simple/​
    pip3 install meson -i https://mirrors.ivolces.com/pypi/simple/​
    ​
Note: Install Python 3.6 or a later version. Otherwise, an incompatibility occurs between Python 3 and certain packages.​
Install test software​
Select the test tool as needed, and then install it based on the steps below accordingly.​
​
Linux Pktgen
iperf
Pktgen-DPDK
​
  1. Download pktgen script.​
  1. Make sure that the Linux kernel includes the pktgen module, and then execute the modprobe pktgen command to load the module.​
​
Step 3: Run performance tests​
Test small-packet transmission performance (PPS)​
​
Use Linux pktgen to test UDP PPS
Use Pktgen-DPDK to test UDP PPS
​
  1. On the Tester, execute the following command to transmit packets.​
  • bash .sh -i [eth_dev] -d [dut_ip] -s 64 -m [dut_mac] -c 10 -p 40000-40003 -n 0 -t [queue_num]​
  • [eth_dev]: Network interface name​
  • [dut_ip]: DUT private IP address​
  • [dut_mac]: DUT MAC address​
  • [queue_num]: Queue number​
  • Based on the following configuration in the script, the total number of flows generated at this time is calculated as: (109 - 9 + 1) * (40003 - 40000 + 1) = 101 * 4 = 404.​
  • ​
    # Flow variation random source port between min and max​
    UDP_SRC_MIN=9​
    UDP_SRC_MAX=109​
    ​
  1. On the DUT, execute the sar -n DEV 1 command to observe the network throughput.​
  • The following output is displayed:​
  • ​alt​​
​
Test bulk data transmission performance (BPS)​
​
Use iperf to test TCP BPS
Use Pktgen-DPDK to test UDP BPS
​
  1. On the DUT, execute the following command to run the iperf server.​
  • iperf -s -i 1​
  1. On the Tester, execute the following command to run the iperf client.​
  • iperf -c [dut_ip] -P 32 -t 60 -i 1​
[dut_ip]: DUT private IP​
  1. On the DUT, execute the sar -n DEV 1 command to observe the network throughput. Unit conversion: [rxkB/s] * 8 / 1000000 = Gbps.​
  • ​alt​​
​
Subsequent operations​
After the Pktgen-DPDK test, you can associate the network interfaces used for testing with their original drivers as needed. In the example provided in this topic, the network interface is associated with virito-pci.​
  1. Create the script bind-virtio.sh to associate the network interface used for testing with igb_uio.​
  1. Execute the vim bind-virtio.sh command to create the bind-virtio.sh file.​
  1. Press i to enter the edit mode.​
  1. In the bind-virtio.sh file, enter the following content.​
  • ​
    #!/bin/bash​
    ​
    dpdk_dir=/root/dpdk/ # Modify to the DPDK source code directory of your cloud server​
    nic_bdf=00:07.0 # Need to change to the PCI address of the network card to which you want to bind igb_uio​
    ​
    ifconfig $eth_str down ; echo $?​
    ​
    cd $dpdk_dir ; ./usertools/dpdk-devbind.py --unbind $nic_bdf ; echo $?​
    ​
    rmmod igb_uio ; echo $?​
    ​
    cd $dpdk_dir ; ./usertools/dpdk-devbind.py --bind=virtio-pci $nic_bdf ; echo $?​
    ​
    eth_int=0​
    while [ "$eth_int" == "0" ]​
    do​
    eth_int=$(ls -l /sys/class/net/ | grep $nic_bdf | wc -l)​
    done​
    ​
    net_str=$(ls -l /sys/class/net/ | grep $nic_bdf)​
    eth_str=${net_str##*/}​
    ​
    eth_int=0​
    while [ "$eth_int" == "0" ]​
    do​
    eth_int=$(ifconfig -a | grep $eth_str | wc -l)​
    done​
    ​
    ifconfig $eth_str up; echo $?​
    ​
    ​
  1. Press Esc to exit the edit mode, input :wq and press Enter.​
  1. Execute the chmod +x bind-virtio.sh command to grant execution permission to the bind-virtio.sh file.​
  1. Execute the bash bind-virtio.sh command to execute the script.​
​
Last updated: 2026.06.18 17:49:49