NIC multi-queue allows you to configure multiple transmit and receive queues on a network interface. Each queue can be processed by a different CPU core. This feature improves network I/O throughput and reduces latency by distributing packet processing across multiple CPU cores.
Why use NIC multi-queue
A traditional single-queue network interface relies on one CPU core to process all packets. This can lead to CPU overload, increased latency, and packet loss. Modern servers have multi-core CPUs, and NIC multi-queue distributes network traffic across these cores to use resources more efficiently.
Under the same network packets per second (PPS) and bandwidth conditions, tests show that using two queues instead of one improves network performance by 50% to 100%. Using four queues offers even greater performance gains:
Better utilization of multi-core CPU architecture: Distributes network traffic across multiple CPU cores for a more balanced load and higher CPU utilization.
Higher throughput: Processing multiple packets simultaneously significantly increases network throughput, especially under high loads.
Lower latency: Reduces congestion and latency by distributing packets across multiple queues.
Reduced packet loss: Mitigates packet loss caused by an overloaded single queue during periods of high traffic.
Although NIC multi-queue offers these benefits, improper configuration can decrease performance or cause other issues. For example, incorrect settings for the queue count or CPU affinity can cause unnecessary context-switching overhead. Setting the queue count too low can underutilize your hardware resources.
When an elastic network interface (ENI) is attached to an instance, its queue count is automatically set to the default for that instance type. If you need to manually adjust the queue count for the ENI, first carefully consider your specific use case and hardware conditions to determine the optimal configuration.
How NIC multi-queue works
Queue architecture
An ENI supports multiple queues, specifically multiple combined queues. Each combined queue is processed by an independent CPU core. This enables parallel packet processing, reduces lock contention, and fully utilizes multi-core performance.
Receive (RX) and Transmit (TX) queues are the two types of queues used for processing packets. Each combined queue consists of one RX queue and one TX queue:
RX queue (RX Queue): An RX queue is used to process incoming data packets from the network. When a packet arrives, the network interface distributes it to a specific RX queue based on Receive Side Scaling (RSS) rules, such as round-robin or flow-based hashing strategies.
Some instance type families support custom RSS for ENIs. This feature allows you to use hash algorithms to intelligently distribute network traffic to different RX queues. For more information, see Custom RSS for ENIs.
TX queue (TX Queue): A TX queue is used to manage outgoing data packets. An application places generated packets into a TX queue, and the network interface then sends them based on factors like sequence or priority.
IRQ affinity support
Each queue is associated with an independent interrupt. IRQ affinity distributes interrupt handling across different CPU cores to prevent any single core from being overloaded.
IRQ affinity is enabled by default on all public images except for Red Hat Enterprise Linux. For more information, see Configure IRQ affinity.
Limitations
Only some instance types support NIC multi-queue. For more information, see Instance type families. If the value in the Multi-queue column is greater than 1, the instance type supports NIC multi-queue.
For instance types that support NIC multi-queue, the feature is enabled automatically after you attach an ENI to an instance.
The queue count listed for an instance type represents the maximum queues per ENI supported by that type.
You can call the DescribeInstanceTypes API operation to query queue-related metrics for an instance type family by specifying the InstanceTypeFamily parameter:
Default queue count
The PrimaryEniQueueNumber response parameter indicates the default queue count for the primary ENI. The SecondaryEniQueueNumber parameter indicates the default queue count for a secondary ENI.
Maximum queues per ENI
The MaximumQueueNumberPerEni response parameter indicates the maximum queues per ENI allowed for the instance type family.
Total queue quota
The TotalEniQueueQuantity response parameter indicates the total queue quota allowed for the instance type family.
Some older public images with kernel versions earlier than 2.6 may not support NIC multi-queue. Use the latest public images.
View the ENI queue count
Use the console
In the upper-left corner of the page, select a region and resource group.
Click the ID of the target secondary ENI to open its details page.
In the Basic Information section, find the Queues parameter. The value indicates the current queue count of the ENI.

If you modified the queue count for the ENI, the modified value is displayed.
If you have not modified the queue count for the ENI:
If the ENI is not attached to an instance, no value is displayed.
If the ENI is attached to an instance, the default queue count for the instance type is displayed.
Use the API
Call the DescribeNetworkInterfaceAttribute operation to view the queue count of an ENI. The QueueNumber parameter in the response indicates the queue count.
If you modified the queue count for the ENI, the modified value is displayed.
If you have not modified the queue count for the ENI:
If the ENI is not attached to an instance, no value is displayed.
If the ENI is attached to an instance, the default queue count for the instance type is displayed.
Check within the instance
Connect to a Linux instance.
NoteFor Windows instances, you can view the ENI queue count in the ECS console or by calling an API operation.
For more information, see Connect to a Linux instance by using Workbench.
Run the
ip acommand to view network configuration information.
Run the following command to check if the primary ENI eth0 supports NIC multi-queue.
This example uses the primary ENI. To check a secondary ENI, replace the network interface identifier with eth1, eth2, or another value.
ethtool -l eth0Check the command output to determine if NIC multi-queue is supported:
If the value of "Combined" under "Pre-set maximums" is greater than 1, the ENI supports NIC multi-queue. This value indicates the maximum queue count supported by the ENI.
The value of "Combined" under "Current hardware settings" indicates the current queue count in use.
In this example, the output indicates that the ENI supports a maximum of three combined (RX+TX) queues and is currently using three queues.

To modify the maximum number of queues that an ENI supports, see Modify the queue count for an ENI.
To modify the number of queues in use by the OS, see Modify the queue count used by the OS.
Modify the ENI queue count
When you attach an ENI to an instance, its queue count is automatically set to the default for that instance type. If you need to manually adjust the queue count, you can do so in the console or by calling an API operation. Note the following:
You can modify an ENI's queue count only when the ENI is in the Available state, or when it is Bound and the attached instance is Stopped.
The queue count cannot exceed the maximum queues per ENI for the instance type.
The total queue count of all ENIs on an instance cannot exceed the total queue quota for the instance type.
Use the console
In the upper-left corner of the page, select a region and resource group.
Click the ID of the target secondary ENI to open its details page.
Click Modify Queue Count.

Click OK.
Use the API
You can call the ModifyNetworkInterfaceAttribute operation and set the QueueNumber parameter to modify the queue count of an ENI.
After you modify the queue count for an ENI, the new setting takes effect the next time the attached instance starts.
Modify the OS queue count
When you modify the queue count for an ENI, the new setting is automatically applied within the OS, and the number of active queues matches the new count.
You can also tune the number of queues that the ENI actively uses. This value must be less than or equal to the configured queue count for the ENI.
Changing the queue count used by the OS inside an instance does not affect the ENI's configured queue count. This change does not appear in the console or API responses.
This change is temporary and does not persist across instance restarts.
The following example shows how to adjust the number of queues used by an ENI on an Alibaba Cloud Linux 3 instance that supports NIC multi-queue.
Connect to a Linux instance.
For more information, see Connect to a Linux instance by using Workbench.
Run the
ip address showcommand to view network configuration information.
Run the following command to check if the primary ENI eth0 supports NIC multi-queue.
This example uses the primary ENI. To check a secondary ENI, replace the network interface identifier with eth1, eth2, or another value.
ethtool -l eth0Check the command output to determine if NIC multi-queue is supported:
If the value of "Combined" under "Pre-set maximums" is greater than 1, the ENI supports NIC multi-queue. This value indicates the maximum queue count supported by the ENI.
The value of "Combined" under "Current hardware settings" indicates the current queue count in use.
In this example, a maximum of three combined (RX+TX) queues are supported and three queues are currently in use.

Run the following command to set the number of active queues for the primary ENI eth0 to 2.
This example uses the primary ENI. To adjust a secondary ENI, replace the network interface identifier with eth1, eth2, or another value.
sudo ethtool -L eth0 combined NNis the number of queues that you want the ENI to use.Nmust be less than or equal to the "Combined" value under "Pre-set maximums".In this example, set the number of queues for the primary ENI to 2:
sudo ethtool -L eth0 combined 2
Configure IRQ affinity
When you use NIC multi-queue, you typically need to configure IRQ affinity. This process assigns interrupts from different queues to specific CPU cores. This helps reduce CPU contention and improve network performance.
All public images except for Red Hat Enterprise Linux have IRQ affinity enabled by default and require no additional configuration.
Red Hat Enterprise Linux images support IRQ affinity for NIC multi-queue, but it is not enabled by default. Follow the steps in this topic to configure it.
The following steps show how to use the ecs_mq script to automatically configure IRQ affinity for NIC multi-queue on a Red Hat Enterprise Linux 9.2 image. If your instance does not use a Red Hat Enterprise Linux image, IRQ affinity is enabled by default and requires no configuration.
Connect to a Linux instance.
For more information, see Connect to a Linux instance by using Workbench.
(Optional) Stop the irqbalance service.
The irqbalance service dynamically adjusts IRQ affinity, which can conflict with the
ecs_mqscript. To avoid this conflict, stop the irqbalance service.systemctl stop irqbalance.serviceRun the following command to download the latest version of the
ecs_mqautomatic configuration script.wget https://ecs-image-tools.oss-cn-hangzhou.aliyuncs.com/ecs_mq/ecs_mq_latest.tgzRun the following command to decompress the
ecs_mqscript package.tar -xzf ecs_mq_latest.tgzRun the following command to change the working directory.
cd ecs_mq/Run the
ecs_mqinstallation script.bash install.sh redhat 9NoteReplace
redhatand9with the name and major version number of your operating system.Run the following command to start the
ecs_mqservice.systemctl start ecs_mqAfter the service starts, it automatically enables IRQ affinity.
To find the optimal balance for your workload, test different combinations of queue counts and IRQ affinity settings while monitoring metrics like throughput and latency.

