Online migration method, device and equipment of virtual machine

By identifying and controlling virtual machine memory page types and adopting an iterative transfer strategy, the problems of large data transfer volume and significant performance impact during online virtual machine migration were solved, resulting in faster migration speeds and lower system impact.

CN120994313APending Publication Date: 2025-11-21JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511261012.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-04
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

In existing technologies, the large amount of data transfer during virtual machine online migration and its significant impact on system performance lead to slow migration speeds and decreased system performance.

Method used

By identifying and transferring the type of dirty memory pages based on the static page information of the source and destination virtual machines during the migration process, an iterative transfer strategy is adopted. The first iteration transfers all memory data, subsequent iterations transfer frequently modified hot pages, and the final iteration pauses the virtual machine for full transfer, thereby reducing invalid data transfer.

Benefits of technology

This reduces the amount of data transferred during the online migration of virtual machines, improves migration speed, and reduces the impact on system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994313A_ABST
    Figure CN120994313A_ABST
Patent Text Reader

Abstract

The invention discloses an online migration method, device and equipment of a virtual machine, and relates to the technical field of virtualization, the method comprises the following steps: in an online migration process of a source virtual machine, according to memory static page information of the source virtual machine and a target virtual machine, transmitting full memory data of the source virtual machine to the target virtual machine; according to the dirty marking frequency of each dirty memory page in the source virtual machine, obtaining a page type corresponding to each dirty memory page; according to the page type corresponding to each dirty memory page, determining a to-be-transmitted dirty page of the iteration transmission; if the current iteration transmission is not the last iteration transmission, transmitting the dirty page to be transmitted of the current iteration transmission to the target virtual machine; if the current iteration transmission is the last iteration transmission, pausing the source virtual machine, and transmitting the dirty page to be transmitted of the current iteration transmission to the target virtual machine; according to the method, the data volume needing to be transmitted in the online migration process of the virtual machine can be reduced, the migration speed is increased, and the influence on the system performance is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of virtualization technology, and in particular to a method, apparatus, and device for online migration of virtual machines. Background Technology

[0002] Currently, the widespread adoption of virtualization technology has driven a surge in demand for online virtual machine (VM) migration. Data centers are evolving towards high availability and elastic scheduling, but current capabilities for large-scale VM migration and cross-data center migration remain weak. Online VM migration is a technology that migrates running virtual machines from one physical machine to another, and it is widely used in cloud computing, virtualization, and data centers.

[0003] In related technologies, online virtual machine migration methods have problems such as large amounts of memory data transfer and significant impact on system performance. For example, prolonged virtual machine pauses and high network bandwidth usage during the migration process can greatly affect system performance.

[0004] Therefore, how to reduce the amount of data that needs to be transferred during the online migration of virtual machines, improve the migration speed, and reduce the impact on system performance is an urgent problem to be solved. Summary of the Invention

[0005] The purpose of this invention is to provide a method, apparatus, and device for online migration of virtual machines, so as to reduce the amount of data that needs to be transferred during the online migration of virtual machines, improve the migration speed, and reduce the impact on system performance.

[0006] To address the aforementioned technical problems, this invention provides an online migration method for virtual machines, comprising:

[0007] During the online migration of the source virtual machine, the full memory data of the source virtual machine is transferred to the destination virtual machine based on the static page information of the memory of the source virtual machine and the destination virtual machine.

[0008] Based on the dirty frequency of each dirty memory page in the source virtual machine, obtain the page type corresponding to each dirty memory page;

[0009] Based on the page type corresponding to each of the dirty memory pages, the dirty pages to be transferred in this iteration are determined; wherein, when this iteration is not the last iteration, the dirty pages to be transferred in this iteration include dirty memory pages corresponding to page types other than hot pages; the dirty pages to be transferred in the last iteration include all the dirty memory pages.

[0010] If this iteration transfer is not the last iteration transfer, then the dirty pages to be transferred in this iteration transfer will be transferred to the destination virtual machine;

[0011] If this iteration transfer is the last iteration transfer, then the source virtual machine is paused, and the dirty pages to be transferred in this iteration transfer are transferred to the destination virtual machine.

[0012] On the other hand, the memory static page information is the data information of the memory static pages, which include kernel code segment memory pages, shared library code memory pages, system configuration file memory pages, and / or kernel static data memory pages.

[0013] On the other hand, the data information is a hash value, and the step of transferring the full memory data of the source virtual machine to the destination virtual machine based on the static page information of the source virtual machine and the destination virtual machine includes:

[0014] If the hash values ​​of the first static memory pages in the source virtual machine and the destination virtual machine are the same, then the destination virtual machine is controlled to perform memory mapping of the first static memory pages;

[0015] If the hash values ​​of the second static memory pages in the source virtual machine and the destination virtual machine are different, then the second static memory page in the source virtual machine is transferred to the destination virtual machine; wherein, the first static memory page and the second static memory page are any two static memory pages.

[0016] On the other hand, before transferring the full memory data of the source virtual machine to the destination virtual machine based on the static page information of the source virtual machine and the destination virtual machine, the process further includes:

[0017] The source host device adds the static memory pages from the source virtual machine to the cache of the source host device; wherein the source virtual machine is set on the source host device;

[0018] Create a first hash table in the cache of the source host device corresponding to the static memory pages in the source virtual machine;

[0019] Preload static memory pages from the destination virtual machine into the cache of the source host device;

[0020] A second hash table corresponding to the static memory pages of the destination virtual machine is created in the cache of the source host device.

[0021] On the other hand, before obtaining the page type corresponding to each dirty memory page based on the dirty frequency of each dirty memory page in the source virtual machine, the method further includes:

[0022] Based on the target timestamps corresponding to each dirty memory page, the dirty marking frequency of each dirty memory page is determined; wherein, the target timestamp corresponding to the current dirty memory page includes the latest dirty marking timestamp of the current dirty memory page and the dirty marking timestamps within a preset time period before the latest dirty marking timestamp; the current dirty memory page is any of the dirty memory pages.

[0023] On the other hand, determining the dirtying frequency of each dirty memory page based on its corresponding target timestamps includes:

[0024] pass Calculate the current dirty memory page marking frequency; where count is the number of target timestamps corresponding to the current dirty memory page; e is the natural constant, t current t is the latest dirty timestamp of the current dirty memory page. i Let be the i-th dirty timestamp of the current dirty memory page, and r be the preset decay coefficient.

[0025] On the other hand, before determining the dirty pages to be transferred in this iteration based on the page type corresponding to each of the dirty memory pages, the method further includes:

[0026] Determine whether the transmission time of dirty memory pages corresponding to page types other than the hot pages is greater than the preset acceptable downtime;

[0027] If so, then it is determined that this iteration transmission is not the last iteration transmission;

[0028] If not, then this iteration transmission is determined to be the last iteration transmission.

[0029] On the other hand, the step of transferring the dirty pages to be transferred in this iteration to the destination virtual machine if the current iteration transfer is not the last iteration transfer includes:

[0030] If this iteration is not the last iteration, then the compression method corresponding to each dirty page to be transmitted in this iteration is determined according to the page type or page type and dirty labeling frequency of the dirty pages to be transmitted in this iteration; wherein, if the compression speed of the compression method corresponding to the first dirty page to be transmitted is greater than the compression speed of the compression method corresponding to the second dirty page to be transmitted, then the dirty labeling frequency of the first dirty page to be transmitted is greater than the dirty labeling frequency of the second dirty page to be transmitted; the first dirty page to be transmitted and the second dirty page to be transmitted are any two dirty pages to be transmitted in this iteration.

[0031] According to the compression method corresponding to each dirty page to be transferred, the dirty pages to be transferred in this iteration are compressed and transferred to the destination virtual machine.

[0032] The present invention also provides an online migration device for virtual machines, comprising:

[0033] The full data transfer module is used to transfer the full memory data of the source virtual machine to the destination virtual machine during the online migration of the source virtual machine, based on the memory static page information of the source virtual machine and the destination virtual machine.

[0034] The type acquisition module is used to acquire the page type corresponding to each dirty memory page based on the dirty frequency of each dirty memory page in the source virtual machine;

[0035] The transmission determination module is used to determine the dirty pages to be transmitted in the current iteration based on the page type corresponding to each of the dirty memory pages; wherein, when the current iteration is not the last iteration, the dirty pages to be transmitted in the current iteration include dirty memory pages corresponding to page types other than hot pages; the dirty pages to be transmitted in the last iteration include all the dirty memory pages.

[0036] An intermediate transmission module is used to transmit the dirty pages to be transmitted in the current iteration to the destination virtual machine if the current iteration is not the last iteration.

[0037] The final transmission module is used to pause the source virtual machine and transfer the dirty pages to be transmitted in this iteration to the destination virtual machine if this iteration is the last iteration.

[0038] This invention also provides an online migration device for virtual machines, comprising:

[0039] Memory, used to store computer programs;

[0040] A processor, used to execute the computer program to implement the steps of the online migration method for virtual machines as described above.

[0041] The present invention provides an online migration method for virtual machines, comprising: during the online migration of a source virtual machine, transferring the full memory data of the source virtual machine to the destination virtual machine based on the static page information of the memory of the source virtual machine and the destination virtual machine; obtaining the page type corresponding to each dirty memory page based on the dirty marking frequency of each dirty memory page in the source virtual machine; determining the dirty pages to be transferred in the current iteration based on the page type corresponding to each dirty memory page; wherein, when the current iteration is not the last iteration, the dirty pages to be transferred in the current iteration include dirty memory pages corresponding to page types other than hot pages; the dirty pages to be transferred in the last iteration include all dirty memory pages; if the current iteration is not the last iteration, then transferring the dirty pages to be transferred in the current iteration to the destination virtual machine; if the current iteration is the last iteration, then pausing the source virtual machine and transferring the dirty pages to be transferred in the current iteration to the destination virtual machine.

[0042] As can be seen, this invention, by transferring the full memory data of the source virtual machine to the destination virtual machine based on the static page information of the source and destination virtual machines, can reduce unnecessary static page data transfers during the initial full memory data transfer. Furthermore, through the identification of dirty memory page types and corresponding transfer control in subsequent iterations, frequently modified hot pages can be paused for full transfer during the final iteration, reducing invalid memory data transfers, improving migration speed, and minimizing the impact on system performance. In addition, this invention also provides an online virtual machine migration device and apparatus, which also possesses the aforementioned beneficial effects. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0044] Figure 1 A flowchart illustrating an online migration method for a virtual machine provided in an embodiment of the present invention;

[0045] Figure 2 This is a schematic diagram of the memory space of a virtual machine provided in an embodiment of the present invention;

[0046] Figure 3 A schematic diagram of the architecture of another online migration method for virtual machines provided in an embodiment of the present invention;

[0047] Figure 4 A structural block diagram of an online migration device for virtual machines provided in an embodiment of the present invention;

[0048] Figure 5 This is a schematic diagram of the structure of an online migration device for virtual machines provided in an embodiment of the present invention. Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0050] Please refer to Figure 1 , Figure 1This is a flowchart illustrating an online migration method for virtual machines provided in an embodiment of the present invention. The method may include:

[0051] Step 101: During the online migration of the source virtual machine, the full memory data of the source virtual machine is transferred to the destination virtual machine based on the static page information of the memory of the source and destination virtual machines.

[0052] It is understood that the source virtual machine in this embodiment can be a virtual machine migrated from the source host device (physical host) to the destination host device (physical host). The destination virtual machine in this embodiment can be the virtual machine that serves as the source virtual machine on the destination host device after the source virtual machine has been successfully migrated, i.e., the virtual machine started on the destination host device. This embodiment uses an iterative transfer method for online migration of the source virtual machine. This step can be the full memory data transfer process of the source virtual machine during the first iterative transfer. In this step, by comparing the memory static page information of the source virtual machine and the destination virtual machine, unnecessary data transfer of memory static pages (i.e., memory static pages with the same data content) can be reduced during the first iterative transfer.

[0053] Correspondingly, the static page information in this step can be the data information of the static page, used to represent the data status of the static page. A static page can be a memory page containing data that hardly changes (i.e., static data) (such as 4KB or other sizes). For example, static pages can include kernel code segment memory pages, shared library code memory pages, system configuration file memory pages, and / or kernel static data memory pages; Figure 2 As shown, static memory pages can include memory pages such as kernel code segments, shared library code, system configuration files, and kernel static data.

[0054] The method provided in this embodiment can be applied to the source host device that sets up the active virtual machine; it can also be a virtualization platform device, such as a server. This embodiment does not impose any limitations on this.

[0055] It should be noted that the specific method for transferring the full memory data of the source virtual machine to the destination virtual machine based on the static memory page information of the source and destination virtual machines in this step can be set by the designer according to the usage scenario and user needs. For example, when the data information of the static memory pages (i.e., the static memory page information) is specifically a hash value, this step can control the destination virtual machine to perform memory mapping of the first static memory page if the hash values ​​of the first static memory pages in the source and destination virtual machines are the same; if the hash values ​​of the second static memory pages in the source and destination virtual machines are different, the second static memory page in the source virtual machine is transferred to the destination virtual machine; where the first and second static memory pages can be any two static memory pages. That is to say, in this embodiment, the comparison of the hash values ​​corresponding to each static memory page in the source and destination virtual machines can determine whether the corresponding static memory pages in the source and destination virtual machines have the same data content. In other embodiments, the data content of each static memory page in the source and destination virtual machines can also be directly compared, and this embodiment does not impose any restrictions on this.

[0056] Correspondingly, the method provided in this embodiment may further include the process of obtaining the hash values ​​corresponding to each static memory page in the source virtual machine and the destination virtual machine. For example, before this step, it may include: the source host device adding the static memory pages in the source virtual machine to the cache of the source host device; creating a first hash table corresponding to the static memory pages in the source virtual machine in the cache of the source host device, such as using the XBZRLE (Xor Based Zero Run Length Encoding, a differential compression algorithm used to calculate memory page differences) caching mechanism to create the first hash table; preloading the static memory pages in the destination virtual machine to the cache of the source host device; creating a second hash table corresponding to the static memory pages in the destination virtual machine in the cache of the source host device; wherein, the source virtual machine is set on the source host device, the first hash table includes the hash values ​​corresponding to each static memory page in the source virtual machine, and the second hash table includes the hash values ​​corresponding to each static memory page in the destination virtual machine.

[0057] In some other embodiments, step 101 may further include: the source host device adding the static memory pages in the source virtual machine to the cache of the source host device; creating a first hash table corresponding to the static memory pages in the source virtual machine in the cache of the source host device; controlling the destination host device to add the static memory pages in the destination virtual machine to the cache of the destination host device, and creating a second hash table corresponding to the static memory pages in the destination virtual machine in the cache of the destination host device; and receiving the second hash table sent by the destination host device.

[0058] The method provided in this embodiment can be applied to the source host device that sets up the active virtual machine; it can also be a virtualization platform device, such as a server. This embodiment does not impose any limitations on this.

[0059] For example, the method provided in this embodiment may include an initial cache phase and an initial iterative transfer phase. The initial cache phase first identifies and adds the static memory pages of the virtual machine running on the source node (i.e., the source host device) to the cache according to the QEMU (an open-source hardware virtualization engine) memory management module, and simultaneously creates a corresponding hash list (i.e., the first hash table). On the destination end (i.e., the destination host device), the QEMU virtualization management process is notified to asynchronously start and load the system. After the system loads, a cache hash list (i.e., the second hash table) is created according to the same logic as the source node. In the initial iterative transfer phase, during the first full memory data transfer, the hash lists of the source and destination virtual machines are compared. If the hash values ​​of a certain static memory page are the same, that page does not need to be transferred; only the corresponding memory mapping needs to be performed on the destination virtual machine.

[0060] Step 102: Based on the dirty frequency of each dirty memory page in the source virtual machine, obtain the page type corresponding to each dirty memory page.

[0061] It is understandable that the dirty memory pages in this step can be memory pages modified during the virtual machine's operation, i.e., memory pages in the source virtual machine that are different from those in the destination virtual machine. For example, during the first iteration of full memory data transfer, some memory pages will be modified because the source virtual machine is continuously running, making them different from the previously transferred data content. In this embodiment, the dirty frequency can be the number of times a dirty memory page is modified within a certain period of time. In this embodiment, dirty memory pages can be classified based on the dirty frequency during iterative transfers after the first iteration to achieve layered transfer of hot and cold pages, so that frequently modified hot pages can be transferred by pausing the virtual machine for full transfer in the last iteration, avoiding multiple invalid transfers of hot pages. That is to say, in each iterative transfer after the first iteration, the data to be transferred in this iteration (i.e., the dirty pages to be transferred) can be determined through step 102 and subsequent steps, such as... Figure 2 The process of iteratively transmitting thermal data.

[0062] Correspondingly, this step may precede a process of obtaining the dirtying frequency of each dirty memory page. For example, the dirtying frequency of each dirty memory page can be determined based on its various corresponding target timestamps. The target timestamps corresponding to the current dirty memory page include the latest dirtying timestamp and the dirtying timestamps within a preset time period preceding the latest dirtying timestamp. The current dirty memory page can be any dirty memory page. For example, the latest dirtying timestamp t of the current dirty memory page can be recorded. currentAdd timestamp records to the timestamp list on this page; clean up old timestamps in timestamp_list that exceed the sliding time window T (i.e., the preset time period, such as 1 second) (i.e., remove timestamps t≤t). current -T records), ensuring that the list only retains the dirty events within the most recent T time period, enabling the tracking of dirty events (updated in real time).

[0063] Correspondingly, the specific method for determining the dirtying frequency of each dirty memory page based on its corresponding target timestamps can be set by the designer according to the practical scenario and user needs. For example, the dirtying frequency of the current dirty memory page can be calculated using count / T (i.e., unweighted frequency); or it can be calculated using... Calculate the dirty frequency (i.e., weighted frequency) of the current dirty memory page; where count is the number of target timestamps corresponding to the current dirty memory page; e is the natural constant, t current t is the latest dirty timestamp of the current dirty memory page. i Let be the timestamp of the i-th dirty memory page, and r be a preset decay coefficient, such as 0.4. The smaller r is, the higher the weight of recent dirty pages. i The time decay weight is the i-th dirty timestamp.

[0064] It should be noted that the specific method for determining the page type of each dirty memory page based on its dirty marking frequency in this step can be set by the designer according to the use case and user requirements. For example, the page type of each dirty memory page can be determined based on its dirty marking frequency and a preset classification threshold. For instance, when the page type includes hot pages, warm pages, and cold pages, the preset classification threshold can include the hot page threshold (f... high ) and temperature threshold (f low In this step, the dirty page marking frequency (f) can be greater than the hot page threshold (i.e., f > f). high When the current dirty memory page is identified as a hot page, it is determined that the page type corresponding to the current dirty memory page is a hot page, indicating that it is prone to repeated dirtying during migration; when the dirtying frequency of the current dirty memory page is less than or equal to the hot page threshold and greater than the warm page threshold (i.e., f), the page type is determined to be a hot page. high ≥f>f low When the current dirty memory page is identified as a warm page, it indicates that a small number of blocks may become dirty during migration. The dirty page marking frequency is less than or equal to the warm page threshold and greater than or equal to 1 (i.e., f...). low When f ≥ 1), the page type corresponding to the current dirty memory page is determined to be a cold page, indicating that the probability of marking it as dirty is low and it is highly likely that it will not be marked as dirty in subsequent iterations.

[0065] Correspondingly, to improve the accuracy of identifying the page type corresponding to each dirty memory page, the method provided in this embodiment may also include a dynamic adjustment process of preset classification thresholds. For example, the preset classification thresholds can be adjusted at preset adjustment time intervals (Δt, such as 500ms) to adapt to load changes; for example, the preset classification thresholds include hot page thresholds (f high ) and temperature threshold (f low At each time interval Δt, the dirty frequency of all memory pages (or dirty memory pages) can be collected. The memory pages with non-zero dirty frequencies are sorted in descending order to obtain a sorted list (sorted_f). The α×Nth value in sorted_f (where N is the total number of memory pages with non-zero dirty frequencies) is taken as the hot page threshold, i.e., the first α (hot page ratio, such as 20%) of pages are hot pages. The (α+β)×Nth value in sorted_f (where N is the total number of pages with non-zero frequencies) is taken as the warm page threshold, where β is the warm page ratio (such as 30%). For example, if α=20% and β=30%, then f high f is the critical value for the top 20%. low The first 50% is the critical value, and the last 50% is the cold page.

[0066] Step 103: Determine the dirty pages to be transferred in this iteration based on the page type corresponding to each dirty memory page.

[0067] Specifically, when this iteration transfer is not the last iteration transfer, the dirty pages to be transferred in this iteration transfer include dirty memory pages corresponding to page types other than hot pages; the dirty pages to be transferred in the last iteration transfer include all dirty memory pages.

[0068] It is understandable that in this step, the dirty memory pages (i.e., the dirty pages to be transferred) that need to be transferred in this iteration can be determined based on the page type corresponding to each dirty memory page determined in this iteration; among them, hot pages are only transferred in the last iteration.

[0069] Correspondingly, before this step, it is determined whether the current iteration transfer is the last iteration transfer. For example, before this step, it can be determined whether the transfer time of dirty memory pages corresponding to page types other than hot pages is greater than a preset acceptable downtime. If yes, then it is determined that the current iteration transfer is not the last iteration transfer; if no, then it is determined that the current iteration transfer is the last iteration transfer. In some other embodiments, it is also possible to directly determine whether the current iteration count has reached a threshold before step 103. If yes, then it is determined that the current iteration transfer is the last iteration transfer; if no, then it is determined that the current iteration transfer is not the last iteration transfer. Alternatively, if the transfer time of dirty memory pages corresponding to page types other than hot pages is less than or equal to a preset acceptable downtime, or if the current iteration count has reached a threshold, then it is determined that the current iteration transfer is the last iteration transfer. This embodiment does not impose any restrictions on this.

[0070] For example, when the page type includes hot pages, warm pages, and cold pages, this step can, if the current iteration transfer is not the last iteration transfer, use the dirty memory pages of warm pages and cold pages as the dirty pages to be transferred in the current iteration transfer; if the current iteration transfer is the last iteration transfer, use the dirty memory pages of hot pages, warm pages, and cold pages as the dirty pages to be transferred in the current iteration transfer, so as to pause the source virtual machine for full transfer.

[0071] Step 104: If this iteration transfer is not the last iteration transfer, then transfer the dirty pages to be transferred in this iteration transfer to the destination virtual machine.

[0072] Understandably, this step can transfer dirty memory pages corresponding to page types other than hot pages (such as warm pages and cold pages) to the destination virtual machine when this iteration transfer is not the last iteration transfer, thus completing this iteration transfer.

[0073] Accordingly, in this step, dirty pages to be transferred can be added to the transfer queue in descending order of their dirty marking frequency, so that dirty pages with high dirty marking frequency can be transferred to the destination virtual machine first.

[0074] Furthermore, a hybrid compression strategy can be employed in this step to transfer the dirty pages to be transferred in this iteration to the destination virtual machine, thereby improving online migration efficiency, such as... Figure 3 The caching and hybrid compression module is used. For example, in this step, the compression method corresponding to each dirty page to be transmitted in this iteration can be determined based on the page type or page type and dirty labeling frequency of the dirty pages to be transmitted in this iteration; according to the compression method corresponding to each dirty page to be transmitted, the dirty pages to be transmitted in this iteration are compressed and transmitted to the destination virtual machine. Among them, a faster compression method can be used to compress the dirty pages to be transmitted with a higher dirty labeling frequency to reduce retransmission costs; for example, when the compression speed of the compression method corresponding to the first dirty page to be transmitted is greater than the compression speed of the compression method corresponding to the second dirty page to be transmitted, the dirty labeling frequency of the first dirty page to be transmitted is greater than the dirty labeling frequency of the second dirty page to be transmitted; the first dirty page to be transmitted and the second dirty page to be transmitted are any two dirty pages to be transmitted in this iteration.

[0075] For example, when page types include hot pages, warm pages, and cold pages, if the page type of the dirty page to be transferred is a warm page and the dirtying frequency is greater than the preset switching threshold (T... thresholdIf the page type of the dirty page to be transferred is warm and the dirty labeling frequency is less than or equal to the preset switching threshold, then the compression method corresponding to the dirty page to be transferred is the Zstd (a lossless compression algorithm) compression algorithm at levels 3-6; if the page type of the dirty page to be transferred is cold, then the compression method corresponding to the dirty page to be transferred is the Zstd compression algorithm at levels 7-10. In other words, for dirty pages with a dirty labeling frequency exceeding the threshold T... threshold The warm page can use the LZ4 compression algorithm to ensure compression speed is prioritized and retransmission costs are reduced; for the standard dirty frequency does not exceed the threshold T threshold Warm pages can use Zstd compression algorithms of level 3-6 to moderately increase the compression ratio to reduce the amount of data transmitted, while avoiding high CPU (central processing unit) overhead that could affect other virtual machine services. For cold pages, Zstd compression algorithms of level 7-10 can be used, because once a cold page is successfully migrated, it almost does not need to be retransmitted. A certain amount of speed can be sacrificed for a high compression ratio, which can significantly reduce network transmission pressure.

[0076] Step 105: If this iteration transfer is the last iteration transfer, then pause the source virtual machine and transfer the dirty pages to be transferred in this iteration transfer to the destination virtual machine.

[0077] Understandably, this step can pause the source virtual machine and transfer the remaining dirty memory pages to the destination virtual machine all at once during the last iteration transfer, if the transfer time of dirty memory pages corresponding to page types other than hot pages is less than or equal to the preset acceptable downtime. Figure 3 The process of transferring a hot page in one go. Because multiple iterations of transfer have been performed beforehand, the pause time for the source virtual machine during the final iteration is very short, improving the user experience.

[0078] In this embodiment, the present invention transmits the full memory data of the source virtual machine to the destination virtual machine based on the static page information of the source and destination virtual machines. This reduces unnecessary static page data transmission during the initial full memory data transmission. Furthermore, by identifying the type of dirty memory pages and controlling the transmission accordingly in subsequent iterations, frequently modified hot pages can be paused for full transmission during the final iteration, reducing invalid memory data transmission, improving migration speed, and minimizing the impact on system performance.

[0079] Corresponding to the above method embodiments, this invention also provides an online migration device for virtual machines. The online migration device for virtual machines described below and the online migration method for virtual machines described above can be referred to in correspondence.

[0080] Please refer to Figure 4 , Figure 4 This is a structural block diagram of an online migration device for virtual machines provided in an embodiment of the present invention. It may include:

[0081] The full transfer module 10 is used to transfer the full memory data of the source virtual machine to the destination virtual machine during the online migration of the source virtual machine, based on the static page information of the memory of the source virtual machine and the destination virtual machine.

[0082] The type acquisition module 20 is used to obtain the page type corresponding to each dirty memory page based on the dirty marking frequency of each dirty memory page in the source virtual machine.

[0083] The transmission determination module 30 is used to determine the dirty pages to be transmitted in this iteration based on the page type corresponding to each dirty memory page; wherein, when this iteration is not the last iteration, the dirty pages to be transmitted in this iteration include dirty memory pages corresponding to page types other than hot pages; the dirty pages to be transmitted in the last iteration include all dirty memory pages.

[0084] The intermediate transmission module 40 is used to transmit the dirty pages to be transmitted in the current iteration to the destination virtual machine if the current iteration is not the last iteration.

[0085] The final transmission module 50 is used to pause the source virtual machine and transfer the dirty pages to be transmitted in this iteration to the destination virtual machine if this iteration is the last iteration.

[0086] In some embodiments, the memory static page information is the data information of the memory static pages, which include kernel code segment memory pages, shared library code memory pages, system configuration file memory pages, and / or kernel static data memory pages.

[0087] In some embodiments, the data information is a hash value. The full transmission module 10 can be specifically used to control the destination virtual machine to perform memory mapping of the first static memory page if the hash values ​​of the first static memory page in the source virtual machine and the destination virtual machine are the same; if the hash values ​​of the second static memory page in the source virtual machine and the destination virtual machine are different, the second static memory page in the source virtual machine is transmitted to the destination virtual machine; wherein, the first static memory page and the second static memory page are any two static memory pages.

[0088] In some embodiments, the device is applied to a source host device and may further include:

[0089] The caching module is used to add static memory pages from the source virtual machine to the cache of the source host device; the source virtual machine is set on the source host device.

[0090] The first creation module is used to create a first hash table corresponding to the memory static pages in the source virtual machine in the cache of the source host device;

[0091] The preload module is used to preload static memory pages from the destination virtual machine into the cache of the source host device;

[0092] The second creation module is used to create a second hash table corresponding to the static memory pages in the destination virtual machine in the cache of the source host device.

[0093] In some embodiments, the device may further include:

[0094] The frequency determination module is used to determine the dirtying frequency of each dirty memory page based on the various target timestamps corresponding to each dirty memory page; wherein, the target timestamp corresponding to the current dirty memory page includes the latest dirtying timestamp of the current dirty memory page and the dirtying timestamps within a preset time period before the latest dirtying timestamp; the current dirty memory page is any dirty memory page.

[0095] In some embodiments, the frequency determination module may be specifically used to determine the frequency by means of... Calculate the current dirty memory page marking frequency; where count is the number of target timestamps corresponding to the current dirty memory page; e is the natural constant, t current t is the latest dirty timestamp of the current dirty memory page. i Let be the i-th dirty timestamp of the current dirty memory page, and r be the preset decay coefficient.

[0096] In some embodiments, the device may further include:

[0097] The judgment module is used to determine whether the transmission time of dirty memory pages corresponding to page types other than hot pages is greater than the preset acceptable downtime; if yes, it determines that this iteration transmission is not the last iteration transmission; if no, it determines that this iteration transmission is the last iteration transmission.

[0098] In some embodiments, the intermediate transmission module 40 may include:

[0099] The compression determination submodule is used to determine the compression method corresponding to each dirty page to be transmitted in the current iteration transmission, based on the page type or page type and dirty labeling frequency, if the current iteration transmission is not the last iteration transmission; wherein, if the compression speed of the compression method corresponding to the first dirty page to be transmitted is greater than the compression speed of the compression method corresponding to the second dirty page to be transmitted, then the dirty labeling frequency of the first dirty page to be transmitted is greater than the dirty labeling frequency of the second dirty page to be transmitted; the first dirty page to be transmitted and the second dirty page to be transmitted are any two dirty pages to be transmitted in this iteration transmission;

[0100] The compression and transmission submodule is used to compress and transmit the dirty pages to be transmitted in this iteration to the destination virtual machine according to the compression method corresponding to each dirty page to be transmitted.

[0101] In this embodiment, the present invention uses the full transfer module 10 to transfer the full memory data of the source virtual machine to the destination virtual machine based on the memory static page information of the source virtual machine and the destination virtual machine. This can reduce unnecessary data transfer of memory static pages during the initial full memory data transfer. Furthermore, through the identification of dirty memory page types and corresponding transfer control in subsequent iterations, frequently modified hot pages can be paused for full transfer during the last iteration, reducing invalid memory data transfer, improving migration speed, and reducing the impact on system performance.

[0102] Corresponding to the above method embodiments, this invention also provides an online migration device for virtual machines. The online migration device for virtual machines described below and the online migration method for virtual machines described above can be referred to in correspondence.

[0103] Please refer to Figure 5 , Figure 5 This is a schematic diagram of the structure of an online migration device for virtual machines provided in an embodiment of the present invention. The electronic device may include:

[0104] Memory D1 is used to store computer programs;

[0105] Processor D2 is used to implement the steps of the online migration method for virtual machines provided in the above method embodiments when executing a computer program.

[0106] In this embodiment, the online migration device for virtual machines can be a host device that hosts the source virtual machine (i.e., the source host device); or it can be a virtualization platform device, such as a server.

[0107] Corresponding to the above method embodiments, this invention also provides a computer program product. The computer program product described below and the online migration method for virtual machines described above can be referred to each other.

[0108] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the online migration method for virtual machines provided in the above-described method embodiments.

[0109] Corresponding to the above method embodiments, this invention also provides a computer-readable storage medium. The computer-readable storage medium described below and the online migration method for virtual machines described above can be referred to in correspondence.

[0110] A computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the online migration method for a virtual machine as described in the above method embodiments.

[0111] The computer-readable storage medium can specifically be a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or any other readable storage medium capable of storing program code.

[0112] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatuses, devices, computer program products, and computer-readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant details can be found in the method section.

[0113] The online migration method, apparatus, and device for virtual machines provided by this invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of this invention. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of this invention.

Claims

1. A method for online migration of virtual machines, characterized in that, include: During the online migration of the source virtual machine, the full memory data of the source virtual machine is transferred to the destination virtual machine based on the static page information of the memory of the source virtual machine and the destination virtual machine. Based on the dirty frequency of each dirty memory page in the source virtual machine, obtain the page type corresponding to each dirty memory page; Based on the page type corresponding to each of the dirty memory pages, the dirty pages to be transferred in this iteration are determined; wherein, when this iteration is not the last iteration, the dirty pages to be transferred in this iteration include dirty memory pages corresponding to page types other than hot pages; the dirty pages to be transferred in the last iteration include all the dirty memory pages. If this iteration transfer is not the last iteration transfer, then the dirty pages to be transferred in this iteration transfer will be transferred to the destination virtual machine; If this iteration transfer is the last iteration transfer, then the source virtual machine is paused, and the dirty pages to be transferred in this iteration transfer are transferred to the destination virtual machine.

2. The online migration method for virtual machines according to claim 1, characterized in that, The static memory page information refers to the data information of static memory pages, which include kernel code segment memory pages, shared library code memory pages, system configuration file memory pages, and / or kernel static data memory pages.

3. The online migration method for virtual machines according to claim 2, characterized in that, The data information is a hash value. The step of transferring the full memory data of the source virtual machine to the destination virtual machine based on the static page information of the source and destination virtual machines includes: If the hash values ​​of the first static memory pages in the source virtual machine and the destination virtual machine are the same, then the destination virtual machine is controlled to perform memory mapping of the first static memory pages; If the hash values ​​of the second static memory pages in the source virtual machine and the destination virtual machine are different, then the second static memory page in the source virtual machine is transferred to the destination virtual machine; wherein, the first static memory page and the second static memory page are any two static memory pages.

4. The online migration method for virtual machines according to claim 3, characterized in that, Before transferring the full memory data of the source virtual machine to the destination virtual machine based on the static page information of the source virtual machine and the destination virtual machine, the process further includes: The source host device adds the static memory pages from the source virtual machine to the cache of the source host device; wherein the source virtual machine is set on the source host device; Create a first hash table in the cache of the source host device corresponding to the static memory pages in the source virtual machine; Preload static memory pages from the destination virtual machine into the cache of the source host device; A second hash table corresponding to the static memory pages of the destination virtual machine is created in the cache of the source host device.

5. The online migration method for virtual machines according to claim 1, characterized in that, Before obtaining the page type corresponding to each dirty memory page based on the dirty frequency of each dirty memory page in the source virtual machine, the method further includes: Based on the target timestamps corresponding to each dirty memory page, the dirty marking frequency of each dirty memory page is determined; wherein, the target timestamp corresponding to the current dirty memory page includes the latest dirty marking timestamp of the current dirty memory page and the dirty marking timestamps within a preset time period before the latest dirty marking timestamp; the current dirty memory page is any of the dirty memory pages.

6. The online migration method for virtual machines according to claim 5, characterized in that, The step of determining the dirtying frequency of each dirty memory page based on the corresponding target timestamps includes: pass Calculate the current dirty memory page marking frequency; where count is the number of target timestamps corresponding to the current dirty memory page; e is the natural constant, t current t is the latest dirty timestamp of the current dirty memory page. i Let be the i-th dirty timestamp of the current dirty memory page, and r be the preset decay coefficient.

7. The online migration method for virtual machines according to claim 1, characterized in that, Before determining the dirty pages to be transferred in this iteration based on the page type corresponding to each of the dirty memory pages, the method further includes: Determine whether the transmission time of dirty memory pages corresponding to page types other than the hot pages is greater than the preset acceptable downtime; If so, then it is determined that this iteration transmission is not the last iteration transmission; If not, then this iteration transmission is determined to be the last iteration transmission.

8. The online migration method for virtual machines according to any one of claims 1 to 7, characterized in that, If the current iteration transfer is not the last iteration transfer, then the dirty pages to be transferred in this iteration transfer are transferred to the destination virtual machine, including: If this iteration is not the last iteration, then the compression method corresponding to each dirty page to be transmitted in this iteration is determined according to the page type or page type and dirty labeling frequency of the dirty pages to be transmitted in this iteration; wherein, if the compression speed of the compression method corresponding to the first dirty page to be transmitted is greater than the compression speed of the compression method corresponding to the second dirty page to be transmitted, then the dirty labeling frequency of the first dirty page to be transmitted is greater than the dirty labeling frequency of the second dirty page to be transmitted; the first dirty page to be transmitted and the second dirty page to be transmitted are any two dirty pages to be transmitted in this iteration. According to the compression method corresponding to each dirty page to be transferred, the dirty pages to be transferred in this iteration are compressed and transferred to the destination virtual machine.

9. An online migration device for virtual machines, characterized in that, include: The full data transfer module is used to transfer the full memory data of the source virtual machine to the destination virtual machine during the online migration of the source virtual machine, based on the memory static page information of the source virtual machine and the destination virtual machine. The type acquisition module is used to acquire the page type corresponding to each dirty memory page based on the dirty frequency of each dirty memory page in the source virtual machine; The transmission determination module is used to determine the dirty pages to be transmitted in the current iteration based on the page type corresponding to each of the dirty memory pages; wherein, when the current iteration is not the last iteration, the dirty pages to be transmitted in the current iteration include dirty memory pages corresponding to page types other than hot pages; the dirty pages to be transmitted in the last iteration include all the dirty memory pages. An intermediate transmission module is used to transmit the dirty pages to be transmitted in the current iteration to the destination virtual machine if the current iteration is not the last iteration. The final transmission module is used to pause the source virtual machine and transfer the dirty pages to be transmitted in this iteration to the destination virtual machine if this iteration is the last iteration.

10. An online migration device for virtual machines, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the online migration method for a virtual machine as described in any one of claims 1 to 8.

Citation Information

Cited By

  • Dirty page migration method, dirty page migration device, electronic equipment, medium and product

    CN122173207A