This topic describes how to test the packet forwarding rate, network bandwidth, and network latency of an Elastic Compute Service (ECS) instance. In this topic, Netperf and sockperf are used to test the network performance of ECS instances.
Prerequisites
- ECS instances that meet requirements for the test environment are created. For more information, see Create an instance by using the wizard.
- In the same test environment, all ECS instances reside within the same virtual private cloud (VPC), are connected to the same vSwitch, and belong to the same security group.
Prepare the environment
- To prevent data loss, we recommend that you use a tool to test the network performance of new ECS instances that contain no data.
- Instance type specifications are all verified and obtained within a test environment. In actual scenarios, the performance of an instance may vary based on other factors such as instance load and networking model.
- Test the packet forwarding rate (less than 6 million pps), network bandwidth, and network latency of an ECS instance
Test item Test machine Auxiliary test machine Instance type ecs.g7.large ecs.g7.large Image Alibaba Cloud Linux 2.1903 LTS 64-bit Alibaba Cloud Linux 2.1903 LTS 64-bit Quantity 1 1 - For more information about how to test the packet forwarding rate (less than 6 million pps), see the Test the packet forwarding rate (less than 6 million pps) section of this topic.
- For more information about how to test the network bandwidth, see the Test the network bandwidth section of this topic.
- For more information about how to test the network latency, see the Test the network latency section of this topic.
- Test the packet forwarding rate (greater than 6 million pps and less than 20 million pps) of an ECS instance
Test item Test machine Auxiliary test machine Instance type ecs.g7.16xlarge ecs.g7.16xlarge Image Alibaba Cloud Linux 2.1903 LTS 64-bit Alibaba Cloud Linux 2.1903 LTS 64-bit Quantity 1 3 For more information about how to test the packet forwarding rate (greater than 6 million pps and less than 20 million pps), see the Test the packet forwarding rate (greater than 6 million pps and less than 20 million pps) section of this topic.
- Test the packet forwarding rate (greater than 20 million pps) of an ECS instance
Test item Test machine Auxiliary test machine Instance type ecs.g7.32xlarge ecs.g7.32xlarge Image Alibaba Cloud Linux 2.1903 LTS 64-bit Alibaba Cloud Linux 2.1903 LTS 64-bit Quantity 1 3 For more information about how to test the packet forwarding rate (greater than 20 million pps), see the Test the packet forwarding rate (greater than 20 million pps) section of this topic.
Test the packet forwarding rate (less than 6 million pps)
- Connect to the test machine and the auxiliary test machine. For more information about the methods for connecting to an instance, see Connection methods.
- Run the following command on the test machine and the auxiliary test machine to download Netperf:
wget https://benchmark-packages.oss-cn-qingdao.aliyuncs.com/netperf-2.7.0.tar.gz
- Run the following command on the test machine and the auxiliary test machine to install Netperf and SAR.
- Run the following command on the test machine to 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
- Run the following command on the test machine to query the private IP address of the test machine:
ifconfig || ip addr
- Run the following command on the auxiliary test machine to 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 private IP address of the test machine obtained in the previous step, as shown in the following figure. - Run the following command on the test machine to test the network traffic:
View the values in thesar -n DEV 1
rxpck/s
column in the test result. Therxpck/s
column shows the total number of packets received by the test machine per second. In this example, the number of packets received by the test machine per second is about 900,000, as shown in the following figure.
Test the packet forwarding rate (greater than 6 million pps and less than 20 million pps)
- Connect to the test machine and the auxiliary test machine. For more information about the methods for connecting to an instance, see Connection methods.
- Run the following command on three auxiliary test machines and one test machine to install sockperf:
yum install -y autoconf automake libtool gcc-c++ cd /opt wget https://github.com/Mellanox/sockperf/archive/refs/tags/3.8.tar.gz tar -zxf 3.8.tar.gz cd sockperf-3.8/ ./autogen.sh ./configure make -j `cat /proc/cpuinfo| grep process | wc -l` make install
- Run the following command on three auxiliary test machines to send traffic to the test machine:
Replaceserver_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
<Private IP address of the test machine>
with the private IP address of the actual test machine.run_time
specifies the time period during which traffic is sent. - Run the following command on three auxiliary test machines and one test machine to test the network traffic:
View the values in thesar -n DEV 1
rxpck/s
column on the test machine. Therxpck/s
column shows the total number of packets received by the test machine per second. In this example, the number of packets received by the test machine per second is about 12,000,000, as shown in the following figure.
Test the packet forwarding rate (greater than 20 million pps)
- Connect to the test machine and the auxiliary test machine. For more information about the methods for connecting to an instance, see Connection methods.
- Run the following command on three auxiliary test machines and one test machine to install sockperf:
yum install -y autoconf automake libtool gcc-c++ cd /opt wget https://github.com/Mellanox/sockperf/archive/refs/tags/3.8.tar.gz tar -zxf 3.8.tar.gz cd sockperf-3.8/ ./autogen.sh ./configure make -j `cat /proc/cpuinfo| grep process | wc -l` make install
- Run the following command on the test machine to bind the interrupts:
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
- Run the following command on three auxiliary test machines to send traffic to the test machine:
Replaceserver_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
<Private IP address of the test machine>
with the private IP address of the actual test machine.run_time
specifies the time period during which traffic is sent. - Run the following command on three auxiliary test machines and one test machine to test the network traffic:
View the values in thesar -n DEV 1
rxpck/s
column on the test machine. Therxpck/s
column shows the total number of packets received by the test machine per second. In this example, the number of packets received by the test machine per second is about 20,000,000, as shown in the following figure.
Test the network bandwidth
- Connect to the test machine and the auxiliary test machine. For more information about the methods for connecting to an instance, see Connection methods.
- Run the following command on the test machine and the auxiliary test machine to download Netperf:
wget https://benchmark-packages.oss-cn-qingdao.aliyuncs.com/netperf-2.7.0.tar.gz
- Run the following command on the test machine and the auxiliary test machine to install Netperf and SAR:
yum install -y gcc autoconf automake libtool sysstat tar -zxvf netperf-2.7.0.tar.gz cd netperf ./configure make && make install
- Run the following command on the test machine to 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
- Run the following command on the test machine to query the private IP address of the test machine:
ifconfig || ip addr
- Run the following command on the auxiliary test machine to 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 private IP address of the test machine obtained in the previous step, as shown in the following figure. - Run the following command on the test machine to test the network bandwidth:
View the values in thesar -n DEV 1
rxkB/s
column in the test result. TherxkB/s
column shows the total number of bytes that are received by the test machine per second. The network bandwidth (unit: Kbit/s) is the value of rxkB/s multiplied by 8.
Test the network latency
- Connect to the test machine and the auxiliary test machine. For more information about the methods for connecting to an instance, see Connection methods.
- Run the following command on the test machine and the auxiliary test machine to install sockperf:
yum install -y autoconf automake libtool gcc-c++ cd /opt wget https://github.com/Mellanox/sockperf/archive/refs/tags/3.8.tar.gz tar -zxf 3.8.tar.gz cd sockperf-3.8/ ./autogen.sh ./configure make -j `cat /proc/cpuinfo| grep process | wc -l` make install
- Run the following command on the test machine to start sockperf:
sockperf sr --tcp --daemonize
- Run the following command on the test machine to query the private IP address of the test machine:
ifconfig || ip addr
- Run the following command on the auxiliary test machine to 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 private IP address of the test machine obtained in the previous step.View the data returned, as shown in the following figure.- Data returned staring with
avg-latency
indicates the average latency in microseconds. - Data returned staring with
percentile 99.000
indicates the 99-percentile latency in microseconds.
- Data returned staring with