Help Center/ Huawei Cloud EulerOS/ Best Practices/ Binding NIC Interrupts to CPU Cores
Updated on 2025-07-29 GMT+08:00

Binding NIC Interrupts to CPU Cores

Overview

With NIC interrupts bound to cores, data processing requests from each NIC can be allocated to their specified CPU core. This makes network data processing more efficient and improves the data throughput. This section describes how to configure NIC interrupt binding in HCE 2.0.

Preparations

Prepare an ECS and assign a public IP address or EIP to the ECS.

Prerequisites

The irqbalance service is disabled. If it is not, perform the following steps to disable it:

  1. Stop the irqbalance service.

    systemctl stop irqbalance

  2. Check whether the service is stopped.

    systemctl status irqbalance

    If Active: inactive is displayed, the irqbalance service is stopped.

Procedure

  1. Run the following command to check the number of NIC queues (in this example, there are two NIC queues. One corresponds to an input interrupt and another corresponds an output interrupt):

    ethtool -l eth0

    Replace eth0 with your actual NIC name. The following steps use eth0 as an example.

  2. Run lscpu to check the number of CPU cores. In this example, there are four CPU cores.

  3. Check the interrupt corresponding to the current NIC queue.

    cat /proc/interrupts | grep virtio0 | awk '{print $1 $(NF)}'

    In this example, data input of eth0 uses interrupts 25 and 27, and data output uses interrupts 26 and 28.

    You can run the following command to view the mapping between NICs and VirtIO:

    ethtool -i eth0 | grep bus-info | awk -F "bus-info:" '{print $2}' | xargs -I {} ls /sys/bus/pci/drivers/virtio-pci/{} | grep virtio

  4. Check the NIC interrupt binding.

    cat /proc/irq/{25,26,27,28}/smp_affinity_list

    In this example, interrupts 25, 26, 27, and 28 are bound to CPU 3.

  5. Manually bind NIC interrupts.

    Bind data input interrupts of eth0 to CPU 0 and CPU 1.

    echo 0 > /proc/irq/25/smp_affinity_list
    echo 1 > /proc/irq/27/smp_affinity_list

    Bind data output interrupts of eth0 to CPU 2 and CPU 3.

    echo 2 > /proc/irq/26/smp_affinity_list
    echo 3 > /proc/irq/28/smp_affinity_list

  6. Check the binding result.

    Run the following command to check the NIC interrupt binding:

    cat /proc/irq/{25,26,27,28}/smp_affinity_list

    The NIC interrupts are bound as expected.