Network interface controller (NIC) multi-queue enables an Elastic Compute Service (ECS) instance to use multiple NIC queues to improve network performance. Performance bottlenecks may occur when a single vCPU is used to process NIC interrupts on an instance. To solve this issue, you can use NIC multi-queue to distribute NIC interrupts across different vCPUs. This way, network performance is improved.

Prerequisites

The following requirements are met:

  • The instance type of your instance supports the NIC multi-queue feature. For more information about the instance types that support NIC multi-queue, see Instance families. If the number of NIC queues is greater than one, NIC multi-queue is supported.
    Note In an instance of the re6p persistent memory-optimized instance family, if NIC interrupts are not distributed across different vCPUs, we recommend that you upgrade the ecs_mq configuration script to the latest version.
  • The image of your instance supports the NIC multi-queue feature and has this feature disabled by default. The following public images provided by Alibaba Cloud support the NIC multi-queue feature. The support for this feature is irrelevant to the bit sizes of the operating systems contained in images.
    Note
    • Even if your operating system is included in the list, public images of earlier versions may not support the NIC multi-queue feature. We recommend that you use the latest public images. If the image of your instance has the NIC multi-queue feature enabled by default, skip this topic.
    • The following procedure applies only to Linux instances. You do not need to configure the NIC multi-queue feature for ECS instances that run Windows 2012 or later because this feature is automatically configured.
    Public image NIC multi-queue supported NIC multi-queue enabled
    CentOS 6.8/6.9/7.2/7.3/7.4/8.* Yes Yes
    Ubuntu 14.04/16.04/18.04/20.04 Yes Yes
    Debian 8.9/9.2/10.* Yes Yes
    SUSE Linux Enterprise Server 12 SP1/12 SP2/15 SP1/15 SP2 Yes Yes
    Red Hat Enterprise Linux 6.9/7.4/7.5 Yes No
    OpenSUSE 42.3/15.* Yes No
    Alibaba Cloud Linux 2.1903 Yes Yes
    Windows 2012 or later Yes Yes

Background information

NIC multi-queue is a technology that can fix Quality of Service (QoS) issues of I/O bandwidth. The NIC multi-queue driver uses interrupts to bind each queue to different vCPUs to solve processing bottlenecks of single vCPUs when network I/O bandwidth increases and improve the packet forwarding rate and bandwidth performance. Under identical packet forwarding rate and network bandwidth conditions, two queues have performance 50% to 100% higher than that of a single queue. Performance can be improved even greater with the use of four queues.

Automatic configuration

  1. Connect to an ECS instance.
    For more information about connection methods, see Connection methods.
  2. Download the ecs_mq automatic configuration script package.
    wget https://ecs-image-tools.oss-cn-hangzhou.aliyuncs.com/ecs_mq/ecs_mq_latest.tgz
  3. Decompress the script package.
    tar -xzf ecs_mq_latest.tgz
  4. Change the working path.
    cd ecs_mq/
  5. Run the extracted script.
    The command format varies based on image versions. For example, use bash install.sh centos 7 for CentOS 7.6 images.
    bash install.sh <Operating system name> <Major version number of the operating system>
  6. Start the service.
    systemctl start ecs_mq

Manual configuration

In the following example, a CentOS 7.6 image is used. The primary elastic network interface (ENI) is named eth0, and the secondary ENI is named eth1. This section describes how to manually configure NIC multi-queue.

  1. Run the ethtool -l eth0 command to check whether the primary ENI supports NIC multi-queue.
    [root@localhost ~]# ethtool -l eth0
    Channel parameters for eth0:
    Pre-set maximums:
    RX: 0
    TX: 0
    Other: 0
    Combined: 2 # Indicates that a maximum of two queues can be configured.
    Current hardware settings:
    RX: 0
    TX: 0
    Other: 0
    Combined: 1 # Indicates that one queue is in effect.
    Note If the return values of the two Combined fields are the same, NIC multi-queue is enabled for the primary ENI.
  2. Run the ethtool -L eth0 combined 2 command to enable NIC multi-queue.
    This command configures the eth0 primary ENI to use two queues.
    [root@localhost ~]# ethtool -L eth0 combined 2
  3. Configure NIC multi-queue for the secondary ENI.
    # Check whether the eth1 secondary ENI supports NIC multi-queue.
    [root@localhost ~]# ethtool -l eth1
    Channel parameters for eth1:
    Pre-set maximums:
    RX: 0
    TX: 0
    Other: 0
    Combined: 4 # Indicates that a maximum of four queues can be configured.
    Current hardware settings:
    RX: 0
    TX: 0
    Other: 0
    Combined: 1 # Indicates that one queue is in effect.
    # Configure the eth1 secondary ENI to use four queues.
    [root@localhost ~]# ethtool -L eth1 combined 4