CN111638937A - Virtual machine migration method and device, electronic equipment and storage medium - Google Patents
Virtual machine migration method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN111638937A CN111638937A CN202010328920.1A CN202010328920A CN111638937A CN 111638937 A CN111638937 A CN 111638937A CN 202010328920 A CN202010328920 A CN 202010328920A CN 111638937 A CN111638937 A CN 111638937A
- Authority
- CN
- China
- Prior art keywords
- migration
- dirty
- dirty page
- virtual machine
- speed
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000013508 migration Methods 0.000 title claims abstract description 383
- 230000005012 migration Effects 0.000 title claims abstract description 382
- 238000000034 method Methods 0.000 title claims abstract description 71
- 230000005540 biological transmission Effects 0.000 claims description 38
- 125000004122 cyclic group Chemical group 0.000 claims description 7
- 230000003247 decreasing effect Effects 0.000 claims description 6
- 230000008569 process Effects 0.000 description 18
- 238000010586 diagram Methods 0.000 description 14
- 238000012545 processing Methods 0.000 description 14
- 238000004891 communication Methods 0.000 description 11
- 238000012546 transfer Methods 0.000 description 10
- 239000008186 active pharmaceutical agent Substances 0.000 description 8
- 238000004590 computer program Methods 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 5
- 230000009467 reduction Effects 0.000 description 5
- 230000009471 action Effects 0.000 description 4
- 230000003993 interaction Effects 0.000 description 4
- 238000007726 management method Methods 0.000 description 4
- 230000005236 sound signal Effects 0.000 description 4
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000001133 acceleration Effects 0.000 description 2
- 230000008901 benefit Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 238000011084 recovery Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/4557—Distribution of virtual machine instances; Migration and load balancing
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Power Sources (AREA)
Abstract
The embodiment of the invention provides a migration method and device of a virtual machine, electronic equipment and a storage medium, and relates to the technical field of computers. Wherein, the method comprises the following steps: synchronizing a dirty page bitmap, wherein the dirty page bitmap represents whether a default small page of the virtual machine is a dirty page or not; when the shutdown migration condition is not met, controlling the virtual machine to stop running for a preset time length according to a preset time period, migrating default small pages which are dirty pages according to the dirty page bitmap, and entering the step of synchronizing the dirty page bitmap to perform the next round of migration; and when the shutdown migration condition is met, stopping running the virtual machine, and migrating the default small page which is the dirty page according to the dirty page bitmap. When the migration condition is not met, the virtual machine can be controlled to stop running for the preset time according to the preset time period, so that the dirty page generation speed of the virtual machine is reduced, the dirty data volume is reduced, and the migration time is further reduced.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for migrating a virtual machine, an electronic device, and a storage medium.
Background
A virtual machine is a set of functions that can run on a physical host, and the virtual machine needs to occupy resources of the physical host, including but not limited to a disk and a memory. In practical applications, there are some scenarios that require migrating a virtual machine from a physical host (hereinafter referred to as a source host) to another physical host (hereinafter referred to as a target host), and migrating a virtual machine without stopping the virtual machine is referred to as live migration. The pre-copy method is a typical dynamic migration method, and because the pre-copy method does not depend on a source host, the migration failure does not affect the continuous operation of the virtual machine, so that the use of the pre-copy method is wide.
In the prior art, the first pre-copy method mainly includes the following steps: firstly, migrating a memory page of a virtual machine to a target host through multi-round migration on the premise that the virtual machine does not shut down until a preset maximum migration frequency or a maximum data volume is reached; then, the running of the virtual machine is stopped, and the last round of migration is carried out. The second pre-copy method mainly comprises the following steps: the method comprises the steps that memory pages of a virtual machine are migrated to a target host through multiple rounds of migration on the premise that the virtual machine does not stop running until a stop migration condition is reached, and in order to enable the virtual machine to reach the stop migration condition as soon as possible, a speed reduction program is added into an IO (input output) queue of the virtual machine, so that when the virtual machine accesses the IO queue, the sequence reduction program is executed, and the dirty page generation speed of the virtual machine is reduced. The migration in the two methods is copy.
After the inventor researches the prior art, it is found that the first pre-copy method has the condition that the amount of data to be migrated is large when the virtual machine stops running, which results in long migration time; the second pre-copy method cannot accurately determine when the virtual machine accesses the IO queue, so that the speed reduction effect is not obvious, and the migration time is long.
Disclosure of Invention
In view of the above, embodiments of the present invention are proposed to provide a migration method of a virtual machine that overcomes or at least partially solves the above problems.
Correspondingly, the embodiment of the invention also provides a virtual machine migration device, electronic equipment and a storage medium, which are used for ensuring the implementation and application of the method.
In order to solve the above problem, an embodiment of the present invention discloses a virtual machine migration method, including:
synchronizing a dirty page bitmap, wherein the dirty page bitmap represents whether a default small page of the virtual machine is a dirty page or not;
when the shutdown migration condition is not met, controlling the virtual machine to stop running for a preset time length according to a preset time period, migrating default small pages which are dirty pages according to the dirty page bitmap, and entering the step of synchronizing the dirty page bitmap to perform the next round of migration;
and when the shutdown migration condition is met, stopping running the virtual machine, and migrating the default small page which is the dirty page according to the dirty page bitmap.
Optionally, the method further comprises:
when the shutdown migration condition is not met, determining the dirty page generation speed of the previous round of migration according to the dirty page bitmap and the transmission duration corresponding to the previous round of migration;
determining the migration speed of the dirty pages in the previous round of migration according to the data volume of the previous round of migration and the transmission time length corresponding to the previous round of migration;
the control of the virtual machine to stop running for a preset duration according to a preset time period includes:
and if the dirty page generation speed of the previous round of migration is greater than the dirty page migration speed of the previous round, controlling the virtual machine to stop running for a preset time according to a preset time period.
Optionally, the method further comprises:
if the difference value between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is smaller than or equal to a first speed difference threshold value, reducing the preset time period and/or increasing the preset duration;
if the difference between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is greater than a second speed difference threshold, increasing the preset time period and/or decreasing the preset duration, wherein the second speed difference threshold is greater than the first speed difference threshold.
Optionally, the method further comprises:
counting the number of dirty pages according to the dirty page bitmap, wherein the number of the dirty pages represents the default number of small pages of the dirty pages;
and determining whether the shutdown migration condition is met or not according to the migration speed of the dirty pages in the previous round of migration, the preset shutdown duration and the number of the dirty pages.
The embodiment of the invention also discloses a virtual machine migration device, which comprises:
a dirty page bitmap synchronization module, configured to synchronize a dirty page bitmap, where the dirty page bitmap represents whether a default small page of the virtual machine is a dirty page;
the circular migration module is used for controlling the virtual machine to stop running for a preset time according to a preset time period when the shutdown migration condition is not met, migrating default small pages which are dirty pages according to the dirty page bitmap, and entering the dirty page bitmap synchronization module to perform the next round of migration;
and the shutdown migration module is used for stopping running the virtual machine when the shutdown migration condition is met, and migrating the default small page which is the dirty page according to the dirty page bitmap.
Optionally, the apparatus further comprises:
the dirty page generation speed determination module is used for determining the dirty page generation speed of the previous round of migration according to the dirty page bitmap and the transmission duration corresponding to the previous round of migration when the shutdown migration condition is not met;
the dirty page migration speed determining module is used for determining the dirty page migration speed of the previous round of migration according to the data volume of the previous round of migration and the transmission time corresponding to the previous round of migration;
the cyclic migration module comprises:
and the cyclic migration sub-module is used for controlling the virtual machine to stop running for a preset time length according to a preset time period when the shutdown migration condition is not met and the dirty page generation speed of the previous round of migration is greater than the dirty page migration speed corresponding to the previous round, migrating the default small page which is the dirty page according to the dirty page bitmap, and entering the dirty page bitmap synchronization module to perform the next round of migration.
Optionally, the apparatus further comprises:
the first operation stopping adjusting module is used for reducing the preset time period and/or increasing the preset time length if the difference value between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is smaller than or equal to a first speed difference threshold value;
and the second operation stopping adjustment module is used for increasing the preset time period and/or reducing the preset time length if the difference value between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is greater than a second speed difference threshold, wherein the second speed difference threshold is greater than the first speed difference threshold.
Optionally, the apparatus further comprises:
the dirty page number counting module is used for counting the number of dirty pages according to the dirty page bitmap, wherein the dirty page number represents the default small page number of the dirty pages;
and the shutdown migration condition determining module is used for determining whether the shutdown migration condition is met according to the migration speed of the dirty pages of the previous round of migration, the preset shutdown duration and the number of the dirty pages.
An embodiment of the present invention also discloses an electronic device comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for:
synchronizing a dirty page bitmap, wherein the dirty page bitmap represents whether a default small page of the virtual machine is a dirty page or not;
when the shutdown migration condition is not met, controlling the virtual machine to stop running for a preset time length according to a preset time period, migrating default small pages which are dirty pages according to the dirty page bitmap, and entering the step of synchronizing the dirty page bitmap to perform the next round of migration;
and when the shutdown migration condition is met, stopping running the virtual machine, and migrating the default small page which is the dirty page according to the dirty page bitmap.
The embodiment of the invention also discloses a readable storage medium, and when instructions in the storage medium are executed by a processor of the electronic device, the electronic device can execute the migration method of one or more virtual machines in the embodiment of the invention.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, during each round of migration, if the shutdown migration condition is not met, the virtual machine can be controlled to stop running for the preset time according to the preset time period, and as the virtual machine does not modify the memory in the running stopping process, dirty pages are not generated, so that the dirty page generation speed of the virtual machine can be reduced, the dirty data volume is reduced, and the migration time is further reduced.
Drawings
FIG. 1 is a flowchart illustrating the steps of an embodiment of a method for migrating a virtual machine according to the present invention;
FIG. 2 is a schematic diagram of the interaction between the slowdown control thread and the VCPU thread of the present invention;
FIG. 3 is a process flow diagram of the slowdown control thread of the present invention;
FIG. 4 is a block diagram of an embodiment of a virtual machine migration apparatus according to the present invention;
FIG. 5 is a block diagram illustrating an architecture of an electronic device for migrating a virtual machine, in accordance with an exemplary embodiment.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
One of the core concepts of the embodiments of the present invention is that, when a virtual machine is dynamically migrated, a memory page is migrated through multiple rounds of migration, and when a shutdown migration condition is not satisfied, the virtual machine is controlled to stop running for a preset duration according to a preset time period, and during the process of stopping running of the virtual machine, the memory page is not written and modified, so that the dirty page generation speed of the virtual machine can be reduced, and the migration duration is further reduced.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a virtual machine migration method according to the present invention is shown, which may specifically include the following steps:
The embodiment of the invention is used for migrating the virtual machine from the source host to the target host in the running process, the virtual machine occupies the memory of the source host in the running process of the source host, and the memory is modified or written in due to running. In practical applications, a source host may allocate a certain memory space for a virtual machine, and divide a memory into a plurality of pages (subsequently referred to as memory pages) to facilitate management of the memory space, so that if one of the memory pages is modified or written, the memory page is referred to as a dirty page. It can be understood that the process of migrating the virtual machine from the source host to the target host during the running process is the process of copying the dirty pages.
In order to record memory pages that become dirty pages, a dirty page bitmap may be used, where a flag indicating whether some memory pages allocated to the virtual machine are dirty pages is stored in the dirty page bitmap, and the dirty page bitmap may be a binary sequence. For example, if 512KB of memory is allocated to the virtual machine and each memory page is 4KB in size, the number of the memory pages is 512/4-128, so that the virtual machine corresponds to a dirty page bitmap including 128 bits, each bit represents whether a memory page is a dirty page, and if the first bit of the dirty page bitmap is 1, the first memory page is a dirty page; if the second bit of the dirty page bitmap is 0, it indicates that the second memory page is not a dirty page.
It should be noted that the dirty page bitmap is set for a default small page, where the default small page is a minimum page used by an MMU (memory management Unit) and is related to system settings of a source host, the default small page is relative to a large page, and the data size of the large page may be a multiple of the data size of the default small page, and the large page is usually obtained by merging several default small pages. For example, if the data amount of the default small page is 4KB, 512 default small pages may be merged into a large page of 2 MB.
The dirty page bitmap is managed by the MMU in a unified manner, and in the embodiment of the present invention, a dirty page bitmap needs to be copied before the virtual machine is migrated, that is, the dirty page bitmap is synchronized, and after the copy, each bit in the original dirty page bitmap is set to 0, so that the MMU immediately records the modification or writing to the memory page after the copy.
And step 102, when the shutdown migration condition is not met, controlling the virtual machine to stop running for a preset time length according to a preset time period, migrating default small pages which are dirty pages according to the dirty page bitmap, and entering the step of synchronizing the dirty page bitmap to perform the next round of migration.
When the shutdown migration condition is not met, migration cannot be completed within a preset shutdown duration, so that shutdown migration cannot be performed, and migration can only be continued in the running process of the virtual machine until the shutdown migration condition is met. It can be understood that, generally, when a round of migration is started, the amount of data to be migrated is large, and with multiple rounds of migration, the amount of data to be migrated is reduced, so that through multiple rounds of migration, the shutdown migration condition can be finally met to perform shutdown migration.
The multi-round migration refers to that the dirty page bitmap is synchronized for many times and migration is performed according to the dirty page bitmap, that is, one round of migration is performed by performing steps 101 and 102 once, or one round of migration is performed by performing steps 101 and 103 once.
It should be noted that, steps 101 and 103 are the last migration, and are executed only once, and after the last migration, the migration of the virtual machine is completed.
When the shutdown migration condition is not met, the embodiment of the invention can start a deceleration control thread to control the virtual machine to stop running for a preset time according to a preset time period. Specifically, referring to the interaction process of the deceleration control thread and one of the VCPU (Central Processing Unit of Virtual machine) threads as shown in fig. 2, the deceleration control thread sends stop information to the VCPU thread to control the Virtual machine to stop running, the VCPU thread may return information representing that the Virtual machine stops running to the deceleration control thread, the time required for sending the inter-process information is omitted, and the time for sending the stop information is regarded as the time for the Virtual machine to stop running; after the virtual machine stops running for a preset time, sending recovery information to the VCPU thread to enable the virtual machine to recover running, wherein the VCPU thread can return information representing that the virtual machine recovers running to the deceleration control thread; after the virtual machine resumes running, the next stop message may be sent according to the preset time period, and this is done alternately and continuously.
The virtual machine stopping operation frequency is controlled by the preset time period, the stopping operation time of the virtual machine is controlled by the preset time duration, each time period corresponds to a short time, the stopping operation time duration of the virtual machine is the preset time duration in each time period, and the operation time duration of the virtual machine is a time duration except the preset time duration in the time period, so that the alternating process of stopping operation and continuing operation of the virtual machine continuously in the preset time period is realized. For example, when the time period is second and the preset duration is 30 milliseconds, the deceleration control thread may send a stop message to the VCPU thread every second, so that the virtual machine may stop running for 30 milliseconds every second, and after running for 30 milliseconds, the deceleration control thread may send a recovery message to the VCPU thread, so that the virtual machine is in a running state in the remaining 970 milliseconds every second, which may implement an alternating process of stopping running for 30 milliseconds, running for 970 milliseconds, …, stopping running for 30 milliseconds, and running for 970 milliseconds. In general, in a time period, the occupation ratio of the preset time duration is small, so that the access to the virtual machine is not affected, and the dirty page generation speed of the virtual machine is reduced under the condition of no perception of access.
The embodiment of the invention reduces the dirty page generation speed of the virtual machine by continuously stopping running the virtual machine, is beneficial to reducing the migration duration, and meets the condition of shutdown migration as soon as possible to finish the migration.
And 103, stopping running the virtual machine when the shutdown migration condition is met, and migrating the default small page which is the dirty page according to the dirty page bitmap.
It can be understood that when the shutdown migration condition is met, migration of all dirty pages can be completed within a preset shutdown duration, so that migration of the virtual machine is completed. After step 103 is performed, the migration is complete and the virtual machine is started on the target host.
Specifically, the default small pages that are the dirty pages may be migrated from the source host to the target host in the order of the default small pages in the dirty page bitmap, that is: the default pagelet, which is a dirty page, is copied from the source host to the target host.
Optionally, the method further comprises steps a1 to a 2:
and step A1, when the halt migration condition is not met, determining the dirty page generation speed of the previous round of migration according to the dirty page bitmap and the transmission duration corresponding to the previous round of migration.
The dirty page bitmap is obtained by the current round of migration, and includes dirty pages generated in the previous round of migration, so that the dirty data amount generated in the previous round of migration can be determined according to the product of the number of the dirty pages in the dirty page bitmap and the data amount of the default small pages, and the speed of generating the dirty pages in the previous round of migration, namely the speed of generating the dirty pages in the previous round of migration, is obtained by dividing the dirty data amount by the transmission time of the previous round. Because the dirty page bitmap of the previous round can be acquired during the current round of migration, the dirty page generation speed of the previous round of migration can be calculated before the default small page which is the dirty page is migrated according to the dirty page bitmap or after the default small page which is the dirty page is migrated according to the dirty page bitmap.
Step A2, determining the migration speed of the dirty page in the previous round of migration according to the data size of the previous round of migration and the transmission time length corresponding to the previous round of migration.
Specifically, the ratio of the data size of the previous migration and the transmission time corresponding to the previous migration may be used as the dirty page migration speed of the previous migration. Since the data volume of the previous round of migration must be known after the previous round of migration is completed, the migration speed of the dirty page of the previous round of migration can be calculated after the default small page which is the dirty page is migrated according to the dirty page bitmap in the previous round.
It is understood that after multiple rounds of migration, steps a1 and a2 may generate a dirty page generation speed and a dirty page migration speed for the multiple rounds of migration.
Based on the steps a1 and a2, the step 102, includes the sub-steps A3:
and a substep A3, when the shutdown migration condition is not met and the dirty page generation speed of the previous round of migration is greater than the dirty page migration speed of the previous round, controlling the virtual machine to stop running for a preset time according to a preset time period, migrating the default small page which is the dirty page according to the dirty page bitmap, and entering the step of synchronizing the dirty page bitmap to perform the next round of migration.
In practical application, a migration thread can obtain a dirty page bitmap, determine the data volume and transmission time of migration, determine the dirty page generation speed and the dirty page migration speed, and send the dirty page generation speed and the dirty page migration speed to a deceleration control thread through inter-thread communication, so that the deceleration control thread determines whether to enter a uniform deceleration stage, and when entering the uniform deceleration stage, the deceleration control thread sends stop information to a VCPU thread, otherwise, the deceleration control thread does not send the stop information. Wherein, the uniform deceleration stage is as follows: and controlling the virtual machine to stop running for a preset time according to a preset time period. As shown in fig. 3, after the speed reduction control thread is started, the speed reduction control thread may monitor a dirty page generation speed and a dirty page migration speed, and if the dirty page migration speed is greater than or equal to the dirty page generation speed and does not satisfy the shutdown migration condition, it means that the migration is not the last round of migration, and may satisfy the shutdown migration condition and complete the migration after multiple rounds of migration, so as to continue monitoring the dirty page generation speed and the dirty page migration speed; if the condition of shutdown migration is met, the last round of migration is represented, and the migration can be completed in the current round of migration, so that the deceleration control thread is ended without continuing monitoring; if the shutdown migration condition is not met and the hidden dirty page migration speed in fig. 3 is less than the dirty page generation speed, it means that the migration is not the last round of migration and the migration cannot be completed after several rounds of iteration, so that the uniform deceleration stage needs to be entered.
In order to avoid misjudgment caused by the fact that the accidental dirty page generation speed is larger than the dirty page migration speed, the deceleration control thread can continuously monitor multiple rounds of migration, if the local round of migration does not meet the shutdown migration condition, and the dirty page generation speed of the continuous multiple rounds of migration before the local round of migration is larger than the dirty page migration speed, the migration cannot be completed no matter how many rounds of migration are performed under the scene, and then the uniform deceleration stage is started.
Certainly, when the shutdown migration condition is not met, if the dirty page generation speed of continuous multiple rounds of migration is less than or equal to the corresponding dirty page migration speed, the migration can be completed after a plurality of rounds of migration, so that the virtual machine is not controlled to stop running for a preset time length according to a preset time period, and the default small page which is the dirty page is directly migrated according to the dirty page bitmap.
The embodiment of the invention can accurately control the virtual machine to stop running for the preset time length according to the preset time period through the dirty page generation speed and the dirty page migration speed, realize necessary running stop, avoid unnecessary running stop and ensure the normal response of the virtual machine as far as possible.
Optionally, the method further comprises steps B1 to B2:
and step B1, if the difference between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is less than or equal to the first speed difference threshold, reducing the preset time period and/or increasing the preset time duration.
In the embodiment of the present invention, after controlling the virtual machine to stop running for the preset time period according to the preset time period, the dirty page generation speed and the dirty page migration speed may be continuously monitored to determine whether a difference obtained by subtracting the dirty page generation speed from the dirty page migration speed reaches an expected first speed difference threshold, and if not, it represents that the dirty page generation speed is still a little large, and the migration cannot be completed quickly, and at this time, the preset time period may be reduced or the preset time period may be increased. For example, if the time period is 1 second and the preset duration is 30 msec, the time period may be reduced to 0.8 second or the preset duration may be increased to 50 msec.
Step B2, if the difference between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is greater than a second speed difference threshold, increasing the preset time period and/or decreasing the preset duration, where the second speed difference threshold is greater than the first speed difference threshold.
In the embodiment of the present invention, after the virtual machine is controlled to stop operating for the preset time period according to the preset time period, the dirty page generation speed and the dirty page migration speed may be continuously monitored to determine whether a difference obtained by subtracting the dirty page generation speed from the dirty page migration speed is greater than a second speed difference threshold, and if so, it represents that the stop time period of the virtual machine is a little longer, or the preset time period is a little shorter, which may affect the normal operation of the virtual machine, and at this time, the preset time period may be increased or decreased. For example, if the time period is 1 second and the preset duration is 30 msec, the time period may be increased to 1.3 seconds or the preset duration may be decreased to 20 msec.
It can be understood that, if the difference between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is greater than the first speed difference threshold and is less than or equal to the second speed difference threshold, the virtual machine is continuously controlled to stop running for the current preset time period according to the current preset time period without reducing or increasing the preset time period or increasing or reducing the preset time period. In addition, the step B1 or B2 may also be performed a plurality of times until the difference between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is greater than the first speed difference threshold and less than or equal to the second speed difference threshold.
The embodiment of the invention can dynamically adjust the preset time period and/or the preset duration, thereby controlling the uniform deceleration stage to be more accurately and accurately.
Optionally, the method further comprises steps C1 to C2:
and step C1, counting the number of the dirty pages according to the dirty page bitmap, wherein the number of the dirty pages represents the default number of the small pages of the dirty pages.
Specifically, the number of 1 s in the dirty page bitmap may be counted to obtain the number of dirty pages.
And step C2, determining whether the shutdown migration condition is met according to the migration speed of the dirty pages in the previous round of migration, the preset shutdown duration and the number of the dirty pages.
It can be understood that the migration speed of the dirty page of the previous round of migration is more accurate than that of the dirty page of the earlier round of migration, so that the migration speed of the dirty page of the previous round of migration is used as a reference to determine whether the halt migration condition is met.
Specifically, if the dirty page migration speed of the previous round of migration can transmit the data volume corresponding to the number of the dirty pages within the preset shutdown duration, determining that the shutdown migration condition is met; and if the dirty page migration speed of the previous round of migration cannot transmit the data volume corresponding to the number of the dirty pages within the preset shutdown time, determining that the shutdown migration condition is not met.
The embodiment of the invention can accurately determine whether the shutdown migration condition is met or not through the migration speed of the dirty pages, the shutdown time and the number of the dirty pages.
Optionally, the step C2 includes sub-steps D1 to D4:
and a substep D1, determining the maximum data volume which can be transmitted when data transmission is carried out at the dirty page migration speed of the previous round of migration within the preset shutdown time.
In the embodiment of the present invention, the unit of the dirty page migration speed of the previous round of migration is MB/sec, and the unit of the maximum data size obtained is MB.
The maximum data amount may be the product of the downtime and the migration speed of the dirty page in the previous round of migration. Specifically, the maximum transmittable data amount DS can be calculated by referring to the following formulamax:
DSmax=Tstop·V (1)
Wherein, TstopAnd V is the migration speed of the dirty pages in the previous round of migration.
And a substep D2, determining the default number of small pages corresponding to the maximum data amount according to the data amount corresponding to the default small pages.
Specifically, the default small page number corresponding to the maximum data amount may be a ratio of the maximum data amount to the data amount corresponding to the default small page, and when the data amount corresponding to the default small page is KB, the default small page may obtain the data amount corresponding to the maximum data amountThe default number of small pages NUM is calculated as followsmaxThe formula of (a):
wherein, DSminThe default data size is the data size corresponding to the small page.
And a substep D3 of determining that a shutdown migration condition is satisfied if the number of dirty pages is less than or equal to the default small number of pages.
It is to be understood that the default number of small pages is the maximum number of default small pages that can be transmitted within the preset shutdown time at the above moving speed of the previous round of moving, and if the number of the small pages to be transmitted is less than or equal to the default number of small pages, it is determined that all the small pages can be moved within the preset shutdown time, so as to determine that the moving condition is satisfied.
Sub-step D4, determining that the stop-migration condition is not satisfied if the number of dirty pages is greater than the default number of small pages.
It can be understood that the default number of small pages is the maximum number of default small pages which can be transmitted within the preset shutdown time at the above moving speed of the previous round of moving, and if the number of the small pages to be transmitted is greater than the default number of small pages, it is determined that all the small pages cannot be moved within the preset shutdown time, so as to determine that the moving condition is not satisfied.
The embodiment of the invention can firstly determine the maximum number of default small pages which can be transmitted within the preset shutdown time at the dirty page migration speed of the previous round of migration, thereby judging whether the shutdown migration condition is met.
Optionally, in another embodiment of the present invention, the step C2 includes sub-steps D5 to D8:
and a substep D5 of determining the dirty data amount corresponding to the dirty page number according to the data amount corresponding to the default small page.
The embodiment of the present invention is explained in units of KB of the data amount corresponding to the default small page, and the unit of the obtained dirty data amount is KB.
Specifically, the dirty data amount may be a data amount corresponding to the default small page and the dirty pageThe product of the numbers. Specifically, the dirty data amount DS can be calculated by referring to the following formuladty:
DSdty=DSmin·NUMdty(3)
Wherein, DSminIs the data size corresponding to the default small page, NUMdtyIs the number of dirty pages.
And a sub-step D6 of determining the transmission time length required for the dirty data volume to be transmitted at the dirty page migration speed of the previous round of migration.
Specifically, the transmission time period may be a ratio of the amount of dirty data to the transmission speed, and when the transmission speed is MB/sec, the following calculation of the transmission time period T may be obtainedtransThe formula of (a):
wherein, DSdtyAnd V is the migration speed of the dirty page in the previous round of migration, which is the result calculated by the formula (3).
And a substep D7 of determining that a shutdown transition condition is satisfied if the transmission duration is less than or equal to the shutdown duration.
It can be understood that the transfer duration is the time required for all the dirty pages to be transferred at the dirty page transfer speed of the previous round of transfer, so that if the transfer duration is less than or equal to the shutdown duration, it is determined that all the dirty pages can be transferred within the preset shutdown duration, and thus it is determined that the shutdown transfer condition is satisfied.
And a substep D8, determining that a shutdown migration condition is not satisfied if the transmission duration is greater than the shutdown duration.
It can be understood that the transfer duration is a duration required for all the dirty pages to be transferred at the dirty page transfer speed of the previous round of transfer, so that if the transfer duration is longer than the shutdown duration, it is determined that all the dirty pages cannot be transferred within the preset shutdown duration, and it is determined that the shutdown transfer condition is not met.
The embodiment of the invention can determine the time length required by the transmission of all the dirty pages at the dirty page migration speed of the previous round of migration, thereby judging whether the shutdown migration condition is met.
Optionally, the step C2 includes sub-steps D9 to D12:
and a substep D9 of determining the dirty data amount corresponding to the dirty page number according to the data amount corresponding to the default small page.
This substep can be referred to the detailed description of substep D5 and will not be described herein.
And a substep D10, determining the maximum data volume which can be transmitted when data transmission is carried out at the dirty page migration speed of the previous round of migration within the preset shutdown time.
This substep can be referred to the detailed description of substep D1 and will not be described herein.
And a substep D11 of determining that a shutdown migration condition is satisfied if the dirty data amount is less than or equal to the maximum data amount.
It can be understood that the maximum data size is the maximum data size that can be transmitted within the preset shutdown time at the dirty page migration speed of the previous round of migration, and the dirty data size is the data size to be transmitted, so that if the dirty data size is less than or equal to the maximum data size, it is determined that all the dirty pages can be migrated within the preset shutdown time, and it is determined that the shutdown migration condition is satisfied.
And a substep D12 of determining that a shutdown migration condition is not satisfied if the dirty data amount is greater than the maximum data amount.
It can be understood that the maximum data size is the maximum data size which can be transmitted within the preset shutdown time at the dirty page migration speed of the previous round of migration, and the dirty data size is the data size to be transmitted, so that if the dirty data size is greater than the maximum data size, it is determined that all the dirty pages cannot be migrated within the preset shutdown time, and it is determined that the shutdown migration condition is not satisfied.
The embodiment of the invention can determine the maximum data volume and the dirty data volume which can be transmitted within the preset shutdown time of the dirty page migration speed of the previous round of migration, thereby judging whether the shutdown migration condition is met.
In the embodiment of the invention, during each round of migration, if the shutdown migration condition is not met, the virtual machine can be controlled to stop running for the preset time according to the preset time period, and as the virtual machine does not modify the memory in the running stopping process, dirty pages are not generated, so that the dirty page generation speed of the virtual machine can be reduced, the dirty data volume is reduced, and the migration time is further reduced.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 4, a block diagram of a migration apparatus of a virtual machine according to an embodiment of the present invention is shown, where the apparatus 200 may specifically include the following modules:
a dirty page bitmap synchronization module 201, configured to synchronize a dirty page bitmap, where the dirty page bitmap represents whether a default pagelet of the virtual machine is a dirty page.
And the cyclic migration module 202 is configured to, when the shutdown migration condition is not satisfied, control the virtual machine to stop running for a preset duration according to a preset time period, migrate the default small page, which is a dirty page, according to the dirty page bitmap, and enter the dirty page bitmap synchronization module 201 to perform a next round of migration.
And the shutdown migration module 203 is configured to stop running the virtual machine when a shutdown migration condition is met, and migrate the default small page, which is a dirty page, according to the dirty page bitmap.
Optionally, the apparatus further comprises:
and the dirty page generation speed determination module is used for determining the dirty page generation speed of the previous round of migration according to the dirty page bitmap and the transmission duration corresponding to the previous round of migration when the shutdown migration condition is not met.
And the dirty page migration speed determining module is used for determining the dirty page migration speed of the previous round of migration according to the data volume of the previous round of migration and the transmission time length corresponding to the previous round of migration.
Based on the dirty page generation speed determination module and the dirty page migration speed determination module, the cyclic migration module includes:
and the cyclic migration sub-module is used for controlling the virtual machine to stop running for a preset time length according to a preset time period when the shutdown migration condition is not met and the dirty page generation speed of the previous round of migration is greater than the dirty page migration speed of the previous round, migrating the default small page which is the dirty page according to the dirty page bitmap, and entering the dirty page bitmap synchronization module to perform the next round of migration.
Optionally, the apparatus further comprises:
and the first operation stopping adjusting module is used for reducing the preset time period and/or increasing the preset time length if the difference value between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is less than or equal to a first speed difference threshold value.
And the second operation stopping adjustment module is used for increasing the preset time period and/or reducing the preset time length if the difference value between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is greater than a second speed difference threshold, wherein the second speed difference threshold is greater than the first speed difference threshold.
Optionally, the apparatus further comprises:
and the dirty page number counting module is used for counting the number of dirty pages according to the dirty page bitmap, wherein the dirty page number represents the default small page number of the dirty pages.
And the shutdown migration condition determining module is used for determining whether the shutdown migration condition is met according to the migration speed of the dirty pages of the previous round of migration, the preset shutdown duration and the number of the dirty pages.
Optionally, the shutdown migration condition determining module includes:
and the first maximum data volume determining submodule is used for determining the maximum data volume which can be transmitted when data transmission is carried out at the dirty page migration speed of the previous round of migration within the preset shutdown time.
And the default small page number determining submodule is used for determining the default small page number corresponding to the maximum data volume according to the data volume corresponding to the default small page.
And the first determining submodule is used for determining that the shutdown migration condition is met if the number of the dirty pages is less than or equal to the default small number of the pages.
And the second determining submodule is used for determining that the shutdown migration condition is not met if the number of the dirty pages is greater than the default number of the small pages.
Optionally, the shutdown migration condition determining module includes:
and the first dirty data amount determining submodule is used for determining the dirty data amount corresponding to the dirty page number according to the data amount corresponding to the default small page.
And the transmission time length determining submodule is used for determining the transmission time length required by the dirty page migration speed of the previous round of migration to transmit the dirty data volume.
And the third determining submodule is used for determining that a shutdown migration condition is met if the transmission time length is less than or equal to the shutdown time length.
And the fourth determining submodule is used for determining that the shutdown migration condition is not met if the transmission time length is greater than the shutdown time length.
Optionally, the shutdown migration condition determining module includes:
and the second dirty data amount determining submodule is used for determining the dirty data amount corresponding to the dirty page number according to the data amount corresponding to the default small page.
And the second maximum data volume determining submodule is used for determining the maximum data volume which can be transmitted when data transmission is carried out at the dirty page migration speed of the previous round of migration within the preset shutdown time.
And a fifth determining submodule, configured to determine that a shutdown migration condition is satisfied if the dirty data amount is less than or equal to the maximum data amount.
And a sixth determining submodule, configured to determine that the shutdown migration condition is not satisfied if the dirty data amount is larger than the maximum data amount.
In the embodiment of the invention, during each round of migration, if the shutdown migration condition is not met, the virtual machine can be controlled to stop running for the preset time according to the preset time period, and as the virtual machine does not modify the memory in the running stopping process, dirty pages are not generated, so that the dirty page generation speed of the virtual machine can be reduced, the dirty data volume is reduced, and the migration time is further reduced.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
Fig. 5 is a block diagram illustrating an architecture of an electronic device 300 for migrating a virtual machine, according to an example embodiment. For example, the electronic device 300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 5, electronic device 300 may include one or more of the following components: processing component 302, memory 304, power component 306, multimedia component 308, audio component 310, input/output (I/O) interface 312, sensor component 314, and communication component 316.
The processing component 302 generally controls overall operation of the electronic device 300, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing elements 302 may include one or more processors 320 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 302 can include one or more modules that facilitate interaction between the processing component 302 and other components. For example, the processing component 302 can include a multimedia module to facilitate interaction between the multimedia component 308 and the processing component 302.
The memory 304 is configured to store various types of data to support operations at the device 300. Examples of such data include instructions for any application or method operating on the electronic device 300, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 304 may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 306 provides power to the various components of the electronic device 300. The power components 306 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 300.
The multimedia component 308 comprises a screen providing an output interface between the electronic device 300 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 308 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 300 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 310 is configured to output and/or input audio signals. For example, the audio component 310 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 300 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 304 or transmitted via the communication component 316. In some embodiments, audio component 310 also includes a speaker for outputting audio signals.
The I/O interface 312 provides an interface between the processing component 302 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The communication component 316 is configured to facilitate wired or wireless communication between the electronic device 300 and other devices. The electronic device 300 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 316 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 316 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 300 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 304, that are executable by the processor 320 of the electronic device 300 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer readable storage medium in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform a method of migration of a virtual machine, the method comprising:
synchronizing a dirty page bitmap, wherein the dirty page bitmap represents whether a default small page of the virtual machine is a dirty page or not;
when the shutdown migration condition is not met, controlling the virtual machine to stop running for a preset time length according to a preset time period, migrating default small pages which are dirty pages according to the dirty page bitmap, and entering the step of synchronizing the dirty page bitmap to perform the next round of migration;
and when the shutdown migration condition is met, stopping running the virtual machine, and migrating the default small page which is the dirty page according to the dirty page bitmap.
Optionally, the method further comprises:
when the shutdown migration condition is not met, determining the dirty page generation speed of the previous round of migration according to the dirty page bitmap and the transmission duration corresponding to the previous round of migration;
determining the migration speed of the dirty pages in the previous round of migration according to the data volume of the previous round of migration and the transmission time length corresponding to the previous round of migration;
the control of the virtual machine to stop running for a preset duration according to a preset time period includes:
and if the dirty page generation speed of the previous round of migration is greater than the dirty page migration speed of the previous round, controlling the virtual machine to stop running for a preset time according to a preset time period.
Optionally, the method further comprises:
if the difference value between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is smaller than or equal to a first speed difference threshold value, reducing the preset time period and/or increasing the preset duration;
if the difference between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is greater than a second speed difference threshold, increasing the preset time period and/or decreasing the preset duration, wherein the second speed difference threshold is greater than the first speed difference threshold.
Optionally, the method further comprises:
counting the number of dirty pages according to the dirty page bitmap, wherein the number of the dirty pages represents the default number of small pages of the dirty pages;
and determining whether the shutdown migration condition is met or not according to the migration speed of the dirty pages in the previous round of migration, the preset shutdown duration and the number of the dirty pages.
Optionally, the determining whether a stop migration condition is met according to the dirty page migration speed of the previous round of migration, a preset stop duration and the number of the dirty pages includes:
determining the maximum data volume which can be transmitted when the data transmission is carried out at the dirty page migration speed of the previous round of migration within the preset shutdown time;
determining the default small page number corresponding to the maximum data volume according to the data volume corresponding to the default small page;
if the number of the dirty pages is less than or equal to the default small number of pages, determining that a shutdown migration condition is met;
and if the dirty page number is larger than the default small page number, determining that the shutdown migration condition is not met.
Optionally, the determining whether a stop migration condition is met according to the dirty page migration speed of the previous round of migration, a preset stop duration and the number of the dirty pages includes:
determining the dirty data volume corresponding to the dirty page number according to the data volume corresponding to the default small page;
determining the transmission time length required for transmitting the dirty data volume at the dirty page migration speed of the previous round of migration;
if the transmission time length is less than or equal to the shutdown time length, determining that a shutdown migration condition is met;
and if the transmission time length is longer than the shutdown time length, determining that the shutdown migration condition is not met.
Optionally, the determining whether a stop migration condition is met according to the dirty page migration speed of the previous round of migration, a preset stop duration and the number of the dirty pages includes:
determining the dirty data volume corresponding to the dirty page number according to the data volume corresponding to the default small page;
determining the maximum data volume which can be transmitted when the data transmission is carried out at the dirty page migration speed of the previous round of migration within the preset shutdown time;
if the dirty data volume is smaller than or equal to the maximum data volume, determining that a shutdown migration condition is met;
and if the dirty data volume is larger than the maximum data volume, determining that the shutdown migration condition is not met.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a predictive manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The foregoing describes in detail a migration method, apparatus, electronic device, and storage medium of a virtual machine provided by the present invention, and a specific example is applied in the present document to explain the principle and implementation of the present invention, and the description of the foregoing embodiment is only used to help understand the method and core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (10)
1. A migration method of a virtual machine is characterized by comprising the following steps:
synchronizing a dirty page bitmap, wherein the dirty page bitmap represents whether a default small page of the virtual machine is a dirty page or not;
when the shutdown migration condition is not met, controlling the virtual machine to stop running for a preset time length according to a preset time period, migrating default small pages which are dirty pages according to the dirty page bitmap, and entering the step of synchronizing the dirty page bitmap to perform the next round of migration;
and when the shutdown migration condition is met, stopping running the virtual machine, and migrating the default small page which is the dirty page according to the dirty page bitmap.
2. The method of claim 1, further comprising:
when the shutdown migration condition is not met, determining the dirty page generation speed of the previous round of migration according to the dirty page bitmap and the transmission duration corresponding to the previous round of migration;
determining the migration speed of the dirty pages in the previous round of migration according to the data volume of the previous round of migration and the transmission time length corresponding to the previous round of migration;
the control of the virtual machine to stop running for a preset duration according to a preset time period includes:
and if the dirty page generation speed of the previous round of migration is greater than the corresponding dirty page migration speed of the previous round, controlling the virtual machine to stop running for a preset time according to a preset time period.
3. The method of claim 2, further comprising:
if the difference value between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is smaller than or equal to a first speed difference threshold value, reducing the preset time period and/or increasing the preset duration;
if the difference between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is greater than a second speed difference threshold, increasing the preset time period and/or decreasing the preset duration, wherein the second speed difference threshold is greater than the first speed difference threshold.
4. The method according to any one of claims 1 to 3, further comprising:
counting the number of dirty pages according to the dirty page bitmap, wherein the number of the dirty pages represents the default number of small pages of the dirty pages;
and determining whether the shutdown migration condition is met or not according to the migration speed of the dirty pages in the previous round of migration, the preset shutdown duration and the number of the dirty pages.
5. A migration apparatus of a virtual machine, comprising:
a dirty page bitmap synchronization module, configured to synchronize a dirty page bitmap, where the dirty page bitmap represents whether a default small page of the virtual machine is a dirty page;
the circular migration module is used for controlling the virtual machine to stop running for a preset time according to a preset time period when the shutdown migration condition is not met, migrating default small pages which are dirty pages according to the dirty page bitmap, and entering the dirty page bitmap synchronization module to perform the next round of migration;
and the shutdown migration module is used for stopping running the virtual machine when the shutdown migration condition is met, and migrating the default small page which is the dirty page according to the dirty page bitmap.
6. The apparatus of claim 5, further comprising:
the dirty page generation speed determination module is used for determining the dirty page generation speed of the previous round of migration according to the dirty page bitmap and the transmission duration corresponding to the previous round of migration when the shutdown migration condition is not met;
the dirty page migration speed determining module is used for determining the dirty page migration speed of the previous round of migration according to the data volume of the previous round of migration and the transmission time corresponding to the previous round of migration;
the cyclic migration module comprises:
and the cyclic migration sub-module is used for controlling the virtual machine to stop running for a preset time length according to a preset time period when the shutdown migration condition is not met and the dirty page generation speed of the previous round of migration is greater than the dirty page migration speed corresponding to the previous round, migrating the default small page which is the dirty page according to the dirty page bitmap, and entering the dirty page bitmap synchronization module to perform the next round of migration.
7. The apparatus of claim 6, further comprising:
the first operation stopping adjusting module is used for reducing the preset time period and/or increasing the preset time length if the difference value between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is smaller than or equal to a first speed difference threshold value;
and the second operation stopping adjustment module is used for increasing the preset time period and/or reducing the preset time length if the difference value between the dirty page migration speed of the previous round of migration and the dirty page generation speed of the previous round is greater than a second speed difference threshold, wherein the second speed difference threshold is greater than the first speed difference threshold.
8. The apparatus of any of claims 5 to 7, further comprising:
the dirty page number counting module is used for counting the number of dirty pages according to the dirty page bitmap, wherein the dirty page number represents the default small page number of the dirty pages;
and the shutdown migration condition determining module is used for determining whether the shutdown migration condition is met according to the migration speed of the dirty pages of the previous round of migration, the preset shutdown duration and the number of the dirty pages.
9. An electronic device comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors the one or more programs including instructions for:
synchronizing a dirty page bitmap, wherein the dirty page bitmap represents whether a default small page of the virtual machine is a dirty page or not;
when the shutdown migration condition is not met, controlling the virtual machine to stop running for a preset time length according to a preset time period, migrating default small pages which are dirty pages according to the dirty page bitmap, and entering the step of synchronizing the dirty page bitmap to perform the next round of migration;
and when the shutdown migration condition is met, stopping running the virtual machine, and migrating the default small page which is the dirty page according to the dirty page bitmap.
10. A readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the method of migrating a virtual machine according to any of method claims 1-4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010328920.1A CN111638937A (en) | 2020-04-23 | 2020-04-23 | Virtual machine migration method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010328920.1A CN111638937A (en) | 2020-04-23 | 2020-04-23 | Virtual machine migration method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111638937A true CN111638937A (en) | 2020-09-08 |
Family
ID=72331806
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010328920.1A Pending CN111638937A (en) | 2020-04-23 | 2020-04-23 | Virtual machine migration method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111638937A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115794315A (en) * | 2023-02-02 | 2023-03-14 | 天翼云科技有限公司 | Statistical method and device of dirty page rate, electronic equipment and storage medium |
WO2024104295A1 (en) * | 2022-11-14 | 2024-05-23 | 杭州阿里云飞天信息技术有限公司 | Thermal migration control method and apparatus for virtual machine, and medium and computer device |
WO2024164725A1 (en) * | 2023-02-07 | 2024-08-15 | 天翼云科技有限公司 | Virtual machine migration method and apparatus, electronic device and medium |
WO2024174755A1 (en) * | 2023-02-23 | 2024-08-29 | 中兴通讯股份有限公司 | Virtual machine migration method, device, and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103955399A (en) * | 2014-04-30 | 2014-07-30 | 华为技术有限公司 | Migrating method and device for virtual machine, as well as physical host |
CN107463424A (en) * | 2016-06-02 | 2017-12-12 | 北京金山云网络技术有限公司 | A kind of virtual machine migration method and device |
CN107832118A (en) * | 2017-11-18 | 2018-03-23 | 浙江网新恒天软件有限公司 | A kind of KVM live migration of virtual machine optimization methods of reduction VCPU temperatures |
CN110134490A (en) * | 2018-02-08 | 2019-08-16 | 中兴通讯股份有限公司 | Dynamic migration of virtual machine method, equipment and storage medium |
-
2020
- 2020-04-23 CN CN202010328920.1A patent/CN111638937A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103955399A (en) * | 2014-04-30 | 2014-07-30 | 华为技术有限公司 | Migrating method and device for virtual machine, as well as physical host |
CN107463424A (en) * | 2016-06-02 | 2017-12-12 | 北京金山云网络技术有限公司 | A kind of virtual machine migration method and device |
CN107832118A (en) * | 2017-11-18 | 2018-03-23 | 浙江网新恒天软件有限公司 | A kind of KVM live migration of virtual machine optimization methods of reduction VCPU temperatures |
CN110134490A (en) * | 2018-02-08 | 2019-08-16 | 中兴通讯股份有限公司 | Dynamic migration of virtual machine method, equipment and storage medium |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024104295A1 (en) * | 2022-11-14 | 2024-05-23 | 杭州阿里云飞天信息技术有限公司 | Thermal migration control method and apparatus for virtual machine, and medium and computer device |
CN115794315A (en) * | 2023-02-02 | 2023-03-14 | 天翼云科技有限公司 | Statistical method and device of dirty page rate, electronic equipment and storage medium |
WO2024159964A1 (en) * | 2023-02-02 | 2024-08-08 | 天翼云科技有限公司 | Statistical method and apparatus for dirty page rate, and electronic device and storage medium |
WO2024164725A1 (en) * | 2023-02-07 | 2024-08-15 | 天翼云科技有限公司 | Virtual machine migration method and apparatus, electronic device and medium |
WO2024174755A1 (en) * | 2023-02-23 | 2024-08-29 | 中兴通讯股份有限公司 | Virtual machine migration method, device, and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111638937A (en) | Virtual machine migration method and device, electronic equipment and storage medium | |
RU2637474C2 (en) | Method and device for controlling background application and terminal device | |
RU2667027C2 (en) | Method and device for video categorization | |
CN109254849B (en) | Application program running method and device | |
CN107193653B (en) | Bandwidth resource allocation method, device and storage medium | |
US11871083B2 (en) | Video stream playback control method, device, and storage medium | |
CN109408207A (en) | Micro services access control method, device and storage medium | |
CN113703937B (en) | Animation switching method and device and storage medium | |
EP3015983B1 (en) | Method and device for optimizing memory | |
CN111638938B (en) | Migration method and device of virtual machine, electronic equipment and storage medium | |
CN111340808A (en) | Screen display monitoring method and device, electronic equipment and storage medium | |
CN113867927A (en) | Resource allocation method, device, electronic equipment and storage medium | |
CN115719586A (en) | Screen refresh rate adjusting method and device, electronic equipment and storage medium | |
CN110968523A (en) | Memory defragmentation method and device | |
CN106527919A (en) | Method and device for adjusting screen display | |
CN109710152B (en) | Event processing method and device and storage medium | |
CN114185444A (en) | Method and device for preventing mistaken touch of touch screen and storage medium | |
CN114253385B (en) | Power consumption management method and device for mobile terminal and computer readable storage medium | |
CN112130994B (en) | Resource allocation method, device, electronic equipment and storage medium | |
EP3425511B1 (en) | Method and apparatus for monitoring virtual document object model | |
CN113655984A (en) | Audio playback control method, audio playback control device, and computer storage medium | |
CN114077461A (en) | Application program running method, device, equipment and storage medium | |
US11681351B2 (en) | Method and device for controlling screen, and storage medium | |
CN118796085A (en) | Storage space control method and device of embedded flash memory | |
CN117009044A (en) | Task processing method, device, electronic equipment, storage medium and product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information |
Address after: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing Applicant after: Loongson Zhongke Technology Co.,Ltd. Address before: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing Applicant before: LOONGSON TECHNOLOGY Corp.,Ltd. |
|
CB02 | Change of applicant information | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200908 |