How Do I Bind NIC Interrupts to Cores?
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.
Prerequisites
The irqbalance service must be disabled. You can run systemctl stop irqbalance to disable it. To disable the irqbalance service from automatically starting upon system startup, run systemctl disable irqbalance.
Procedure
- Run ethtool -l eth0 to check the number of NIC queues. In this example, there are two NIC queues.
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.
- Run the following command to check the interrupts of the current NIC queue (in this example, the IDs of interrupts for data input of eth0 are 25 and 27, and those for data output are 26 and 28):
cat /proc/interrupts | grep virtio0 | awk '{print $1 $(NF)}'
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 existing binding.
Run cat /proc/irq/{25,26,27,28}/smp_affinity_list to check the binding. In this example, interrupts 25, 26, 27, and 28 are bound to CPU3.
- Manually bind NIC interrupts.
Bind data input interrupts of eth0 to CPU0 and CPU1.
echo 0 > /proc/irq/25/smp_affinity_list echo 1 > /proc/irq/27/smp_affinity_list
Bind data output interrupts of eth0 to CPU2 and CPU3.
echo 2 > /proc/irq/26/smp_affinity_list echo 3 > /proc/irq/28/smp_affinity_list
- Check the binding result.
Run cat /proc/irq/{25,26,27,28}/smp_affinity_list. The command output shows that the binding is successful.
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