A method, device, and equipment for automatically selecting a virtual machine live migration acceleration solution
By automatically selecting the virtual machine hot migration acceleration solution and selecting the appropriate migration strategy based on CPU and memory usage, the migration failure problem caused by user manual selection is solved, and the migration efficiency and user experience are improved.
Patent Information
- Application Number
- CN202111152511.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-29
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-09-29
AI Technical Summary
In the prior art, users need to manually select the virtual machine hot migration acceleration solution, requiring users to have high professional and technical skills. It is difficult for ordinary users to judge the appropriate migration plan, resulting in increased or failure of migration time.
By receiving hot migration requests from virtual machines, analyzing automatic acceleration parameters, obtaining the CPU and memory usage status of the virtual machine, selecting appropriate migration acceleration solutions based on usage, such as multi-threaded compression, XOR operation memory differential data compression or automatic convergence scheme, and automatically configure migration parameters to complete migration.
It realizes automatic selection of migration acceleration solutions based on the operating status of the virtual machine, avoiding migration failure caused by insufficient user technology, and improving migration efficiency and user experience.
Smart Images

Figure CN113886012B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of virtual machine live migration acceleration, and particularly relates to a method, device, and equipment for automatically selecting a virtual machine live migration acceleration scheme. Background Art
[0002] For virtual machines based on qemu-kvm, during use, it is often necessary to migrate the virtual machines for various reasons and ensure that the services running inside the virtual machines do not interrupt during the migration process. For example, when the host machine to which the virtual machine belongs needs to be shut down for maintenance, all virtual machines on this host machine need to be migrated to other physical hosts. At this time, for virtual machines running important services, it is necessary to ensure that the services do not interrupt during the migration process. Here, the live migration technology of virtual machines is used.
[0003] For qemu-kvm, to implement the live migration of virtual machines, at the underlying technology level, it is necessary to organize the memory data of the running virtual machine and send it to the target host machine, and then continue to run the virtual machine on the target virtual machine based on the memory data. The virtual machine needs to experience a short downtime during the live migration process. However, since the downtime is very short, the existence of this downtime state cannot be perceived from the user and service levels. For live migration, the biggest problem currently is that the virtual machine is always in a running state during the migration process, so the services running inside the virtual machine also continuously read and write the memory data, and the memory data of the source virtual machine is constantly changing. Then, during the copy process of the virtual machine memory data from the source node to the target node, some memory page data will be modified. This part of the memory page is called a dirty page. Therefore, the entire virtual machine memory copy process is actually a process of continuously generating and eliminating dirty pages. Therefore, if the services inside the virtual machine are relatively busy, the generation rate of dirty pages will be very fast. And when the network transmission bandwidth is fixed, if the generation rate of memory dirty pages is greater than the network transmission rate, it will cause the virtual machine memory copy to never be completed, and ultimately cause the live migration to fail.
[0004] To solve the above problems, qemu internally implements some methods to accelerate the memory copy process. Different acceleration methods have their own advantages and disadvantages. Currently, it is required that the user manually specify a virtual machine migration acceleration scheme according to the specific service scenario of a specific virtual machine. In this case, it is required that the user has a certain understanding of the virtualization underlying technology, and the professional technical skills requirements for the user are relatively high. However, in most cases, ordinary users cannot judge which scheme should be used to accelerate the live migration for their service scenarios. If the wrong migration acceleration scheme is selected, it often has the opposite effect, resulting in an increase in the virtual machine migration time and even the inability to complete the live migration process. Summary of the Invention
[0005] Currently, users need to manually specify a virtual machine migration acceleration solution according to the specific business scenarios of specific virtual machines. In this case, it is required that users have a certain understanding of the underlying virtualization technology, and the professional technical skills requirements for users are relatively high. However, in most cases, ordinary users cannot determine which solution should be used to accelerate live migration for their business scenarios. If the wrong migration acceleration solution is selected, it often has the opposite effect, resulting in an increase in virtual machine migration time and even the inability to complete the live migration process. The present invention provides a method, device, and equipment for automatically selecting a virtual machine live migration acceleration solution.
[0006] The technical solution of the present invention is as follows:
[0007] In a first aspect, the technical solution of the present invention provides a method for automatically selecting a virtual machine live migration acceleration solution, including the following steps:
[0008] After receiving a request to perform virtual machine live migration, parse the automatic acceleration parameters;
[0009] When it is determined that automatic migration acceleration needs to be started according to the parsed parameter values, call the first virtualization interface to obtain the CPU time of the virtual machine;
[0010] Calculate the average CPU utilization rate through the CPU time;
[0011] When the average CPU utilization rate is greater than a set first threshold, call the second virtualization interface to obtain the memory usage status;
[0012] Calculate the memory utilization rate according to the obtained memory usage status;
[0013] When the memory utilization rate is greater than a set second threshold, select an automatic convergence solution;
[0014] Call the third virtualization interface to configure parameters for the selected acceleration solution to complete the migration.
[0015] During virtual machine live migration, obtain the virtual machine CPU time and memory usage status through the virtualization interface, so as to determine a suitable live migration acceleration solution based on the virtual machine CPU and memory usage status.
[0016] Further, before the step of parsing the automatic acceleration parameters after receiving an instruction to perform virtual machine live migration, it includes:
[0017] Expand the virtual machine live migration interface in the interface service to receive the automatic acceleration parameters used to control whether to enable the automatic selection of the migration acceleration solution.
[0018] When receiving a request through the expanded interface, parse the value of the automatic acceleration parameters in the request.
[0019] Further, the steps of invoking the first virtualization interface to obtain the CPU time of the virtual machine include:
[0020] Invoke the first virtualization interface to obtain the CPU time of the virtual machine;
[0021] After T seconds, invoke the first virtualization interface to obtain the CPU time of the virtual machine;
[0022] The steps of calculating the average utilization rate of the CPU through the CPU time include:
[0023] Calculate the average utilization rate of the virtual machine CPU in the past T seconds through the difference between the two CPU times.
[0024] Further, the method further includes:
[0025] When the average utilization rate of the CPU is less than or equal to the set first threshold, select the multi-threaded compression scheme;
[0026] Calculate the number of threads used to compress the memory data according to the CPU utilization rate; execute the steps: invoke the third virtualization interface to configure the parameters of the selected acceleration scheme to complete the migration.
[0027] Further, the method further includes:
[0028] When the memory utilization rate is less than or equal to the set second threshold, select the scheme of compressing memory difference data based on exclusive OR operation;
[0029] Calculate the size of the available cache for compressing memory difference data based on exclusive OR operation; execute the steps: invoke the third virtualization interface to configure the parameters of the selected acceleration scheme to complete the migration.
[0030] Further, after the step of selecting the automatic convergence scheme when the memory utilization rate is greater than the set second threshold, it further includes:
[0031] Set the initial CPU limit frequency ratio and the limit frequency increment amplitude for automatic convergence.
[0032] Further, the steps of invoking the third virtualization interface to configure the parameters of the selected acceleration scheme to complete the migration include: invoking the third virtualization interface to pass the selected migration acceleration scheme to the virtualization layer in the form of parameters, and the virtualization interface accelerates the live migration process according to the passed migration acceleration scheme when executing the migration process.
[0033] In a second aspect, the technical solution of the present invention provides a device for automatically selecting a live migration acceleration scheme for a virtual machine, including a parameter parsing module, a CPU time acquisition module, a calculation module, a memory usage status acquisition module, a judgment and selection module, and an execution module;
[0034] A parameter parsing module, which is used to parse automatic acceleration parameters after receiving a request for performing hot migration of a virtual machine;
[0035] A CPU time acquisition module, which is used to call a first virtualization interface to acquire the CPU time of the virtual machine when it is determined according to the parsed parameter value that automatic migration acceleration needs to be started;
[0036] A calculation module, which is used to calculate the average utilization rate of the CPU through the CPU time; calculate the memory utilization rate according to the acquired memory usage status;
[0037] A memory usage status acquisition module, which is used to call a second virtualization interface to acquire the memory usage status when the average utilization rate of the CPU is greater than a set first threshold;
[0038] A judgment and selection module, which is used to select an automatic convergence scheme when the memory utilization rate is greater than a set second threshold;
[0039] An execution module, which is used to call a third virtualization interface to configure parameters for the selected acceleration scheme and complete the migration.
[0040] Furthermore, the device further includes an interface setting module;
[0041] The interface setting module is used to expand a virtual machine hot migration interface in the interface service for receiving automatic acceleration parameters used to control whether to enable an automatic selection of a migration acceleration scheme.
[0042] Furthermore, the CPU time acquisition module is specifically used to call a first virtualization interface to acquire the CPU time of the virtual machine; after T seconds, call the first virtualization interface to acquire the CPU time of the virtual machine;
[0043] The calculation module is used to calculate the average utilization rate of the virtual machine CPU in the past T seconds through the difference between the two CPU times.
[0044] Furthermore, the judgment and selection module is further used to select a multi-threaded compression scheme when the average utilization rate of the CPU is less than or equal to a set first threshold;
[0045] The calculation module is further used to calculate the number of threads used to compress memory data according to the CPU utilization rate.
[0046] Furthermore, the judgment and selection module is further used to select a scheme for compressing memory difference data based on exclusive OR operation when the memory utilization rate is less than or equal to a set second threshold;
[0047] The calculation module is further used to calculate the size of the available cache for compressing memory difference data based on exclusive OR operation.
[0048] Furthermore, the device further includes a setting module;
[0049] A setting module for setting the initial CPU limit frequency ratio for automatic convergence and the frequency limit increment amplitude.
[0050] Furthermore, an execution module is specifically configured to call a third virtualization interface to transfer the selected migration acceleration scheme to the virtualization layer by passing parameters, and when the virtualization interface executes the migration process, it accelerates the live migration process according to the transferred migration acceleration scheme.
[0051] As can be seen from the above technical solutions, the present invention has the following advantages: It can automatically select a suitable migration acceleration scheme according to the running state of the virtual machine, avoiding the occurrence of migration failure problems caused by users' unfamiliarity with relevant technical principles. It can automatically select a migration acceleration scheme when the user performs a live migration of the virtual machine, improving the migration efficiency. It avoids the situation where the user needs to manually select a migration acceleration scheme, and also avoids the migration failure caused by the user selecting the wrong migration acceleration scheme due to insufficient understanding of the underlying professional technology. After adopting the present invention, the user experience can be improved both in terms of the usability of the cloud platform and the product performance indicators.
[0052] In addition, the design principle of the present invention is reliable, the structure is simple, and it has a very wide application prospect.
[0053] Thus, compared with the prior art, the present invention has prominent substantive features and significant progress, and the beneficial effects of its implementation are also obvious. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0055] Figure 1 It is a schematic flowchart of the method according to an embodiment of the present invention.
[0056] Figure 2 It is a schematic flowchart of the method according to another embodiment of the present invention.
[0057] Figure 3 It is a schematic block diagram of the device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0058] To enable those skilled in the art to better understand the technical solutions in the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.
[0059] qemu: An open-source simulated processor, which is a program responsible for creating virtual machines at the underlying layer in the ICOS project;
[0060] qemu-kvm: An implementation of the qemu program based on the kvm kernel virtual machine, which can be considered equivalent to qemu in this application;
[0061] xbzrle: A memory differential data compression technology based on exclusive-or operation. This technology obtains the memory page data differences through exclusive-or operation and compresses them according to a certain format;
[0062] Memory dirty page convergence: The process in which the remaining memory dirty pages become fewer and fewer and tend to zero as the live migration progresses.
[0063] As Figure 1 shown, the embodiments of the present invention provide a method for automatically selecting a virtual machine live migration acceleration scheme, including the following steps:
[0064] Step 11: After receiving a request to execute virtual machine live migration, parse the automatic acceleration parameters;
[0065] Step 12: When it is determined that automatic migration acceleration needs to be started according to the parsed parameter values, call the first virtualization interface to obtain the CPU time of the virtual machine;
[0066] Step 13: Calculate the average CPU utilization rate through the CPU time;
[0067] Step 14: When the average CPU utilization rate is greater than the set first threshold, call the second virtualization interface to obtain the memory usage status;
[0068] Step 15: Calculate the memory utilization rate according to the obtained memory usage status;
[0069] Step 16: When the memory utilization rate is greater than the set second threshold, select the automatic convergence scheme;
[0070] Step 17: Call the third virtualization interface to configure the parameters of the selected acceleration scheme to complete the migration.
[0071] When performing live migration of a virtual machine, obtain the CPU time and memory usage status of the virtual machine through the virtualization interface, and thus determine a suitable live migration acceleration scheme based on the CPU and memory usage status of the virtual machine.
[0072] As Figure 2 shown, the embodiments of the present invention provide a method for automatically selecting a live migration acceleration scheme for a virtual machine. The variables affecting the selection of the acceleration scheme mainly include the CPU usage rate, memory usage rate, and network transmission bandwidth of the virtual machine. Since a separate network card device is often used for the management service of the virtual machine when deploying in a user cloud platform, and another set of network devices is used for the virtual machine to run specific services, the internal network resource occupancy rate of the virtual machine does not affect the selection of the live migration acceleration scheme. Therefore, when selecting the live migration acceleration scheme, we mainly consider two indicators: the CPU usage rate and the memory usage rate.
[0073] After the upper-layer cloud management platform OpenStack receives the live migration instruction issued by the user, it can obtain the CPU and memory usage conditions of the corresponding virtual machine by calling the interface provided by libvirt and through certain calculations. At this time, comprehensively judge the CPU and memory usage rates of the virtual machine, and finally select a suitable migration acceleration scheme. If the CPU resource occupancy rate is less than or equal to 60%, the multi-threaded compression scheme can be selected for migration acceleration. On the contrary, if the CPU resource occupancy rate is greater than 60%, the multi-threaded compression scheme can be excluded, and then judge the memory occupancy rate. If the memory occupancy rate is less than or equal to 50%, the xbzrle acceleration scheme can be selected. If the memory occupancy rate is greater than 50%, the automatic convergence scheme is finally selected to avoid the failure of live migration by sacrificing the continuous stability of the virtual machine service. After determining the live migration acceleration scheme, when calling the libvirt migration interface, the selected migration acceleration scheme can be passed to the libvirt layer by passing parameters. When libvirt executes the migration process, it will accelerate the live migration process according to the passed migration acceleration scheme. The method includes the following steps:
[0074] Step 21: Expand the virtual machine live migration interface in the interface service to receive an automatic acceleration parameter for controlling whether to enable the automatic selection of the migration acceleration scheme;
[0075] In this step, expand the virtual machine live migration interface in the nova_api service of the upper-layer cloud management platform OpenStack, and an additional automatic acceleration parameter auto_accelerate = true / false can be received to control whether to enable the automatic selection of the migration acceleration scheme.
[0076] Step 22: After receiving the request to perform live migration of the virtual machine, parse the automatic acceleration parameter;
[0077] In this step, after receiving the nova_api live migration process, the nova_compute service parses the auto_accelerate parameter and determines whether to enable automatic selection of migration acceleration based on the parameter value.
[0078] Step 23: When it is determined to start automatic migration acceleration based on the parsed parameter value, call the first virtualization interface to obtain the CPU time of the virtual machine.
[0079] When the value of auto_accelerate in the live migration request is true, nova_compute first calls the libvirt getCPUStats interface to obtain the CPU time of the virtual machine, and then calls getCPUStats again after one second to obtain the CPU time of the virtual machine at this time. Among them, the first virtualization interface is the libvirt getCPUStats interface, and T is 1 second.
[0080] Step 24: Calculate the average CPU usage rate through the CPU time.
[0081] In this step, the average CPU usage rate of the virtual machine in the past second is calculated through the difference between the two CPU times.
[0082] Step 25: Determine whether the average CPU usage rate is greater than the set first threshold. If so, execute Step 26; otherwise, execute Step 30. In this step, the first threshold is set to 60%.
[0083] Step 26: Call the second virtualization interface to obtain the memory usage status.
[0084] The libvirt memoryStats interface is the second virtualization interface; when the CPU usage rate is greater than 60%, call the libvirt memoryStats interface to obtain the current memory usage status of the virtual machine.
[0085] Step 27: Calculate the memory usage rate based on the obtained memory usage status.
[0086] The memory usage rate of the current virtual machine can be calculated through the values of the available field and the unused field in the return result called in Step 26.
[0087] Step 28: Determine whether the memory usage rate is greater than the set second threshold. If so, execute Step 29; otherwise, execute Step 31.
[0088] In this step, the second threshold is 50%.
[0089] Step 29: Select the automatic convergence scheme, set the initial CPU limit frequency ratio for automatic convergence and the frequency limit increment; execute Step 32;
[0090] Meanwhile, to ensure the stability and continuity of the internal services of the virtual machine, set the initial CPU limit frequency ratio for automatic convergence to 95% and the frequency limit increment to 5%.
[0091] It should be noted that for the automatic convergence scheme: qemu will, according to the copy situation of the memory data and based on a certain algorithm, if the dirty pages in the virtual machine memory cannot converge within a certain period of time, the qemu process will reduce the generation of dirty pages in the memory by reducing the CPU frequency, so as to achieve the purpose of quickly converging the dirty pages in the memory. Since this scheme will reduce the virtual machine CPU frequency within a certain period of time, this will cause a certain impact on the operation of the internal services of the virtual machine. Therefore, this scheme is applicable to the situation where both the virtual machine CPU and memory resource occupancy rates are very high and the live migration process cannot be completed through conventional schemes.
[0092] Step 30: Select the multi-threaded compression scheme, calculate the number of threads used to compress the memory data according to the CPU usage rate; execute Step 32;
[0093] The specific calculation method is: cpu_cores * (1 – cpu_used%), that is, multiply the number of virtual machine CPUs by the percentage of unused CPUs, and take the integer of the result as the number of threads used to compress the memory.
[0094] It should be noted that for the multi-threaded compression scheme: before the memory data is transmitted through the network, the data is compressed using a compression algorithm first, which can reduce the amount of data transmitted. Since this scheme requires a part of the CPU resources when compressing the memory data, when the CPU resources are relatively tight, because there is not enough CPU resources for the memory data to perform compression operations, in this case, not only the migration efficiency of the memory data cannot be improved, but also the memory data copy time will become longer.
[0095] Step 31: Select the scheme for compressing memory difference data based on exclusive-or operation, calculate the size of the available cache for compressing memory difference data based on exclusive-or operation; execute Step 32;
[0096] Calculate the memory size used for the xbzrle cache. According to the result returned by the call in Step 26, the size of the unused memory in the virtual machine can be obtained, and 80% of the unused memory capacity is used for the xbzrle cache, and the remaining 20% is left for the virtual machine to use.
[0097] It should be noted that xbzrle, i.e., the memory difference data compression technology based on exclusive OR operation. Under this scheme, for memory dirty pages, not all of them will be copied, but only the difference data part of the dirty pages will be copied, which can also reduce the data transmission volume. However, under this scheme, the data transmission volume cannot be reduced in the initial state. It is not until the initial memory copy is completed and the dirty page data copying starts that its acceleration effect can be reflected. Therefore, if the virtual machine memory usage is very high, the initial memory copy will occupy a large amount of network bandwidth. This scheme is applicable to the situation where the virtual machine memory occupancy is not high, but the CPU resources are relatively tense.
[0098] Step 32: Call the third virtualization interface to configure the parameters of the selected acceleration scheme and complete the migration. In this step, the finally determined hot migration acceleration scheme is configured by setting the flag of the libvirt migrate3 interface, and then the additional parameters of the acceleration scheme are set through the params parameter. Call the libvirt migrate3 interface to complete the migration. The third virtualization interface is the libvirt migrate3 interface.
[0099] As Figure 3 shown, an apparatus for automatically selecting a virtual machine hot migration acceleration scheme according to an embodiment of the present invention includes a parameter parsing module, a CPU time acquisition module, a calculation module, a memory usage status acquisition module, a judgment and selection module, and an execution module;
[0100] The parameter parsing module is used to parse the automatic acceleration parameters after receiving a request to perform virtual machine hot migration;
[0101] The CPU time acquisition module is used to call the first virtualization interface to acquire the CPU time of the virtual machine when it is determined according to the parsed parameter value that automatic migration acceleration needs to be started;
[0102] The calculation module is used to calculate the average usage rate of the CPU through the CPU time; calculate the memory usage rate according to the acquired memory usage status;
[0103] The memory usage status acquisition module is used to call the second virtualization interface to acquire the memory usage status when the average usage rate of the CPU is greater than a set first threshold;
[0104] The judgment and selection module is used to select an automatic convergence scheme when the memory usage rate is greater than a set second threshold;
[0105] The execution module is used to call the third virtualization interface to configure the parameters of the selected acceleration scheme and complete the migration.
[0106] Since an independent network card device is often used for the management service of virtual machines during the deployment of the user cloud platform, and another set of network devices is used for the specific services run by the virtual machines, the internal network resource occupancy rate of the virtual machines does not affect the selection of the hot migration acceleration solution. Therefore, when selecting the hot migration acceleration solution, we mainly consider two indicators: CPU usage rate and memory usage rate.
[0107] An embodiment of the present invention provides a device for automatically selecting a hot migration acceleration solution for virtual machines, including a parameter parsing module, a CPU time acquisition module, a calculation module, a memory usage status acquisition module, a judgment and selection module, an execution module, and an interface setting module;
[0108] The interface setting module is used to expand a virtual machine hot migration interface in the interface service for receiving an automatic acceleration parameter for controlling whether to enable the automatic selection of the migration acceleration solution;
[0109] The parameter parsing module is used to parse the automatic acceleration parameter after receiving a request to perform virtual machine hot migration;
[0110] The CPU time acquisition module is used to call the first virtualization interface to obtain the CPU time of the virtual machine when it is determined according to the parsed parameter value that automatic migration acceleration needs to be started; after T seconds, call the first virtualization interface to obtain the CPU time of the virtual machine;
[0111] The calculation module is used to calculate the average CPU usage rate of the virtual machine in the past T seconds through the difference between the two CPU times; calculate the memory usage rate according to the obtained memory usage status; is also used to calculate the number of threads for compressing memory data according to the CPU usage rate; is also used to calculate the size of the available cache for compressing memory difference data based on exclusive-or operation;
[0112] The memory usage status acquisition module is used to call the second virtualization interface to obtain the memory usage status when the average CPU usage rate is greater than a set first threshold;
[0113] The judgment and selection module is used to select an automatic convergence solution when the memory usage rate is greater than a set second threshold; is also used to select a multi-threaded compression solution when the average CPU usage rate is less than or equal to the set first threshold; is also used to select a solution for compressing memory difference data based on exclusive-or operation when the memory usage rate is less than or equal to the set second threshold;
[0114] The execution module is used to call the third virtualization interface to transfer the selected migration acceleration solution to the virtualization layer in a parameter-passing manner, and the virtualization interface accelerates the hot migration process according to the transferred migration acceleration solution when executing the migration process.
[0115] The device further includes a setting module; used for setting the initial CPU limit frequency ratio for automatic convergence and the frequency limit increment amplitude. Specifically, the initial CPU limit frequency ratio for automatic convergence is set to 95%, and the frequency limit increment amplitude is 5%.
[0116] A computer device provided by an embodiment of the present invention, the device may include: a processor, a communication interface, a memory, and a bus. Among them, the processor, the communication interface, and the memory communicate with each other through the bus. The bus can be used for information transmission between the electronic device and the sensor. The processor can call the logical instructions in the memory to execute the following method: Step 11: After receiving a request to perform virtual machine live migration, parse the automatic acceleration parameters; Step 12: When it is determined that automatic migration acceleration needs to be started according to the parsed parameter values, call the first virtualization interface to obtain the CPU time of the virtual machine; Step 13: Calculate the average CPU usage rate through the CPU time; Step 14: When the average CPU usage rate is greater than a set first threshold, call the second virtualization interface to obtain the memory usage status; Step 15: Calculate the memory usage rate according to the obtained memory usage status; Step 16: When the memory usage rate is greater than a set second threshold, select an automatic convergence scheme; Step 17: Call the third virtualization interface to configure the parameters of the selected acceleration scheme to complete the migration.
[0117] In some specific embodiments, the processor can call the logical instructions in the memory, and specifically can implement the following steps: When the average CPU usage rate is less than or equal to the set first threshold, select a multi-threaded compression scheme; Calculate the number of threads used to compress memory data according to the CPU usage rate; When the memory usage rate is less than or equal to the set second threshold, select a scheme for compressing memory difference data based on exclusive-or operation; Calculate the size of the available cache for compressing memory difference data based on exclusive-or operation.
[0118] In some specific embodiments, the processor can call the logical instructions in the memory, and specifically can implement the following steps: When the memory usage rate is greater than the set second threshold and an automatic convergence scheme is selected, set the initial CPU limit frequency ratio for automatic convergence and the frequency limit increment amplitude.
[0119] The various embodiments in this specification are described in a progressive manner. The key point of each embodiment is the difference from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method part.
[0120] In addition, when the logical instructions in the above-mentioned memory can be 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 such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0121] Although the present invention has been described in detail by referring to the accompanying drawings and in combination with the preferred embodiments, the present invention is not limited thereto. Without departing from the spirit and essence of the present invention, those of ordinary skill in the art can make various equivalent modifications or substitutions to the embodiments of the present invention, and all such modifications or substitutions should be within the scope of the present invention. / Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for automatically selecting a virtual machine hot migration acceleration solution, characterized in that It includes the following steps: After receiving a request to perform virtual machine live migration, parse the automatic acceleration parameters; When it is determined that automatic migration acceleration needs to be started according to the parsed parameter values, call the first virtualization interface to obtain the CPU time of the virtual machine; Calculate the average CPU utilization rate through the CPU time; When the average CPU utilization rate is greater than the set first threshold, call the second virtualization interface to obtain the memory usage status; Calculate the memory utilization rate according to the obtained memory usage status; When the memory utilization rate is greater than the set second threshold, select an automatic convergence scheme; Call the third virtualization interface to configure the parameters of the selected acceleration scheme to complete the migration; This method further includes: When the average CPU utilization rate is less than or equal to the set first threshold, select a multi-threaded compression scheme; Calculate the number of threads used to compress memory data according to the CPU utilization rate; Execute the steps: call the third virtualization interface to configure the parameters of the selected acceleration scheme to complete the migration.
2. The method for automatically selecting a virtual machine hot migration acceleration solution according to claim 1, characterized in that Before the step of parsing the automatic acceleration parameters after receiving an instruction to perform virtual machine live migration, it includes: In the interface service, expand the virtual machine live migration interface for receiving the automatic acceleration parameters used to control whether to enable the automatic selection of migration acceleration schemes.
3. The method for automatically selecting a virtual machine hot migration acceleration solution according to claim 1, wherein The step of calling the first virtualization interface to obtain the CPU time of the virtual machine includes: Call the first virtualization interface to obtain the CPU time of the virtual machine; After T seconds, call the first virtualization interface to obtain the CPU time of the virtual machine; The step of calculating the average CPU utilization rate through the CPU time includes: Calculate the average CPU utilization rate of the virtual machine in the past T seconds through the difference between the two CPU times.
4. The method for automatically selecting a virtual machine hot migration acceleration solution according to claim 1, wherein This method further includes: When the memory utilization rate is less than or equal to the set second threshold, select a scheme for compressing memory difference data based on exclusive-or operation; Calculate the size of the available cache for compressing memory difference data based on exclusive-or operation; Execute the steps: call the third virtualization interface to configure the parameters of the selected acceleration scheme to complete the migration.
5. The method for automatically selecting a virtual machine hot migration acceleration solution according to claim 1, wherein After the step of selecting an automatic convergence scheme when the memory utilization rate is greater than the set second threshold, it further includes: Set the initial CPU limit frequency ratio and the limit frequency increment amplitude for automatic convergence.
6. The method for automatically selecting a virtual machine hot migration acceleration solution according to claim 1, characterized in that The step of calling the third virtualization interface to configure the parameters of the selected acceleration scheme to complete the migration includes: call the third virtualization interface to pass the selected migration acceleration scheme to the virtualization layer in the form of parameters, and when the virtualization interface executes the migration process, accelerate the live migration process according to the passed migration acceleration scheme.
7. An apparatus for automatically selecting a virtual machine hot migration acceleration solution, characterized in that, It includes a parameter parsing module, a CPU time acquisition module, a calculation module, a memory usage status acquisition module, a judgment and selection module, and an execution module; The parameter parsing module is used to parse the automatic acceleration parameters after receiving a request to perform virtual machine live migration; The CPU time acquisition module is used to call the first virtualization interface to obtain the CPU time of the virtual machine when it is determined that automatic migration acceleration needs to be started according to the parsed parameter values; The calculation module is used to calculate the average CPU utilization rate through the CPU time; calculate the memory utilization rate according to the obtained memory usage status; A memory usage status acquisition module, which is used to call a second virtualization interface to acquire the memory usage status when the average utilization rate of the CPU is greater than a set first threshold; A judgment and selection module, which is used to select an automatic convergence solution when the memory utilization rate is greater than a set second threshold; An execution module, which is used to call a third virtualization interface to configure parameters for the selected acceleration solution and complete the migration; The judgment and selection module is further used to select a multi-threaded compression solution when the average utilization rate of the CPU is less than or equal to the set first threshold.
8. The apparatus for automatically selecting a virtual machine live migration acceleration solution according to claim 7, wherein The judgment and selection module is further used to select a memory difference data compression solution based on exclusive-or operation when the memory utilization rate is less than or equal to the set second threshold.
9. A computer device, characterized in that, It includes a processor and a memory, and the processor and the memory complete communication with each other through a bus; the memory stores program instructions executable by the processor, and the processor can execute the method for automatically selecting a virtual machine hot migration acceleration solution according to any one of claims 1 to 6 by calling the program instructions.
Citation Information
Patent Citations
IaaS cloud platform-oriented method and system for optimizing resource scheduling efficiency
CN108595250A