Data migration method and device, virtual machine to be migrated, medium and product
By dynamically adjusting the granularity of virtual machine disk bitmap data blocks and the dirty page transfer time in memory, the problems of dirty page amplification and bandwidth imbalance in virtual machine hot migration are solved, and efficient virtual machine migration is achieved.
Patent Information
- Application Number
- CN202511353264.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-22
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2045-09-22
AI Technical Summary
In existing technologies, the data block granularity of the disk bitmap is fixed during virtual machine hot migration, which cannot adapt to different input/output load characteristics, resulting in dirty page amplification. When memory and disk dirty page transfers are carried out in parallel, the bandwidth allocation is unbalanced, resulting in low migration success rate and efficiency.
By dynamically determining the disk bitmap data block granularity of the virtual machine to be migrated, and combining the disk dirty page rate and memory dirty page transfer time, memory dirty page transfer is scheduled to match the disk transfer pressure, thereby achieving a dynamic balance between memory and disk bandwidth resources.
It reduces invalid data transmission, improves migration success rate and efficiency, and avoids migration delays or failures caused by bandwidth contention.
Smart Images

Figure CN120849025B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular to a data migration method and device, a virtual machine to be migrated, a medium and a product. BACKGROUND
[0002] Virtual machine live migration refers to migrating a running virtual machine from one physical host to another physical host under the premise of ensuring business continuity. However, the data block granularity of the disk bitmap used in the live migration process in the prior art is usually fixed, which cannot adapt to different input / output load characteristics, resulting in dirty page amplification, increased invalid migration data volume, and lack of dynamic coordination mechanism when memory and disk dirty page transmission are parallel, frequent memory transmission occupies bandwidth, especially in the initial stage of high disk transmission pressure, causing bandwidth allocation imbalance, thereby resulting in low migration success rate and migration efficiency. SUMMARY
[0003] To solve the above technical problems, the embodiments of the present application provide a data migration method and device, a virtual machine to be migrated, a medium and a product, which can solve the problem of low migration success rate and migration efficiency in related art.
[0004] The technical solution of the present application is implemented as follows:
[0005] A data migration method, the method comprising:
[0006] determining the data block granularity of the disk bitmap of the virtual machine to be migrated based on the input / output data generated by the virtual machine to be migrated during operation;
[0007] after each round of disk dirty page transmission is completed, determining the target transmission time of the next round of memory dirty page transmission based on the first disk dirty page rate obtained by tracking the disk bitmap determined by the data block granularity;
[0008] scheduling the transmission of the next round of memory dirty page according to the target transmission time.
[0009] In the above solution, the determination of the data block granularity of the disk bitmap of the virtual machine to be migrated based on the input / output data generated by the virtual machine to be migrated during operation comprises:
[0010] obtaining the number of disk blocks changed within a sampling period and the total write data volume from the input / output data;
[0011] determining the average block granularity of the input / output data based on the number and the total write data volume;
[0012] determine the data block granularity based on the average block granularity and a target policy, wherein the target policy represents a mapping relationship between the average block granularity and the data block granularity.
[0013] In the foregoing solution, the first disk dirty page rate determined based on the disk bitmap tracking determined by the data block granularity is used to determine a target transmission time of the next round of memory dirty page transmission.
[0014] a current transmission time of the current round of memory dirty page transmission is obtained.
[0015] The target transmission time is determined based on the first disk dirty page rate and the current transmission time.
[0016] In the foregoing solution, the target transmission time is determined based on the first disk dirty page rate and the current transmission time, including:
[0017] If the first disk dirty page rate is less than a first threshold value, the target transmission time is determined as a target value.
[0018] If the first disk dirty page rate is greater than or equal to the first threshold value, the target transmission time is determined based on the first disk dirty page rate, the current transmission time, and a second disk dirty page rate of the last round of disk dirty page transmission.
[0019] In the foregoing solution, the target transmission time is determined based on the first disk dirty page rate, the current transmission time, and the second disk dirty page rate of the last round of disk dirty page transmission, including:
[0020] A first change rate of the disk dirty page rate is determined based on the first disk dirty page rate and the second disk dirty page rate.
[0021] The target transmission time is determined based on the first change rate and the current transmission time.
[0022] In the foregoing solution, the target transmission time is determined based on the first change rate and the current transmission time, including:
[0023] If the first change rate is less than a second threshold value, the target transmission time is obtained by decreasing the current transmission time by a target proportion.
[0024] If the first change rate is greater than or equal to the second threshold value, the current transmission time is determined as the target transmission time.
[0025] In the foregoing solution, the next round of memory dirty page transmission is scheduled according to the target transmission time, including:
[0026] After scheduling the multiple rounds of memory dirty page transmission, a target interruption time of a next round of memory dirty page transmission is determined based on whether the to-be-migrated virtual machine meets a target condition; wherein the target condition includes that an automatic convergence function is enabled, or that the automatic convergence function is not enabled and a total number of rounds of current memory dirty page transmission is greater than a starting round of a start-up shutdown adjustment;
[0027] According to the target transmission time, and within a time limit of the target interruption time, transmission of a next round of memory dirty page is scheduled.
[0028] In the above scheme, the target interruption time of the next round of memory dirty page transmission is determined based on whether the to-be-migrated virtual machine meets the target condition, including:
[0029] If the target condition is not met, a current interruption time of the current round of memory dirty page transmission is determined as the target interruption time;
[0030] If the target condition is met, a time period between an interruption time threshold of the to-be-migrated virtual machine and the current interruption time is divided based on a target number of shares, to obtain a plurality of time intervals;
[0031] The target interruption time is determined based on a first memory dirty page rate of the current round of memory dirty page transmission, a second memory dirty page rate of a previous round of memory dirty page transmission, the plurality of time intervals, and the current interruption time.
[0032] In the above scheme, the target interruption time is determined based on the first memory dirty page rate, the second memory dirty page rate, the plurality of time intervals, and the current interruption time, including:
[0033] A second change rate of the memory dirty page rate is determined based on the first memory dirty page rate and the second memory dirty page rate;
[0034] The target interruption time is determined based on the second change rate, the plurality of time intervals, and the current interruption time.
[0035] In the above scheme, the target interruption time is determined based on the second change rate, the plurality of time intervals, and the current interruption time, including:
[0036] If the second change rate indicates that the memory dirty page rate decreases and a decrease amplitude is less than a third threshold value, or the memory dirty page rate increases, the target interruption time is determined based on the current interruption time and a time interval; wherein the target interruption time is less than or equal to the interruption time threshold;
[0037] If the second change rate indicates that the memory dirty page rate decreases and a decrease amplitude is greater than or equal to the third threshold value, the current interruption time is determined as the target interruption time.
[0038] A data migration apparatus, the apparatus comprising:
[0039] a first processing unit configured to determine a data block granularity of a disk bitmap of a virtual machine to be migrated based on input / output data generated by the virtual machine to be migrated during running;
[0040] a second processing unit configured to determine a target transmission time of a next round of memory dirty page transmission based on a first disk dirty page rate obtained by tracking the disk bitmap determined by the data block granularity after completion of each round of disk dirty page transmission;
[0041] a transmission unit configured to schedule transmission of the next round of memory dirty page according to the target transmission time.
[0042] A virtual machine to be migrated, the virtual machine to be migrated comprising a processor, a memory and a communication bus;
[0043] the communication bus is configured to realize communication connection between the processor and the memory;
[0044] the processor is configured to execute a data migration program stored in the memory to realize steps of the above data migration method.
[0045] A computer readable storage medium, the storage medium storing one or more programs, the one or more programs being executable by one or more processors to realize steps of the above data migration method.
[0046] A computer program product comprising a computer program, the computer program realizing steps of the above data migration method when executed by a processor.
[0047] The data migration method, device, virtual machine to be migrated, medium and product provided by the embodiments of the present application can dynamically determine the data block granularity of the disk bitmap based on the actual input / output data of the virtual machine to be migrated, so that the bitmap granularity is matched with the average block size of the input / output operation, thereby accurately tracking dirty pages, avoiding the dirty page amplification problem caused by fixed granularity, and reducing invalid data transmission. Meanwhile, after the completion of each round of disk dirty page transmission, the target transmission time of the next round of memory dirty page transmission is dynamically calculated according to the dirty page rate and its change trend obtained by tracking the disk bitmap, so that the memory transmission rhythm can be adapted to the disk transmission pressure, that is, when the disk dirty page rate is high at the initial stage of migration, the transmission time is prolonged to preferentially guarantee the disk bandwidth, and when the disk load is reduced at the later stage of migration, the transmission time is shortened to speed up the memory transmission, thereby realizing the dynamic balance of the memory and disk bandwidth resources. And by scheduling the transmission according to the target transmission time, it is ensured that the memory dirty page transmission is executed within the optimal time window, avoiding the migration delay or failure caused by bandwidth competition, and finally not only reducing the data redundancy and bandwidth conflict in the migration process, but also improving the migration success rate and migration efficiency in the high-load scenario. BRIEF DESCRIPTION OF DRAWINGS
[0048] Figure 1 A flowchart of a data migration method provided by an embodiment of the present application is shown in the figure.
[0049] Figure 2 A flowchart of another data migration method provided by an embodiment of the present application is shown in the figure.
[0050] Figure 3 A flowchart of another data migration method provided by an embodiment of the present application is shown in the figure.
[0051] Figure 4 A schematic diagram of adjusting the interruption time in a data migration method provided by an embodiment of the present application is shown in the figure.
[0052] Figure 5 A structural schematic diagram of a data migration device provided by an embodiment of the present application is shown in the figure.
[0053] Figure 6 A structural schematic diagram of a virtual machine to be migrated provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0054] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application.
[0055] It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
[0056] It should be noted that the main process of local disk virtual machine migration is: first, check the hardware compatibility and resource configuration of the opposite end, then migrate the disk and memory data in full; then enter the incremental transmission stage, in the dirty page incremental transmission stage, the changes of memory and disk pages during migration will be recorded on different bitmaps (bitmaps), each iteration will check how many bits of the bitmap are marked as dirty data, and these incremental dirty data will be transmitted to the destination virtual machine, and during the transmission, the estimated bandwidth and the amount of remaining dirty data will be evaluated to estimate how long it will take to transmit the remaining dirty page data, if the transmission can be completed within the interruption time limit, the source virtual machine will be suspended, and the remaining dirty data and device state (Central Processing Unit (CPU), network card, etc.) data will be migrated to the destination virtual machine, and finally the destination virtual machine runs the original program and the source virtual machine is destroyed.
[0057] Virtual machine live migration needs to migrate memory dirty page data and disk data at the same time, generally in order to improve the efficiency and success rate of virtual machine live migration, the process can be optimized from the aspects of data transmission and data generation; Specifically, in terms of data transmission, when dirty page data is transmitted, the data to be migrated is compressed before transmission, which reduces the amount of data transmitted to the destination virtual machine, and can better utilize bandwidth resources, but compression will occupy additional CPU resources, which can be handled by technologies such as Quick Assist Technology (QAT) and other technologies. For a bound-core virtual machine, during data transmission, the migration thread may compete with the virtual CPU (vCPU) thread for CPU resources, affecting migration efficiency, so find idle physical cores on the host machine before migration, and bind the live migration thread to these idle cores. Another approach is to limit the source of dirty page data, such as enabling auto_converge to reduce the frequency of the virtual machine's CPU, and gradually reducing the running time of the vCPU thread per unit time during migration, to suppress the speed of generating dirty page data in the virtual machine memory. In addition, when the virtual machine live migration enters the incremental iteration migration stage, some hot memory may be frequently modified, and may be repeatedly migrated during iteration transmission, according to the principle of memory locality, delay the migration of some hot memory data, to reduce the amount of data transmitted. In addition, since disk data also needs to be migrated, intensive Input / Output (I / O) will generate excessive dirty page data, making it difficult to migrate successfully, in order to ensure success rate, it is necessary to limit the Quality of Service (QoS) of disk I / O.
[0058] However, the above scheme has the following problems: 1. For the local virtual machine live migration scenario, the block size of the I / O action of the virtual machine is different in different business scenarios (for example, the block size may be 1 megabyte (MB) when the I / O tester (such as fio) is tested, 256 kilobytes (KB), etc.), but the disk bitmap data block granularity is fixed in the live migration process, and there may be a problem of disk live migration dirty data amplification. For example, in the random write scenario, the block size of fio is relatively small, and the disk dirty data is amplified by multiple times, causing more data to be invalidly migrated. 2. For the local virtual machine live migration scenario, the disk dirty page and the memory are transmitted in parallel in the incremental migration stage. The read-write performance of the memory device and the disk device is quite different, and the dirty page generated by the virtual machine memory per unit time may be tens of times that of the disk dirty page, but the disk data volume is usually large, and most of the time is spent on the migration of the data disk. Due to the unreasonable time slice allocation of the memory live migration, the memory dirty page is iteratively transmitted multiple times during the parallel transmission of the disk and the memory dirty page, which occupies a large amount of bandwidth resources. Therefore, in the initial stage of the disk data transmission, the transmission efficiency of the memory dirty page can be limited, and when the disk dirty page data grows slowly, the memory dirty page transmission can be gradually released. 3. In order to suppress the generation of too much memory dirty page of the virtual machine, causing the live migration to fail to converge, the auto_converge function is generally used to limit the CPU utilization of the virtual machine vCPU thread, and the strategy adopted by auto_converge is: starting from reducing the customer vCPU execution time by 20%, if the migration is not completed, it will reduce the running time allocated to the vCPU by 10% each time, and the upper limit of the vCPU running time is reduced to 99% until the virtual machine can be successfully migrated. When auto_converge limits the CPU of the virtual machine, the downtime is fixed and short, and has little effect on all businesses, but in actual use, except for a few businesses, most business scenarios can tolerate a larger downtime, especially in the local virtual machine migration scenario. Reducing the CPU utilization of the virtual machine will affect the smooth running of the virtual machine business, especially in the late stage of the migration frequency reduction, and even the phenomenon of lagging may occur. The downtime can be appropriately relaxed to make it converge faster and avoid limiting the CPU utilization of the virtual machine to a lower level.
[0059] Based on this, the embodiment of the application provides a data migration method, which can be applied to a to-be-migrated virtual machine. Referring to FIG. 1, the method comprises the following steps: Figure 1
[0060] Step 101, determining the data block granularity of the disk bitmap of the to-be-migrated virtual machine based on the input / output data generated in the running process of the to-be-migrated virtual machine.
[0061] In the embodiments of the present application, the to-be-migrated virtual machine refers to a local virtual machine that is running and needs to be migrated; the input / output data (i.e., I / O data) refers to data generated when the to-be-migrated virtual machine performs read / write operations on a disk during running, including read / write times, data block size, total write byte number, etc.; the disk bitmap is a data structure used to track changes of disk data, and each bit represents whether a data block on the disk is modified (i.e., whether it is a dirty page); and the data block granularity refers to the size of the disk data block represented by each bit in the disk bitmap.
[0062] In the embodiments of the present application, the I / O data generated by the to-be-migrated virtual machine during running can be monitored, and the data is analyzed to obtain the number of disk blocks changed and the total write byte number within the target time, and then the optimal disk bitmap granularity is determined according to the number and the total write byte number, so as to reduce the dirty page amplification phenomenon and improve the migration efficiency.
[0063] In step 102, after completion of each round of disk dirty page transmission, a target transmission time of the next round of memory dirty page transmission is determined based on a first disk dirty page rate obtained by tracking the disk bitmap determined by the data block granularity.
[0064] In the embodiments of the present application, the first disk dirty page rate refers to the disk dirty page rate corresponding to the current round of disk dirty page transmission, and the disk dirty page rate refers to the proportion of the data blocks in the disk that are modified but not synchronized in a unit of time to the total data blocks; and the target transmission time refers to a time parameter for controlling the frequency of memory dirty page transmission during live migration, which is used to balance the bandwidth occupancy of disk and memory data transmission.
[0065] In the embodiments of the present application, after completion of each round of disk dirty page transmission, the disk dirty page rate of the current round (i.e., the first disk dirty page rate) is calculated according to the current disk bitmap, and then the transmission time of the next round of memory dirty page transmission is determined directly according to the disk dirty page rate of the current round, or the transmission time of the next round of memory dirty page transmission is determined according to the disk dirty page rate of the current round in combination with the disk dirty page rate of the previous round. It should be noted that the determination of the transmission time of memory dirty page transmission can make the rhythm (i.e., frequency) of memory transmission match the pressure of disk transmission. Specifically, in the early stage of migration, the disk dirty page rate is high (the pressure of disk transmission is large), and the determined target transmission time is long, i.e., the memory transmission thread sleeps for a long time before working once, so that a large amount of bandwidth is released for disk transmission; in the later stage of migration, the disk dirty page rate decreases (the pressure of disk transmission is small), and the determined target transmission time becomes shorter, i.e., the memory transmission thread is woken up more frequently, so that the rhythm of memory transmission is accelerated, and the remaining bandwidth is used to complete the migration quickly; that is, by adjusting the transmission time of memory dirty page transmission, the transmission of memory dirty page and disk dirty page is balanced.
[0066] Step 103: scheduling the transmission of the next round of memory dirty pages according to the target transmission time.
[0067] In the embodiment of the present application, the transmission of the memory dirty pages refers to the process of transmitting the data pages in the memory of the virtual machine to be migrated which are modified but not yet written into the disk to the destination host; according to the determined target transmission time, a time window is set, and the transmission task of the next round of memory dirty pages is arranged in the time window, so as to ensure that the transmission of the memory dirty pages is performed in a reasonable time window, thereby ensuring that the transmission process will not cause the migration efficiency to decrease or the migration to fail due to bandwidth competition.
[0068] The data migration method provided by the embodiment of the present application dynamically determines the data block granularity of the disk bitmap based on the actual input / output data of the virtual machine to be migrated, so that the bitmap granularity is matched with the average block size of the input / output operation, thereby accurately tracking the dirty pages, avoiding the dirty page amplification problem caused by the fixed granularity, and reducing the invalid data transmission; at the same time, after the completion of each round of disk dirty page transmission, the target transmission time of the next round of memory dirty page transmission is dynamically calculated according to the dirty page rate and its change trend obtained by tracking the disk bitmap, so that the memory transmission rhythm can be adapted to the disk transmission pressure, that is, when the disk dirty page rate is high at the initial stage of migration, the transmission time is prolonged to preferentially guarantee the disk bandwidth, and when the disk load is reduced at the later stage of migration, the transmission time is shortened to speed up the memory transmission, thereby realizing the dynamic balance of the memory and disk bandwidth resources; and by scheduling the transmission according to the target transmission time, the transmission of the memory dirty pages is ensured to be performed in an optimal time window, avoiding the migration delay or failure caused by bandwidth competition, and finally not only reducing the data redundancy and bandwidth conflict in the migration process, but also improving the migration success rate and migration efficiency in the high-load scenario.
[0069] Based on the foregoing embodiment, the embodiment of the present application also provides another data migration method, which is shown in Figure 2 The method comprises the following steps:
[0070] Step 201: obtaining, by the virtual machine to be migrated, the number of disk blocks changed and the total written data amount in a sampling period from input / output data.
[0071] In the embodiments of the present application, the sampling period is a preset sampling time window, and selecting a proper sampling period can balance the real-time performance and stability of data, and avoid misjudgment caused by instantaneous flow fluctuation; the changed disk blocks refer to disk storage units modified by write operations of the virtual machine to be migrated within the sampling period, and the data contents of these blocks have changed compared with the previous ones, thus, the changed data blocks can be used to evaluate the data block granularity size of the disk bitmap in the subsequent process; the total write data amount refers to the total data amount of all write operations of the virtual machine to be migrated within the target time. In a feasible implementation manner, the target time can be 1 second, 5 seconds or 10 seconds in the past, etc. The input / output data can be obtained through a virtual machine agent (QEMU Guest Agent, QGA).
[0072] In the embodiments of the present application, before the migration starts, the virtual machine to be migrated starts monitoring the I / O operations of the disk itself, and determines a sampling period, and then in each sampling period window, the number of changed disk blocks is counted, and the data size of all write operations is accumulated to obtain the total write data amount in the sampling period.
[0073] Step 202, the virtual machine to be migrated determines the average block granularity of the input / output data based on the number and the total write data amount.
[0074] In the embodiments of the present application, the average block granularity is also called average I / O size, which is not a pre-set value, but a statistical value calculated according to the collected number and total write data amount, and it represents the average data size of each disk write operation of the virtual machine to be migrated within the target time; the calculation formula of the average block granularity is: average block granularity = total write byte amount / number of changed disk blocks. In a feasible implementation manner, the number and the total write data amount can be collected in the virtual machine to be migrated through the iostat command or other tools.
[0075] Step 203, the virtual machine to be migrated determines the data block granularity of the disk bitmap of the virtual machine to be migrated based on the average block granularity and the target strategy.
[0076] The target strategy represents the mapping relationship between the average block granularity and the data block granularity.
[0077] In the embodiments of the present application, the target strategy is a preset decision rule or mapping table for mapping the calculated average block granularity to the most suitable, preset disk bitmap granularity, and the strategy can be an optimized scheme based on experience or experiment; the calculated average block granularity is compared with the threshold defined in the target strategy, so as to select an optimal data block granularity of the disk bitmap, and thereafter, the new data block granularity can be used to track the dirty data of the disk in the whole migration process; in this way, by estimating the average I / O operation block size and selecting a suitable disk bitmap size, the problem of amplification of dirty data in disk live migration is weakened, and the efficiency of disk migration is improved.
[0078] In a feasible implementation manner, when the average block granularity is above 512 KB, the data block granularity is determined as 1 MB; when the average block granularity is between 512 KB and 64 KB, the data block granularity is determined as 256 KB; and when the average block granularity is below 64 KB, the data block granularity is determined as 64 KB.
[0079] It should be noted that after the completion of each round of disk dirty page transmission, the to-be-migrated virtual machine needs to determine the target transmission time of the next round of memory dirty page transmission, and the specific process is as follows:
[0080] In step 204, the to-be-migrated virtual machine acquires the current transmission time of the current round of memory dirty page transmission.
[0081] In the embodiments of the present application, the current transmission time refers to the transmission time used by the current round of memory dirty page transmission being performed, and it is a known, specific value (for example, 100 milliseconds (ms)); the current transmission time can be read from a variable or configuration item storing the value.
[0082] In step 205, the to-be-migrated virtual machine determines the target transmission time based on the first disk dirty page rate and the current transmission time.
[0083] In the embodiments of the present application, the first disk dirty page rate and the first threshold value can be compared in size, and then the target transmission time is determined according to the comparison result and the current transmission time.
[0084] It should be noted that step 205 can be implemented in the following manner:
[0085] In step 205A, if the first disk dirty page rate is less than the first threshold value, the to-be-migrated virtual machine determines the target transmission time as the target value.
[0086] In the embodiments of the present application, the target value is a very short time close to zero (even zero); the first threshold is a preset critical value for judgment, which is used to distinguish whether the dirty page rate of the disk is high or low; the first dirty page rate of the disk smaller than the first threshold indicates that the dirty data generation speed of the disk has been very slow, and the pressure of disk migration has been greatly reduced, at this time, it is no longer necessary to deliberately suppress memory transmission to give way to the disk, and the target transmission time can be directly set as the target value, which means that the next round of memory transmission can wait for a very short time (or no need to wait), thereby speeding up the overall migration progress.
[0087] Step 205B, if the first dirty page rate of the disk is greater than or equal to the first threshold, the virtual machine to be migrated determines the target transmission time based on the first dirty page rate of the disk, the current transmission time and the second dirty page rate of the disk in the last round of dirty page transmission.
[0088] In the embodiments of the present application, the first dirty page rate of the disk greater than or equal to the first threshold indicates that the dirty data generation speed of the disk is still very fast, and the disk migration still needs to occupy a large amount of bandwidth, at this time, it is necessary to further analyze the trend to determine whether to maintain or relax the restriction on memory transmission.
[0089] It should be noted that step 205B can be implemented in the following way:
[0090] Step 205b1, the virtual machine to be migrated determines the first change rate of the dirty page rate based on the first dirty page rate of the disk and the second dirty page rate.
[0091] In the embodiments of the present application, the first change rate reflects the trend of the disk load, i.e., whether the disk load is intensifying, stable or slowing down; the first change rate can be calculated by the following expression: first change rate = (first dirty page rate and - second dirty page rate) / second dirty page rate.
[0092] Step 205b2, the virtual machine to be migrated determines the target transmission time based on the first change rate and the current transmission time.
[0093] In the embodiments of the present application, the first change rate can be analyzed, and the target transmission time is determined based on the analysis result and the current transmission time; it should be noted that the transmission time is no longer a fixed time, but the transmission time is used as a control lever, which is dynamically adjusted according to the actual load (i.e., the dirty page rate) of the disk and its change trend, thereby realizing the optimal allocation of bandwidth resources between disk migration and memory migration.
[0094] Step 206, the virtual machine to be migrated schedules the transmission of the next round of memory dirty pages according to the target transmission time.
[0095] In the embodiment of the present application, after the to-be-migrated virtual machine completes the memory dirty page transmission of the current round, a timer or a sleep mechanism is set according to the calculated target transmission time, so that the memory transmission thread enters a waiting state. If the target transmission time is 0, the next round of transmission is started immediately; if the target transmission time is greater than 0, the thread is put to sleep for the corresponding time and then is woken up; after the transmission time ends, the to-be-migrated virtual machine scheduler wakes up the memory transmission thread and starts the next round of collection and transmission of the memory dirty page.
[0096] It should be noted that the description of the same steps and the same content in the present embodiment and other embodiments can refer to the description in other embodiments, which will not be repeated here.
[0097] The data migration method provided by the embodiment of the present application dynamically determines the data block granularity of the disk bitmap based on the actual input / output data of the to-be-migrated virtual machine, so that the bitmap granularity matches the average block size of the input / output operation, thereby accurately tracking the dirty page and avoiding the dirty page amplification problem caused by fixed granularity and reducing invalid data transmission. Meanwhile, after each round of disk dirty page transmission is completed, the target transmission time of the next round of memory dirty page transmission is dynamically calculated according to the dirty page rate and its change trend tracked by the disk bitmap, so that the memory transmission rhythm can adapt to the disk transmission pressure, that is, the transmission time is lengthened to preferentially guarantee the disk bandwidth when the disk dirty page rate is high in the early stage of migration, and the transmission time is shortened to speed up the memory transmission when the disk load is reduced in the later stage of migration, thereby realizing the dynamic balance of the memory and disk bandwidth resources. Moreover, the transmission is scheduled according to the target transmission time, so as to ensure that the memory dirty page transmission is performed within the optimal time window, avoid migration delay or failure caused by bandwidth competition, and finally not only reduce the data redundancy and bandwidth conflict in the migration process, but also improve the migration success rate and migration efficiency in the high-load scenario.
[0098] Based on the foregoing embodiments, the present embodiment further provides another data migration method, which is described with reference to Figure 3 The method comprises the following steps:
[0099] Step 301: The to-be-migrated virtual machine obtains the number of disk blocks that have changed and the total write data amount in a sampling period from the input / output data.
[0100] Step 302: The to-be-migrated virtual machine determines the average block granularity of the input / output data based on the number and the total write data amount.
[0101] Step 303: The to-be-migrated virtual machine determines the data block granularity based on the average block granularity and a target strategy.
[0102] The target strategy represents the mapping relationship between the average block granularity and the data block granularity.
[0103] It should be noted that after each round of disk dirty page transmission is completed, the to-be-migrated virtual machine needs to determine the target transmission time of the next round of memory dirty page transmission, which is as follows:
[0104] It should be noted that after step 303, step 304 can be executed, or steps 305-308 can be executed.
[0105] Step 304, if the first disk dirty page rate is less than the first threshold value, the to-be-migrated virtual machine determines that the target transmission time is the target value.
[0106] Step 305, if the first disk dirty page rate is greater than or equal to the first threshold value, the to-be-migrated virtual machine obtains the current transmission time of the current round of memory dirty page transmission.
[0107] Step 306, the to-be-migrated virtual machine determines the first change rate of the disk dirty page rate based on the first disk dirty page rate and the second disk dirty page rate.
[0108] It should be noted that after step 306, step 307 can be executed, or step 308 can be executed.
[0109] Step 307, if the first change rate is less than the second threshold value, the to-be-migrated virtual machine decrements the current transmission time by the target proportion to obtain the target transmission time.
[0110] In the embodiment of the application, the second threshold value is a critical value preset and used to judge whether the trend of disk load change is significant, and the value is usually a negative number, which is used to judge whether the speed of the dirty page rate is fast enough; the target proportion is a preset reduction factor, which is used to multiply the current transmission time to obtain a new and shorter transmission time; the first disk dirty page rate less than the first threshold value indicates that the disk dirty page rate is not only decreasing, but also the speed of the decrease is very fast, which also indicates that the pressure of disk data transmission is rapidly decreasing, and there is sufficient bandwidth that can be released for memory transmission, so that the target transmission time=the current transmission time*(100%-target proportion) can be calculated through the expression; in this way, the transmission time of the next round of memory dirty page transmission is shortened, the memory transmission thread is woken up faster, and data transmission is performed more frequently, so that the newly released bandwidth is used to speed up the synchronization of memory data and promote the migration process to be completed faster.
[0111] In a feasible implementation manner, the second threshold value can be set to-5%; assuming that the current transmission time is 100 milliseconds and the target proportion is preset to 0.2 (i.e., 20% reduction each time), the target transmission time calculated is 100*(100%-20%)=80 milliseconds.
[0112] Step 308, if the first change rate is greater than or equal to the second threshold value, the to-be-migrated virtual machine determines that the current transmission time is the target transmission time.
[0113] In the embodiments of the present application, the first change rate greater than or equal to the second threshold indicates that the change trend of the dirty page rate of the disk is not ideal, specifically including the following two cases: one is that the dirty page rate is decreasing, but the decreasing speed is very slow, which indicates that the disk transmission pressure is still large, and the opportunity to give up bandwidth greatly has not come; the other is that the dirty page rate does not change or even rises (the change rate is 0 or positive), which indicates that the disk write activity is still very frequent, and the load has not been reduced or even increased. In this case, the virtual machine to be migrated judges that it is not appropriate to relax the restriction on memory transmission at present, and directly sets the target transmission time to the same value as the current transmission time. In this way, the next round of memory dirty page transmission will continue to maintain the current transmission time, which means that the memory transmission will continue to be "suppressed", thereby reserving the necessary bandwidth for disk transmission, avoiding the impact on the overall migration stability due to blindly accelerating the memory transmission and causing the disk and the memory to compete for bandwidth.
[0114] It should be noted that after the scheduling of the multiple rounds of memory dirty page transmission is completed, the virtual machine to be migrated can also judge whether to enter the interrupt time dynamic growth phase, and improve the migration efficiency and success rate by growing the interrupt time in steps, as shown in Figure 4 It should be noted that steps 304, 307 and 308 can be followed by steps 309 or steps 310-313.
[0115] It should be noted that steps 304, 307 and 308 can be followed by steps 309 or steps 310-313.
[0116] Step 309, if the virtual machine to be migrated does not meet the target condition, the virtual machine to be migrated determines that the current interrupt time of the current round of memory dirty page transmission is the target interrupt time of the next round of memory dirty page transmission.
[0117] The target condition includes: the automatic convergence function is enabled, or the automatic convergence function is not enabled and the total number of the current memory dirty page transmission is greater than the starting round of the start-up shutdown adjustment.
[0118] In the embodiments of the present application, the target condition not met by the to-be-migrated virtual machine specifically refers to that the auto-converge function is not enabled, and the total number of rounds of current memory dirty page transmission is less than or equal to the starting round, and the auto-converge is a technology for suppressing the generation rate of memory dirty pages by actively reducing the running speed of the vCPU of the to-be-migrated virtual machine, when the migration process cannot keep up with the speed of the generation of dirty pages, the vCPU is limited to reduce the amount of data to be migrated from the source, so as to make the migration converge; the starting round is a preset iteration round threshold, which indicates that, in the case where the auto-converge function is not enabled, after how many rounds of memory dirty page transmission, it is considered that the migration may enter the bottleneck period, and it is considered to adjust the downtime; the current downtime is the downtime used in the current round of memory dirty page transmission; and the target downtime is the downtime planned and set for the next round of memory dirty page transmission.
[0119] In the embodiments of the present application, after completing a round of memory dirty page transmission, the to-be-migrated virtual machine evaluates whether the current state meets the target condition, that is, whether the auto-converge function is enabled is checked, if not, whether the total number of rounds of memory dirty page transmission completed so far exceeds the preset starting round is checked, if not, it means that the migration is still in the early or stable stage, and there is no obvious sign of convergence difficulty, therefore, it is not necessary to risk increasing the downtime, and it is the safest and most reasonable choice to continue to maintain the current stable configuration, then the to-be-migrated virtual machine directly determines that the current downtime is the target downtime, that is, the downtime set for the next round of memory dirty page transmission will be exactly the same as the downtime used in the current round, in this way, the migration process will continue to iterate with the current fixed, usually shorter default downtime parameter, until the target condition is met.
[0120] Step 310, if the target condition is met, the to-be-migrated virtual machine divides the time interval between the downtime threshold value of the to-be-migrated virtual machine and the current downtime based on the target number of shares, to obtain a plurality of time intervals.
[0121] In the embodiments of the present application, the target number of shares is a preset integer, which represents how many shares a time interval is divided into on average, and determines the fineness and smoothness of the increase of the downtime, and the more the shares, the smaller the step of each adjustment, and the smoother the adjustment; the downtime threshold value (Maximum Downtime / Tolerance Time) is the longest business downtime (i.e. maximum downtime) that the business can tolerate, and it is a safety upper limit, which ensures that no matter how the adjustment is made, the downtime will not exceed this value, thereby ensuring the business continuity is not affected by disaster; and the time interval is the length of each share obtained by equally dividing the difference between the downtime threshold value and the current downtime according to the target number of shares, which represents the step of each allowed increase in downtime.
[0122] In the embodiments of the present application, the time interval can be calculated by the following expression: time interval=(interruption time threshold-current interruption time) / target share; in a possible implementation, if the current interruption time is 100 ms, the interruption time threshold is 200 ms, and the target share is 10, then each time interval is 10 ms, and then the interruption time can be gradually increased by 10 ms in the subsequent.
[0123] In step 311, the to-be-migrated virtual machine determines a second change rate of the memory dirty page rate based on a first memory dirty page rate in the current memory dirty page transmission and a second memory dirty page rate in the last memory dirty page transmission.
[0124] In the embodiments of the present application, the first memory dirty page rate is the memory dirty page rate generated in the current memory dirty page transmission process, indicating the modification speed of the memory page in the current iteration; the second memory dirty page rate is the memory dirty page rate generated in the last memory dirty page transmission process; the second change rate is used to measure the change trend and amplitude of the memory dirty page rate between two iterations, and the second change rate can be calculated by the following expression: second change rate=(first memory dirty page rate-second memory dirty page rate) / second memory dirty page rate; it should be noted that the second change rate is negative if the memory dirty page rate decreases between two iterations, and is positive if the memory dirty page rate increases between two iterations.
[0125] It should be noted that step 311 can be followed by step 312, and step 311 can also be followed by step 313.
[0126] In step 312, if the second change rate indicates that the memory dirty page rate decreases and the decrease amplitude is less than a third threshold, or the memory dirty page rate increases, the to-be-migrated virtual machine determines the target interruption time based on the current interruption time and a time interval.
[0127] The target interruption time is less than or equal to the interruption time threshold.
[0128] In the embodiments of the present application, if the second change rate indicates that the memory dirty page rate decreases and the decrease amplitude is less than the third threshold, it indicates that the suppression effect is not good, and the dirty page generation speed is still very fast; if the memory dirty page rate increases (i.e., the change rate is positive), it indicates that the situation is deteriorating, and the dirty page generation is faster; that is, under the limitation of the current interruption time, it is necessary to take measures to increase the interruption time to allow more data to be transmitted in a single round to catch up with the speed of dirty page generation. Specifically, the target interruption time can be calculated by the following expression: current interruption time+time interval; it should be noted that after the target interruption time is determined, it is necessary to check whether the calculated target interruption time is greater than the interruption time threshold, and if so, the target interruption time is forced to be equal to the interruption time threshold to ensure that the business tolerance limit is never exceeded.
[0129] If the second change rate indicates that the dirty page rate of the memory decreases and the decrease amplitude is greater than or equal to the third threshold value, the virtual machine to be migrated determines the current interruption time as the target interruption time.
[0130] In the embodiment of the present application, the decrease amplitude greater than or equal to the third threshold value indicates that the current dirty page rate of the memory is rapidly decreasing, which indicates that the existing migration strategy (including the current interruption time setting and the auto-converge that may have been enabled) has a very significant effect, at this time, it should be continued to be maintained, that is, directly setting the target interruption time = the current interruption time.
[0131] It should be noted that after the step 309, the step 312 and the step 313, the step 314 can be executed.
[0132] In the step 314, the virtual machine to be migrated schedules the transmission of the next round of dirty pages of the memory according to the target transmission time and within the time limit of the target interruption time.
[0133] In the embodiment of the present application, first, the target transmission time is waited for a length of time, and the bandwidth is given to the disk transmission, after the waiting is finished, the transmission of the next round of dirty pages of the memory is started. At the same time, a hard timeout time for the current transmission is set, that is, the target interruption time, and the transmission operation must be completed within this time window, if the time is up and the transmission is not completed, the current transmission will also be forcibly paused, and the next iteration is entered, so as to ensure that the business interruption will not exceed the preset safe range.
[0134] It should be noted that the same steps and the same content in the embodiment and in other embodiments can refer to the description in other embodiments, and will not be described here.
[0135] The data migration method provided in the embodiment of the present application dynamically determines the data block granularity of the disk bitmap based on the actual input / output data of the virtual machine to be migrated, so that the bitmap granularity is matched with the average block size of the input / output operation, thereby accurately tracking the dirty pages, avoiding the dirty page amplification problem caused by the fixed granularity, and reducing the invalid data transmission. At the same time, after the completion of each round of disk dirty page transmission, the dirty page rate and its change trend obtained by tracking the disk bitmap are used to dynamically calculate the target transmission time of the next round of memory dirty page transmission, so that the memory transmission rhythm can be adapted to the disk transmission pressure, that is, the transmission time is lengthened to preferentially guarantee the disk bandwidth when the disk dirty page rate is high in the early migration stage, and the transmission time is shortened to speed up the memory transmission when the disk load is reduced in the late migration stage, so as to realize the dynamic balance of the memory and the disk bandwidth resources. And by scheduling the transmission according to the target transmission time, it is ensured that the memory dirty page transmission is executed within the optimal time window, avoiding the migration delay or failure caused by the bandwidth competition, finally, not only the data redundancy and the bandwidth conflict in the migration process are reduced, but also the migration success rate and the migration efficiency in the high load scenario are improved.
[0136] Based on the foregoing embodiments, the embodiments of the present application provide a data migration device, which can be applied to Figures 1-3 The data migration method provided by the corresponding embodiments can refer to Figure 5 As shown in the figure, the data migration device 4 can include a first processing unit 41, a second processing unit 42, and a transmission unit 43, wherein:
[0137] The first processing unit 41 is configured to determine a data block granularity of a disk bitmap of a virtual machine to be migrated based on input / output data generated by the virtual machine to be migrated during running;
[0138] The second processing unit 42 is configured to determine a target transmission time of memory dirty page transmission in a next round based on a first disk dirty page rate obtained by tracking the disk bitmap determined by the data block granularity after completion of disk dirty page transmission in each round;
[0139] The transmission unit 43 is configured to schedule transmission of the memory dirty page in the next round according to the target transmission time.
[0140] In other embodiments of the present application, the first processing unit 41 is further configured to perform the following steps:
[0141] Obtain the number of disk blocks changed in a sampling period and the total write data amount from the input / output data;
[0142] Determine an average block granularity of the input / output data based on the number and the total write data amount;
[0143] Determine the data block granularity based on the average block granularity and a target strategy, wherein the target strategy represents a mapping relationship between the average block granularity and the data block granularity.
[0144] In other embodiments of the present application, the second processing unit 42 is further configured to perform the following steps:
[0145] Obtain a current transmission time of memory dirty page transmission in the current round;
[0146] Determine the target transmission time based on the first disk dirty page rate and the current transmission time.
[0147] In other embodiments of the present application, the second processing unit 42 is further configured to perform the following steps:
[0148] If the first disk dirty page rate is less than a first threshold value, determine the target transmission time as a target value;
[0149] If the first disk dirty page rate is greater than or equal to the first threshold value, determine the target transmission time based on the first disk dirty page rate, the current transmission time, and a second disk dirty page rate of disk dirty page transmission in a previous round.
[0150] In other embodiments of the present application, the second processing unit 42 is further configured to perform the following steps:
[0151] determine a first change rate of the disk dirty page rate based on the first disk dirty page rate and the second disk dirty page rate;
[0152] determine the target transmission time based on the first change rate and the current transmission time.
[0153] In other embodiments of the present application, the second processing unit 42 is further configured to perform the following steps:
[0154] if the first change rate is less than the second threshold, the target transmission time is obtained by decreasing the current transmission time according to the target ratio;
[0155] if the first change rate is greater than or equal to the second threshold, the target transmission time is determined as the current transmission time.
[0156] In other embodiments of the present application, the second processing unit 42 is further configured to perform the following steps:
[0157] after scheduling the completion of the multiple rounds of memory dirty page transmission, determine a target interrupt time for the next round of memory dirty page transmission based on whether the target condition is met by the virtual machine to be migrated; wherein the target condition includes: the automatic convergence function is enabled, or the automatic convergence function is not enabled and the total number of rounds of current memory dirty page transmission is greater than the starting round of the start interrupt adjustment;
[0158] schedule the transmission of the next round of memory dirty page according to the target transmission time and within the time limit of the target interrupt time.
[0159] In other embodiments of the present application, the second processing unit 42 is further configured to perform the following steps:
[0160] if the target condition is not met, the current interrupt time of the current round of memory dirty page transmission is determined as the target interrupt time;
[0161] if the target condition is met, divide the time period between the interrupt time threshold of the virtual machine to be migrated and the current interrupt time based on the target number of shares, to obtain a plurality of time intervals;
[0162] determine the target interrupt time based on the first memory dirty page rate of the current round of memory dirty page transmission, the second memory dirty page rate of the last round of memory dirty page transmission, the plurality of time intervals and the current interrupt time.
[0163] In other embodiments of the present application, the second processing unit 42 is further configured to perform the following steps:
[0164] determine a second change rate of the memory dirty page rate based on the first memory dirty page rate and the second memory dirty page rate;
[0165] determine the target interrupt time based on the current interrupt time and a time interval.
[0166] In other embodiments of the present application, the second processing unit 42 is further configured to perform the following steps:
[0167] If the second change rate indicates that the memory dirty page rate is decreasing and the decreasing amplitude is less than the third threshold value, or the memory dirty page rate is increasing, the target interrupt time is determined based on the current interrupt time and a time interval; wherein the target interrupt time is less than or equal to the interrupt time threshold value;
[0168] If the second change rate indicates that the memory dirty page rate is decreasing and the decreasing amplitude is greater than or equal to the third threshold value, the current interrupt time is determined as the target interrupt time.
[0169] It should be noted that the specific implementation process of the steps performed by each module in the embodiments of the present application can refer to Figures 1-3 the implementation process of the data migration method provided by the corresponding embodiments, which will not be described here.
[0170] The data migration device provided by the embodiments of the present application dynamically determines the data block granularity of the disk bitmap based on the actual input / output data of the to-be-migrated virtual machine, so that the bitmap granularity matches the average block size of the input / output operation, thereby accurately tracking the dirty page and avoiding the dirty page amplification problem caused by fixed granularity and reducing invalid data transmission. At the same time, after each round of disk dirty page transmission is completed, the target transmission time of the next round of memory dirty page transmission is dynamically calculated according to the dirty page rate and its change trend obtained by tracking the disk bitmap, so that the memory transmission rhythm can adapt to the disk transmission pressure, that is, the transmission time is prolonged to preferentially guarantee the disk bandwidth when the disk dirty page rate is high in the initial stage of migration, and the transmission time is shortened to speed up the memory transmission when the disk load is reduced in the later stage of migration, thereby realizing the dynamic balance of the memory and disk bandwidth resources. And by scheduling the transmission according to the target transmission time, it is ensured that the memory dirty page transmission is executed within the optimal time window, avoiding the migration delay or failure caused by bandwidth competition, ultimately not only reducing the data redundancy and bandwidth conflict in the migration process, but also improving the migration success rate and migration efficiency in the high-load scenario.
[0171] Based on the foregoing embodiments, the embodiments of the present application provide a to-be-migrated virtual machine, which can be applied to Figures 1-3 In the data migration method provided by the corresponding embodiments, refer to Figure 6 As shown in the figure, the to-be-migrated virtual machine 5 can include a processor 51, a memory 52 and a communication bus 53, wherein:
[0172] The communication bus 53 is configured to realize the communication connection between the processor 51 and the memory 52;
[0173] The processor 51 is configured to execute the data migration program in the memory 52 to implement the following steps:
[0174] determine the data block granularity of the disk bitmap of the virtual machine to be migrated based on the input / output data generated by the virtual machine to be migrated during running;
[0175] determine the target transmission time of the next round of memory dirty page transmission based on the first disk dirty page rate obtained by tracking the disk bitmap determined by the data block granularity;
[0176] transmit the next round of memory dirty pages according to the target transmission time.
[0177] In other embodiments of the present application, the processor 51 is configured to execute the data migration program in the memory 52 to determine the data block granularity of the disk bitmap of the virtual machine to be migrated based on the input / output data generated by the virtual machine to be migrated during running, to implement the following steps:
[0178] obtain the number of disk blocks changed and the total write data amount in the sampling period from the input / output data;
[0179] determine the average block granularity of the input / output data based on the number and the total write data amount;
[0180] determine the data block granularity based on the average block granularity and a target strategy; wherein the target strategy represents the mapping relationship between the average block granularity and the data block granularity.
[0181] In other embodiments of the present application, the processor 51 is configured to execute the data migration program in the memory 52 to determine the target transmission time of the next round of memory dirty page transmission based on the first disk dirty page rate obtained by tracking the disk bitmap determined by the data block granularity, to implement the following steps:
[0182] obtain the current transmission time of the current round of memory dirty page transmission;
[0183] determine the target transmission time based on the first disk dirty page rate and the current transmission time.
[0184] In other embodiments of the present application, the processor 51 is configured to execute the data migration program in the memory 52 to determine the target transmission time based on the first disk dirty page rate and the current transmission time, to implement the following steps:
[0185] if the first disk dirty page rate is less than a first threshold value, determine the target transmission time as a target value;
[0186] if the first disk dirty page rate is greater than or equal to the first threshold value, determine the target transmission time based on the first disk dirty page rate, the current transmission time, and a second disk dirty page rate of the last round of disk dirty page transmission.
[0187] In other embodiments of the present application, the processor 51 is configured to execute the data migration program in the memory 52 to determine the target transmission time based on the first disk dirty page rate, the current transmission time and the second disk dirty page rate of the last round of disk dirty page transmission, so as to implement the following steps:
[0188] determine the first change rate of the disk dirty page rate based on the first disk dirty page rate and the second disk dirty page rate;
[0189] determine the target transmission time based on the first change rate and the current transmission time.
[0190] In other embodiments of the present application, the processor 51 is configured to execute the data migration program in the memory 52 to determine the target transmission time based on the first change rate value and the current transmission time, so as to implement the following steps:
[0191] if the first change rate is less than the second threshold value, the target transmission time is obtained by decreasing the current transmission time according to the target proportion;
[0192] if the first change rate is greater than or equal to the second threshold value, the current transmission time is determined as the target transmission time.
[0193] In other embodiments of the present application, the processor 51 is configured to execute the data migration program in the memory 52 to schedule the transmission of the next round of memory dirty pages according to the target transmission time, so as to implement the following steps:
[0194] after scheduling the transmission of multiple rounds of memory dirty pages is completed, the target interruption time of the next round of memory dirty page transmission is determined based on whether the target condition of the to-be-migrated virtual machine is met; wherein the target condition includes: the automatic convergence function is enabled, or the automatic convergence function is not enabled and the total number of rounds of current memory dirty page transmission is greater than the starting round of the start-up shutdown adjustment;
[0195] the transmission of the next round of memory dirty pages is scheduled according to the target transmission time and within the time limit of the target interruption time.
[0196] In other embodiments of the present application, the processor 51 is configured to execute the data migration program in the memory 52 to determine the target interruption time of the next round of memory dirty page transmission based on whether the target condition of the to-be-migrated virtual machine is met, so as to implement the following steps:
[0197] if the target condition is not met, the current interruption time of the current round of memory dirty page transmission is determined as the target interruption time;
[0198] if the target condition is met, a plurality of time intervals are obtained by dividing the time period between the interruption time threshold of the to-be-migrated virtual machine and the current interruption time based on the target share;
[0199] The target interrupt time is determined based on the first memory dirty page rate of the current memory dirty page transmission, the second memory dirty page rate of the last memory dirty page transmission, the plurality of time intervals, and the current interrupt time.
[0200] In other embodiments of the present application, the processor 51 is configured to execute the data migration program in the memory 52 to determine the target interrupt time based on the first memory dirty page rate of the current memory dirty page transmission, the second memory dirty page rate of the last memory dirty page transmission, the plurality of time intervals, and the current interrupt time, to implement the following steps:
[0201] The second change rate of the memory dirty page rate is determined based on the first memory dirty page rate and the second memory dirty page rate.
[0202] The target interrupt time is determined based on the second change rate, the plurality of time intervals, and the current interrupt time.
[0203] In other embodiments of the present application, the processor 51 is configured to execute the data migration program in the memory 52 to determine the target interrupt time based on the second change rate, the plurality of time intervals, and the current interrupt time, to implement the following steps:
[0204] If the second change rate indicates that the memory dirty page rate decreases and the decrease amplitude is less than a third threshold value, or the memory dirty page rate increases, the target interrupt time is determined based on the current interrupt time and one time interval; wherein the target interrupt time is less than or equal to the interrupt time threshold value.
[0205] If the second change rate indicates that the memory dirty page rate decreases and the decrease amplitude is greater than or equal to the third threshold value, the current interrupt time is determined as the target interrupt time.
[0206] It should be noted that the specific description of the steps performed by the processor can refer to the description of the steps performed by the processor in the data migration method provided by the corresponding embodiments. Figures 1-3 The implementation process in the data migration method provided by the corresponding embodiments is not described here.
[0207] The virtual machine to be migrated provided by the embodiments of the present application dynamically determines the data block granularity of the disk bitmap based on the actual input / output data of the virtual machine to be migrated, so that the bitmap granularity matches the average block size of the input / output operation, thereby accurately tracking dirty pages, avoiding the problem of dirty page amplification caused by fixed granularity, and reducing invalid data transmission. Meanwhile, after the completion of each round of disk dirty page transmission, the target transmission time of the next round of memory dirty page transmission is dynamically calculated according to the dirty page rate and its change trend obtained by tracking the disk bitmap, so that the memory transmission rhythm can adapt to the disk transmission pressure, that is, when the disk dirty page rate is high at the initial stage of migration, the transmission time is prolonged to preferentially guarantee the disk bandwidth, and when the disk load decreases at the later stage of migration, the transmission time is shortened to speed up the memory transmission, thereby realizing the dynamic balance of the memory and the disk bandwidth resources. Moreover, by scheduling the transmission according to the target transmission time, it is ensured that the memory dirty page transmission is executed within the optimal time window, avoiding the migration delay or failure caused by bandwidth competition, and finally not only reducing the data redundancy and bandwidth conflict in the migration process, but also improving the migration success rate and migration efficiency in the high-load scenario.
[0208] Based on the foregoing embodiments, the embodiments of the present application provide a computer readable storage medium, the storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement Figures 1-3 The steps in the data migration method provided by the corresponding embodiments.
[0209] Based on the foregoing embodiments, the embodiments of the present application provide a computer program product, the computer program being executed by a processor to implement Figures 1-3 The steps in the data migration method provided by the corresponding embodiments.
[0210] It should be noted that the computer readable storage medium above can be a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Ferromagnetic Random Access Memory (FRAM), a Flash Memory, a magnetic surface memory, an optical disc, or a Compact Disc Read-Only Memory (CD-ROM) memory, etc. It can also be various electronic devices including one or any combination of the above memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.
[0211] It should be noted that in this paper, the term "include", "contain" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0212] The above application embodiment serial number is only for description, not representing the pros and cons of the embodiment.
[0213] Through the above description of the embodiments, those skilled in the art can clearly understand that the above embodiment method can be realized by software plus the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better implementation. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disc, optical disc) and includes a number of instructions for making a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the methods described in various embodiments of the present application.
[0214] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0215] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0216] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0217] The above merely provides the preferred embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent flow transformation made by using the content of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data migration method, characterized in that, The method includes: The data block granularity of the disk bitmap of the virtual machine to be migrated is determined based on the average block granularity of the input / output data generated during the operation of the virtual machine to be migrated. After each round of dirty page transfer is completed, the target transfer time for the next round of dirty page transfer is determined based on the first dirty page rate obtained by disk bitmap tracking determined by the data block granularity. Schedule the next round of dirty page transfers according to the target transfer time; The step of determining the target transfer time for the next round of dirty page transfer based on the first dirty page rate obtained from the disk bitmap tracking determined by the data block granularity includes: If the dirty page rate of the first disk is less than the first threshold, the target transfer time is determined to be the target value; If the first disk dirty page rate is greater than or equal to the first threshold, the target transmission time is determined based on the first disk dirty page rate, the current transmission time of the current round of memory dirty page transmission, and the second disk dirty page rate of the previous round of disk dirty page transmission. The step of scheduling the next round of dirty page transfers according to the target transfer time includes: After multiple rounds of dirty page transfers are completed, the target interruption time for the next round of dirty page transfers is determined based on whether the virtual machine to be migrated meets the target conditions. The target conditions include automatic convergence being enabled, or automatic convergence not being enabled and the total number of rounds of current dirty page transfers being greater than the starting round for initiating shutdown adjustment. According to the target transmission time, and within the time limit of the target interruption time, the next round of dirty page transmission is scheduled.
2. The method according to claim 1, characterized in that, The process of determining the data block granularity of the disk bitmap of the virtual machine to be migrated based on the average block granularity of the input / output data generated during the operation of the virtual machine includes: From the input / output data, obtain the number of disk blocks that changed during the sampling period and the total amount of data written; Based on the quantity and the total amount of data written, determine the average block granularity of the input / output data; Based on the average block granularity and the target strategy, the data block granularity is determined; wherein, the target strategy is a preset mapping table used to map different average block granularities to corresponding data block granularities.
3. The method according to claim 1, characterized in that, Based on the first dirty page rate obtained from disk bitmap tracking determined by the data block granularity, the target transfer time for the next round of dirty page transfer is determined, including: Get the current transfer time of this round of dirty page transfer.
4. The method according to claim 1, characterized in that, Determining the target transfer time based on the first disk dirty page rate, the current transfer time, and the second disk dirty page rate from the previous round of disk dirty page transfer includes: Based on the first disk dirty page rate and the second disk dirty page rate, a first rate of change of the disk dirty page rate is determined; The target transmission time is determined based on the first rate of change and the current transmission time.
5. The method according to claim 4, characterized in that, Determining the target transmission time based on the first rate of change value and the current transmission time includes: If the first rate of change is less than the second threshold, the target transmission time is obtained by subtracting the current transmission time from the target ratio. If the first rate of change is greater than or equal to the second threshold, the current transmission time is determined to be the target transmission time.
6. The method according to claim 1, characterized in that, Based on whether the virtual machine to be migrated meets the target conditions, the target outage time for the next round of dirty page transfer is determined, including: If the target condition is not met, the current interrupt time of this round of dirty page transfer is determined as the target interrupt time; If the target conditions are met, the time period between the interruption time threshold of the virtual machine to be migrated and the current interruption time is divided based on the target number of copies to obtain multiple time intervals; The target interrupt time is determined based on the first dirty page rate of the current round of dirty page transfer, the second dirty page rate of the previous round of dirty page transfer, the multiple time intervals, and the current interrupt time.
7. The method according to claim 6, characterized in that, The determination of the target interrupt time based on the first dirty page rate of the current round of dirty page transfer, the second dirty page rate of the previous round of dirty page transfer, the multiple time intervals, and the current interrupt time includes: Based on the first dirty page rate and the second dirty page rate, a second rate of change of the dirty page rate is determined; The target interruption time is determined based on the second rate of change, the plurality of time intervals, and the current interruption time.
8. The method according to claim 7, characterized in that, Determining the target interruption time based on the second rate of change, the plurality of time intervals, and the current interruption time includes: If the second rate of change indicates that the dirty page rate is decreasing and the decrease is less than the third threshold, or the dirty page rate is increasing, the target interrupt time is determined based on the current interrupt time and a time interval; wherein the target interrupt time is less than or equal to the interrupt time threshold. If the second rate of change indicates that the dirty page rate of memory is decreasing and the decrease is greater than or equal to the third threshold, the current interrupt time is determined as the target interrupt time.
9. A data migration device, characterized in that, The device includes: The first processing unit is used to determine the data block granularity of the disk bitmap of the virtual machine to be migrated based on the average block granularity of the input / output data generated during the operation of the virtual machine to be migrated. The second processing unit is used to determine the target transfer time for the next round of memory dirty page transfer based on the first disk dirty page rate obtained by disk bitmap tracking determined by the data block granularity after each round of disk dirty page transfer is completed. The transmission unit is used to schedule the transmission of the next round of dirty pages in memory according to the target transmission time; The second processing unit is further configured to determine the target transmission time as a target value if the first disk dirty page rate is less than a first threshold; and to determine the target transmission time based on the first disk dirty page rate, the current transmission time of the current round of memory dirty page transmission, and the second disk dirty page rate of the previous round of disk dirty page transmission if the first disk dirty page rate is greater than or equal to the first threshold. The transmission unit is further configured to, after scheduling multiple rounds of dirty page transfers, determine the target interruption time for the next round of dirty page transfers based on whether the virtual machine to be migrated meets the target conditions; wherein, the target conditions include that the automatic convergence function is enabled, or that the automatic convergence function is not enabled and the total number of rounds of current dirty page transfers is greater than the starting round of the start-up shutdown adjustment; and to schedule the next round of dirty page transfers according to the target transfer time and within the time limit of the target interruption time.
10. A virtual machine to be migrated, characterized in that, The virtual machine to be migrated includes: a processor, memory, and a communication bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute a data migration program in memory to implement the steps of the data migration method as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the steps of the data migration method as described in any one of claims 1 to 8.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the data migration method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Virtual machine live migration method and device, electronic equipment and storage medium
CN114942825A