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:
- Stop the irqbalance service.
systemctl stop irqbalance
- Check whether the service is stopped.
systemctl status irqbalance
If Active: inactive is displayed, the irqbalance service is stopped.
Procedure
- 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.
- Run lscpu to check the number of CPU cores. In this example, there are four CPU cores.
- 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
- 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.
- 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
- 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot