Virtual machine migration method and device, computing equipment and storage medium
By optimizing migration strategies based on read and write type and target migration duration during the virtual machine migration process, including closing write-intensive virtual machines and migrating non-hot spot dirty pages, the problem of high virtual machine migration failure rate is solved, and a higher success rate and user experience is achieved.
Patent Information
- Application Number
- CN202411854174.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-07-04
AI Technical Summary
During the virtual machine migration process, the virtual machine migration failure rate is high due to excessive or light load caused by uneven resource allocation, hardware replacement, software upgrade, etc., especially when the migration fails when the write operations are frequent.
By determining the read and write type and target migration duration of the virtual machine, first migrate non-hot spot dirty pages or shut down the virtual machine in write-intensive situations, ensuring that the memory page migration speed is greater than the update speed, and using incremental migration and full migration strategies to optimize the migration process.
It improves the success rate and reliability of virtual machine migration, reduces the impact on users, and improves the user experience.
Smart Images

Figure CN120256013A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of servers, and particularly to a virtual machine migration method, apparatus, computing device, and storage medium. Background Art
[0002] When a virtual machine is running, the host may have uneven resource allocation, resulting in overloaded or underloaded conditions. In addition, there are situations such as hardware replacement, software upgrade, network adjustment, and fault handling on the host. In these cases, it is necessary to migrate the virtual machine.
[0003] Virtual machine migration refers to the process of migrating a virtual machine from one physical host to another, which can achieve purposes such as load balancing, fault recovery, and resource optimization. However, during the migration process, the services of the virtual machine are still running, which may cause frequent updates of the virtual machine's data, resulting in the inability to complete the virtual machine migration and a high migration failure rate. Summary of the Invention
[0004] Embodiments of this application disclose a virtual machine migration method, apparatus, computing device, and storage medium, which can improve the success rate of virtual machine migration.
[0005] Embodiments of this application disclose a virtual machine migration method, the method comprising:
[0006] Determine the read / write type of the source virtual machine and the target migration duration of the source virtual machine;
[0007] Migrate the first memory page in the source virtual machine to the destination virtual machine;
[0008] If it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read / write type of the source virtual machine is write-intensive, then after shutting down the source virtual machine, migrate the second memory page in the source virtual machine to the destination virtual machine.
[0009] In the embodiments of this application, the first host determines the read / write type of the source virtual machine and the target migration duration of the source virtual machine, and migrates the first memory page in the source virtual machine to the target virtual machine. When the first host determines that the source virtual machine cannot complete data migration within the target migration duration and determines that the read / write type of the source virtual machine is write-intensive, then after shutting down the source virtual machine, migrate the second memory page in the source virtual machine to the target virtual machine. By shutting down the source virtual machine when it is determined that the read / write type of the source virtual machine is write-intensive, the update of the memory pages of the source virtual machine stops, that is, the source virtual machine no longer generates the second memory page, and migrate the second memory page in the source virtual machine to the destination virtual machine, ensuring that the memory page migration speed is greater than the memory page update speed of the source virtual machine, thereby improving the success rate of virtual machine migration.
[0010] As an alternative implementation, the method further includes:
[0011] If it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is read-intensive, then after migrating the second memory page in the source virtual machine to the destination virtual machine, the source virtual machine is shut down.
[0012] In this embodiment, when it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is read-intensive, migrating the second memory page in the source virtual machine to the destination virtual machine and then shutting down the source virtual machine can ensure the successful migration of the source virtual machine. At the same time, after migrating the second memory page in the source virtual machine to the destination virtual machine, shutting down the source virtual machine reduces the impact on the user when the source virtual machine is shut down, improving the user experience.
[0013] As an alternative implementation, the method further includes:
[0014] Determine the hot dirty pages existing in the source virtual machine, where the hot dirty pages are dirty pages with a write operation frequency greater than the first threshold;
[0015] When it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is write-intensive, shutting down the source virtual machine and migrating the second memory page in the source virtual machine to the destination virtual machine includes:
[0016] If it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is write-intensive, then migrate the non-hot dirty pages to the destination virtual machine; where the non-hot dirty pages are the dirty pages in the source virtual machine except the hot dirty pages;
[0017] After the migration of the non-hot dirty pages is completed, shut down the source virtual machine, and after shutting down the source virtual machine, migrate the hot dirty pages in the source virtual machine to the destination virtual machine.
[0018] In this embodiment, during the operation of the source virtual machine, hot dirty pages will be frequently changed in a short period of time, that is, they will become dirty and be repeatedly migrated in multiple rounds of iterative migration. By delaying the migration of hot dirty pages, multiple migrations of hot dirty pages can be avoided, thereby reducing the migration time and improving the migration efficiency. At the same time, when the read-write type of the source virtual machine is write-intensive, first migrate the non-hot dirty pages to the destination virtual machine. After the migration of the non-hot dirty pages is completed, shut down the source virtual machine, which can avoid generating new second memory pages, and migrate the hot dirty pages to the destination virtual machine, so as to synchronize all the memory pages of the source virtual machine to the destination virtual machine and improve the reliability of the migration. Secondly, because the number of remaining hot dirty pages is small after the migration of the non-hot dirty pages is completed, it is possible to ensure that the shutdown duration of the source virtual machine is short, and the adverse impact on the user caused by shutting down the source virtual machine can be minimized, or even no adverse impact on the user, that is, the user does not feel the shutdown of the source virtual machine.
[0019] As an alternative implementation, the method further includes:
[0020] If it is determined that the source virtual machine can complete data migration within the target migration duration, after migrating the second memory pages in the source virtual machine to the destination virtual machine, shut down the source virtual machine.
[0021] In this embodiment, when it is determined that the source virtual machine can complete data migration within the target migration duration, after migrating the second memory pages in the source virtual machine to the destination virtual machine and then shutting down the source virtual machine, it can ensure the successful migration of the source virtual machine. At the same time, after migrating the second memory pages in the source virtual machine to the destination virtual machine and then shutting down the source virtual machine, the impact of shutting down the source virtual machine on the user is reduced, and the user experience is improved.
[0022] As an alternative implementation, before migrating the first memory pages in the source virtual machine to the destination virtual machine, the method further includes:
[0023] Analyze the data stored in the first memory pages in the source virtual machine to determine the first memory pages to be released, and the first memory pages to be released include one or more of blank pages, clean pages, and zeroed pages;
[0024] Release the first memory pages to be released from the memory corresponding to the source virtual machine;
[0025] The migration of the first memory pages in the source virtual machine to the destination virtual machine includes:
[0026] Migrate the remaining first memory pages in the source virtual machine to the destination virtual machine.
[0027] In this embodiment, before migration, the data stored in the first memory page of the source virtual machine is analyzed to determine the first memory page to be released, and the first memory page to be released is released from the memory corresponding to the source virtual machine, thereby reducing the size of the first memory page in the source virtual machine, that is, reducing the total amount of memory pages to be migrated, and thus improving the migration efficiency of migrating the first memory page.
[0028] As an optional implementation manner, the method further includes:
[0029] When the source virtual machine enters the running state, monitor the access operations on the memory pages of the source virtual machine;
[0030] When a write operation on a target memory page is monitored, update the change count of the target memory page, where the target memory page is any memory page of the source virtual machine;
[0031] The determination of the target read / write type corresponding to the source virtual machine includes:
[0032] Determine the dirty page generation rate corresponding to the source virtual machine according to the change counts of each memory page;
[0033] Determine the read / write type of the source virtual machine according to the dirty page generation rate.
[0034] In this embodiment, by monitoring the access operations on the memory pages of the source virtual machine and updating the change count of any memory page when a write operation on the memory page is monitored, the write operations on the memory pages can be effectively tracked and counted, ensuring the accuracy of the determined change count of the memory page, and thus improving the effectiveness of the determined read / write type of the source virtual machine.
[0035] As an optional implementation manner, the method further includes:
[0036] Before reaching the target migration duration, if it is determined that the first migration duration required for the source virtual machine to migrate the first memory page and the second memory page is greater than the target migration duration, it is determined that the source virtual machine cannot complete data migration within the target migration duration; or,
[0037] When reaching the target migration duration, if it is determined that there are second memory pages in the source virtual machine that have not been migrated to the destination virtual machine, it is determined that the source virtual machine cannot complete data migration within the target migration duration.
[0038] In this embodiment, before reaching the target migration duration, pre-judging whether the source virtual machine can complete data migration within the target migration duration can reduce the waiting time required for the source virtual machine when reaching the target migration duration, which helps the source virtual machine to plan the migration process in advance.
[0039] When the target migration duration is reached, by determining whether there are second memory pages in the source virtual machine that have not been migrated to the destination virtual machine, it can be determined whether the source virtual machine can complete data migration within the target migration duration, which can improve the accuracy of the determination.
[0040] An embodiment of the present application discloses a virtual machine migration device, and the device includes:
[0041] A determination module, configured to determine the read-write type of the source virtual machine and the target migration duration of the source virtual machine;
[0042] A first migration module, configured to migrate the first memory pages in the source virtual machine to the destination virtual machine;
[0043] A second migration module, configured to, if it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is write-intensive, then after shutting down the source virtual machine, migrate the second memory pages in the source virtual machine to the destination virtual machine.
[0044] An embodiment of the present application discloses a computing device, including a memory and a processor. A computer program is stored in the memory, and when the computer program is executed by the processor, the processor implements any virtual machine migration method disclosed in the embodiments of the present application.
[0045] An embodiment of the present application discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, any virtual machine migration method disclosed in the embodiments of the present application is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0047] Figure 1 is an application scenario diagram of a virtual machine migration method disclosed in an embodiment of the present application;
[0048] Figure 2 is a flowchart of a virtual machine migration method disclosed in an embodiment of the present application;
[0049] Figure 3 is a flowchart of another virtual machine migration method disclosed in an embodiment of the present application;
[0050] Figure 4 is a flowchart of a compression migration process disclosed in an embodiment of the present application;
[0051] Figure 5 It is a schematic structural diagram of a virtual machine migration device disclosed in an embodiment of the present application;
[0052] Figure 6 It is a schematic structural diagram of a computing device disclosed in an embodiment of the present application. Specific embodiments
[0053] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0054] It should be noted that the terms "including" and "having" and any variations thereof in the embodiments of the present application and the accompanying drawings are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes unlisted steps or units, or optionally further includes other steps or units inherent to these processes, methods, products, or devices.
[0055] To facilitate the understanding of the technical solutions of the present application, a brief description of the related technologies involved in the present application is made.
[0056] Host Machine: It refers to computing devices such as servers, PCs (Personal Computers), laptops, and tablets that run virtualization software (such as VMware, VirtualBox, Docker, etc.).
[0057] Hypervisor: Also known as VMM (Virtual Machine Monitor), it is software or hardware that creates and manages virtual environments. It allows multiple guest operating systems to run simultaneously on the same host computer, with each guest operating system in its own independent virtual environment. The main functions of the hypervisor include: virtual machine creation, virtual machine startup, virtual machine shutdown, and virtual machine stop. Among them, virtual machine creation refers to generating a new virtualization instance, allocating resources to it, and configuring the operating system and application environment. Virtual machine startup means transitioning the virtual machine to the running state, and the virtual machine starts using the resources of the host computer to run the operating system and application programs. Virtual machine shutdown refers to freezing the running state of the virtual machine, freezing all running threads and processes without terminating its processes or shutting down the system, and no read / write operations are performed at this time. Virtual machine stop means transitioning the virtual machine to the shutdown state, and the virtual machine releases all the resources it occupies, and the hypervisor reclaims the resources of the virtual machine.
[0058] Cold migration: Refers to the process of migrating a virtual machine in a closed state from one host computer to another in a virtual environment. Specifically, the disk file of the virtual machine and the configuration file defined in XML (eXtensible Markup Language) format (these two files constitute a virtual machine) are copied to the target host to which it is to be migrated.
[0059] Hot migration: Refers to the process of migrating a virtual machine in a running state from one host computer to another in a virtual environment, and during the entire migration process, the application services on this virtual machine are hardly affected, and users do not feel the interruption of the service.
[0060] Memory page: Refers to the smallest allocation unit of memory.
[0061] Dirty Pages: Memory pages that have been modified.
[0062] During the migration process, when the write operation frequency of the virtual machine is very high, it will cause the memory data of the virtual machine to be continuously updated, resulting in a very long migration time required. Even due to the memory page update speed being greater than the migration speed, the migration of the virtual machine cannot be completed.
[0063] The embodiments of the present application disclose a virtual machine migration method, device, computing device, and storage medium, which can improve the migration success rate of virtual machines.
[0064] Figure 1 It is an application scenario diagram of the virtual machine migration method in an embodiment. As Figure 1As shown in the figure, the first host 110 can be communicatively connected to the second host 120. The first host 110 can run one or more virtual machines. A virtual machine is a virtualized instance running on the first host 110. The first host 110 usually also runs a first virtual machine manager (Hypervisor) 111, which is used to allocate the hardware resources of the first host 110 (such as CPU (Central Processing Unit) resources and memory resources) to the virtual machines running on the first host 110.
[0065] Similarly, the second host 120 can run one or more virtual machines. The second host 120 runs a second virtual machine manager (Hypervisor) 121, which is used to allocate the hardware resources of the second host 120 to the virtual machines running on the second host 120.
[0066] Exemplarily, the first host 110 and the second host 120 can establish a network connection, such as by Ethernet, Wi-Fi (Wireless Fidelity), a cellular network, etc.
[0067] In some cases, it is necessary to migrate a running virtual machine from one host to another. Generally speaking, the hot migration method is adopted to achieve the migration of the virtual machine so that users cannot feel the service interruption. Here, taking the migration of the virtual machine on the first host 110 to the virtual machine on the second host 120 as an example, the virtual machine to be migrated on the first host 110 is called the source virtual machine, and the virtual machine on the second host 120 used to receive the memory pages of the source virtual machine is called the destination virtual machine.
[0068] It should be noted that the first host and the second host can be a shared storage pool (as Figure 1 shown), or they can not share a storage pool. Virtual machine migration can be divided into shared storage hot migration and non-shared storage hot migration according to whether to migrate storage data. The following embodiments discuss the scenario of shared storage, that is, the case where storage data is not migrated during the migration process. For the scenario of non-shared storage, the difference from the scenario of shared storage is that in addition to migrating the memory pages of the virtual machine during the migration process, shared data such as data on the disk will also be transferred.
[0069] In an embodiment of the present application, the first host determines the read / write type of the source virtual machine and the target migration duration of the source virtual machine, and migrates the first memory page in the source virtual machine to the target virtual machine. When the first host determines that the source virtual machine cannot complete data migration within the target migration duration and determines that the read / write type of the source virtual machine is write-intensive, the first host shuts down the source virtual machine and migrates the second memory page in the source virtual machine to the target virtual machine. By shutting down the source virtual machine when determining that the read / write type of the source virtual machine is write-intensive, the update of the memory page of the source virtual machine stops, that is, the source virtual machine no longer generates a second memory page. Then, the second memory page in the source virtual machine is migrated to the destination virtual machine, ensuring that the memory page migration speed is greater than the memory page update speed of the source virtual machine, thereby improving the migration success rate of the virtual machine.
[0070] Please refer to Figure 2 , which shows a schematic flow chart of a virtual machine migration method provided by an embodiment of the present application. This method can be applied to the first host, such as the first virtual machine manager of the first host.
[0071] Such as Figure 2 shown, this method may include steps 202 to 208.
[0072] Step 202, determine the read / write type corresponding to the source virtual machine and the target migration duration of the source virtual machine.
[0073] Among them, the read / write type of the source virtual machine is determined according to the dirty page generation rate of the source virtual machine generating dirty pages. It should be noted that the dirty page generation rate may refer to the number of dirty pages generated by the source virtual machine per unit time, such as the number of dirty pages generated by the source virtual machine per minute. A dirty page refers to a modified memory page. When the virtual machine executes a write operation, dirty pages may be generated. Therefore, the dirty page generation rate can be used as an indicator to measure the frequency of write operations of the virtual machine. When the first host determines that the source virtual machine cannot complete data migration within the target migration duration, the migration operation can be optimized according to the read / write type corresponding to the source virtual machine, thereby improving the migration success rate.
[0074] Exemplarily, when the first host determines that the source virtual machine cannot complete data migration within the target migration duration, the target migration duration is extended, and within the remaining migration duration of the extended target migration duration, the memory pages that have not been migrated are migrated according to a migration strategy matching the write operation frequency of the source virtual machine, so as to minimize the time for the source virtual machine to be in a stopped state as much as possible, so as to improve the migration success rate while ensuring the user experience.
[0075] In some embodiments, the read-write type may include read-intensive or write-intensive. Among them, read-intensive means that the source virtual machine performs write operations on memory pages with a relatively low frequency, and write-intensive means that the source virtual machine performs write operations on memory pages with a relatively high frequency. In some embodiments, the dirty page generation rate corresponding to write-intensive is greater than a second threshold, and the dirty page generation rate corresponding to read-intensive is less than or equal to the second threshold. It should be noted that the second threshold can be set according to the actual situation, such as determined according to the network bandwidth of the first host for implementing data migration. The second threshold can be used to measure whether the dirty page generation rate is greater than the dirty page transfer rate of the first host. If the dirty page generation rate is greater than the second threshold, it can be considered that the dirty page generation rate is greater than the dirty page migration rate of the first host. If the dirty page generation rate is less than or equal to the second threshold, it can be considered that the dirty page generation rate is less than or equal to the dirty page migration rate of the first host.
[0076] Exemplarily, the read-write type can be determined according to the number of changes of each dirty page of the source virtual machine within a first time period and the first duration corresponding to the first time period. The first host can calculate the quotient of the sum of the number of changes of each dirty page and the first duration to obtain the dirty page generation rate corresponding to the source virtual machine. In some embodiments, the first time period can be the time period when the source virtual machine is in the running state, such as the time period from the moment when the source virtual machine switches to the running state to the moment when it is determined that a migration operation is required. In this embodiment, according to the number of changes of each dirty page when the source virtual machine is in the running state, the read-write type of the source virtual machine corresponding to the source virtual machine is determined. Since the first time period is relatively long, it can monitor the long-term write operation situation of the source virtual machine, avoiding the increase or decrease of short-term write operations from interfering with the determination of the read-write type of the source virtual machine, thereby ensuring the accuracy of the calculated dirty page generation rate corresponding to the source virtual machine and the accuracy of the determined read-write type of the source virtual machine.
[0077] In some other embodiments, the read-write type can be determined according to the number of changes of each dirty page of the source virtual machine within the first historical time period and the second duration corresponding to the first historical time period. The first host can calculate the quotient of the sum of the number of changes of each dirty page within the first historical time period and the second duration to obtain the dirty page generation rate corresponding to the source virtual machine. It should be noted that the first historical time period can refer to a time period including the historical time corresponding to the moment when it is determined that a migration operation needs to be performed. Exemplarily, if the moment when it is determined that a migration operation needs to be performed is 9 o'clock today, then the time period of the historical time corresponding to 9 o'clock today can be 9 o'clock yesterday, and the first historical time period can be from 9 o'clock to 10 o'clock yesterday, from 8 o'clock to 9 o'clock, from 8 o'clock to 10 o'clock, etc. The frequency of the source virtual machine performing write operations may be different in different time periods. Therefore, determining the dirty page generation rate corresponding to the source virtual machine according to the number of changes of each dirty page within the first historical time period can ensure that the determined read-write type is more matched with the frequency of the write operations performed by the source virtual machine during the migration process, and ensure the accuracy of the migration strategy determined based on the read-write type.
[0078] It should be noted that the target migration duration of the source virtual machine can be the migration duration initially configured for the source virtual machine, such as the migration duration set by the user, or the historical migration duration (i.e., the target migration duration used in the past). The first host can also estimate the number of memory pages to be migrated by the source virtual machine and determine the target migration duration according to the estimated number of memory pages and the historical migration information. The historical migration information can include the number of historical memory pages migrated by the source virtual machine and the migration duration required to migrate the historical memory pages. According to the migration duration required for the source virtual machine to migrate the historical memory pages, estimate the number of memory pages to be migrated by the source virtual machine and the required migration duration, and use this migration duration as the target migration duration.
[0079] It should be noted that the target migration duration is estimated or preset, and the target migration duration determined in some scenarios may not be reasonable. In this embodiment, the target migration duration can be adjusted, and the migration strategy can be adjusted according to the read-write type of the source virtual machine to improve the success rate of migration.
[0080] In some embodiments, the first host determines the target migration duration of the source virtual machine before migrating the first memory page in the source virtual machine to the destination virtual machine.
[0081] In some embodiments, the first host may determine the read / write type of the source virtual machine before or after migrating the first memory page in the source virtual machine to the destination virtual machine. It should be noted that determining the read / write type of the source virtual machine before migrating the first memory page in the source virtual machine to the destination virtual machine can reduce the impact of network latency and other factors. When it is determined that the source virtual machine cannot complete the data migration within the target migration duration, the target migration policy corresponding to the read / write type of the source virtual machine can be determined, ensuring the continuity of the migration operation and improving the migration efficiency.
[0082] Step 204: Migrate the first memory page in the source virtual machine to the destination virtual machine.
[0083] It should be noted that the first memory page may refer to the memory page determined to be migrated before migrating the source virtual machine, or in other words, the first memory page may refer to the memory page in the source virtual machine before dirty pages are generated after the migration of the source virtual machine is started. Migrating the first memory page in the source virtual machine to the destination virtual machine may refer to synchronizing the data stored in the first memory page in the source virtual machine to the destination virtual machine, or in other words, making the data stored in the memory page of the destination virtual machine consistent with the data stored in the first memory page in the source virtual machine.
[0084] In some embodiments, the first host may migrate the first memory page in the source virtual machine to the destination virtual machine according to a preset migration policy. It should be noted that the first host may migrate the memory page in the source virtual machine to the destination virtual machine according to a preset migration policy. During the process of following the preset migration policy, it can be determined whether the source virtual machine can complete the data migration within the target migration duration, or after migrating the first memory page in the source virtual machine to the destination virtual machine, it can be determined whether the source virtual machine can complete the data migration within the target migration duration, and the migration plan can be flexibly adjusted according to the judgment result, while ensuring the migration success rate and minimizing the migration complexity as much as possible.
[0085] In some embodiments, the preset migration policy may include migrating the first memory page in the source virtual machine to the destination virtual machine using a full - volume migration method. It should be noted that the full - volume migration method refers to a migration method of migrating all the memory pages of the source virtual machine to the destination virtual machine at once.
[0086] Step 206: Determine whether the source virtual machine can complete the data migration within the target migration duration. If yes, execute step 208; if not, execute step 210.
[0087] It should be noted that if the source virtual machine can migrate the first memory page and the second memory page to the destination virtual machine within the target migration duration, or in other words, the data stored in the memory page of the destination virtual machine is the same as that stored in the memory page of the source virtual machine, it can be considered that the source virtual machine can complete the data migration within the target migration duration. Otherwise, it is determined that the source virtual machine cannot complete the data migration within the target migration duration. Herein, the second memory page may refer to the dirty page generated during the migration process.
[0088] It can be understood that if the source virtual machine completes the migration task before determining whether the source virtual machine can complete the data migration within the target migration duration, the step of determining whether the source virtual machine can complete the data migration within the target migration duration is not executed.
[0089] In some embodiments, before the target migration duration is reached, if it is determined that the first migration duration required for the source virtual machine to migrate the first memory page and the second memory page is greater than the target migration duration, it is determined that the source virtual machine cannot complete the data migration within the target migration duration.
[0090] It should be noted that the first host can determine the first migration duration corresponding to the source virtual machine migrating the first memory page and the second memory page, and determine whether the first migration duration is greater than the target migration duration. If the first migration duration is greater than the target migration duration, it is determined that the source virtual machine cannot complete the data migration within the target migration duration. If the first migration duration is less than or equal to the target migration duration, it is determined that the source virtual machine can complete the data migration within the target migration duration.
[0091] In some embodiments, after migrating the first memory page in the source virtual machine to the destination virtual machine by using the full - volume migration method, the second memory page in the source virtual machine is migrated to the destination virtual machine by using the incremental migration method. Exemplarily, the first migration duration corresponding to the source virtual machine migrating the first memory page and the second memory page includes the full - volume migration duration corresponding to migrating the first memory page and the incremental migration duration corresponding to migrating the second memory page. The full - volume migration duration can be determined by the quotient between the size of the first memory page and the network bandwidth corresponding to the source virtual machine for implementing data migration. The incremental migration duration can be determined by the quotient between the size of the second memory page that the source virtual machine needs to migrate and the network bandwidth corresponding to the source virtual machine for implementing data migration. Exemplarily, the size of the second memory page that the source virtual machine needs to migrate can be determined according to the dirty page generation rate of the source virtual machine and the data volume stored in the memory page. It should be noted that the size of the second memory page that the source virtual machine needs to migrate is positively correlated with the dirty page generation rate and the data volume stored in the memory page of the source virtual machine, and the size of the second memory page that the source virtual machine needs to migrate is the product of the dirty page generation rate and the data volume stored in the memory page.
[0092] It should be noted that the incremental migration method refers to the migration method in which, after the full - volume migration method, only the changed amount (i.e., dirty pages) generated in the source virtual machine is migrated to the destination virtual machine. The incremental migration method migrates the memory dirty pages of the source virtual machine to the second host in rounds through iterative transmission. The virtualization manager monitors and records the modifications of all the memory pages that have been transmitted during each round of migration, and transmits the memory dirty pages generated during this round of migration during the next round of migration. During this incremental iterative migration stage, multiple rounds of iteration are performed on the memory, so that the memory dirty pages gradually decrease or converge. In this embodiment, migration is performed through the full - volume migration method to ensure data integrity, and then migration is performed through the incremental migration method to continuously synchronize data changes, which can improve the reliability and stability of migration. Exemplarily, first, the memory pages in the source virtual machine are migrated to the destination virtual machine, so that the memory pages to be migrated gradually decrease, and then it is determined whether the source virtual machine can complete data migration within the target migration duration, which can improve the accuracy of the determination.
[0093] In some embodiments, the first host can determine whether the source virtual machine can complete data migration within the target migration duration when the migration duration reaches the first target duration. Among them, the first target duration is less than the target migration duration, and the first target duration can be determined according to the target migration duration. Exemplarily, the first target duration is the difference between the target migration duration and the preset duration. It should be noted that the preset duration can be set in advance, and the difference between the target migration duration and the preset duration is calculated to obtain the first target duration. In some embodiments, a timer can be set. At the moment when the migration operation starts, the timer is started. When the first target duration is reached, the first host pre - judges whether the source virtual machine can complete data migration within the target migration duration, so that it can pre - judge whether the source virtual machine can complete data migration within the target migration duration before ensuring that the target timeout duration is reached.
[0094] In some embodiments, the first host can pre - judge whether the source virtual machine can complete data migration within the target migration duration when the number of migration rounds reaches the target number of rounds. It should be noted that for the incremental migration method, multiple rounds of migration are required. Therefore, the target number of rounds can be set, and when the number of migration rounds reaches the target number of rounds, it is determined whether the source virtual machine can complete data migration within the target migration duration. In this embodiment, when the target number of rounds is reached, based on the dirty pages generated during the previous round of incremental migration, the completion time of data migration can be predicted more accurately, that is, a more accurate judgment result of whether the source virtual machine can complete data migration within the target migration duration can be obtained.
[0095] It should be noted that the first host can also pre - judge whether the source virtual machine can complete data migration within the target migration duration when other conditions are met. This embodiment does not make any limitations in this regard.
[0096] In this embodiment, before reaching the target migration duration, it is pre-determined whether the source virtual machine can complete data migration within the target migration duration, which can reduce the waiting time required for the source virtual machine when reaching the target migration duration and contribute to the advance planning of the migration process by the source virtual machine.
[0097] In other embodiments, when reaching the target migration duration, it is determined whether there is a second memory page in the source virtual machine that has not been migrated to the destination virtual machine. If it is determined that there is a second memory page in the source virtual machine that has not been migrated to the destination virtual machine, it is determined that the source virtual machine cannot complete data migration within the target migration duration. If it is determined that there is no second memory page in the source virtual machine that has not been migrated to the destination virtual machine, it is determined that the source virtual machine can complete data migration within the target migration duration.
[0098] In some embodiments, within the target migration duration, after migrating the first memory page in the source virtual machine to the destination virtual machine by using a full-volume migration method, the second memory page in the source virtual machine is migrated to the destination virtual machine by using an incremental migration method. When reaching the target migration duration, if it is determined that there is still a second memory page in the source virtual machine that has not been migrated to the destination virtual machine, it is determined that the source virtual machine cannot complete data migration within the target migration duration.
[0099] In this embodiment, when reaching the target migration duration, by determining whether there is a second memory page in the source virtual machine that has not been migrated to the destination virtual machine to determine whether the source virtual machine can complete data migration within the target migration duration, the accuracy of the determination can be improved.
[0100] Step 208: After migrating the second memory page in the source virtual machine to the destination virtual machine, shut down the source virtual machine.
[0101] It should be noted that when the first host determines that the source virtual machine can complete data migration within the target migration duration, it can maintain the current target migration duration unchanged, that is, without extending the target migration duration, use a preset migration strategy to migrate the memory pages in the source virtual machine to the destination virtual machine. When reaching the target migration duration, the data migration of the source virtual machine can also be completed. Exemplarily, the preset migration strategy includes migrating the first memory page in the source virtual machine to the destination virtual machine by using a full-volume migration method and then migrating the second memory page in the source virtual machine to the destination virtual machine by using an incremental migration method.
[0102] Exemplarily, when the preset migration strategy includes migrating the first memory pages in the source virtual machine to the destination virtual machine by using the full-volume migration method and migrating the second memory pages in the source virtual machine to the destination virtual machine by using the incremental migration method, in the case where there are uncompleted migrated memory pages, the first host continues to use the incremental migration method to continue migrating the uncompleted migrated memory pages in the source virtual machine to the destination virtual machine until the migration is completed. Exemplarily, when the remaining memory pages can be transferred and completed within a set time period (the time is short enough so that the user cannot perceive the stop), a final round of incremental migration is performed. In this final round of incremental migration, the virtual machine on the first host can be shut down, and the remaining memory pages are transferred to the destination host to ensure that all dirty pages generated during the migration are synchronized to the destination virtual machine.
[0103] Exemplarily, after the first host migrates the second memory pages in the source virtual machine to the destination virtual machine, the second host can start the destination virtual machine based on the memory pages migrated to the destination virtual machine, so that the destination virtual machine can respond to the user's operations.
[0104] In some embodiments, before reaching the target migration duration, if it is determined that the source virtual machine can complete data migration within the target migration duration, the current target migration duration is maintained, and the uncompleted migrated memory pages in the source virtual machine are continued to be migrated to the destination virtual machine.
[0105] In this embodiment, in the case where it is determined that the source virtual machine can complete data migration within the target migration duration, migrating the second memory pages in the source virtual machine to the destination virtual machine and shutting down the source virtual machine can ensure the successful migration of the source virtual machine. At the same time, after migrating the second memory pages in the source virtual machine to the destination virtual machine and then shutting down the source virtual machine, the impact of shutting down the source virtual machine on the user is reduced, and the user experience is improved.
[0106] Step 210, determine whether the read-write type of the source virtual machine is write-intensive. If so, execute step 212; if not, execute step 214.
[0107] In some embodiments, the target migration duration is extended according to the estimated migration duration, and within the remaining migration duration of the extended target migration duration, the operations to be performed are determined according to the read / write type of the source virtual machine. It should be noted that the remaining migration duration of the extended target migration duration is the difference between the extended target migration duration and the third duration, where the third duration is the duration between the moment when the migration operation starts and the moment when the target migration duration is extended according to the estimated migration duration. Between the moment when the target migration duration is extended according to the estimated migration duration and the moment when the migration stops, the second memory pages in the source virtual machine are migrated to the destination virtual machine according to the migration policy corresponding to the read / write type of the source virtual machine. The duration between the moment when the migration stops and the moment when the migration operation starts is the extended target migration duration. If it is determined that the source virtual machine cannot complete data migration within the target migration duration, the target migration duration is extended according to the estimated migration duration, and within the remaining migration duration of the extended target migration duration, the second memory pages in the source virtual machine are migrated to the destination virtual machine according to the migration policy corresponding to the read / write type of the source virtual machine.
[0108] Exemplarily, the migration policy corresponding to the read-intensive type is different from the migration policy corresponding to the write-intensive type. Since the memory pages in the read-intensive source virtual machine are different from the memory pages in the write-intensive source virtual machine in terms of characteristics, the memory pages in the read-intensive source virtual machine are less modified during migration, while the memory pages in the write-intensive source virtual machine are more frequently modified during migration. By configuring different migration policies for the read-intensive and write-intensive types, the efficiency of virtual machine live migration can be effectively improved, and the duration of the source virtual machine being shut down can be minimized to ensure the user experience.
[0109] In this embodiment, in the case where it is determined that the source virtual machine cannot complete data migration within the target migration duration, by extending the target migration duration, the risk of migration failure caused by insufficient target migration time setting can be reduced, and the migration success rate can be improved. At the same time, within the remaining target migration duration, the uncompleted migrated memory pages in the source virtual machine are migrated to the destination virtual machine according to the migration policy corresponding to the read / write type, which can better adapt to source virtual machines of different read / write types and can further improve the migration success rate.
[0110] It should be noted that the first host can determine the estimated migration duration according to the size of the second memory pages that need to be migrated in the source virtual machine. Exemplarily, the extended target migration duration is the sum of the target migration duration and the estimated migration duration. In some embodiments, the estimated migration duration can be the remaining migration duration. The remaining migration duration can refer to the estimated duration required to migrate the second memory pages that need to be migrated in the source virtual machine to the destination virtual machine. Exemplarily, the first host can determine the remaining migration duration according to the size of the second memory pages that need to be migrated and the dirty page migration rate. Exemplarily, the dirty page migration rate can be determined according to the historical migration amount and the historical migration duration. The historical migration amount can refer to the size of the memory pages migrated from the source virtual machine to the destination virtual machine from the start of the migration operation to the moment when the estimated migration duration is determined, and the historical migration duration refers to the duration between the moment when the estimated migration duration is determined and the start of the migration operation.
[0111] In some other embodiments, the estimated migration duration can be the difference between the remaining migration duration and the current remaining duration. The current remaining duration can refer to the remaining duration from the moment when it is determined whether the source virtual machine can complete the data migration within the target migration duration to the moment when the migration stops. In this embodiment, the extended target migration duration T1 = the target migration duration T0 + the remaining migration duration T2 - the current remaining duration T3, so that the extended target migration duration can satisfy migrating the uncompleted memory pages in the source virtual machine to the destination virtual machine, and at the same time make the extended target migration duration as short as possible to improve the migration responsiveness.
[0112] In some embodiments, when the first host determines that the source virtual machine cannot complete the data migration within the target migration duration, it can determine whether the read / write type of the source virtual machine is write-intensive. In this embodiment, only when it is determined that the source virtual machine cannot complete the data migration within the target migration duration, the read / write type of the source virtual machine is determined to be write-intensive, so that when it is determined that the source virtual machine can complete the memory within the target migration duration, the corresponding read / write type of the source virtual machine does not need to be determined, thereby reducing the computing amount of the first host.
[0113] It should be noted that it can first be determined whether the read / write type of the source virtual machine is write-intensive, and then the target migration duration is extended according to the estimated migration duration, or the target migration duration can first be extended according to the estimated migration duration, and then it is determined whether the read / write type of the virtual machine is write-intensive. This embodiment does not make a limitation on this.
[0114] Step 212, after shutting down the source virtual machine, migrate the second memory pages in the source virtual machine to the destination virtual machine.
[0115] It should be noted that if it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is write-intensive, after the source virtual machine is shut down, the second memory pages in the source virtual machine are migrated to the destination virtual machine. Shutting down the source virtual machine may refer to freezing the running state of the source virtual machine, and the source virtual machine does not respond to the read-write operations of the user. At this time, it can be considered that the source virtual machine does not generate new second memory pages. By shutting down the source virtual machine, it is possible to avoid the failure of the source virtual machine migration caused by the too fast generation speed of the second memory pages, and improve the migration success rate of the source virtual machine.
[0116] Exemplarily, after the first host migrates the second memory pages in the source virtual machine to the destination virtual machine, the second host can start the destination virtual machine based on the memory pages migrated to the destination virtual machine, so that the destination virtual machine responds to the operations of the user.
[0117] Step 214, after migrating the second memory pages in the source virtual machine to the destination virtual machine, shut down the source virtual machine.
[0118] It should be noted that if it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is read-intensive, after migrating the second memory pages in the source virtual machine to the destination virtual machine, shut down the source virtual machine. The first host can first migrate the second memory pages in the source virtual machine to the destination virtual machine, and after migrating the second memory pages in the source virtual machine to the destination virtual machine, then shut down the source virtual machine. The second host can start the destination virtual machine based on the memory pages migrated to the destination virtual machine, so that the destination virtual machine responds to the operations of the user.
[0119] In some embodiments, migrating the second memory pages in the source virtual machine to the destination virtual machine includes migrating the second memory pages in the source virtual machine to the destination virtual machine by using an incremental migration method. Among them, the dirty page generation rate corresponding to the read-intensive type is less than or equal to the second threshold. It should be noted that migrating the second memory pages in the source virtual machine to the destination virtual machine by using an incremental migration method may include multiple rounds of incremental migration until all the second memory pages are migrated to the target virtual machine. The dirty page generation rate of the read-intensive source virtual machine is relatively low. Therefore, it can be considered that as long as the target migration duration is set long enough, after multiple rounds of incremental migration, the number of dirty pages will definitely converge or be small enough. In the case where the read-write type is read-intensive, only the target migration duration can be extended, and the incremental migration method is continued to migrate the uncompleted migrated memory pages in the source virtual machine to the destination virtual machine, so as to simplify the complexity of the migration operation, improve the migration success rate, and at the same time reduce the duration of shutting down the source virtual machine to ensure the user experience.
[0120] In some embodiments, if the second memory page in the source virtual machine cannot be migrated to the destination virtual machine within the remaining migration duration after the extended target migration duration, the target migration duration is extended again according to the estimated migration duration, and step 214 is executed until the second memory page in the source virtual machine is migrated to the destination virtual machine, that is, until the data migration of the source virtual machine is completed.
[0121] In some embodiments, a maximum tolerance duration can be set. When it is determined that the extended target migration duration is greater than the maximum tolerance duration, the migration is stopped and a prompt message is output, which is used to prompt that the migration fails. It should be noted that the maximum tolerance duration can be set by the administrator. Generally, the maximum tolerance duration is greater than the target migration duration. By setting the maximum tolerance duration, the administrator can prevent the migration operation from proceeding without limit, prevent the resources of the source virtual machine from being occupied by the migration operation for a long time, and at the same time avoid migration failures caused by unreasonable settings of the target migration duration (such as being too short), thereby improving the stability and success rate of data migration of the source virtual machine.
[0122] In this embodiment, when it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is read-intensive, after migrating the second memory page in the source virtual machine to the destination virtual machine, the source virtual machine is shut down, which can ensure the successful migration of the source virtual machine. At the same time, after migrating the second memory page in the source virtual machine to the destination virtual machine, the source virtual machine is shut down, reducing the impact of the shutdown of the source virtual machine on the user and improving the user experience.
[0123] In the embodiment of the present application, the first host determines the read-write type of the source virtual machine and the target migration duration of the source virtual machine, and migrates the first memory page in the source virtual machine to the target virtual machine. When the first host determines that the source virtual machine cannot complete data migration within the target migration duration and determines that the read-write type of the source virtual machine is write-intensive, after shutting down the source virtual machine, the second memory page in the source virtual machine is migrated to the target virtual machine. By shutting down the source virtual machine when it is determined that the read-write type of the source virtual machine is write-intensive, the memory page update of the source virtual machine stops, that is, the source virtual machine no longer generates the second memory page, and the second memory page in the source virtual machine is migrated to the destination virtual machine, ensuring that the memory page migration speed is greater than the memory page update speed of the source virtual machine, thereby improving the migration success rate of the virtual machine.
[0124] Please refer to Figure 3 , which shows a schematic flowchart of another virtual machine migration method provided by the embodiment of the present application. This method can be applied to the first host, such as the first virtual machine manager of the first host.
[0125] As Figure 3 shown, this virtual machine migration method may include steps 302 to step 316.
[0126] Step 302: Determine the read / write type of the source virtual machine and the target migration duration of the source virtual machine.
[0127] For the description of step 302, please refer to the description of step 202, which will not be limited here.
[0128] Step 304: Determine the hot dirty pages existing in the source virtual machine.
[0129] Among them, the hot dirty page is a dirty page whose write operation frequency is greater than the first threshold, that is, the hot dirty page is a dirty page that is frequently modified. The first threshold is less than the second threshold, and the first threshold can be set according to actual needs, which is not limited in this embodiment. The write operation frequency of the dirty page can refer to the number of write operations performed on the same dirty page by the source virtual machine within a unit time, such as the number of write operations performed on the same dirty page by the source virtual machine per minute. It should be noted that the hot dirty pages can be determined before migrating the first memory page in the source virtual machine to the destination virtual machine, or the hot dirty pages can also be identified when it is determined that the source virtual machine cannot complete the data migration within the target migration duration. The first host can determine the read / write type corresponding to the source virtual machine, the target migration duration of the source virtual machine, and the hot dirty pages existing in the source virtual machine at the same time, or can determine the read / write type corresponding to the source virtual machine, the target migration duration of the source virtual machine, and the hot dirty pages existing in the source virtual machine at different times. This embodiment does not limit the timing of determining the hot dirty pages existing in the source virtual machine.
[0130] In some embodiments, when the source virtual machine enters the running state, monitor the access operations on the memory pages of the source virtual machine. When a write operation on a target memory page is monitored, update the change count of the target memory page. According to the change counts of each memory page, determine the dirty page generation rate corresponding to the source virtual machine, and determine the read / write type of the source virtual machine according to the dirty page generation rate. Among them, the target memory page is any memory page of the source virtual machine. It should be noted that the access operations can include write operations and read operations. The first host can identify the type of the access operation and record the write operation on any memory page when a write operation on any memory page is monitored.
[0131] In some embodiments, the first host can be provided with a counter corresponding to each memory page. When a write operation on a target memory page is monitored, increase the count value of the counter corresponding to the target memory page by "1" to update the count value of the counter corresponding to the target memory page, so as to update the change count of the target memory page. In this embodiment, by setting a counter corresponding to each memory page, the change counts of each memory page can be effectively tracked, ensuring the accuracy of the dirty page generation rate determined according to the change counts of each memory page.
[0132] In this embodiment, by monitoring the access operations performed on the memory pages of the source virtual machine and updating the change count of a memory page when a write operation on any memory page is monitored, the write operations on the memory pages can be effectively tracked and counted, ensuring the accuracy of the change count of the determined memory pages, thereby improving the effectiveness of determining the read / write type of the source virtual machine.
[0133] In some embodiments, according to the change count of the target memory page, the write operation frequency of the target memory page is determined. If the write operation frequency of the target memory page is greater than the first threshold, the target memory page is marked as a hot dirty page. By marking the memory pages with a write operation frequency greater than the first threshold, the accuracy of the migration of hot dirty pages and non-hot dirty pages by the first host is ensured.
[0134] In some embodiments, if the write operation frequency of the target memory page is greater than the first threshold, the location where the target memory page is located is written into the hot list, so that the first host can determine hot dirty pages and non-hot dirty pages according to the hot list.
[0135] Step 306, migrate the first memory page in the source virtual machine to the destination virtual machine.
[0136] Step 308, determine whether the source virtual machine can complete data migration within the target migration duration. If so, execute step 310; if not, execute step 312.
[0137] Step 310, after migrating the second memory page in the source virtual machine to the destination virtual machine, shut down the source virtual machine.
[0138] Step 312, determine whether the read / write type of the source virtual machine is write-intensive. If not, execute step 314; if so, execute steps 316 to 318.
[0139] Step 314, after migrating the second memory page in the source virtual machine to the destination virtual machine, shut down the source virtual machine.
[0140] For the descriptions of steps 306 to 314, please refer to the descriptions of steps 204 to 212, which will not be elaborated here.
[0141] Step 316, migrate the non-hot dirty pages to the destination virtual machine.
[0142] Step 318, after the migration of the non-hot dirty pages is completed, shut down the source virtual machine and then migrate the hot dirty pages in the source virtual machine to the destination virtual machine.
[0143] It should be noted that when the read / write type of the source virtual machine is write-intensive, the first host migrates the non-hot dirty pages to the destination virtual machine. After the migration of the non-hot dirty pages is completed, the source virtual machine is shut down, and the hot dirty pages are migrated to the destination virtual machine. Herein, the non-hot dirty pages are the dirty pages in the source virtual machine except the hot dirty pages.
[0144] It should be noted that during the operation of the source virtual machine, the hot dirty pages will be frequently changed in a short period of time, that is, they will become dirty and be repeatedly migrated during multiple rounds of iterative migration. By delaying the migration of the hot dirty pages, multiple migrations of the hot dirty pages can be avoided, thereby reducing the migration time and improving the migration efficiency. At the same time, when the read / write type of the source virtual machine is write-intensive, the non-hot dirty pages are first migrated to the destination virtual machine. After the migration of the non-hot dirty pages is completed, the source virtual machine is shut down, which can avoid generating new second memory pages, and the hot dirty pages are migrated to the destination virtual machine, realizing the synchronization of all the memory pages of the source virtual machine to the destination virtual machine and improving the reliability of the migration. Secondly, since the number of remaining hot dirty pages is small after the migration of the non-hot dirty pages is completed, the duration of shutting down the source virtual machine can be ensured to be short, and the adverse impact on the user caused by shutting down the source virtual machine can be minimized, or even no adverse impact on the user is caused, that is, the user does not feel the shutdown of the source virtual machine.
[0145] In some embodiments, when it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read / write type is write-intensive, the first host reallocates the resources for data migration of the source virtual machine, and based on the reallocated resources, migrates the uncompleted memory pages in the source virtual machine to the destination virtual machine. Herein, the reallocated resources are greater than the resources before reallocation.
[0146] It should be noted that the resources available for data migration of the source virtual machine may refer to the resources not currently occupied in the first host. The resources for data migration may include network bandwidth and CPU resources, etc. Among them, the network bandwidth and CPU resources affect the data migration rate of the source virtual machine. The first host can flexibly adjust the resources allocated to the source virtual machine according to the current workloads and migration requirements of each virtual machine. During the migration process, the source virtual machine can also flexibly adjust the resources for data migration according to the current workload and migration requirements of the source virtual machine, that is, the resources of other virtual machines (virtual machines in the first host except the source virtual machine) can be used for data migration of the source virtual machine, and / or the resources of the source virtual machine for implementing the workload can be used for implementing data migration. In this embodiment, by increasing the resources for data migration of the source virtual machine, the data migration speed can be accelerated, the time required for data migration can be reduced, and the migration success rate can be improved.
[0147] In some embodiments, based on the reallocated resources, migrating the uncompleted migrated memory pages in the source virtual machine to the destination virtual machine may include, based on the reallocated resources, adopting an incremental migration method to migrate the second memory page in the source virtual machine to the destination virtual machine. It should be noted that the description of the incremental migration method can be referred to the above embodiments and will not be elaborated here. In this embodiment, by increasing the resources of the source virtual machine for data migration and continuing to adopt the incremental migration method to migrate the uncompleted migrated memory pages in the source virtual machine to the destination virtual machine, the dirty page migration rate can be increased. The increased dirty page migration rate can be greater than the dirty page generation rate, so that the incremental migration method can be adopted to migrate the uncompleted migrated memory pages in the source virtual machine to the destination virtual machine. While improving the migration success rate, the adverse impact on users caused by shutting down the source virtual machine can be reduced.
[0148] In some embodiments, the first host may determine whether the resources available for data migration of the source virtual machine can migrate the uncompleted migrated memory pages in the source virtual machine to the destination virtual machine within the remaining migration duration of the extended target migration duration. If so, within the remaining migration duration of the extended target migration duration, reallocate the resources of the source virtual machine for data migration, and based on the reallocated resources, adopt an incremental migration method to migrate the completed migrated memory pages in the source virtual machine to the destination virtual machine; if not, migrate the non-hot dirty pages to the destination virtual machine based on the originally allocated resources for data migration. After the non-hot dirty page migration is completed, shut down the source virtual machine and then migrate the hot dirty pages to the destination virtual machine.
[0149] In this embodiment, when the read-write type of the source virtual machine is write-intensive, first determine whether the resources available for data migration of the source virtual machine can migrate the uncompleted migrated memory pages in the source virtual machine to the destination virtual machine within the remaining migration duration of the extended target migration duration. If so, reallocate the resources of the source virtual machine for data migration, and based on the reallocated resources, migrate the uncompleted migrated memory pages in the source virtual machine to the destination virtual machine, which can reduce the shutdown duration of the source virtual machine and thus ensure the user experience. If not, migrate the non-hot dirty pages to the destination virtual machine. After the non-hot dirty page migration is completed, shut down the source virtual machine and then migrate the hot dirty pages to the destination virtual machine, which can reduce the migration duration and thus reduce the resource occupation of the first host by the migration operation.
[0150] Please refer to Figure 4 , which shows a schematic flowchart of a compression migration process provided by an embodiment of the present application. This process can be applied to the first host, such as the first virtual machine manager of the first host.
[0151] Such as Figure 4As shown, before migrating the first memory page in the source virtual machine to the destination virtual machine, that is, before Figure 2 before step 204 shown in Figure 3 before step 306 shown in
[0152] The virtual machine migration method may further include steps 402 to 404. Migrating the first memory page in the source virtual machine to the destination virtual machine may include step 406.
[0153] Step 402, analyze the data stored in the first memory page in the source virtual machine to determine the first memory page to be released.
[0154] Among them, the first memory page to be released includes one or more of blank pages, clean pages, and zeroed pages. It should be noted that a blank page refers to a memory page that does not contain any data. A clean page refers to a memory page in which the data stored in the memory page is exactly the same as the corresponding data on the disk, that is, the data stored in the clean page has not been modified relative to the corresponding data on the disk. A zeroed page refers to a memory page in which the stored data is all "0". In some cases, when the system needs to allocate new memory space for a process, in order to ensure data security and consistency, these memory pages will be zeroed first and then allocated to the process for use. Since blank pages and zeroed pages do not contain any useful data, and at the same time, the target host can read the data of clean pages from the disk, blank pages, clean pages, and zeroed pages can be not migrated to reduce the amount of data to be migrated.
[0155] It should be noted that releasing the first memory page to be released from the memory corresponding to the source virtual machine may mean that the source virtual machine releases the first memory page to be released to reduce the memory corresponding to the source virtual machine, thereby reducing the amount of data to be migrated and improving the migration efficiency.
[0156] In some embodiments, releasing the memory page to be released from the memory corresponding to the source virtual machine may include swapping the memory page to be released to the disk to release the memory.
[0157] In other embodiments, releasing the memory page to be released from the memory corresponding to the source virtual machine may include reclaiming the memory page to be released from the memory corresponding to the source virtual machine through the hypervisor to release the memory page to be released from the memory corresponding to the source virtual machine. Exemplarily, the memory page to be released is reclaimed from the memory corresponding to the source virtual machine through the management module.
[0158] Step 406, migrate the remaining first memory pages in the source virtual machine to the destination virtual machine.
[0159] In some embodiments, the remaining first memory pages in the source virtual machine are migrated to the destination virtual machine in a full-scale migration manner.
[0160] In this embodiment, before migration, the data stored in the first memory pages in the source virtual machine is analyzed to determine the first memory pages to be released, and the first memory pages to be released are released from the memory corresponding to the source virtual machine, thereby reducing the size of the first memory pages in the source virtual machine, that is, reducing the total amount of memory pages to be migrated, and thus improving the migration efficiency of migrating the first memory pages.
[0161] Please refer to Figure 5 , Figure 5 which shows a schematic structural diagram of a virtual machine migration device disclosed in an embodiment of the present application. This device can be applied to the first host. As Figure 5 shown, the virtual machine migration device 500 may include a determination module 510, a first migration module 520, and a second migration module 530. Among them, the determination module 510 is used to determine the read / write type of the source virtual machine and the target migration duration of the source virtual machine. The first migration module 520 is used to migrate the first memory pages in the source virtual machine to the destination virtual machine. The second migration module 530 is used to, if it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read / write type of the source virtual machine is write-intensive, after shutting down the source virtual machine, migrate the second memory pages in the source virtual machine to the destination virtual machine.
[0162] In some embodiments, the virtual machine migration device 500 may further include a third migration module. The third migration module is used to, if it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read / write type of the source virtual machine is read-intensive, after migrating the second memory pages in the source virtual machine to the destination virtual machine, shut down the source virtual machine.
[0163] In some embodiments, the virtual machine migration device 500 may further include a hot spot identification module, and the second migration module 530 may include a first migration unit and a second migration unit. The hot spot identification module is used to determine the hot dirty pages existing in the source virtual machine. Among them, the hot dirty pages are dirty pages with a write operation frequency greater than a first threshold. The first migration unit is used to, if it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read / write type of the source virtual machine is write-intensive, migrate the non-hot dirty pages to the destination virtual machine. Among them, the non-hot dirty pages are the dirty pages in the source virtual machine except the hot dirty pages. The second migration unit is used to, after the migration of the non-hot dirty pages is completed, after shutting down the source virtual machine, migrate the hot dirty pages in the source virtual machine to the destination virtual machine.
[0164] In some embodiments, the virtual machine migration device 500 may further include a fourth migration module. The fourth migration module is configured to, if it is determined that the source virtual machine can complete data migration within the target migration duration, close the source virtual machine after migrating the second memory pages in the source virtual machine to the destination virtual machine.
[0165] In some embodiments, the virtual machine migration device 500 may further include a release determination module and a memory release module. The release determination module is configured to analyze the data stored in the first memory pages in the source virtual machine before migrating the first memory pages in the source virtual machine to the destination virtual machine, so as to determine the first memory pages to be released, where the first memory pages to be released include one or more of blank pages, clean pages, and zeroed pages. The memory release module is configured to release the first memory pages to be released from the memory corresponding to the source virtual machine. The first migration module 520 is further configured to migrate the remaining first memory pages in the source virtual machine to the destination virtual machine.
[0166] In some embodiments, the virtual machine migration device 500 may further include a monitoring module and an update module. The determination module 510 may include a first determination unit and a second determination unit. The monitoring module is configured to monitor access operations performed on the memory pages of the source virtual machine when the source virtual machine enters the running state. The update module is configured to update the change count of the target memory page when a write operation is monitored on the target memory page, where the target memory page is any memory page of the source virtual machine. The first determination unit is configured to determine the dirty page generation rate corresponding to the source virtual machine according to the change counts of the respective memory pages. The second determination unit is configured to determine the read / write type of the source virtual machine according to the dirty page generation rate.
[0167] In some embodiments, the virtual machine migration device 500 may further include a first determination module or a second determination module. The first determination module is configured to, before the target migration duration is reached, if it is determined that the first migration duration for migrating the first memory pages and the second memory pages in the source virtual machine is greater than the target migration duration, determine that the source virtual machine cannot complete data migration within the target migration duration. The second determination module is configured to, when the target migration duration is reached, if it is determined that there are second memory pages in the source virtual machine that have not been migrated to the destination virtual machine, determine that the source virtual machine cannot complete data migration within the target migration duration.
[0168] In an embodiment of the present application, the virtual machine migration device 500 may include a determination module 510, a first migration module 520, and a second migration module 530. The determination module 510 determines the read / write type of the source virtual machine and the target migration duration of the source virtual machine. The first migration module 520 migrates the first memory page in the source virtual machine to the destination virtual machine. If the second migration module 530 determines that the source virtual machine cannot complete data migration within the target migration duration and the read / write type of the source virtual machine is write-intensive, the source virtual machine is shut down, and the second memory page in the source virtual machine is migrated to the destination virtual machine. By shutting down the source virtual machine when it is determined that the read / write type of the source virtual machine is write-intensive, the update of the memory page of the source virtual machine stops, that is, the source virtual machine no longer generates a second memory page, and the second memory page in the source virtual machine is migrated to the destination virtual machine, ensuring that the memory page migration speed is greater than the memory page update speed of the source virtual machine, thereby improving the migration success rate of the virtual machine.
[0169] Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of a computing device disclosed in an embodiment of the present application.
[0170] As Figure 6 shown, the computing device 600 may include:
[0171] A memory 610 storing executable program code;
[0172] A processor 620 coupled to the memory 610;
[0173] Wherein, the processor 620 calls the executable program code stored in the memory 610 and executes any virtual machine migration method disclosed in the embodiment of the present application.
[0174] Wherein, the computing device 600 may include the first host computer described in the above embodiment.
[0175] An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by the processor, the processor implements any virtual machine migration method disclosed in the embodiment of the present application.
[0176] An embodiment of the present application discloses a program product including a computer program, and when the computer program is executed by the processor, the processor implements any virtual machine migration method disclosed in the embodiment of the present application.
[0177] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, the "in one embodiment" or "in an embodiment" that appears throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. Those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to the present application.
[0178] In various embodiments of the present application, it should be understood that the size of the serial numbers of the above processes does not necessarily mean the inevitable sequence of execution order. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0179] The units described as separate components above may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0180] In addition, in each embodiment of the present application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0181] If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions for causing a computer device (which can be a personal computer, a server or a network device, etc., specifically, the processor in the computer device) to execute some or all of the steps of the above methods in each embodiment of the present application.
[0182] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program, and this program can be stored in a computer-readable storage medium. The storage medium includes read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc memories, magnetic disc memories, magnetic tape memories, or any other medium that can be used to carry or store data and is computer-readable.
[0183] The above has introduced in detail a virtual machine migration method, device, computing device, and storage medium disclosed in the embodiments of the present application. Specific examples are used herein to elaborate on the principles and implementation manners of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. At the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A virtual machine migration method, characterized in that, The method includes: Determining the read-write type of the source virtual machine and the target migration duration of the source virtual machine; Migrating a first memory page in the source virtual machine to the destination virtual machine; If it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is write-intensive, then after shutting down the source virtual machine, migrating a second memory page in the source virtual machine to the destination virtual machine.
2. The method according to claim 1, wherein The method further includes: If it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is read-intensive, then after migrating a second memory page in the source virtual machine to the destination virtual machine, shutting down the source virtual machine.
3. The method according to claim 1, wherein The method further includes: Determining the hot dirty pages existing in the source virtual machine, where the hot dirty pages are dirty pages with a write operation frequency greater than a first threshold; If it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is write-intensive, then shutting down the source virtual machine and migrating a second memory page in the source virtual machine to the destination virtual machine includes: If it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read-write type of the source virtual machine is write-intensive, then migrating non-hot dirty pages to the destination virtual machine; where the non-hot dirty pages are the dirty pages in the source virtual machine except the hot dirty pages; After the migration of the non-hot dirty pages is completed, after shutting down the source virtual machine, migrating the hot dirty pages in the source virtual machine to the destination virtual machine.
4. The method according to claim 1, characterized in that The method further includes: If it is determined that the source virtual machine can complete data migration within the target migration duration, then after migrating a second memory page in the source virtual machine to the destination virtual machine, shutting down the source virtual machine.
5. The method according to claim 1, characterized in that Before migrating a first memory page in the source virtual machine to the destination virtual machine, the method further includes: Analyzing the data stored in the first memory page in the source virtual machine to determine the first memory page to be released, where the first memory page to be released includes one or more of blank pages, clean pages, and zeroed pages; Releasing the first memory page to be released from the memory corresponding to the source virtual machine; The migrating of the first memory page in the source virtual machine to the destination virtual machine includes: Migrating the remaining first memory pages in the source virtual machine to the destination virtual machine.
6. The method according to claim 1, wherein The method further includes: When the source virtual machine enters the running state, monitoring the access operations performed on the memory pages of the source virtual machine; When a write operation on a target memory page is monitored, updating the change count of the target memory page, where the target memory page is any memory page of the source virtual machine; The determining of the target read-write type corresponding to the source virtual machine includes: Determining the dirty page generation rate corresponding to the source virtual machine according to the change counts of each memory page; Determining the read-write type of the source virtual machine according to the dirty page generation rate.
7. The method according to claim 1, wherein The method further includes: Before reaching the target migration duration, if it is determined that the first migration duration required for the source virtual machine to migrate the first memory page and the second memory page is greater than the target migration duration, it is determined that the source virtual machine cannot complete data migration within the target migration duration; or, When the target migration duration is reached, if it is determined that there is a second memory page in the source virtual machine that has not been migrated to the destination virtual machine, it is determined that the source virtual machine cannot complete data migration within the target migration duration.
8. A virtual machine migration device, characterized in that, The device includes: A determination module, configured to determine the read / write type of the source virtual machine and the target migration duration of the source virtual machine; A first migration module, configured to migrate the first memory page in the source virtual machine to the destination virtual machine; A second migration module, configured to, if it is determined that the source virtual machine cannot complete data migration within the target migration duration and the read / write type of the source virtual machine is write-intensive, after shutting down the source virtual machine, migrate the second memory page in the source virtual machine to the destination virtual machine.
9. A computing device, characterized in that, It includes a memory and a processor. When the computer program stored in the memory is executed by the processor, the processor implements the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method according to any one of claims 1 to 7.