In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Being good at "things"-- Network Card RSS Technology
Before introducing VMQ, let's take a look at how network cards receive network data on traditional physical servers. When multicore CPU appears, because the network card does not support interrupting network traffic to multiple logical cores but to one of the logical cores for processing, this results in uneven use of CPU and reduces the efficiency of CPU in handling network traffic, as shown in figure 1.
Fig. 1 the network card interrupts a CPU logic core to receive data
Now most network cards have supported Receive SideScaling (hereinafter referred to as RSS). If the physical machine network card supports multiple hardware receiving queues, the received data will be distributed to multiple queues of the network card. On the physical server with multiple cores, the RSS technology of the network card interrupts the different CPU logic cores of the network card to improve the efficiency of data reception, as shown in figure 2. The purpose of RSS technology is to find the best CPU logic core for the queue to balance the CPU overhead of the network.
Fig. 2 RSS queue interrupts multiple CPU logical cores to receive data
How the Hyper-V virtual machine queue works
The situation of the virtual environment is more complicated than the physical environment, one is that the physical machine network card loses its RSS function after the physical machine network card is transformed into a virtual switch, and the other is that there are several virtual machines running on the physical machine, and the physical machine and the virtual machine receive data packets through the same network card, so it is necessary to find an equally effective way to balance the CPU overhead of the network and ensure the network performance of the virtual machine at the same time. VMQ technology comes into being because of the need. VMQ is a special queue, which adopts a queue similar to the hardware of the network card, and adopts a mechanism similar to RSS as the queue interrupt different CPU logic core. The difference is that the logic of VMQ filtering and distributing data packets is different from that of the network card hardware queues. In the case of only physical machines, the physical machine network cards only consider the physical machine's own data queues, while in the virtualized environment, the virtual switch should not only balance the physical machine queues but also take care of the virtual machine queues.
Before introducing how VMQ works, let's take a look at the routing path of virtual switch packets. There are two types of queues in Hyper-V virtual switches-VMQ and default queues. The data of the default queue is successively routed, filtered, extended, access control list and forwarding path of the virtual switch, and finally distributed by the virtual machine bus, as shown in figure 3.
Figure 3 data forwarding path of virtual switch
The VMQ queue collects the MAC addresses of virtual machines before distributing data to the queue, and then assigns VMQ queues to virtual machines with VMQ enabled through the VMQ MAC filter. Virtual machines that are not VMQ enabled and data that do not match the VMQ MAC filter will continue to be placed in the default queue. Unlike the default queue, VMQ queues do not use complete routing, filtering, extension, access control lists, and forwarding paths, but instead "jump the queue" to extend and send data to the virtual machine bus with less routing code. After the data is sent to the virtual network card by the virtual machine bus, the virtual machine uses virtual RSS (vRSS) technology to interrupt the virtual CPU for the queue on the virtual network card, as shown in figure 4.
Figure 4 VMQ queue and default queue
We can clearly see the benefits of VMQ from figure 4. If the virtual machine network card attribute enables the VMQ function, the virtual switch will bypass the virtual switch layer upon layer routing code, which can ensure that the data can be accurately and quickly forwarded to the virtual machine. Compared with the case without VMQ, it can not only reduce the CPU resource consumption required to process routing, but also reduce the delay of data transmission.
VMQ also has a distinction between dynamic and static. Static VMQ refers to the fixed relationship between the VMQ queue and the CPU logical core of the interrupt. Figure 4 is a typical static VMQ. The VMQ queue and logical CPU1 association assigned to virtual 1 in the network card, and the VMQ queue and logical CPU2 association assigned to virtual 2 will not change during the whole life cycle of virtual machine 1 and virtual machine 2. It can be considered that the data of virtual machine 1 has been processed by logical CPU1, while the data of virtual machine 2 has been processed by logical CPU2. Static VMQ may slow down the processing of the virtual machine network when the CPU associated with the virtual machine is busy, so the dynamic VMQ mechanism is introduced from WindowsServer 2012 R2, and the dynamic VMQ is more intelligent. As the name implies, dynamic VMQ allows the virtual machine network to dynamically associate and adjust according to the load and its associated logical CPU. As shown in figure 5, when the logical CPU2 is relatively idle, both the VMQ queues of virtual machine 1 and virtual machine 2 are associated with the logical CPU2.
Figure 5 dynamic VMQ
After understanding the basic principles of VMQ and dynamic VMQ, we can actually understand the default number of receiving queues and the number of processors used by the RSS of the network card and the vRSS of the virtual network card. The following example commands and results can show the number of queues and processors used by the network card. The default number of receiving queues for the network card RSS in the example is 8, and the maximum number of processors used by default is 16.
PS C:\ > Get-NetworkAdapterRss-Name "Ethernet 4"
Name
: Ethernet 4
InterfaceDescription
: Intel Ethernet CNA X540-T2 # 2
Enabled
: True
NumberOfReceiveQueues
: 8
Profile
: NUMAStatic
BaseProcessor: [Group:Number] [Group:Number]
: 0
MaxProcessor: [Group:Number] [[] [Group:Number]
::
MaxProcessors
: 16
Several of the important parameters are described as follows:
Enabled: enable or disable RSS
BaseProcessor: the minimum number of processors assigned to the Nic by the system; [Group:Number]-the ratio of the number of processor groups to the number of processors.
MaxProcessor: the maximum number of processors assigned to the network card; [Group:Number]-the ratio of the number of processor groups to the number of processors.
MaxProcessors: the maximum number of processors allocated to the Nic.
We can set the maximum number of CPU participating in receiving queues and RSS interrupts through the Set-NetAdapter command. The following example sets the default number of RSS receiving queues for the network card Ethernet4 to 16.
PS C:\ > Set-NetworkAdapterRss-Name "Ethernet 4"-NumberOfReceiveQueues 16
Name
: Ethernet 4
InterfaceDescription
: Intel Ethernet CNA X540-T2 # 2
Enabled
: True
NumberOfReceiveQueues
: 16
Profile
: NUMAStatic
BaseProcessor: [Group:Number] [Group:Number]
: 0
MaxProcessor: [Group:Number] [[] [Group:Number]
::
MaxProcessors
: 16
It is also relatively easy to enable and disable virtual VMQ. By default, Hyper-V virtual machine enables the VMQ feature. We can turn it on or off according to whether the virtual machine needs VMQ and the actual network card performance. If there are too many virtual machines and the VMQ queues of network cards are insufficient, we can also set VMQ weights for virtual machines with VMQ enabled at the right time. The network data of virtual machines with high weights will be placed in the VMQ queue first, and vice versa. The default VMQ weight is 100, as shown in the following example.
PS C:\ > Set-NetworkAdapterRss-Name "Ethernet 4"-NumberOfReceiveQueues 16
VMQWeight: 100
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.