Virtual machine hot migration method, device and storage medium
By determining the dirty page rate of the virtual processor during the virtual machine hot migration and limiting the memory access bandwidth of the target VCPU, the problem of too many dirty pages in the virtual machine hot migration is solved, and the migration success rate and judgment accuracy are improved .
Patent Information
- Application Number
- CN202111577821.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-12-22
AI Technical Summary
During the virtual machine hot migration process, a large number of dirty pages may be generated, reducing the success rate of hot migration of virtual machines.
The dirty page rate is reduced to improve migration success rate by determining the dirty page rate of each virtual processor of the virtual machine and limiting the memory access bandwidth of the target VCPU based on the dirty page rate.
While saving computing resources, it improves the success rate of virtual machine hot migration, and enhances the reliability and efficiency of judging whether the migration converges.
Smart Images

Figure CN114443211B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of virtual machines, and in particular to a virtual machine hot migration method, device and storage medium. Background Art
[0002] Virtual machine hot migration technology can migrate virtual machines from one physical machine to another without interrupting business.
[0003] Before the hot migration starts, the virtual machine runs on the source physical machine. After the hot migration starts, the virtual machine is started on the destination physical machine and its state is set to pause. The memory data sent by the source physical machine is continuously received until the remaining memory of the source physical machine is small enough. Finally, the source physical machine is paused and the remaining memory is copied to the destination physical machine at one time.
[0004] However, during the hot migration of a virtual machine, a large number of memory dirty pages may be generated, which reduces the success rate of the hot migration of the virtual machine. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a virtual machine hot migration method, device and storage medium to solve the problem that a large number of memory dirty pages may be generated during the virtual machine hot migration process, thereby reducing the success rate of the virtual machine hot migration.
[0006] According to a first aspect, an embodiment of the present invention provides a virtual machine hot migration method, comprising:
[0007] During the hot migration of a virtual machine, determine the dirty page rate of each virtual processor VCPU of the virtual machine;
[0008] Determining the dirty page rate of the virtual machine according to the dirty page rate of each VCPU;
[0009] If it is determined according to the dirty page rate of the virtual machine that the set migration convergence condition is not satisfied, then selecting a target VCPU that satisfies the set dirty page rate condition from each VCPU;
[0010] A memory access bandwidth restriction is performed on the target VCPU, where the memory access bandwidth restriction is used to reduce a dirty page rate of the target VCPU.
[0011] In an implementation manner of the present application, when it is determined that the set migration convergence condition is not met based on the dirty page rate of the virtual machine, a target VCPU that meets the set dirty page rate condition is selected from each VCPU, and memory access bandwidth is restricted for the target VCPU. This saves computing resources while improving the success rate of virtual machine hot migration.
[0012] In combination with the first aspect, in a first implementation of the first aspect, the setting of the migration convergence condition includes: a dirty page rate of the virtual machine is less than or equal to a migration transmission rate of the virtual machine.
[0013] In the implementation manner of the present application, whether the migration is converged can be determined by the size relationship between the dirty page rate of the virtual machine and the migration transmission rate of the virtual machine, thereby improving the reliability of determining whether the migration is converged.
[0014] In combination with the first aspect, in a second implementation of the first aspect, selecting a target VCPU that satisfies a set dirty page rate condition from each VCPU includes:
[0015] Performing a first sorting on each VCPU in descending order of dirty page rate, and selecting a set number of VCPUs from the head end of the first sorting in sequence, wherein the set number of VCPUs are the target VCPUs; or
[0016] A second sorting is performed on each VCPU in an ascending order of dirty page rate, and the set number of VCPUs are selected in sequence from the end of the second sorting forward, and the set number of VCPUs are the target VCPUs.
[0017] In the implementation manner of the present application, one or more target VCPUs with higher dirty page rates can be determined by sorting according to the dirty page rate of each VCPU, thereby improving the efficiency and accuracy of selecting the target VCPU.
[0018] In combination with the first aspect or the first implementation manner of the first aspect or the second implementation manner of the first aspect, in a third implementation manner of the first aspect, determining the dirty page rate of each VCPU of the virtual machine includes:
[0019] For any VCPU in each of the VCPUs, the dirty page rate of the VCPU is determined according to the number of dirty page addresses increased in the dirty page modification record PML cache corresponding to the VCPU within a set time.
[0020] In the implementation manner of the present application, the dirty page rate of the VCPU can be determined based on the number of dirty page addresses added in the dirty page modification record corresponding to the VCPU within a set time, which can improve the efficiency of determining the dirty page rate.
[0021] In combination with the third implementation manner of the first aspect, in a fourth implementation manner, the following further comprises:
[0022] The PML cache allocated to each VCPU is enabled.
[0023] In an implementation manner of the present application, when starting a virtual machine, a PML cache can be allocated to each VCPU. During the hot migration of the virtual machine, the PML cache allocated to each VCPU can be started, thereby ensuring that the dirty page rate of the VCPU is determined by the number of dirty page addresses increased within a set time according to the dirty page modification record corresponding to the VCPU, thereby improving the reliability of determining the dirty page rate.
[0024] In combination with the first aspect or the first implementation manner of the first aspect or the second implementation manner of the first aspect, in a fifth implementation manner, determining the dirty page rate of the virtual machine according to the dirty page rate of each virtual processor includes:
[0025] The sum of the dirty page rates of each virtual processor is calculated, and the calculated result is the dirty page rate of the virtual machine.
[0026] In the implementation manner of the present application, the dirty page rate of the virtual machine can be determined by calculating the sum of the dirty page rates of each virtual processor, and then the dirty page rate of the virtual machine can be used to determine whether the migration has converged, thereby improving the accuracy of determining whether the migration has converged.
[0027] In combination with the first aspect or the first implementation manner of the first aspect or the second implementation manner of the first aspect, in a sixth implementation manner, limiting the memory access bandwidth of the target VCPU includes:
[0028] Determine the memory access bandwidth upper limit value of the thread corresponding to the target VCPU;
[0029] The memory access bandwidth of the target VCPU is restricted according to the memory access bandwidth upper limit value.
[0030] In the implementation manner of the present application, the memory access bandwidth of the target VCPU can be limited by the memory access bandwidth upper limit value, which can increase the memory access latency and effectively reduce the amount of dirty pages generated by the virtual machine VCPU per unit time.
[0031] According to a second aspect, an embodiment of the present invention provides an electronic device, including:
[0032] A first determination module is used to determine the dirty page rate of each virtual processor VCPU of the virtual machine during the hot migration of the virtual machine;
[0033] A second determination module, configured to determine the dirty page rate of the virtual machine according to the dirty page rate of each VCPU;
[0034] A selection module, configured to select a target VCPU that meets the set dirty page rate condition from each VCPU if it is determined that the set migration convergence condition is not met according to the dirty page rate of the virtual machine;
[0035] A memory access bandwidth restriction module is used to restrict the memory access bandwidth of the target VCPU, wherein the memory access bandwidth restriction is used to reduce the dirty page rate of the target VCPU.
[0036] In combination with the second aspect, in a first implementation of the second aspect, the setting of the migration convergence condition includes: a dirty page rate of the virtual machine is less than or equal to a migration transmission rate of the virtual machine.
[0037] In conjunction with the second aspect, in a second implementation of the second aspect, the selection module is specifically used to:
[0038] Performing a first sorting on each VCPU in descending order of dirty page rate, and selecting a set number of VCPUs from the head end of the first sorting in sequence, wherein the set number of VCPUs are the target VCPUs; or
[0039] A second sorting is performed on each VCPU in an ascending order of dirty page rate, and the set number of VCPUs are selected in sequence from the end of the second sorting forward, and the set number of VCPUs are the target VCPUs.
[0040] In combination with the second aspect or the first implementation manner of the second aspect or the second implementation manner of the second aspect, in a third implementation manner of the second aspect, the first determining module is specifically used to:
[0041] For any VCPU in each of the VCPUs, the dirty page rate of the VCPU is determined according to the number of dirty page addresses increased in the dirty page modification record PML cache corresponding to the VCPU within a set time.
[0042] In combination with the third implementation manner of the second aspect, in a fourth implementation manner, the electronic device further includes:
[0043] A startup module is used to start the PML cache allocated to each VCPU.
[0044] In combination with the second aspect or the first implementation manner of the second aspect or the second implementation manner of the second aspect, in a fifth implementation manner, the second determining module is specifically configured to:
[0045] The sum of the dirty page rates of each virtual processor is calculated, and the calculated result is the dirty page rate of the virtual machine.
[0046] In combination with the second aspect or the first implementation manner of the second aspect or the second implementation manner of the second aspect, in a sixth implementation manner, the memory access bandwidth limitation module is specifically used to:
[0047] Determine the memory access bandwidth upper limit value of the thread corresponding to the target VCPU;
[0048] The memory access bandwidth of the target VCPU is restricted according to the memory access bandwidth upper limit value.
[0049] According to the third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the virtual machine hot migration method described in the first aspect or any one of the embodiments of the first aspect by executing the computer instructions.
[0050] According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the virtual machine hot migration method described in the first aspect or any one of the embodiments of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present invention in any way. In the accompanying drawings:
[0052] Figure 1 A method flow chart of a virtual machine hot migration method is shown.
[0053] Figure 2 Another method flow chart of a virtual machine hot migration method is shown.
[0054] Figure 3 A schematic diagram showing the calculation process of the dirty page rate of each VCPU is shown.
[0055] Figure 4 A structural schematic diagram of an electronic device is shown.
[0056] Figure 5 Another structural schematic diagram of an electronic device is shown. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0058] Figure 1A method flow chart of a virtual machine hot migration method is shown. The virtual machine hot migration method can be used on an electronic device that controls the hot migration of a virtual machine. The electronic device can be located on a source physical machine in the virtual machine hot migration. Figure 1 As shown, the virtual machine hot migration method includes:
[0059] Step 101: During the hot migration of a virtual machine, determine the dirty page rate of each virtual central processing unit (VCPU) of the virtual machine.
[0060] Specifically, a large number of memory dirty pages will be generated during the hot migration process. If the virtual machine is configured with multiple VCPUs, it is necessary to calculate the dirty page rate at which each VCPU generates dirty pages.
[0061] The virtual machine in this embodiment may refer to a kernel-based virtual machine (KVM).
[0062] Step 102: Determine the dirty page rate of the virtual machine according to the dirty page rate of each VCPU.
[0063] Specifically, if a virtual machine is configured with multiple VCPUs, the dirty page rate of the virtual machine needs to be determined based on the dirty page rates of all VCPUs when calculating the dirty page rate of the virtual machine. For example, the dirty page rate of the virtual machine is determined based on a certain rule and the dirty page rates of all VCPUs.
[0064] Step 103: If it is determined according to the dirty page rate of the virtual machine that the set migration convergence condition is not satisfied, a target VCPU satisfying the set dirty page rate condition is selected from each VCPU.
[0065] Specifically, for a virtual machine with a high memory load, the set migration convergence condition may not be met (i.e., the number of dirty pages generated by the virtual machine cannot converge). In order to improve the success rate of hot migration of the virtual machine, one or more target VCPUs with a higher dirty page rate (i.e., a target VCPU that meets the set dirty page rate condition) can be selected from multiple VCPUs configured for the virtual machine, and then the target VCPU is used to limit the memory access bandwidth to reduce the dirty page rate of the target VCPU; instead of forcing all VCPUs to exit from the user state (i.e., Guest state) to the host state (i.e., Host state) to reduce the dirty page rate, the overhead of VCPU state switching is avoided, saving computing resources.
[0066] Step 104: Perform memory access bandwidth restriction on the target VCPU, where the memory access bandwidth restriction is used to reduce the dirty page rate of the target VCPU.
[0067] Specifically, the memory access bandwidth of the target VCPU can be limited by Intel RDT MBA technology, where RDT is the abbreviation of Resource Director Technology and MBA is the abbreviation of Memory Bandwidth Allocation.
[0068] In addition, after the above step 102, if it is determined according to the dirty page rate of the virtual machine that the set migration convergence condition is met, it can be determined that the virtual machine can be hot migrated successfully.
[0069] The above steps 101 to 104 can be used in the case where the set migration convergence condition is not met in each round of memory iterative copying, that is, each round of memory iterative copying needs to determine the dirty page rate of each VCPU of the virtual machine; determine the dirty page rate of the virtual machine according to the dirty page rate of each VCPU; if it is determined that the set migration convergence condition is not met according to the dirty page rate of the virtual machine, select a target VCPU that meets the set dirty page rate condition from each VCPU; limit the memory access bandwidth of the target VCPU; ... until the set migration convergence condition is met.
[0070] That is, at the end of each round of migration iteration, the dirty page rate of each VCPU is updated and re-judged whether the migration has converged (that is, whether the set migration convergence conditions are met). If it has not converged (that is, it does not meet the set migration convergence conditions), the memory access bandwidth is continued to be limited, for example, by lowering the upper limit of the VCPU memory access bandwidth to limit the memory access bandwidth.
[0071] In an embodiment of the present application, when it is determined that the set migration convergence condition is not met based on the dirty page rate of the virtual machine, a target VCPU that meets the set dirty page rate condition is selected from each VCPU, and memory access bandwidth is restricted for the target VCPU. This saves computing resources while improving the success rate of virtual machine hot migration.
[0072] In an optional embodiment, when executing step 101, the following implementation methods may be adopted, but are not limited to:
[0073] For any VCPU in each VCPU, the dirty page rate of the VCPU is determined according to the number of dirty page addresses increased in the dirty page modification logging (PML) corresponding to the VCPU within a set time.
[0074] Specifically, during the hot migration of a virtual machine, newly added dirty page address entries in the PML cache may be counted periodically to calculate the dirty page rate of each VCPU per unit time.
[0075] In an embodiment of the present application, the dirty page rate of the VCPU can be determined based on the number of dirty page addresses added in the dirty page modification record corresponding to the VCPU within a set time, which can improve the efficiency of determining the dirty page rate.
[0076] In an optional embodiment, the step 101 may further include:
[0077] The PML cache allocated to each VCPU is enabled.
[0078] Specifically, when starting a virtual machine, a PML cache can be allocated to each VCPU to save its dirty page address when the virtual machine migrates. During the hot migration of the virtual machine, the PML cache allocated to each VCPU can be started, so that the dirty page addresses generated during the migration process can be saved in the PML Buffer, and the newly added dirty page address entries in the PML cache are periodically counted to calculate the dirty page rate of each VCPU per unit time.
[0079] In an embodiment of the present application, when starting a virtual machine, a PML cache can be allocated to each VCPU. During the hot migration of the virtual machine, the PML cache allocated to each VCPU can be started, thereby ensuring that the dirty page rate of the VCPU is determined by the number of dirty page addresses increased within a set time according to the dirty page modification record corresponding to the VCPU, thereby improving the reliability of determining the dirty page rate.
[0080] In an optional embodiment, when executing step 102, the following implementation methods may be adopted, but are not limited to:
[0081] The sum of the dirty page rates of each virtual processor is calculated, and the calculated result is the dirty page rate of the virtual machine.
[0082] Specifically, the dirty page rate of the virtual machine may be the sum of the dirty page rates of each virtual processor of the virtual machine.
[0083] In an embodiment of the present application, the dirty page rate of the virtual machine can be determined by calculating the sum of the dirty page rates of each virtual processor, and then the dirty page rate of the virtual machine can be used to determine whether the migration has converged, thereby improving the accuracy of determining whether the migration has converged.
[0084] In an optional embodiment, the setting of the migration convergence condition in step 103 may include: the dirty page rate of the virtual machine is less than or equal to the migration transmission rate of the virtual machine.
[0085] Specifically, when the dirty page rate of the virtual machine is greater than the migration transmission rate of the virtual machine, it indicates that the memory pressure of the virtual machine is large and the number of dirty pages generated cannot converge. When the dirty page rate of the virtual machine is less than or equal to the migration transmission rate of the virtual machine, it indicates that the number of dirty pages generated by the virtual machine can converge.
[0086] In the embodiment of the present application, whether the migration has converged can be determined by the size relationship between the dirty page rate of the virtual machine and the migration transmission rate of the virtual machine, thereby improving the reliability of determining whether the migration has converged.
[0087] In an optional embodiment, when executing step 103, the following implementation methods may be adopted, but are not limited to:
[0088] Perform a first sort on each VCPU in descending order of dirty page rate, and select a set number of VCPUs from the beginning of the first sort in sequence, and use the set number of VCPUs as target VCPUs; or
[0089] A second sort is performed on each VCPU in the order of dirty page rate from small to large, and a set number of VCPUs are selected from the end of the second sort in sequence, and the set number of VCPUs are used as target VCPUs.
[0090] Specifically, the set number of VCPUs may be one or more. In order to improve the success rate of hot migration of the virtual machine, one or more target VCPUs with a higher dirty page rate may be selected from the multiple VCPUs configured for the virtual machine.
[0091] In the embodiment of the present application, one or more target VCPUs with higher dirty page rates can be determined by sorting according to the dirty page rate of each VCPU, thereby improving the efficiency and accuracy of selecting the target VCPU.
[0092] In an optional embodiment, when executing step 104, the following implementation methods may be adopted, but are not limited to:
[0093] Determine the memory access bandwidth upper limit of the thread corresponding to the target VCPU;
[0094] The memory access bandwidth of the target VCPU is restricted according to the upper limit of the memory access bandwidth.
[0095] Specifically, the Intel RDT MBA tool can be used to set the memory access bandwidth upper limit of the thread corresponding to the target VCPU to limit the memory access bandwidth of the target VCPU.
[0096] In an embodiment of the present application, the memory access bandwidth of the target VCPU can be limited by the memory access bandwidth upper limit value, which can increase the memory access latency and effectively reduce the amount of dirty pages generated by the virtual machine VCPU per unit time.
[0097] The implementation process of the above virtual machine hot migration is explained below through a specific example.
[0098] Step 201: Enable the PML hardware function when initializing the virtualization platform. When starting a virtual machine, allocate a PML cache to each VCPU to store its dirty page address when the virtual machine migrates.
[0099] Step 202: During the virtual machine memory migration process, count the address entries added in the PML cache, calculate the dirty page rate of each VCPU, and determine whether the migration converges (whether the set migration convergence conditions are met).
[0100] The calculation process of the dirty page rate of each VCPU is as follows: Figure 3 As shown. Figure 3 In the example, the VCPUs of a virtual machine (VM) include: VCPU1, VCPU2, and VCPU3.
[0101] When calculating the dirty page rates of VCPU1, VCPU2, and VCPU3, the calculation can be based on the Intel PML mechanism and the dirty page ring. The specific process is as follows:
[0102] The PML hardware records the memory page frame number (Guest Physical Address, GPA) accessed by the virtual machine's VCPU into the PML cache. The PML cache is a table with a fixed size of 512 items. KVM synchronizes the contents of the PML cache to the Dirty Page Ring of each VCPU. The Dirty Page Ring is a reusable ring, which can be implemented as an array or a lock-free queue. The Dirty Page Ring can include the Physical Frame Number (PFN) of the memory page accessed by each VCPU of the virtual machine, such as the Guest Frame Number (GFN).
[0103] Furthermore, the Dirty Page Ring is shared between KVM and QEMU (virtual operating system simulator). The dirty page information acquisition module of QEMU periodically accesses the content of the Dirty Page Ring to check whether the VCPU has newly added memory dirty pages, and calculates the dirty page rate of each VCPU. The sum of the VCPU dirty page rates is used as the virtual machine dirty page rate, which is compared with the migration transmission rate to determine whether the migration has converged.
[0104] Step 203: If the migration cannot converge, select one or more VCPUs with high dirty page rates (i.e., target VCPUs that meet the set dirty page rate conditions) according to a certain ratio, use a setting tool (i.e., Intel RDT MBA tool) to set the memory access bandwidth upper limit of the thread corresponding to the target VCPU, and restrict the memory bandwidth access of the thread corresponding to the target VCPU.
[0105] Step 204: At the end of each round of migration iteration, the dirty page rate of each VCPU is updated and whether the migration has converged is re-determined. If not, the VCPU memory access bandwidth upper limit is continuously reduced until the migration converges.
[0106] It can be seen from the above embodiments that the Intel RDT MBA technology can be used to reduce the VCPU memory access bandwidth to achieve migration convergence, and the dirty page rate of each VCPU can be calculated by the Dirty Page Ring, a new dirty page statistics structure added by KVM; the dirty page rate of each VCPU can also be accumulated to calculate the dirty page rate of the virtual machine.
[0107] Figure 4 A schematic diagram of the structure of an electronic device is shown. The electronic device may be a device for controlling hot migration of a virtual machine. Figure 4 As shown, the electronic device includes:
[0108] The first determination module 11 is used to determine the dirty page rate of each virtual processor VCPU of the virtual machine during the hot migration of the virtual machine;
[0109] A second determination module 12 is used to determine the dirty page rate of the virtual machine according to the dirty page rate of each VCPU;
[0110] A selection module 13, configured to select a target VCPU that meets the set dirty page rate condition from each VCPU if it is determined that the set migration convergence condition is not met according to the dirty page rate of the virtual machine;
[0111] The memory access bandwidth limiting module 14 performs memory access bandwidth limiting on the target VCPU, wherein the memory access bandwidth limiting is used to reduce the dirty page rate of the target VCPU.
[0112] In a possible implementation, the setting of the migration convergence condition includes: a dirty page rate of the virtual machine is less than or equal to a migration transmission rate of the virtual machine.
[0113] In a possible implementation, the selection module 13 is specifically used to:
[0114] Performing a first sorting on each VCPU in descending order of dirty page rate, and selecting a set number of VCPUs from the head end of the first sorting in sequence, wherein the set number of VCPUs are the target VCPUs; or
[0115] A second sorting is performed on each VCPU in an ascending order of dirty page rate, and the set number of VCPUs are selected in sequence from the end of the second sorting forward, and the set number of VCPUs are the target VCPUs.
[0116] In a possible implementation, the first determining module 11 is specifically configured to:
[0117] For any VCPU in each of the VCPUs, the dirty page rate of the VCPU is determined according to the number of dirty page addresses increased in the dirty page modification record PML cache corresponding to the VCPU within a set time.
[0118] In a possible implementation, the electronic device further includes:
[0119] A startup module is used to start the PML cache allocated to each VCPU.
[0120] In a possible implementation, the second determining module 12 is specifically configured to:
[0121] The sum of the dirty page rates of each virtual processor is calculated, and the calculated result is the dirty page rate of the virtual machine.
[0122] In a possible implementation, the memory access bandwidth limiting module 14 is specifically used to:
[0123] Determine the memory access bandwidth upper limit value of the thread corresponding to the target VCPU;
[0124] The memory access bandwidth of the target VCPU is restricted according to the memory access bandwidth upper limit value.
[0125] It should be noted here that the electronic device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned method embodiment and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as those in the method embodiment will not be described in detail here.
[0126] Figure 5 Another structural schematic diagram of an electronic device is shown. Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the virtual machine hot migration method, which includes:
[0127] During the hot migration of a virtual machine, determine the dirty page rate of each virtual processor VCPU of the virtual machine;
[0128] Determining the dirty page rate of the virtual machine according to the dirty page rate of each VCPU;
[0129] If it is determined according to the dirty page rate of the virtual machine that the set migration convergence condition is not satisfied, then selecting a target VCPU that satisfies the set dirty page rate condition from each VCPU;
[0130] A memory access bandwidth restriction is performed on the target VCPU, where the memory access bandwidth restriction is used to reduce a dirty page rate of the target VCPU.
[0131] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of 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 method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0132] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, the computer can execute the virtual machine hot migration method provided by the above methods, the method comprising:
[0133] During the hot migration of a virtual machine, determine the dirty page rate of each virtual processor VCPU of the virtual machine;
[0134] Determining the dirty page rate of the virtual machine according to the dirty page rate of each VCPU;
[0135] If it is determined according to the dirty page rate of the virtual machine that the set migration convergence condition is not satisfied, then selecting a target VCPU that satisfies the set dirty page rate condition from each VCPU;
[0136] A memory access bandwidth restriction is performed on the target VCPU, where the memory access bandwidth restriction is used to reduce a dirty page rate of the target VCPU.
[0137] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for hot migration of a virtual machine provided above is implemented, and the method comprises:
[0138] During the hot migration of a virtual machine, determine the dirty page rate of each virtual processor VCPU of the virtual machine;
[0139] Determining the dirty page rate of the virtual machine according to the dirty page rate of each VCPU;
[0140] If it is determined according to the dirty page rate of the virtual machine that the set migration convergence condition is not satisfied, then selecting a target VCPU that satisfies the set dirty page rate condition from each VCPU;
[0141] A memory access bandwidth restriction is performed on the target VCPU, where the memory access bandwidth restriction is used to reduce a dirty page rate of the target VCPU.
[0142] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0143] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A virtual machine hot migration method, characterized in that: include: During the hot migration of a virtual machine, determine the dirty page rate of each virtual processor VCPU of the virtual machine; Determining the dirty page rate of the virtual machine according to the dirty page rate of each VCPU; If it is determined that the set migration convergence condition is not satisfied according to the dirty page rate of the virtual machine, a target VCPU satisfying the set dirty page rate condition is selected from each VCPU; the set migration convergence condition includes: the dirty page rate of the virtual machine is less than or equal to the migration transmission rate of the virtual machine; Performing memory access bandwidth restriction on the target VCPU, wherein the memory access bandwidth restriction is used to reduce a dirty page rate of the target VCPU; The step of selecting a target VCPU that satisfies a set dirty page rate condition from each VCPU includes: Performing a first sorting on each VCPU in descending order of dirty page rate, and selecting a set number of VCPUs from the head end of the first sorting in sequence, wherein the set number of VCPUs are the target VCPUs; or Perform a second sorting on each VCPU in the order of dirty page rate from small to large, and select the set number of VCPUs in sequence from the end of the second sorting forward, the set number of VCPUs being the target VCPUs; the set number of VCPUs includes one or more VCPUs.
2. The method according to claim 1, characterized in that Determining the dirty page rate of each VCPU of the virtual machine includes: For any VCPU in each of the VCPUs, the dirty page rate of the VCPU is determined according to the number of dirty page addresses increased in the dirty page modification record PML cache corresponding to the VCPU within a set time.
3. The method according to claim 2, characterized in that Also includes: The PML cache allocated to each VCPU is enabled.
4. The method according to claim 1, characterized in that Determining the dirty page rate of the virtual machine according to the dirty page rate of each virtual processor includes: The sum of the dirty page rates of each virtual processor is calculated, and the calculated result is the dirty page rate of the virtual machine.
5. The method according to claim 1, characterized in that The limiting the memory access bandwidth of the target VCPU includes: Determine the memory access bandwidth upper limit value of the thread corresponding to the target VCPU; The memory access bandwidth of the target VCPU is restricted according to the memory access bandwidth upper limit value.
6. An electronic device, characterized in that: include: The first determination module is used to determine the dirty page rate of each virtual processor VCPU of the virtual machine during the hot migration of the virtual machine; A second determination module is used to determine the dirty page rate of the virtual machine according to the dirty page rate of each VCPU; A selection module, configured to select a target VCPU from each VCPU that satisfies the set dirty page rate condition if it is determined that the set migration convergence condition is not satisfied according to the dirty page rate of the virtual machine; the set migration convergence condition includes: the dirty page rate of the virtual machine is less than or equal to the migration transmission rate of the virtual machine; A memory access bandwidth restriction module is used to restrict the memory access bandwidth of the target VCPU, wherein the memory access bandwidth restriction is used to reduce the dirty page rate of the target VCPU; The selection module is specifically used to perform a first sorting on each VCPU in descending order of dirty page rate, and select a set number of VCPUs from the head end of the first sorting in sequence, wherein the set number of VCPUs are the target VCPUs; or Perform a second sorting on each VCPU in the order of dirty page rate from small to large, and select the set number of VCPUs in sequence from the end of the second sorting forward, the set number of VCPUs being the target VCPUs; the set number of VCPUs includes one or more VCPUs.
7. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the virtual machine hot migration method according to any one of claims 1 to 5 by executing the computer instructions.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the virtual machine hot migration method according to any one of claims 1 to 5.
