A method for adaptively adjusting parameters of hot-expanding virtual machine network card equipment
By adaptively adjusting network card equipment parameters in virtual machines in cloud computing, the problem of network performance improvement during thermal expansion of virtual machines is solved, and the synchronization improvement of virtual machine network throughput performance is achieved.
Patent Information
- Application Number
- CN202311712772.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-13
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2043-12-13
AI Technical Summary
In the field of cloud computing, it is difficult for the existing technology to simultaneously improve network card performance when the virtual machine is thermally expanded, resulting in insufficient network throughput performance and lack of generalized solutions.
Through the underlying virtualization technology, a method of adaptively adjusting the parameters of the network card equipment of the thermal expansion virtual machine is provided, including dynamically adjusting the number of multi-queues of the network card, interrupt affinity binding and network bandwidth to realize that the virtual machine is not shut down. network performance improvement.
It realizes dynamically adjusting the virtual machine network bandwidth, network card multi-queue and interrupt affinity binding when the virtual machine is thermally expanded to calculate resources, thereby synchronizing the network performance of the virtual machine and improving the network throughput performance of the virtual machine.
Smart Images

Figure CN117880107B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cloud computing, and more specifically, to a method for adaptively adjusting parameters of a hot-expanded virtual machine network card device. Background Art
[0002] The virtual machine network card device parameters refer to the configuration parameters related to the network interface card of the virtual machine, including bandwidth, buffer size, queue length, etc. In a virtualized environment, the network interface card device parameters of the virtual machine are adjusted to adapt to workload changes.
[0003] At present, in the field of cloud computing, the performance tuning method for virtual machine network card devices is basically to shut down the virtual machine and redefine the virtual machine form, or manually adjust it inside the virtual machine. This method will cause long-term inaccessibility to user services inside the virtual machine and is not conducive to forming a universal solution. Ordinary users must have certain network knowledge to improve network performance. As virtual machine online hot expansion technology gradually becomes a development trend, how to simultaneously improve network card performance when hot expanding virtual machine computing resources, the industry has not yet had a complete solution. To this end, the present invention provides a method for adaptively adjusting hot expansion virtual machine network card device parameters. Summary of the invention
[0004] In order to overcome the above-mentioned defects of the prior art, an embodiment of the present invention provides a method for adaptively adjusting the parameters of a hot-expanded virtual machine network card device. With the help of the underlying virtualization technology, a method for dynamically adjusting the receiving and transmitting performance of the network card is provided, so that the network card device can be dynamically adjusted in terms of data flow qos, multiple queues and interrupt binding according to the CPU specifications of the virtual machine without shutting down the virtual machine, so that the network throughput performance of the virtual machine can be synchronously improved during the online hot expansion to solve the problems raised in the above-mentioned background technology.
[0005] To achieve the above object, the present invention provides the following technical solution: a method for adaptively adjusting parameters of a hot-expanded virtual machine network card device, comprising:
[0006] Step 1: Create a virtual machine image, set the startup of the rc.local service, require the rc.local service to be executed after the network is started, and place the execution program of the network card multi-queue and network card interrupt affinity binding in the rc.local service;
[0007] Step 2: When creating a virtual machine, set the number of network card multi-queues to the maximum range according to the setting rules;
[0008] Step 3: When the virtual machine starts, the rc.local service is used to execute the network card multi-queue and network card interrupt affinity binding programs;
[0009] Step 4: When receiving the CPU hot expansion instruction, send the network card instruction through the unix socket channel;
[0010] Step 5: After the system completes the CPU hot expansion operation, it synchronously requests the network module to adjust the network bandwidth of the virtual machine.
[0011] Furthermore, the process of making a virtual machine image includes:
[0012] Create a virtual machine image, install the operating system, and configure the required network settings;
[0013] Edit the / etc / rc.local file and add commands or scripts to be executed at startup;
[0014] Add a delay command in rc.local to ensure that the network is fully started before executing related commands;
[0015] Write scripts or commands for NIC multi-queue and NIC interrupt affinity binding.
[0016] Furthermore, the setting rule is based on the principle of one-to-one binding between queues and CPU cores, and the maximum range is set to the maximum value of the CPU for hot expansion of the virtual machine; the virtual machine is required to run on a physical machine with a kernel version of 4.X or above. From a virtualization perspective, the virtual machine supports 256 queues. In a NUMA architecture system, the number of queues is consistent with the number of CPU cores of the physical machine.
[0017] Furthermore, the network card multi-queue distributes network traffic to M queues, which are processed simultaneously by M CPUs, where M is a positive integer greater than zero; the network card interrupt affinity refers to associating a specific interrupt with a processor core to optimize the interrupt processing performance of the system.
[0018] Furthermore, the contents of executing the network card multi-queue and network card interrupt affinity binding program include:
[0019] When the virtual machine starts, the script is executed through the rc.local service;
[0020] In the script, use the command nproc to check the number of CPUs in the current system;
[0021] Use the special address 169.254.169.254 to obtain the relevant information of the current virtual machine instance through the metadata service of the cloud service to obtain the number of network card multi-queue configurations under the current number of CPUs;
[0022] Call ethtool to set the number of multiple queues of the network card by using the queue command; the queue command is ethtool -LethXcombinedN, where ethX is the name of the network card interface and N is the number of queues to be set;
[0023] Use the binding command to bind the network card interrupt affinity to the CPU.
[0024] Furthermore, the contents of the network card related instructions sent through the unix socket channel include:
[0025] When receiving the CPU hot expansion command, the virtual machine is expanded through qemu through the unixsocket channel between the physical machine and the virtual machine;
[0026] Send instructions to the qemu-guest-agent inside the virtual machine to adjust the network card multi-queue and interrupt affinity binding.
[0027] Furthermore, the contents of sending network card related instructions through the unix socket channel also include:
[0028] After receiving the request, the agent calls the execution program of the network card multi-queue and network card interrupt affinity binding. The program checks the number of CPU cores in the current virtual machine, accesses the metadata service by accessing the specific routing address 169.254.169.254, and re-acquires the number of network card multi-queues of the virtual machine;
[0029] Through ethtool -l <net-dev>combined <queues>Use the command to adjust the number of multiple queues of the virtual machine's network card, check / proc / interrupts to obtain the interrupt number of the network card's interrupt device, and bind the hardware interrupt request IRQ on the network card to the newly added CPU.
[0030] Furthermore, the network module performs data flow control on the virtual switch ovs according to the bandwidth value of the virtual machine network card.
[0031] In a second aspect, the present invention provides an electronic device, comprising: a processor and a memory, wherein the memory stores a computer program that can be called by the processor;
[0032] The processor executes the above-mentioned method for adaptively adjusting the parameters of the hot-expanding virtual machine network card device by calling the computer program stored in the memory.
[0033] In a third aspect, the present invention provides a computer-readable storage medium storing instructions, which, when executed on a computer, enable the computer to execute the above-mentioned method for adaptively adjusting parameters of a hot-expanding virtual machine network card device.
[0034] Technical effects and advantages of the present invention:
[0035] When hot expansion of computing resources is performed on a virtual machine, the present invention provides a feasible solution for dynamically adjusting the network bandwidth, multiple queues of a network card, and interrupt affinity binding of the virtual machine to synchronously improve the network performance of the virtual machine. The present invention has the advantage of adaptively and dynamically adjusting device parameters related to the network card of the virtual machine without executing a shutdown operation and without manual intervention by the user, so as to synchronously improve the performance of the network card of the virtual machine during hot expansion, thereby improving the network throughput performance of the virtual machine. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a schematic diagram of a method for hot-expanding virtual machine network card device parameters in Example 1;
[0037] Figure 2 This is a schematic diagram of a hot expansion virtual machine network card device in Example 1;
[0038] Figure 3 This is a flow chart of the method for hot expansion of virtual machine network card device parameters in Example 1;
[0039] Figure 4 This is a schematic diagram of an electronic device according to Embodiment 2;
[0040] Figure 5 A schematic diagram of a computer-readable storage medium of Example 3. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0042] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. The functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor methods and / or microcontroller methods.
[0043] It should be understood that although the terms "first", "second", etc. may be used herein to describe various units, these units should not be limited by these terms. These terms are used only to distinguish one unit from another. For example, a first unit may be referred to as a second unit, and a similar second unit may be referred to as a first unit without departing from the scope of the exemplary embodiments. The term "and / or" used herein includes any and all combinations of one or more of the associated listed items.
[0044] Based on the virtualization technology qemu-qa, the present invention proposes a universal solution for adaptively adjusting the network card device parameters of online virtual machines when the virtual machines perform hot expansion of computing resources in the field of cloud computing. The network card device parameters here include three aspects: Figure 2 As shown,
[0045] (1) Adjust the number of network card multi-queues related to network transmission and reception. On a symmetric multi-core processor SMP system, initially only one CPU responded to the IRQ (interrupt request) of a network card. As a single CPU could not meet the increasing network card bandwidth performance, network card multi-queue technology emerged. This method binds network transmission and reception queues to different CPU cores to meet the increasing bandwidth requirements. Therefore, adjusting this device parameter can improve the throughput of network transmission and reception packets of the virtual machine at the same time.
[0046] (2) Increase the binding of network card interrupt affinity. The Linux system assigns interrupt numbers to the devices on it. The sending and receiving operations on the network card will be converted into corresponding interrupt signals and sent to the system for processing. On a symmetric multi-core processor (SMP), only one CPU responds to the IRQ of a network card. In order to improve the processing speed of network card interrupt requests, these interrupt signals can be assigned to more CPU processors, that is, the interrupt number and the CPU are bound by affinity;
[0047] (3) Adjust the bandwidth speed limit of the data flow on the network card. The bandwidth of the virtual machine in the OpenStack system is processed by QoS speed limit on the network card device of the virtual machine on the virtual switch OVS. When the computing resources increase, this speed limit value needs to be adjusted to increase the network bandwidth of the virtual machine.
[0048] Example 1
[0049] See also Figure 1 As shown, this embodiment discloses a method for adaptively adjusting parameters of a hot-expanded virtual machine network card device, including:
[0050] Step 1: Create a virtual machine image, set the startup of the rc.local service, require the rc.local service to be executed after the network is started, and place the execution program of the network card multi-queue and network card interrupt affinity binding in the rc.local service;
[0051] Specifically, the process of making a virtual machine image includes:
[0052] 101. Create a virtual machine image, install the operating system, and configure the required network settings;
[0053] 102. Edit the / etc / rc.local file and add commands or scripts to be executed at startup;
[0054] 103. Add a delay command in rc.local to ensure that the relevant commands are executed after the network is fully started;
[0055] 104. Write scripts or commands for network card multi-queue and network card interrupt affinity binding;
[0056] Step 2: When creating a virtual machine, set the number of network card multi-queues to the maximum range according to the setting rules;
[0057] It should be noted that the setting rule is based on the principle of one-to-one binding between queues and CPU cores, and the maximum range is set to the maximum value of the CPU for hot expansion of the virtual machine; further, the virtual machine is required to run on a physical machine with a kernel version of 4.X or above. From the perspective of virtualization, the virtual machine supports 256 queues. In a system with a NUMA architecture, the number of queues is consistent with the number of CPU cores of the physical machine;
[0058] Step 3: When the virtual machine starts, the rc.local service is used to execute the network card multi-queue and network card interrupt affinity binding programs;
[0059] It should be noted that the NIC multi-queue distributes network traffic to M queues and is processed by M CPUs simultaneously, which improves network performance during peak network traffic and thus improves the system's network throughput. NIC interrupt affinity refers to associating specific interrupts with processor cores to optimize the system's interrupt processing performance; M is a positive integer greater than zero;
[0060] Specifically, the contents of executing the network card multi-queue and network card interrupt affinity binding program include:
[0061] When the virtual machine starts, the script is executed through the rc.local service, so that the rc.local service is started;
[0062] In the script, use the command nproc to check the number of CPUs in the current system; enable the network card multi-queue and interrupt affinity binding program to execute;
[0063] Use the special address 169.254.169.254 to obtain the relevant information of the current virtual machine instance through the metadata service of the cloud service to obtain the number of network card multi-queue configurations under the current number of CPUs;
[0064] Call ethtool to set the number of multiple queues of the network card by using the queue command; the queue command is ethtool -LethXcombinedN, where ethX is the name of the network card interface and N is the number of queues to be set;
[0065] Bind the network card interrupt affinity to the CPU through a binding command: the binding command includes taskset or other related tools;
[0066] In this step, the rc.local service is used to execute the NIC multi-queue and NIC interrupt affinity binding programs when the virtual machine starts, check the current number of CPUs, and obtain the NIC multi-queue configuration number under the current number of CPUs through 169.254.169.254. Set the NIC multi-queue number through the system call ethtool, and bind the NIC interrupt affinity to the CPU to ensure that the processing of the NIC interrupt is associated with a specific CPU core to improve performance.
[0067] Step 4: When receiving the CPU hot expansion instruction, send the network card instruction through the unix socket channel;
[0068] Specifically, the contents of the network card related instructions sent through the Unix socket channel include:
[0069] When receiving the CPU hot expansion command, the virtual machine is expanded through qemu through the unixsocket channel between the physical machine and the virtual machine;
[0070] Send instructions to the qemu-guest-agent inside the virtual machine to adjust the network card multi-queue and interrupt affinity binding;
[0071] The contents of sending network card related commands through the unix socket channel also include:
[0072] After receiving the request, the agent calls the execution program of the network card multi-queue and network card interrupt affinity binding. The program checks the number of CPU cores in the current virtual machine, accesses the metadata service by accessing the specific routing address 169.254.169.254, and re-acquires the number of network card multi-queues of the virtual machine;
[0073] Through ethtool -l <net-dev>combined <queues>Use the command to adjust the number of multiple queues of the virtual machine's network card, check / proc / interrupts to obtain the interrupt number of the network card's interrupt device, and bind the hardware interrupt request IRQ on the network card to the newly added CPU;
[0074] Step 5: After the system completes the CPU hot expansion operation, it synchronously requests the network module to adjust the network bandwidth of the virtual machine;
[0075] The network module performs data flow control on the virtual switch ovs according to the bandwidth value of the virtual machine network card;
[0076] Example 2
[0077] See also Figure 2 As shown, this embodiment provides an electronic device, including: a processor and a memory, wherein the memory stores a computer program that can be called by the processor;
[0078] The processor executes a method for adaptively adjusting parameters of a hot-expanding virtual machine network card device in Example 1 by calling a computer program stored in the memory.
[0079] Example 3
[0080] See also Figure 2 As shown, this embodiment provides a computer-readable storage medium storing instructions. When the instructions are executed on a computer, the computer executes a method of adaptively adjusting parameters of a hot-expanding virtual machine network card device in embodiment 1.
[0081] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center via a wired network. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.
[0082] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0083] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0084] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only one. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0085] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0086] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0087] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
[0088] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0089] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.< / queues> < / queues>
Claims
1. A method for adaptively adjusting parameters of a hot-expanded virtual machine network card device, characterized in that: include: Step 1: Create a virtual machine image, set the startup of the rc.local service, require the rc.local service to be executed after the network is started, and place the execution program of the network card multi-queue and network card interrupt affinity binding in the rc.local service; Step 2: When creating a virtual machine, set the number of network card multi-queues to the maximum range according to the setting rules; Step 3: When the virtual machine starts, the rc.local service is used to execute the network card multi-queue and network card interrupt affinity binding programs; Step 4: When receiving the CPU hot expansion instruction, send the network card instruction through the unix socket channel; The contents of sending network card related commands through the unix socket channel include: When receiving the CPU hot expansion command, the virtual machine is expanded through qemu through the unixsocket channel between the physical machine and the virtual machine; Send instructions to the qemu-guest-agent inside the virtual machine to adjust the network card multi-queue and interrupt affinity binding; The contents of sending network card related commands through the unix socket channel also include: After receiving the request, the agent calls the execution program of the network card multi-queue and network card interrupt affinity binding. The program checks the number of CPU cores in the current virtual machine, accesses the metadata service by accessing the specific routing address 169.254.169.254, and re-acquires the number of network card multi-queues of the virtual machine; Through ethtool -l <net-dev>combined <queues> Use the command to adjust the number of multiple queues of the virtual machine's network card, check / proc / interrupts to obtain the interrupt number of the network card's interrupt device, and bind the hardware interrupt request IRQ on the network card to the newly added CPU;< / queues> Step 5, after the system has executed the hot expansion operation of the CPU, it synchronously requests the network module to adjust the network bandwidth of the virtual machine; the network module performs data flow control according to the bandwidth value of the virtual machine network card on the virtual switch ovs.
2. The method for adaptively adjusting the parameters of a hot-expanded virtual machine network card device according to claim 1, characterized in that: The process of making a virtual machine image includes: Create a virtual machine image, install the operating system, and configure the required network settings; Edit the / etc / rc.local file and add commands or scripts to be executed at startup; Add a delay command in rc.local to ensure that the network is fully started before executing related commands; Write scripts or commands for NIC multi-queue and NIC interrupt affinity binding.
3. The method for adaptively adjusting the parameters of a hot-expanded virtual machine network card device according to claim 2, characterized in that: The setting rule is based on the principle of one-to-one binding between queues and CPU cores, and the maximum range is set to the maximum value of the CPU that performs hot expansion on the virtual machine; the virtual machine is required to run on a physical machine with a kernel version of 4.X or above. From a virtualization perspective, the virtual machine supports 256 queues. In a NUMA architecture system, the number of queues is consistent with the number of CPU cores on the physical machine.
4. The method for adaptively adjusting the parameters of a hot-expanded virtual machine network card device according to claim 3, characterized in that: The network card multi-queue distributes network traffic to M queues, which are processed simultaneously by M CPUs, where M is a positive integer greater than zero; the network card interrupt affinity refers to associating a specific interrupt with a processor core to optimize the interrupt processing performance of the system.
5. The method for adaptively adjusting the parameters of a hot-expanded virtual machine network card device according to claim 4, characterized in that: The contents of executing the NIC multi-queue and NIC interrupt affinity binding program include: When the virtual machine starts, the script is executed through the rc.local service; In the script, use the command nproc to check the number of CPUs in the current system; Use the special address 169.254.169.254 to obtain the relevant information of the current virtual machine instance through the metadata service of the cloud service to obtain the number of network card multi-queue configurations under the current number of CPUs; Call ethtool to set the number of multiple queues of the network card by using the queue command; the queue command is ethtool -LethXcombinedN, where ethX is the name of the network card interface and N is the number of queues to be set; Use the binding command to bind the network card interrupt affinity to the CPU.
6. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores a computer program that can be called by the processor; The processor executes a method for adaptively adjusting parameters of a hot-expanding virtual machine network card device according to any one of claims 1 to 5 by calling a computer program stored in the memory.
7. A computer-readable storage medium, characterized in that: Instructions are stored, and when the instructions are executed on a computer, the computer is caused to execute a method for adaptively adjusting parameters of a hot-expanding virtual machine network card device according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method and device for expanding memory of virtual machine
CN107562520A
Openstack load balancing data monitoring method and system, storage medium and equipment
CN113986653A