Help Center> Image Management Service> FAQ> Image Optimization> How Do I Set NIC Multi-Queue for an Image?

How Do I Set NIC Multi-Queue for an Image?

Scenarios

With the increase of network I/O bandwidth, a single vCPU cannot meet the requirement of processing NIC interruptions. NIC multi-queue enables multiple vCPUs to process NIC interruptions, thereby improving network PPS and I/O performance.

ECSs Supporting NIC Multi-Queue

NIC multi-queue can be enabled on an ECS only when the ECS specifications, virtualization type, and image OS meet the requirements described in this section.

  • For details about the ECS specifications that support NIC multi-queue, see ECS Specifications.

    If the number of NIC queues is greater than 1, NIC multi-queue is supported.

  • Only KVM ECSs support NIC multi-queue.
  • The Linux public images listed in Table 2 support NIC multi-queue.
    • Windows OSs have not commercially supported NIC multi-queue. If you enable NIC multi-queue in a Windows image, starting an ECS created using such an image may be slow.
    • You are advised to upgrade the kernel version of the Linux ECS to 2.6.35 or later. Otherwise, NIC multi-queue is not supported.

      Run the uname -r command to obtain the kernel version. If the kernel version is earlier than 2.6.35, contact technical support to upgrade the kernel.

Table 1 Windows ECSs that support NIC multi-queue

OS

Image

Status

Windows

Windows Server 2008 WEB R2 64bit

Supported using private images

Windows Server 2008 Enterprise SP2 64bit

Supported using private images

Windows Server 2008 R2 Standard/Datacenter/Enterprise 64bit

Supported using private images

Windows Server 2008 R2 Enterprise 64bit_WithGPUdriver

Supported using private images

Windows Server 2012 R2 Standard 64bit_WithGPUdriver

Supported using private images

Windows Server 2012 R2 Standard/Datacenter 64bit

Supported using private images

Table 2 Linux ECSs that support NIC multi-queue

OS

Image

Status

NIC Multi-Queue Enabled by Default

Linux

Ubuntu 14.04/16.04 Server 64bit

Yes

Yes

openSUSE 42.2 64bit

Yes

Yes

SUSE Enterprise 12 SP1/SP2 64bit

Yes

Yes

CentOS 6.8/6.9/7.0/7.1/7.2/7.3/7.4/7.5/7.6 64bit

Yes

Yes

Debian 8.0.0/8.8.0/8.9.0/9.0.0 64bit

Yes

Yes

Fedora 24/25 64bit

Yes

Yes

EulerOS 2.2 64bit

Yes

Yes

Operation Instructions

The ECS described in the following section is assumed to meet the requirements on specifications and virtualization type.

Import an External Image File to the IMS Console

For details, see Registering an External Image File as a Private Image (Linux). After the image file is imported, view the value of NIC Multi-Queue on the page providing details about the image.

Set NIC Multi-Queue for the Image

Windows OSs have not commercially supported NIC multi-queue. If you enable NIC multi-queue in a Windows image, starting an ECS created using such an image may be slow.

Use either of the following methods to set the NIC multi-queue attribute.

Method 1:
  1. Log in to the management console.
  2. Under Computing, click Image Management Service.

    The IMS console is displayed.

  3. On the displayed Private Images page, locate the row that contains the target image and click Modify in the Operation column.
  4. Set the NIC multi-queue attribute of the image.
Method 2:
  1. Log in to the management console.
  2. Under Computing, click Image Management Service.

    The IMS console is displayed.

  3. On the displayed Private Images page, click the name of the target image.
  4. In the upper right corner of the displayed image details page, click Modify. In the displayed Modify Image dialog box, set parameter NIC Multi-Queue.

Method 3: Add hw_vif_multiqueue_enabled to an image through the API.

  1. For details about how to obtain the token, see Authentication.
  2. For details about how to call an API to update image information, see Updating Image Information (Native OpenStack API).
  3. Add X-Auth-Token to the request header.

    The value of X-Auth-Token is the token obtained in step 1.

  4. Add Content-Type to the request header.

    The value of Content-Type is application/openstack-images-v2.1-json-patch.

    The request URI is in the following format:

    PATCH /v2/images/{image_id}

    The request body is as follows:
    [       
             { 
              "op":"add",
              "path":"/hw_vif_multiqueue_enabled", 
              "value": "true" 
             } 
     ]

    Figure 1 shows an example request body for setting the NIC multi-queue attribute.

    Figure 1 Example request body

Create an ECS from the Private Image

Use the registered private image to create an ECS. For details, see Purchasing an ECS with Customized Configurations. Note the following when setting the parameters:
  • Region: Select the region where the private image is located.
  • Image: Select Private image and then the desired image from the drop-down list.

Run the Script for Configuring NIC Multi-Queue

Windows OSs have not commercially supported NIC multi-queue. If you enable NIC multi-queue in a Windows image, starting an ECS created using such an image may be slow.

For Linux OSs, the script for automatically configuring NIC multi-queue is provided. If an ECS has multiple NICs, running the script will automatically enable multi-queue for all the NICs.

  1. Log in to the ECS and run the following command to check the number of queues supported by and enabled for a NIC:

    ethtool -l NIC

    Example:

    [root@localhost ~]# ethtool -l eth0   #View the number of queues used by NIC eth0.
    Channel parameters for eth0:
    Pre-set maximums:
    RX:               0
    TX:               0
    Other:            0
    Combined:         4   #The NIC supports a maximum of four queues.
    Current hardware settings:
    RX:               0
    TX:               0
    Other:            0
    Combined:         1   #One queue has been enabled for the NIC.

    If the values of the two Combined fields are the same, NIC multi-queue has been enabled. No further action is required.

  2. Run the following command to download the configuration script multi-queue-hw:

    wget https://ecs-instance-driver.obs.cn-north-1.myhuaweicloud.com/multi-queue-hw

    The download path is https://ecs-instance-driver.obs.cn-north-1.myhuaweicloud.com/multi-queue-hw.

  3. Run the following command to assign execution permissions to the script:

    chmod +x multi-queue-hw

  4. Run the following command to move the multi-queue-hw script to the /etc/init.d directory:

    mv multi-queue-hw /etc/init.d

    Enter y when the following information is displayed:

    mv: overwrite '/etc/init.d/multi-queue-hw'?
  5. Run the following command to run the script:

    /etc/init.d/multi-queue-hw start

    The script takes effect immediately after being executed. However, if you stop an ECS, the NIC multi-queue will become invalid.

  6. Add startup configuration for each OS so that NIC multi-queue is automatically enabled upon the ECS startup.
    • For CentOS, Red Hat, Fedora, EulerOS, SUSE, and openSUSE, run the following command:

      chkconfig multi-queue-hw on

    • For Ubuntu, run the following command:

      update-rc.d multi-queue-hw defaults 90 10

    • For Debian, run the following command:

      systemctl enable multi-queue-hw