A method and device for estimating time consumption of thermal migration and a computer device
By obtaining the initial dirty page rate and migration bandwidth of the target virtual machine through phased virtual iteration, the problem of inaccurate prediction of auto-converge hot migration time in the existing technology is solved, and accurate prediction of migration time of high-load virtual machines is achieved.
Patent Information
- Application Number
- CN202210911202.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-29
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-07-29
AI Technical Summary
Existing methods for estimating the time taken for hot migration are not applicable to auto-converge hot migration, resulting in limited migration capabilities for high-load virtual machines and poor prediction accuracy.
By obtaining the initial dirty page rate and migration bandwidth of the target virtual machine, virtual iterations are performed in stages until the dirty page rate is less than a specified threshold and the dirty page memory is less than the threshold. The iteration time of the first stage and the second stage are calculated separately and then combined to obtain the expected total migration time.
It achieves accurate prediction of auto-converge hot migration time, improving prediction accuracy.
Smart Images

Figure CN115480867B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of virtual machine technology, specifically to a method, apparatus, and computer device for estimating hot migration time. Background Technology
[0002] Live migration refers to the complete preservation of a virtual machine's running state, allowing for rapid restoration to the original hardware platform or even a different hardware platform. In cloud computing environments, live migration technology can be used to ensure business continuity for customers, improve the utilization of cloud data center hardware resources, and achieve load balancing.
[0003] Because connections from clients cannot be disconnected during hot migration, client services continue to operate normally while virtual machines are being migrated, resulting in a continuous generation of dirty data. When the load is high and dirty data generation is rapid, it increases migration time and limits performance, negatively impacting the client experience. Therefore, accurate estimation of migration time is crucial for better migration management and operation. Currently, most estimation methods are based on ordinary hot migration, but the parameter assumptions of ordinary hot migration are overly idealistic and inconsistent with the mainstream auto-converge hot migration. For example, existing estimation methods often assume a constant dirty page rate, while in mainstream auto-converge hot migration, virtual machines are rate-limited to accelerate migration convergence, resulting in a gradual decrease in the dirty page rate.
[0004] Therefore, existing estimation methods are not suitable for estimating the time required for auto-converge hot migration, and their migration capability for high-load virtual machines is very limited, resulting in poor estimation accuracy. Summary of the Invention
[0005] This application provides a method, apparatus, and computer device for estimating hot migration time, which solves the technical problem that existing estimation methods are not applicable to estimating auto-converge hot migration time and have very limited migration capabilities for high-load virtual machines, resulting in poor estimation accuracy.
[0006] On the one hand, a method for estimating the time required for thermal migration is provided, the method comprising:
[0007] Obtain the initial dirty page rate of the target virtual machine and the migration bandwidth of the target virtual machine;
[0008] Based on the initial dirty page rate and the migration bandwidth, a first-stage virtual iteration is performed on the initial dirty page memory of the target virtual machine until the dirty page rate of the target virtual machine is less than a specified threshold; the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations in the first-stage virtual iteration.
[0009] The stable dirty page rate is determined based on the dirty page rate of the last virtual iteration in the first stage of virtual iteration.
[0010] Based on the stable dirty page rate and the migration bandwidth, the dirty page memory of the target virtual machine after the first stage of virtual iteration is subjected to a second stage of virtual iteration until the dirty page memory of the target virtual machine is less than the dirty page threshold.
[0011] The estimated total virtual migration time of the target virtual machine is determined by summing the first virtual iteration time of the first stage virtual iteration with the second virtual iteration time of the second stage virtual iteration.
[0012] In another aspect, a device for estimating the time required for thermal migration is provided, the device comprising:
[0013] The rate and bandwidth acquisition module is used to acquire the initial dirty page rate of the target virtual machine and the migration bandwidth of the target virtual machine.
[0014] The first-stage virtual iteration module is used to perform a first-stage virtual iteration on the initial dirty page memory of the target virtual machine based on the initial dirty page rate and the migration bandwidth, until the dirty page rate of the target virtual machine is less than a specified threshold; the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations in the first-stage virtual iteration.
[0015] The stable dirty page rate determination module is used to determine the stable dirty page rate based on the dirty page rate of the last virtual iteration process in the first stage of virtual iteration.
[0016] The second-stage virtual iteration module is used to perform a second-stage virtual iteration on the dirty page memory of the target virtual machine after the first-stage virtual iteration, based on the stable dirty page rate and the migration bandwidth, until the dirty page memory of the target virtual machine is less than the dirty page threshold.
[0017] The total live migration time estimation module is used to sum the first virtual iteration time of the first stage virtual iteration and the second virtual iteration time of the second stage virtual iteration to determine the estimated total virtual migration time of the target virtual machine.
[0018] In one possible implementation, the specified threshold is 0.5 times the migration bandwidth.
[0019] In one possible implementation, the initial dirty page memory is the actual physical memory used by the target virtual machine.
[0020] In one possible implementation, the rate and bandwidth acquisition module is further configured to:
[0021] Obtain the historical migration information of the target virtual machine;
[0022] Based on the historical migration information, the historical migration bandwidth is extracted and determined as the migration bandwidth of the target virtual machine.
[0023] In one possible implementation, the rate and bandwidth acquisition module is further configured to:
[0024] When the target virtual machine does not have corresponding historical migration information, the available bandwidth from the compute node where the target virtual machine is located to the migration target node is counted in real time, and the available bandwidth is determined as the migration bandwidth of the target virtual machine.
[0025] In one possible implementation, the first-stage virtual iteration module is further configured to:
[0026] The Nth virtual iteration time is determined based on the total number of Nth dirty pages and the migration bandwidth.
[0027] The total number of N+1 dirty pages is generated based on the Nth dirty page rate and the Nth virtual iteration time.
[0028] The (N+1)th dirty page rate is determined based on the Nth dirty page rate;
[0029] The N+1th virtual iteration time is determined based on the migration bandwidth and the total number of N+1th dirty pages.
[0030] In one possible implementation, the second-stage virtual iteration module is further configured to:
[0031] The total number of stable dirty pages (M+1) is determined based on the stable dirty page rate and the Mth stable iteration time.
[0032] The M+1 stable virtual iteration time is determined based on the total number of stable dirty pages and the migration bandwidth.
[0033] In one possible implementation, the total thermal migration time estimation module is further configured to:
[0034] Obtain the first virtual iteration count of the first stage virtual iteration and the second virtual iteration count of the second stage virtual iteration;
[0035] When the sum of the first virtual iteration count and the second virtual iteration count is less than the target virtual iteration count, the migration task of the target virtual machine is determined to have converged, and the sum of the first virtual iteration time and the second virtual iteration time is determined as the expected total virtual migration time of the target virtual machine.
[0036] In another aspect, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, the at least one instruction being loaded and executed by the processor to implement a method for estimating the thermal migration time as described above.
[0037] In another aspect, a computer-readable storage medium is provided, wherein at least one instruction is stored therein, the at least one instruction being loaded and executed by a processor to implement a method for estimating the thermal migration time as described above.
[0038] The technical solution provided in this application may include the following beneficial effects:
[0039] This application first obtains the initial dirty page rate and migration bandwidth of the target virtual machine, and then performs a first-stage virtual iteration on the initial dirty page memory of the target virtual machine based on the initial dirty page rate and migration bandwidth until the dirty page rate of the target virtual machine is less than a specified threshold. Then, based on the dirty page rate of the last virtual iteration in the first-stage virtual iteration, a stable dirty page rate is determined. Subsequently, based on the stable dirty page rate and the migration bandwidth, a second-stage virtual iteration is performed on the dirty page memory of the target virtual machine after the first-stage virtual iteration until the dirty page memory of the target virtual machine is less than the dirty page threshold. Finally, the first virtual iteration time of the first-stage virtual iteration and the second virtual iteration time of the second-stage virtual iteration are summed to determine the expected total virtual migration time of the target virtual machine.
[0040] In the above scheme, the migration process of the target virtual machine is divided into a first virtual migration and a second-stage virtual iteration. During the first virtual migration, the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations in the first stage, that is, the dirty page rate of the target virtual machine decreases proportionally and is in a slowdown phase. During the second virtual migration, the dirty page rate of the target virtual machine remains basically unchanged and is in a stable phase, eventually degenerating into a normal migration. This application calculates the number of iterations and migration time of the target virtual machine in stages, thereby achieving an accurate prediction of the migration time of the target virtual machine and improving the prediction accuracy. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0042] Figure 1 This is a schematic diagram illustrating the virtual machine memory migration iteration based on the background technology.
[0043] Figure 2 This is a schematic diagram illustrating the rate variation of auto-converge hot migration dirty pages according to an exemplary embodiment.
[0044] Figure 3 This is a flowchart illustrating a method for estimating thermal migration time according to an exemplary embodiment.
[0045] Figure 4 This is a flowchart illustrating a method for estimating thermal migration time according to an exemplary embodiment.
[0046] Figure 5 This is a flowchart illustrating an auto-converge hot migration time estimation according to an exemplary embodiment.
[0047] Figure 6 This is a structural block diagram illustrating a device for estimating thermal migration time according to an exemplary embodiment.
[0048] Figure 7 A structural block diagram of a computer device illustrated in an exemplary embodiment of this application is shown. Detailed Implementation
[0049] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0050] It should be understood that in the description of the embodiments of this application, the term "correspondence" may indicate that there is a direct or indirect correspondence between the two, or that there is an association between the two, or that there is a relationship of instruction and being instructed, configuration and being configured, etc.
[0051] Figure 1 This is a schematic diagram illustrating the virtual machine memory migration iteration based on the background technology. For example... Figure 1 As shown, in the existing technology, almost all the dirty memory of the target virtual machine needs to be sent to the destination during the first iteration. The total dirty memory during the first iteration is the total memory M. If the sending bandwidth (or migration bandwidth) is a constant B, then the time for the first iteration of the target virtual machine can be calculated as follows:
[0052]
[0053] The total number of dirty pages in the second iteration is approximately the total number of newly generated dirty pages during the first iteration. Therefore, the total number of dirty pages in the second iteration is:
[0054]
[0055] Where d represents the dirty page rate; ρ is a constant representing the ratio between the dirty page rate and the migration bandwidth, ρ = d / B; i ∈ [1, n], ti represents the time of the i-th iteration; vi represents the total number of dirty pages in the i-th iteration.
[0056] Therefore, based on the above algorithm, the time for the second iteration can be calculated as follows:
[0057]
[0058] The time for the 3rd iteration is:
[0059]
[0060] The time for the nth iteration is:
[0061]
[0062] Assuming the migration converges after a total of n iterations, the total migration time is:
[0063]
[0064] Where ts represents the downtime and other fixed time consumption of the target virtual machine, and C is a small constant.
[0065] As can be seen from the above, the existing technology assumes that the dirty page rate d is constant. However, in auto-converge migration, in order to accelerate migration convergence, after every two iterations, if the dirty page rate d / transmission bandwidth B > 0.5, the vcpu (CPU in the target virtual machine) is rate-limited once. Therefore, the percentage of vcpu (CPU in the target virtual machine) that is rate-limited can be obtained as follows:
[0066] 0%->20%->30%->40%->50%->60%->70%->80%->90%->99%;
[0067] Please refer to Figure 2 The diagram showing the change in the rate of auto-converge hot migration of dirty pages is as follows: Figure 2 As shown, each iteration must take longer than 1000ms; if this requirement is not met, multiple iterations will be accumulated. Therefore, the dirty page rate will gradually decrease during the auto-converge hot migration process, decreasing a maximum of 9 times, and eventually remaining essentially unchanged, meaning it will eventually degenerate into a normal migration. Existing technical solutions are not applicable to auto-converge hot migration.
[0068] Furthermore, in existing technologies, M represents the total memory. However, in reality, the target virtual machine may not fully utilize all memory, and using the total memory will lead to a significantly overestimated result. Secondly, existing technologies do not limit the total number of dirty pages in each iteration. In reality, the total number of dirty pages in a single iteration cannot exceed the total memory. According to the principle of locality, the total number of dirty pages is generally significantly smaller than the total memory, thus the estimation results of existing technologies have a large deviation. Moreover, existing technologies do not send the current total number of dirty pages in each iteration. Instead, when the total number of dirty pages is less than a certain threshold, new dirty page data is resynchronized and the next iteration begins. Therefore, ignoring this threshold in existing technologies also leads to significant estimation errors.
[0069] Figure 3 This is a flowchart illustrating a method for estimating thermal migration time according to an exemplary embodiment. Figure 3 As shown, the estimation method may include the following steps:
[0070] Step S301: Obtain the initial dirty page rate of the target virtual machine and obtain the migration bandwidth of the target virtual machine.
[0071] In one possible implementation, when estimating the migration time of the target virtual machine, the initial dirty page rate and migration bandwidth of the target virtual machine are first obtained, wherein the initial dirty page rate is a constant dirty page rate d.
[0072] Optionally, the migration bandwidth can be the transmission bandwidth B, which is a constant.
[0073] Step S302: Based on the initial dirty page rate and the migration bandwidth, perform a first-stage virtual iteration on the initial dirty page memory of the target virtual machine until the dirty page rate of the target virtual machine is less than a specified threshold; the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations in the first-stage virtual iteration.
[0074] In one possible implementation, after obtaining the migration bandwidth of the target virtual machine, a first-stage virtual iteration is performed on the initial dirty page memory of the target virtual machine based on the initial dirty page rate and the migration bandwidth. During the first-stage virtual iteration, the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations of the first-stage virtual iteration, that is, the dirty page rate of the target virtual machine decreases as the number of iterations of the first-stage virtual iteration decreases. When the dirty page rate of the target virtual machine decreases to less than a specified threshold, the target virtual machine ends the first-stage virtual iteration process.
[0075] Step S303: Determine the stable dirty page rate based on the dirty page rate of the last virtual iteration in the first stage of virtual iteration.
[0076] In one possible implementation, after the target virtual machine finishes the first phase of virtual iteration, the dirty page rate of the target virtual machine has decreased to a certain extent and eventually remains basically unchanged. At this time, the target virtual machine will enter the second phase of virtual iteration, and the dirty page rate of the last virtual iteration in the first phase of virtual iteration will be determined as the stable dirty page rate of the second phase of virtual iteration.
[0077] Step S304: Based on the stable dirty page rate and the migration bandwidth, perform a second stage of virtual iteration on the dirty page memory of the target virtual machine after the first stage of virtual iteration, until the dirty page memory of the target virtual machine is less than the dirty page threshold.
[0078] In one possible implementation, after determining the dirty page rate of the last virtual iteration in the first virtual iteration as the stable dirty page rate of the second virtual iteration, the second virtual iteration is performed on the dirty page memory of the target virtual machine after the first virtual iteration, in the same manner as the first virtual iteration, based on the stable dirty page rate and the migration bandwidth. When the dirty page memory of the target virtual machine is less than the dirty page threshold, the target virtual machine ends the process of the second virtual iteration.
[0079] Step S305: Sum the first virtual iteration time of the first stage virtual iteration with the second virtual iteration time of the second stage virtual iteration to determine the total estimated virtual migration time of the target virtual machine.
[0080] In one possible implementation, after the target virtual machine finishes the first phase of virtual iteration and the second phase of virtual iteration, the first virtual iteration time of the first phase of virtual iteration and the second virtual iteration time of the second phase of virtual iteration are calculated, and the first virtual iteration time and the second virtual iteration time are summed. The result of the summation is used to determine the expected total virtual migration time of the target virtual machine.
[0081] In summary, this application first obtains the initial dirty page rate and migration bandwidth of the target virtual machine, and then performs a first-stage virtual iteration on the initial dirty page memory of the target virtual machine based on the initial dirty page rate and migration bandwidth until the dirty page rate of the target virtual machine is less than a specified threshold. Next, a stable dirty page rate is determined based on the dirty page rate of the last virtual iteration in the first-stage virtual iteration. Then, based on the stable dirty page rate and the migration bandwidth, a second-stage virtual iteration is performed on the dirty page memory of the target virtual machine after the first-stage virtual iteration until the dirty page memory of the target virtual machine is less than the dirty page threshold. Finally, the first virtual iteration time of the first-stage virtual iteration and the second virtual iteration time of the second-stage virtual iteration are summed to determine the expected total virtual migration time of the target virtual machine.
[0082] In the above scheme, the migration process of the target virtual machine is divided into a first virtual migration and a second-stage virtual iteration. During the first virtual migration, the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations in the first stage, that is, the dirty page rate of the target virtual machine decreases proportionally and is in a slowdown phase. During the second virtual migration, the dirty page rate of the target virtual machine remains basically unchanged and is in a stable phase, eventually degenerating into a normal migration. This application calculates the number of iterations and migration time of the target virtual machine in stages, thereby achieving an accurate prediction of the migration time of the target virtual machine and improving the prediction accuracy.
[0083] Figure 4 This is a flowchart illustrating a method for estimating thermal migration time according to an exemplary embodiment. Figure 4 As shown, the estimation method may include the following steps:
[0084] Step S401: Obtain the initial dirty page rate of the target virtual machine and obtain the migration bandwidth of the target virtual machine.
[0085] In one possible implementation, the historical migration information of the target virtual machine is obtained;
[0086] Based on this historical migration information, the historical migration bandwidth is extracted and determined as the migration bandwidth of the target virtual machine.
[0087] In one possible implementation, when the target virtual machine does not have corresponding historical migration information, the available bandwidth from the compute node where the target virtual machine is located to the migration target node is counted in real time, and the available bandwidth is determined as the migration bandwidth of the target virtual machine.
[0088] For further details, please refer to Figure 5 The flowchart shown illustrates an auto-converge hot migration time estimation process. When estimating the migration time of a target virtual machine, it's necessary to first obtain the initial dirty page rate and migration bandwidth of the target virtual machine. The initial dirty page rate is a constant dirty page rate d. When obtaining the migration bandwidth, the historical migration information of the target virtual machine is first searched, and the historical migration bandwidth Bh is extracted from this information and determined as the migration bandwidth B of the target virtual machine. If no historical migration information exists for the target virtual machine, the available bandwidth from the compute node where the target virtual machine resides to the target migration node is calculated in real time, and this available bandwidth is determined as the migration bandwidth B of the target virtual machine.
[0089] In one possible implementation, when the target virtual machine performs its first virtual migration, there is no historical migration information for the target virtual machine, and the available bandwidth is determined as the migration bandwidth B of the target virtual machine.
[0090] Optionally, the available bandwidth can be the current available bandwidth Ba from the compute node where the target virtual machine resides to the target migration node.
[0091] Step S402: Based on the initial dirty page rate and the migration bandwidth, perform a first-stage virtual iteration on the initial dirty page memory of the target virtual machine until the dirty page rate of the target virtual machine is less than a specified threshold; the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations in the first-stage virtual iteration.
[0092] In one possible implementation, the specified threshold is 0.5 times the migration bandwidth.
[0093] In one possible implementation, the initial dirty page memory is the actual physical memory used by the target virtual machine;
[0094] Before performing the first-stage virtual iteration on the initial dirty page memory of the target virtual machine, the method further includes:
[0095] Based on the ratio between the initial dirty page rate and the actual physical memory used, obtain the target time interval and the average dirty page rate of the target virtual machine under the target time interval;
[0096] Based on the target time interval and the average dirty page rate, the upper limit of the total number of dirty pages is obtained.
[0097] In one possible implementation, the Nth virtual iteration time is determined based on the total number of Nth dirty pages and the migration bandwidth;
[0098] Based on the Nth dirty page rate and the Nth virtual iteration time, generate the total number of N+1 dirty pages;
[0099] Based on the Nth dirty page rate, determine the (N+1)th dirty page rate;
[0100] The N+1 virtual iteration time is determined based on the migration bandwidth and the total number of N+1 dirty pages.
[0101] Furthermore, after obtaining the initial dirty page rate of the target virtual machine, information such as the total memory, RSS (Real Use Memory), and maxdowntime (maximum downtime) of the target virtual machine are acquired, and the actual physical memory (RSS) used by the target virtual machine is extracted and determined as the initial dirty page memory. To address the issue of inaccurate total memory in existing technologies, using the actual memory occupied by the cloud host on the host machine, i.e., the aforementioned actual physical memory (RSS), as the total memory is more accurate and reasonable.
[0102] Furthermore, after determining the actual physical memory used (RSS) as the initial dirty page memory, the ratio between the initial dirty page rate and the actual physical memory used (RSS) is calculated; this ratio is the target time interval t (t = RSS / d). Then, the average dirty page rate dm of the target virtual machine under the target time interval t is obtained. Finally, the product between the target time interval t and the average dirty page rate dm is determined as the upper limit of the total dirty page count (the upper limit of the total dirty page count = dm * RSS / d = dm * t). During the iterative virtual migration of the target virtual machine, the total dirty page count of each virtual migration must be controlled within the upper limit of the total dirty page count. When the total dirty page count generated by any virtual migration of the target virtual machine is greater than the upper limit of the total dirty page count, the upper limit of the total dirty page count is directly determined as the total dirty page count generated by this virtual migration for calculation, so as to find the iteration time corresponding to this virtual migration.
[0103] For example, during the first stage of virtual iteration, if the total number of dirty pages generated in the N+1th zone is greater than the upper limit of the total number of dirty pages, then the N+1th iteration is determined directly based on the upper limit of the total number of dirty pages and the migration bandwidth.
[0104] Optionally, regarding the upper limit of the total number of dirty pages, the principle is as follows: Assuming the upper limit of the total number of dirty pages does not exceed the actual used physical memory (RSS), even if all the actual used physical memory (RSS) is written to dirty at a dirty page rate d, it only takes time t. Therefore, the upper limit of the total number of dirty pages can be reached within the target time interval t. If the time is longer, the memory will be repeatedly updated, but the total number of dirty pages will not increase. Therefore, the increase in the number of dirty pages within the target time interval t is the upper limit of the total number of dirty pages. (Since the increase in the number of dirty pages remains constant, the average dirty page rate will decrease as time increases. Therefore, the measurement of the dirty page rate is related to the measurement time interval.)
[0105] Optionally, if the above methods are unavailable, the current memory usage of the guest (i.e., the machine) can be obtained through mechanisms such as mem_balloon (memory balloon) or qemu-guest-agent (the daemon inside the target virtual machine). The total number of dirty pages should not exceed the current memory usage. This upper limit for the total number of dirty pages is also more accurate than directly using the actual physical memory used (RSS) as the upper limit.
[0106] Furthermore, after determining the actual physical memory used (RSS), initial dirty page rate, migration bandwidth, and upper limit of the total number of dirty pages for the target virtual machine, these values are input into the algorithm of the deceleration stage to calculate the number of iterations and virtual migration time of the deceleration stage. The deceleration stage is the aforementioned first virtual iteration stage, and the number of iterations and virtual migration time of the deceleration stage also correspond to the first virtual iteration number and first virtual iteration time of the aforementioned first virtual iteration stage.
[0107] Optionally, the pseudocode for this deceleration phase algorithm is as follows:
[0108]
[0109]
[0110] Optionally, when the ratio between the dirty page rate d and the migration bandwidth B is less than (or equal to) 0.5, the first stage of the virtual iteration process of the target virtual machine ends and the second stage of virtual iteration begins.
[0111] Optionally, when the vcpu (CPU within the target virtual machine) is throttled to 99%, the first phase of the virtual iteration process of the target virtual machine ends, and the second phase of the virtual iteration begins.
[0112] Optionally, during the hot migration process, the target virtual machine will check whether all memory pages are zero pages. If all memory pages are zero, only a very small amount of data will be sent; otherwise, all data will be sent. Zero page (page 0) determination is time-consuming. Since zero pages (page 0) generally exist mainly in the first iteration, their number is approximately (total memory M - actual physical memory used RSS). Therefore, the time for the first iteration needs to be additionally considered for zero page (page 0) determination time: (total memory M - actual physical memory used RSS) / Bz, where Bz is the zero page (page 0) determination rate. Zero pages (page 0) affect the amount of data sent, thus reducing the real-time transmission bandwidth. Therefore, the transmission bandwidth for the first iteration should be appropriately reduced, with the reduction amount related to the number of zero pages (page 0).
[0113] Step S403: Determine the stable dirty page rate based on the dirty page rate of the last virtual iteration process in the first stage of virtual iteration.
[0114] In one possible implementation, when the first stage of virtual iteration of the target virtual machine ends and enters the second stage of virtual iteration, the dirty page rate of the last virtual iteration in the first stage of virtual iteration is determined as the stable dirty page rate in the second stage of virtual iteration. The second stage of virtual iteration corresponds to a stable stage, in which the dirty page rate is basically unchanged and is called the stable dirty page rate.
[0115] Step S404: Based on the stable dirty page rate and the migration bandwidth, perform a second stage of virtual iteration on the dirty page memory of the target virtual machine after the first stage of virtual iteration, until the dirty page memory of the target virtual machine is less than the dirty page threshold.
[0116] In one possible implementation, the total number of stable dirty pages for the (M+1)th time is determined based on the stable dirty page rate and the Mth stable iteration time.
[0117] The M+1 stable virtual iteration time is determined based on the total number of stable dirty pages and the migration bandwidth.
[0118] Optionally, the pseudocode for this stable phase algorithm is as follows:
[0119]
[0120] Optionally, because existing technologies do not send the total number of dirty pages in each iteration, but instead resynchronize new dirty page data and enter the next iteration when the total number of dirty pages is less than a certain threshold, the existing technology ignores this threshold, leading to significant prediction errors. Regarding this threshold, its value is approximately maxdowntime (maximum downtime) * migration bandwidth B, which needs to be deducted from the actual physical memory used (RSS). Since the maxdowntime data is deducted, the original iteration termination condition is no longer suitable. Based on the migration logic and measured data, a new termination condition is derived: ts < 51ms. That is, when ts < 51ms, the second phase of the virtual iteration of the target virtual machine ends. Here, ts represents the downtime and other fixed time consumption of the target virtual machine.
[0121] Step S405: Obtain the first virtual iteration number of the first stage virtual iteration and the second virtual iteration number of the second stage virtual iteration.
[0122] In one possible implementation, after the target virtual machine finishes the first stage virtual iteration process and the second stage virtual iteration process, the first virtual iteration number of the first stage virtual iteration and the second virtual iteration number of the second stage virtual iteration are obtained in order to determine whether the hot migration task of the target virtual machine has converged.
[0123] Step S406: When the sum of the first virtual iteration count and the second virtual iteration count is less than the target virtual iteration count, it is determined that the hot migration task of the target virtual machine has converged, and the sum of the first virtual iteration time and the second virtual iteration time is determined as the expected total virtual migration time of the target virtual machine.
[0124] In one possible implementation, when the sum of the first virtual iteration count and the second virtual iteration count is less than (or equal to) the target virtual iteration count (which is the target virtual iteration count...), Figure 5 When X) is reached, the hot migration task of the target virtual machine is determined to have converged. At this time, the first virtual iteration time of the first stage virtual iteration and the second virtual iteration time of the second stage virtual iteration are calculated, and the first virtual iteration time and the second virtual iteration time are summed. The result of the summation is used to determine the expected total virtual migration time of the target virtual machine.
[0125] Furthermore, if the sum of the first virtual iteration count and the second virtual iteration count exceeds the target virtual iteration count, the hot migration task is considered non-convergent. The target virtual iteration count can be set as needed.
[0126] The following simple example illustrates the content disclosed in the above embodiments:
[0127] Taking any virtual machine (e.g., 4 cores, 8 RAM) as an example, the estimated total time for hot migration of this virtual machine includes the following steps:
[0128] 1) Start the virtual machine and perform memory compression;
[0129] 2) Obtain the dirty page rate d of the virtual machine;
[0130] 3) Obtain information such as the total memory of the virtual machine, the actual physical memory used (RSS), and the maximum downtime.
[0131] 4) Obtain the average dirty page rate dm of the virtual machine at the target time interval t = RSS / d, then the upper limit of the total number of dirty pages is dm * RSS / d;
[0132] 5) Locate the historical migration information of the virtual machine, extract the historical migration bandwidth Bh from it, and determine it as the migration bandwidth B of the virtual machine;
[0133] 6) If there is no historical migration information, the current available bandwidth Ba is counted in real time and determined as the migration bandwidth B of the virtual machine;
[0134] 7) Based on the multiple parameter information obtained in the above steps (dirty page rate d, actual physical memory used (RSS), maximum amount of dirty pages, migration bandwidth B), substitute them into the algorithm for the deceleration stage and the stabilization stage. If the number of iterations is greater than a certain empirical value X (and the specified threshold mentioned above), the migration is considered to be non-convergent; otherwise, the migration is considered to be convergent, and the migration time information is output.
[0135] 8) Perform auto-converge hot migration on the virtual machine. After the migration is complete, check the actual time and number of iterations, and compare them with the predicted results. The comparison results are shown in Table 1:
[0136] Table 1
[0137] Whether it converges Number of iterations Migration time Forecast yes 15 33.151s actual yes 12 28.333s error / 25% 17%
[0138] In summary, this application first obtains the initial dirty page rate and migration bandwidth of the target virtual machine, and then performs a first-stage virtual iteration on the initial dirty page memory of the target virtual machine based on the initial dirty page rate and migration bandwidth until the dirty page rate of the target virtual machine is less than a specified threshold. Next, a stable dirty page rate is determined based on the dirty page rate of the last virtual iteration in the first-stage virtual iteration. Then, based on the stable dirty page rate and the migration bandwidth, a second-stage virtual iteration is performed on the dirty page memory of the target virtual machine after the first-stage virtual iteration until the dirty page memory of the target virtual machine is less than the dirty page threshold. Finally, the first virtual iteration time of the first-stage virtual iteration and the second virtual iteration time of the second-stage virtual iteration are summed to determine the expected total virtual migration time of the target virtual machine.
[0139] In the above scheme, the migration process of the target virtual machine is divided into a first virtual migration and a second-stage virtual iteration. During the first virtual migration, the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations in the first stage, that is, the dirty page rate of the target virtual machine decreases proportionally and is in a slowdown phase. During the second virtual migration, the dirty page rate of the target virtual machine remains basically unchanged and is in a stable phase, eventually degenerating into a normal migration. This application calculates the number of iterations and migration time of the target virtual machine in stages, thereby achieving an accurate prediction of the migration time of the target virtual machine and improving the prediction accuracy.
[0140] Figure 6 This is a structural block diagram illustrating a device for estimating thermal migration time according to an exemplary embodiment. Figure 6 As shown, the prediction device includes:
[0141] The rate and bandwidth acquisition module 601 is used to acquire the initial dirty page rate of the target virtual machine and the migration bandwidth of the target virtual machine.
[0142] The first-stage virtual iteration module 602 is used to perform a first-stage virtual iteration on the initial dirty page memory of the target virtual machine based on the initial dirty page rate and the migration bandwidth, until the dirty page rate of the target virtual machine is less than a specified threshold; the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations of the first-stage virtual iteration.
[0143] The stable dirty page rate determination module 603 is used to determine the stable dirty page rate based on the dirty page rate of the last virtual iteration process in the first stage virtual iteration.
[0144] The second-stage virtual iteration module 604 is used to perform a second-stage virtual iteration on the dirty page memory of the target virtual machine after the first-stage virtual iteration based on the stable dirty page rate and the migration bandwidth, until the dirty page memory of the target virtual machine is less than the dirty page threshold.
[0145] The total live migration time estimation module 605 is used to sum the first virtual iteration time of the first stage virtual iteration and the second virtual iteration time of the second stage virtual iteration to determine the estimated total virtual migration time of the target virtual machine.
[0146] In one possible implementation, the specified threshold is 0.5 times the migration bandwidth.
[0147] In one possible implementation, the initial dirty page memory is the actual physical memory used by the target virtual machine;
[0148] Before performing the first-stage virtual iteration on the initial dirty page memory of the target virtual machine, the method further includes:
[0149] Based on the ratio between the initial dirty page rate and the actual physical memory used, obtain the target time interval and the average dirty page rate of the target virtual machine under the target time interval;
[0150] Based on the target time interval and the average dirty page rate, the upper limit of the total number of dirty pages is obtained.
[0151] In one possible implementation, the rate and bandwidth acquisition module 601 is further configured to:
[0152] Obtain the historical migration information of the target virtual machine;
[0153] Based on this historical migration information, the historical migration bandwidth is extracted and determined as the migration bandwidth of the target virtual machine.
[0154] In one possible implementation, the rate and bandwidth acquisition module 601 is further configured to:
[0155] When there is no corresponding historical migration information for the target virtual machine, the available bandwidth from the compute node where the target virtual machine is located to the migration target node is calculated in real time, and the available bandwidth is determined as the migration bandwidth of the target virtual machine.
[0156] In one possible implementation, the first-stage virtual iteration module 602 is further configured to:
[0157] The Nth virtual iteration time is determined based on the total number of Nth dirty pages and the migration bandwidth.
[0158] Based on the Nth dirty page rate and the Nth virtual iteration time, generate the total number of N+1 dirty pages;
[0159] Based on the Nth dirty page rate, determine the (N+1)th dirty page rate;
[0160] The N+1 virtual iteration time is determined based on the migration bandwidth and the total number of N+1 dirty pages.
[0161] In one possible implementation, the second-stage virtual iteration module 604 is further configured to:
[0162] Based on the stable dirty page rate and the Mth stable iteration time, determine the total number of M+1 stable dirty pages;
[0163] The M+1 stable virtual iteration time is determined based on the total number of stable dirty pages and the migration bandwidth.
[0164] In one possible implementation, the total thermal migration time estimation module 605 is further configured to:
[0165] Obtain the first virtual iteration number of the first stage virtual iteration and the second virtual iteration number of the second stage virtual iteration;
[0166] When the sum of the first virtual iteration count and the second virtual iteration count is less than the target virtual iteration count, the hot migration task of the target virtual machine is determined to have converged, and the first virtual iteration time and the sum of the first virtual iteration times are determined as the expected total virtual migration time of the target virtual machine.
[0167] In summary, this application first obtains the initial dirty page rate and migration bandwidth of the target virtual machine, and then performs a first-stage virtual iteration on the initial dirty page memory of the target virtual machine based on the initial dirty page rate and migration bandwidth until the dirty page rate of the target virtual machine is less than a specified threshold. Next, a stable dirty page rate is determined based on the dirty page rate of the last virtual iteration in the first-stage virtual iteration. Then, based on the stable dirty page rate and the migration bandwidth, a second-stage virtual iteration is performed on the dirty page memory of the target virtual machine after the first-stage virtual iteration until the dirty page memory of the target virtual machine is less than the dirty page threshold. Finally, the first virtual iteration time of the first-stage virtual iteration and the second virtual iteration time of the second-stage virtual iteration are summed to determine the expected total virtual migration time of the target virtual machine.
[0168] In the above scheme, the migration process of the target virtual machine is divided into a first virtual migration and a second-stage virtual iteration. During the first virtual migration, the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations in the first stage, that is, the dirty page rate of the target virtual machine decreases proportionally and is in a slowdown phase. During the second virtual migration, the dirty page rate of the target virtual machine remains basically unchanged and is in a stable phase, eventually degenerating into a normal migration. This application calculates the number of iterations and migration time of the target virtual machine in stages, thereby achieving an accurate prediction of the hot migration time of the target virtual machine and improving the prediction accuracy.
[0169] Figure 7 A structural block diagram of a computer device illustrating an exemplary embodiment of this application is shown. Figure 7 The computer device includes a memory and a processor. The memory stores a computer program, which, when executed by the processor, implements the aforementioned method for estimating the time required for hot migration.
[0170] The processor can be a central processing unit (CPU). It can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations thereof.
[0171] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the methods in the embodiments of this invention. The processor executes various functional applications and data processing by running the non-transitory software programs, instructions, and modules stored in the memory, thereby implementing the methods described in the above embodiments.
[0172] The memory may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created by the processor, etc. Furthermore, the memory may include high-speed random access memory and non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include memory remotely located relative to the processor, which can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0173] In one exemplary embodiment, a computer-readable storage medium is also provided for storing at least one computer program, which is loaded and executed by a processor to implement all or part of the steps in the above-described method. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, or optical data storage device, etc.
[0174] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0175] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for predicting thermal migration time, characterized in that, The method includes: Obtain the initial dirty page rate of the target virtual machine and the migration bandwidth of the target virtual machine; Based on the initial dirty page rate and the migration bandwidth, a first-stage virtual iteration is performed on the initial dirty page memory of the target virtual machine until the dirty page rate of the target virtual machine is less than a specified threshold; the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations in the first-stage virtual iteration. The stable dirty page rate is determined based on the dirty page rate of the last virtual iteration in the first stage of virtual iteration. Based on the stable dirty page rate and the migration bandwidth, the dirty page memory of the target virtual machine after the first stage of virtual iteration is subjected to a second stage of virtual iteration until the dirty page memory of the target virtual machine is less than the dirty page threshold. The estimated total virtual migration time of the target virtual machine is determined by summing the first virtual iteration time of the first stage virtual iteration with the second virtual iteration time of the second stage virtual iteration.
2. The method according to claim 1, characterized in that, The specified threshold is 0.5 times the migration bandwidth.
3. The method according to claim 1, characterized in that, The initial dirty page memory is the actual physical memory used by the target virtual machine.
4. The method according to claim 1, characterized in that, The step of obtaining the migration bandwidth of the target virtual machine includes: Obtain the historical migration information of the target virtual machine; Based on the historical migration information, the historical migration bandwidth is extracted and determined as the migration bandwidth of the target virtual machine.
5. The method according to claim 1, characterized in that, The step of obtaining the migration bandwidth of the target virtual machine includes: When the target virtual machine does not have corresponding historical migration information, the available bandwidth from the compute node where the target virtual machine is located to the migration target node is counted in real time, and the available bandwidth is determined as the migration bandwidth of the target virtual machine.
6. The method according to any one of claims 1 to 5, characterized in that, The first phase of virtual iteration is performed on the initial dirty page memory, including: The Nth virtual iteration time is determined based on the total number of Nth dirty pages and the migration bandwidth. The total number of N+1 dirty pages is generated based on the Nth dirty page rate and the Nth virtual iteration time. Determine the (N+1)th dirty page rate based on the Nth dirty page rate; The N+1th virtual iteration time is determined based on the migration bandwidth and the total number of N+1th dirty pages.
7. The method according to any one of claims 1 to 5, characterized in that, The second phase of virtual iteration on the dirty pages of the target virtual machine after the first phase of virtual iteration includes: The total number of stable dirty pages (M+1) is determined based on the stable dirty page rate and the Mth stable virtual iteration time. The M+1 stable virtual iteration time is determined based on the total number of stable dirty pages and the migration bandwidth.
8. The method according to claim 7, characterized in that, The step of summing the first virtual iteration time of the first stage virtual iteration with the second virtual iteration time of the second stage virtual iteration to determine the estimated total virtual migration time of the target virtual machine includes: Obtain the first virtual iteration count of the first stage virtual iteration and the second virtual iteration count of the second stage virtual iteration; When the sum of the first virtual iteration count and the second virtual iteration count is less than the target virtual iteration count, the migration task of the target virtual machine is determined to have converged, and the sum of the first virtual iteration time and the second virtual iteration time is determined as the expected total virtual migration time of the target virtual machine.
9. A device for predicting the time consumed by thermal migration, characterized in that, The device includes: The rate and bandwidth acquisition module is used to acquire the initial dirty page rate of the target virtual machine and the migration bandwidth of the target virtual machine. The first-stage virtual iteration module is used to perform a first-stage virtual iteration on the initial dirty page memory of the target virtual machine based on the initial dirty page rate and the migration bandwidth, until the dirty page rate of the target virtual machine is less than a specified threshold; the dirty page rate of the target virtual machine is inversely correlated with the number of virtual iterations in the first-stage virtual iteration. The stable dirty page rate determination module is used to determine the stable dirty page rate based on the dirty page rate of the last virtual iteration process in the first stage of virtual iteration. The second-stage virtual iteration module is used to perform a second-stage virtual iteration on the dirty page memory of the target virtual machine after the first-stage virtual iteration, based on the stable dirty page rate and the migration bandwidth, until the dirty page memory of the target virtual machine is less than the dirty page threshold. The total migration time estimation module is used to sum the first virtual iteration time of the first stage virtual iteration and the second virtual iteration time of the second stage virtual iteration to determine the estimated total virtual migration time of the target virtual machine.
10. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction, which is loaded and executed by the processor to implement a method for estimating the thermal migration time as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Memory pre-copying method in virtual machine migration, device executing memory pre-copying method and system
CN103365704A
Scheduling method and system for virtual-machine memory self-adaption thermal migration in hybrid cloud mode
CN107479944A