A virtual machine migration method, device, terminal equipment and storage medium
By performing load testing on the server and calculating virtual machine CPU interference, the virtual machine migration strategy was optimized, which solved the problem of server resource fluctuations caused by virtual machine migration, and achieved more efficient resource utilization and reduced migration frequency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WINHONG INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2026-01-26
- Publication Date
- 2026-05-08
AI Technical Summary
Existing technologies fail to effectively determine whether the target server can support the migration during virtual machine migration, leading to frequent virtual machine migrations that cause fluctuations in server resource usage, and even problems such as overload or repeated migrations.
By performing load testing on all servers awaiting decision at the current moment, distinguishing between overloaded and non-overloaded servers, constructing a server candidate queue, and calculating the CPU interference of virtual machines based on the total number of CPU cores and CPU utilization, constructing a virtual machine CPU interference sequence, and optimizing migration strategies to reduce resource fluctuations.
By optimizing the migration strategy, unnecessary fluctuations in server resources caused by virtual machine migration were reduced, migration accuracy was improved, and frequent migrations and overload situations were avoided.
Smart Images

Figure CN121560462B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of virtual machine migration technology, and in particular to a virtual machine migration method, apparatus, terminal device, and storage medium. Background Technology
[0002] With the rapid development of cloud computing technology, virtualization technology is increasingly widely used in data centers. Virtual machine consolidation, as an important resource management strategy, is crucial for improving data center resource utilization, reducing energy consumption, and lowering operational costs. Through proper virtual machine consolidation, physical resources can be maximized while ensuring service quality, avoiding resource waste. Virtual machine consolidation technology primarily achieves efficient management of data center physical resources through dynamic migration and reallocation of virtual machine resources. The virtual machine consolidation process involves virtual machine migration, which in practice significantly impacts server resource usage patterns. Frequent migration of multiple virtual machines can cause fluctuations in server resource usage. Current technologies do not consider whether the target server can adequately support the virtual machine migration, leading to situations where the target server is already overloaded after migration, necessitating repeated migrations. Therefore, avoiding frequent virtual machine migrations is a pressing issue that needs to be addressed. Summary of the Invention
[0003] This invention provides a virtual machine migration method, apparatus, terminal device, and storage medium, which can reduce the fluctuation of server resource usage caused by virtual machine migration.
[0004] An embodiment of the present invention provides a virtual machine migration method, comprising:
[0005] Retrieve all servers awaiting decision at the current moment; each server includes several virtual machines.
[0006] Perform load testing on each server awaiting decision at the current moment to determine which servers are overloaded and which are not overloaded at the current moment.
[0007] Construct a candidate queue of servers for the current time based on each unloaded server at the current time.
[0008] For each overloaded server at the current moment, calculate the CPU interference of each virtual machine in the current overloaded server based on the total number of CPU cores of the current overloaded server, the total number of virtual CPU cores of each virtual machine, and the CPU utilization of each virtual machine.
[0009] Based on the CPU interference of each virtual machine in the current overloaded server, construct the virtual machine CPU interference sequence of the current overloaded server;
[0010] Construct an initial queue of virtual machines to be migrated. Based on the virtual machine CPU interference sequence of each overloaded server, add each virtual machine of each overloaded server to the initial queue of virtual machines to be migrated to obtain the queue of virtual machines to be migrated at the current time.
[0011] Based on the bandwidth utilization of each unloaded server in the current server candidate queue, migrate all virtual machines in the current virtual machine migration queue to each unloaded server in the current server candidate queue.
[0012] Further, the step of migrating all virtual machines in the virtual machine queue to be migrated to the unloaded servers in the server candidate queue at the current moment based on the bandwidth utilization of each unloaded server in the server candidate queue at the current moment includes:
[0013] Repeat the virtual machine migration operation until the queue of virtual machines to be migrated is empty at the current moment;
[0014] The virtual machine migration operation includes:
[0015] Get the bandwidth utilization of each unloaded server in the server candidate queue at the current time, and select a target server based on the bandwidth utilization of each unloaded server.
[0016] Select a target virtual machine from the queue of virtual machines to be migrated, and migrate the target virtual machine to the target server;
[0017] Remove the target virtual machine from the queue of virtual machines to be migrated.
[0018] Furthermore, it also includes:
[0019] When the queue of virtual machines to be migrated is empty at the current moment, generate a virtual machine migration topology map and a virtual machine migration mapping table for the current moment based on the queue of virtual machines to be migrated and the server candidate queue.
[0020] Migrate each virtual machine based on the current virtual machine migration topology and virtual machine migration mapping table.
[0021] Furthermore, the step of performing load detection on each server to be decided at the current moment to determine each overloaded server and each unoverloaded server at the current moment includes:
[0022] Obtain the load of each server under historical overload, the load of each server under current time, the historical overload time of each server under historical overload, and the virtual machine migration topology map of each server under historical overload.
[0023] Based on the historical overload time of each server to be decided and the virtual machine migration topology map under the historical overload time of each server to be decided, the predicted time of each server to be decided is determined.
[0024] Obtain the CPU utilization of each server to be decided within a preset time period; wherein, the preset time period includes the start time, the current time, and the prediction time;
[0025] The overload ratio is determined based on the load of each server at the historical overload time and the load of each server at the current time.
[0026] If the server to be decided meets the preset overload judgment condition at any current moment, the server to be decided at the current moment is determined to be an overloaded server.
[0027] If the server to be decided does not meet the preset overload judgment condition at any current moment, the server to be decided at the current moment is determined to be an unoverloaded server.
[0028] The preset overload determination conditions include: the CPU utilization rate of the server to be decided is not less than the hot threshold or the overload ratio of the server to be decided is not less than the cumulative overload threshold within a preset time period.
[0029] Further, determining the predicted time for each server to be decided based on its historical overload time and the virtual machine migration topology map under its historical overload time includes:
[0030] Construct a virtual machine migration topology atlas based on the virtual machine migration topology at historical overload moments of each server to be decided;
[0031] For each server to be decided, construct a time series dataset to be processed based on the server's historical overload time and current time.
[0032] Obtain time series data at a selected time from the time series dataset to be processed, obtain virtual machine migration topology map at a selected time from the virtual machine migration topology map set, and construct a binary data set to be processed based on the time series data at the selected time and the virtual machine migration topology map at the selected time.
[0033] The binary data to be processed is input into a preset time series prediction model so that the preset time series prediction model outputs the predicted time series length.
[0034] The prediction time of the server to be decided is determined based on the predicted time series length.
[0035] Furthermore, the preset time series prediction model includes: a normalization layer, a first bidirectional recursive loop layer, a second bidirectional recursive loop layer, a prediction layer, and an anti-normalization layer;
[0036] The step of inputting the binary data to be processed into a preset time series prediction model, so that the preset time series prediction model outputs the predicted time series length, includes:
[0037] The binary data to be processed is input into the normalization layer so that the normalization layer outputs normalized binary data; wherein, the normalized binary data includes: normalized time series data at a selected time and virtual machine migration topology map at a selected time.
[0038] Normalized binary data is input forward into the first bidirectional recursive loop layer so that the first bidirectional recursive loop layer outputs a forward processing result;
[0039] The normalized binary data is input in reverse into the second bidirectional recursive loop layer so that the second bidirectional recursive loop layer outputs the reverse processing result;
[0040] By combining the results of the forward and reverse processing, a bidirectional recursive loop result is obtained.
[0041] The bidirectional recursive loop result is input into the prediction layer to obtain the output prediction time series length;
[0042] The predicted time series length to be output is input into the denormalization layer so that the denormalization layer outputs the predicted time series length.
[0043] Furthermore, before migrating all virtual machines in the virtual machine queue to be migrated to the unloaded servers in the server candidate queue at the current moment based on the bandwidth utilization of each unloaded server in the server candidate queue at the current moment, the process also includes:
[0044] Perform underload detection on each server that is not currently overloaded to identify the servers that are currently underloaded.
[0045] Add all virtual machines on each underloaded server to the queue of virtual machines to be migrated.
[0046] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments;
[0047] One embodiment of the present invention provides a virtual machine migration device, including: a data acquisition module, a load detection module, a server candidate queue construction module, a virtual machine queue construction module to be migrated, and a migration module;
[0048] The data acquisition module is used to acquire all servers to be decided at the current moment; wherein each server to be decided includes several virtual machines;
[0049] The load detection module is used to perform load detection on each server to be decided at the current time, and to determine each overloaded server and each unoverloaded server at the current time.
[0050] The server queue construction module is used to construct a server candidate queue based on each unloaded server at the current time.
[0051] The virtual machine queue construction module is used to calculate the CPU interference degree of each virtual machine in the current overloaded server based on the total number of CPU cores of the current overloaded server, the total number of virtual CPU cores of each virtual machine, and the CPU utilization of each virtual machine for each overloaded server at the current time; construct the virtual machine CPU interference degree sequence of the current overloaded server based on the CPU interference degree of each virtual machine in the current overloaded server; construct an initial virtual machine queue to be migrated, and add each virtual machine of each overloaded server to the initial virtual machine queue to be migrated based on the virtual machine CPU interference degree sequence of each overloaded server to obtain the virtual machine queue to be migrated at the current time.
[0052] The migration module is used to migrate all virtual machines in the virtual machine queue to the unloaded servers in the server candidate queue at the current time, based on the bandwidth utilization of each unloaded server in the server candidate queue at the current time.
[0053] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement a virtual machine migration method as described in the above-described embodiment of the invention.
[0054] Another embodiment of the present invention provides a storage medium including a stored computer program, wherein the computer program, when running, controls the device where the storage medium is located to execute a virtual machine migration method as described in the above-described embodiment of the invention.
[0055] The following benefits can be obtained by implementing the present invention:
[0056] This invention provides a virtual machine migration method, apparatus, terminal device, and storage medium. The method involves acquiring all servers to be decided at the current moment, performing load testing on each server to determine overloaded servers and non-overloaded servers, and then constructing a server candidate queue using the non-overloaded servers. For each overloaded server, the CPU interference degree of each virtual machine in the overloaded server is calculated based on the total number of CPU cores of the overloaded server, the total number of virtual CPU cores of each virtual machine, and the CPU utilization of each virtual machine. A virtual machine CPU interference degree sequence for the overloaded server is then constructed based on the calculated CPU interference degree of each virtual machine. The virtual machines of each overloaded server are added to the initial virtual machine queue to be migrated, resulting in a virtual machine queue to be migrated. This method of first performing load testing on the servers to distinguish whether they are overloaded allows for the migration of virtual machines contained in overloaded servers. Furthermore, based on the calculated CPU interference of each virtual machine in each overloaded server, the virtual machines in the overloaded server are added to the queue of virtual machines to be migrated according to the CPU interference. Then, based on the bandwidth utilization of each unoverloaded server in the server candidate queue, all virtual machines in the queue of virtual machines to be migrated are migrated to each unoverloaded server in the server candidate queue. By considering the bandwidth of each unoverloaded server in the server candidate queue and the CPU interference of the queue of virtual machines to be migrated, the accuracy of virtual machine migration can be improved, thereby reducing the frequent migration problems caused by inaccurate migration and reducing the fluctuation of server resource usage. Attached Figure Description
[0057] Figure 1 This is a flowchart illustrating a virtual machine migration method provided in an embodiment of the present invention.
[0058] Figure 2 This is a schematic diagram of the relationship between a server and a virtual machine provided in an embodiment of the present invention.
[0059] Figure 3 This is a schematic diagram of a preset time series prediction model structure provided in an embodiment of the present invention.
[0060] Figure 4 This is a schematic diagram of the structure of a virtual machine migration device provided in an embodiment of the present invention. Detailed Implementation
[0061] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0062] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this application. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. 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. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains; the terminology used herein is for the purpose of describing specific embodiments only and is not intended to limit this application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and the foregoing description of the accompanying drawings of this application are intended to cover non-exclusive inclusion. In the description of the embodiments of this application, technical terms such as "first," "second," etc., are only used to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly indicating the number, specific order, or primary or secondary relationship of the indicated technical features. In the description of the embodiments of this application, "a plurality of" means two or more, unless otherwise explicitly specified. The reference to "embodiment" herein means that a specific feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will understand, explicitly and implicitly, that the embodiments described herein can be combined with other embodiments. In the description of the embodiments of this application, the term "and / or" is merely a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship. In the description of the embodiments of this application, the term "multiple" refers to two or more (including two); similarly, "multiple groups" refers to two or more groups (including two groups), and "multiple pieces" refers to two or more pieces (including two pieces). In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.
[0063] like Figure 1The image shows a virtual machine migration method provided by an embodiment of the present invention, comprising:
[0064] Step S1: Obtain all servers to be decided at the current moment; where each server to be decided includes several virtual machines;
[0065] Step S2: Perform load testing on each server to be decided at the current moment to determine each overloaded server and each unoverloaded server at the current moment;
[0066] Step S3: Construct a candidate queue of servers for the current time based on each unloaded server at the current time;
[0067] Step S4: For each overloaded server at the current moment, calculate the CPU interference of each virtual machine in the current overloaded server based on the total number of CPU cores of the current overloaded server, the total number of virtual CPU cores of each virtual machine, and the CPU utilization of each virtual machine.
[0068] Step S5: Based on the CPU interference of each virtual machine in the current overloaded server, construct the virtual machine CPU interference sequence of the current overloaded server;
[0069] Step S6: Construct an initial queue of virtual machines to be migrated. Based on the virtual machine CPU interference sequence of each overloaded server, add each virtual machine of each overloaded server to the initial queue of virtual machines to be migrated to obtain the queue of virtual machines to be migrated at the current time.
[0070] Step S7: Based on the bandwidth utilization of each unloaded server in the server candidate queue at the current moment, migrate all virtual machines in the virtual machine queue to be migrated at the current moment to each unloaded server in the server candidate queue at the current moment.
[0071] For step S1, all running servers in the system data center at the current moment are obtained as decision servers, where each decision server contains multiple virtual machines. The inclusion relationship between decision servers and virtual machines is as follows: Figure 2 As shown.
[0072] For step S2, load detection is performed on each server to be decided at the current moment, and each server to be decided is divided into overloaded servers and unloaded servers.
[0073] In a preferred embodiment, the step of load detection on each decision-making server at the current moment to determine each overloaded server and each unoverloaded server at the current moment includes: acquiring the load of each decision-making server at historical overload moments, the load of each decision-making server at the current moment, the historical overload moments of each decision-making server, and the virtual machine migration topology map of each decision-making server at historical overload moments; determining the predicted time of each decision-making server based on the historical overload moments of each decision-making server and the virtual machine migration topology map of each decision-making server at historical overload moments; and acquiring the CPU utilization of each decision-making server within a preset time period; wherein, The preset time period includes the start time, the current time, and the predicted time. The overload ratio is determined based on the load of each server under historical overload times and the load of each server under current times. If a server under current times meets the preset overload judgment conditions, the server under current times is determined to be an overloaded server. If a server under current times does not meet the preset overload judgment conditions, the server under current times is determined to be an unoverloaded server. The preset overload judgment conditions include: the CPU utilization rate of the server under current times is not less than the hot threshold or the overload ratio of the server under current times is not less than the cumulative overload threshold.
[0074] Specifically, the system obtains the load of each server to be decided at its most recent historical overload moment, the most recent historical overload moment for each server to be decided, the load of each server to be decided at the current moment, and the virtual machine migration topology map of each server to be decided at its most recent historical overload moment. Preferably, it can also obtain the virtual machine migration topology map of each server to be decided at its most recent historical underload moment.
[0075] In a preferred embodiment, determining the predicted time for each decision-making server based on its historical overload time and virtual machine migration topology map at that historical overload time includes: constructing a virtual machine migration topology map set based on the virtual machine migration topology map at that historical overload time; for each decision-making server, constructing a time series dataset to be processed based on its historical overload time and current time; obtaining time series data at a selected time from the time series dataset to be processed, obtaining a virtual machine migration topology map at a selected time from the virtual machine migration topology map set, constructing a binary data set to be processed based on the time series data at the selected time and the virtual machine migration topology map at the selected time; inputting the binary data set to be processed into a preset time series prediction model so that the preset time series prediction model outputs a predicted time series length; and determining the predicted time for the decision-making server based on the predicted time series length.
[0076] Specifically, a virtual machine migration topology atlas is constructed based on the historical overload topology of all servers to be decided. Preferably, the virtual machine migration topology map of each server to be decided at the most recent historical underload time is added to the virtual machine migration topology map atlas. For each server to be decided, a time-series dataset to be processed is constructed based on the server's historical overload times and the current time. .in, The time series length, in this invention, refers to the length of the time series from the historical overload moment to the current moment. Preferably, when constructing the time series dataset to be processed, the number of each decision server and the number of features of each decision server can be included to obtain... , For the number of servers, The number of server features; where feature data may include server CPU, memory, and network bandwidth utilization.
[0077] From the time series data to be processed Get from Time series data at the selected time step (i.e., the selected time point above). , Migrate topology atlas from virtual machines Get from A virtual machine migration topology diagram for each time step (i.e., the selected time point mentioned above). Based on... The similarity matrix representing the relationships between server nodes in the data center, calculated using the soft-DTW time-series similarity algorithm, is used as the base graph. This base graph is then compared with the topology atlas from the virtual machine migration. Get from The virtual machine migration topology graphs of each time step are merged to obtain Dynamic topology graph of time steps .according to and Construct the binary data to be processed, represented as .Will The input is fed into a preset time series prediction model so that the preset time series prediction model outputs the predicted time series length. The predicted time series length Given the time series length from the current time to the predicted time, based on the predicted time series length... The prediction time can then be determined.
[0078] In a preferred embodiment, the preset time series prediction model includes: a normalization layer, a first bidirectional recursive loop layer, a second bidirectional recursive loop layer, a prediction layer, and an anti-normalization layer; the step of inputting the binary data to be processed into the preset time series prediction model so that the preset time series prediction model outputs the predicted time series length includes: inputting the binary data to be processed into the normalization layer so that the normalization layer outputs normalized binary data; wherein, the normalized binary data includes: normalized time series data at a selected time and virtual machine migration at a selected time. The topology is shifted; normalized binary data is input forward into the first bidirectional recursive loop layer, so that the first bidirectional recursive loop layer outputs a forward processing result; normalized binary data is input backward into the second bidirectional recursive loop layer, so that the second bidirectional recursive loop layer outputs a backward processing result; the forward processing result and the backward processing result are concatenated to obtain the bidirectional recursive loop result; the bidirectional recursive loop result is input into the prediction layer to obtain the predicted time series length to be output; the predicted time series length to be output is input into the denormalization layer, so that the denormalization layer outputs the predicted time series length.
[0079] Specifically, such as Figure 3 As shown, the preset time series prediction model consists of a normalization layer ReVIN-norm, a first bidirectional recursive loop layer GTG-1, a second bidirectional recursive loop layer GTG-2, a prediction layer, and an anti-normalization layer ReVIN-denorm; wherein, the prediction layer consists of two fully connected layers, the first fully connected layer being FC-1 and the second fully connected layer being FC-2.
[0080] Will When input is fed into the preset time series prediction model, it first reaches the normalization layer, and then passes through the normalization layer. Processing is performed to obtain Then The data is input sequentially into the first and second bidirectional recursive loop layers in both forward and reverse directions. After processing by the first and second bidirectional recursive loop layers, the first bidirectional recursive loop layer outputs the forward processing result. The second bidirectional recursive loop layer outputs the reverse processing result. The positive processing result and reverse processing results The result of the concatenation is a bidirectional recursive loop. .Will The input prediction layer obtains the output prediction time series length, which is then input into the denormalization layer. After processing by the denormalization layer, the desired output prediction time series length is obtained. As a result, according to the results Determine the length of the prediction time series.
[0081] It should be added that the first bidirectional recursive loop layer mentioned above consists of GAT, TCN, and GRU in that order. When input is passed to the first bidirectional recursive loop layer, it passes through GAT, TCN, and GRU in sequence, and finally outputs through GRU. In this structure, the GAT and TCN parameters are shared in the first bidirectional recursive loop layer. The second bidirectional recursive loop layer is also composed of GAT, TCN, and GRU in sequence. When inputting into the second bidirectional recursive loop layer, it passes through GAT, TCN, and GRU in sequence, and finally outputs through GRU. In this structure, the GAT and TCN parameters are shared in the second bidirectional recursive loop layer.
[0082] Preferably, the construction of the preset time series prediction model includes: obtaining a virtual machine migration topology map sample set containing virtual machine migration topology maps at several historical overload times; a historical server time series dataset; constructing several binary tuple samples based on the virtual machine migration topology map sample set and the historical server time series dataset; constructing an initial time series prediction model, using the binary tuple samples as the input of the initial time series prediction model, using the predicted time series length corresponding to the binary tuple samples as the output of the initial time series prediction model, training the initial time series prediction model, and when the prediction error of the initial time series prediction model is minimized, the initial time series prediction model converges, generating the preset time series prediction model.
[0083] It should be added that, since the preset time series prediction model is trained based on time series data, over a relatively long time interval... Within this framework, the prediction accuracy of the preset time series prediction model needs to be periodically evaluated, along with the lag between the predicted time series length and the actual time series length, i.e., prediction error assessment. When the model error and lag of the preset time series prediction model reach a threshold during periodic evaluation, a correlation function is used to calculate the correlation between the predicted time series length and the actual time series length. The specific calculation formula is as follows:
[0084]
[0085] in, It is a sequence and Lag Correlation at units, when the highest correlation occurs with negative lag. If the position is such that the prediction time series is found to be severely lagging, then it is determined that the prediction time series has a serious lag.
[0086] At this point, new historical data is acquired and trained offline to generate a new time-series prediction model. The training method is the same as described above, except that the historical data corresponds to different time points, which will not be elaborated here. After the new time-series prediction model is trained, the new model and the original model are run alternately in an online environment using an A / B testing method. When both the prediction error and lag decrease, the original model is replaced with the new model.
[0087] Obtain the CPU utilization of each server to be decided within a preset time period, which includes the start time. Current moment and prediction time Among them, the start time This represents a historical moment. The preset time period is divided by the current moment, and can be represented as [...]. , ]and[ , The overload ratio is determined based on the load of each server at its historical overload time and its current load. Preferably, the overload ratio can also be calculated in conjunction with the rated load of each server. If the CPU utilization of a server is not less than the hot threshold or the overload ratio is not less than the cumulative overload threshold within a preset time period, then the server is determined to be an overloaded server at the current time. If neither of the above preset overload determination conditions is met, then the server is determined to be an unoverloaded server. Let the hot threshold be... The cumulative overload threshold is At that time, the preset overload judgment condition can be expressed as satisfying the following formula:
[0088]
[0089]
[0090] in, It is a Boolean function; In order to be in CPU resource utilization at any given time It refers to a single moment within a preset time period; The thermal threshold; For overload ratio weighting, ; This is the start time of the preset time period; The current moment; For the predicted time; This refers to the most recent historical overload moment. From Start to The cumulative overload rate threshold.
[0091] For step S3, construct a server candidate queue at the current time based on each unoverloaded server, that is, construct an empty initial server candidate queue, and add each unoverloaded server to the initial server candidate queue to obtain the server candidate queue.
[0092] For step S4, for each overloaded server, calculate the CPU interference level of each virtual machine in the current overloaded server based on the total number of CPU cores of the current overloaded server, the total number of virtual CPU cores of each virtual machine, and the CPU utilization of each virtual machine. For example, the CPU interference level of a virtual machine in the current overloaded server can be calculated using the following formula:
[0093]
[0094] in, For virtual machines from a point in time arrive The degree of interference; For virtual machines exist CPU utilization at any given moment; For virtual machines The total number of virtual CPU cores; This represents the total number of CPU cores on the server where the virtual machine is located, i.e., the total number of CPU cores on the currently overloaded server.
[0095] For step S5, after calculating the CPU interference of each virtual machine in the current overloaded server, a virtual machine CPU interference sequence for the current overloaded server is constructed based on the CPU interference of each virtual machine; wherein, in this virtual machine CPU interference sequence, the virtual machines are sorted in descending order of their CPU interference. At this point, the CPU interference sequence of each virtual machine corresponding to each overloaded server is obtained.
[0096] For step S6, constructing an empty initial queue of virtual machines to be migrated, virtual machines with high CPU interference in each virtual machine's CPU interference sequence corresponding to each overloaded server are preferentially selected and added to the queue of virtual machines to be migrated. Preferably, when adding virtual machines to the queue of virtual machines to be migrated, an overload test can be performed on the overloaded server corresponding to the virtual machine after each addition. If the server is determined to be not overloaded at this time, the selection of virtual machines from that server is stopped, and virtual machines are selected from other overloaded servers to reduce the number of virtual machines selected, thereby reducing the number of virtual machines to be migrated.
[0097] In a preferred embodiment, before migrating all virtual machines in the virtual machine queue to be migrated to the unloaded servers in the server candidate queue at the current time based on the bandwidth utilization of the unloaded servers in the server candidate queue at the current time, the method further includes: performing underload detection on the unloaded servers at the current time to determine the underloaded servers at the current time; and adding all virtual machines of the underloaded servers to the virtual machine queue to be migrated.
[0098] Specifically, the CPU utilization of each non-overloaded server is obtained within the aforementioned preset time period. If the CPU utilization of all servers within the aforementioned preset time period is lower than the cold threshold, then... If the server is found to be underloaded, then all virtual machines on the underloaded server will be added to the virtual machine queue to be migrated.
[0099] For step S7, in a preferred embodiment, migrating all virtual machines in the virtual machine queue to be migrated to the unloaded servers in the server candidate queue at the current time based on the bandwidth utilization of each unloaded server in the server candidate queue at the current time includes: repeatedly performing the virtual machine migration operation until the virtual machine queue to be migrated at the current time is empty; wherein, the virtual machine migration operation includes: obtaining the bandwidth utilization of each unloaded server in the server candidate queue at the current time, selecting a target server based on the bandwidth utilization of each unloaded server; selecting a target virtual machine from the virtual machine queue to be migrated, and migrating the target virtual machine to the target server; removing the target virtual machine from the virtual machine queue to be migrated.
[0100] In a preferred embodiment, the method further includes: when the virtual machine queue to be migrated is empty at the current time, generating a virtual machine migration topology map and a virtual machine migration mapping table at the current time based on the virtual machine queue to be migrated and the server candidate queue; and migrating each virtual machine based on the virtual machine migration topology map and the virtual machine migration mapping table at the current time.
[0101] Specifically, the process involves obtaining the bandwidth utilization of each unloaded server in the current server candidate queue, selecting a target server, and then selecting a target virtual machine from the virtual machine to be migrated queue based on the virtual machine's CPU interference level. This target virtual machine is then migrated to the target server and removed from the virtual machine to be migrated queue. This process is repeated until the virtual machine to be migrated queue is empty, generating a virtual machine migration topology diagram of each target virtual machine in the current virtual machine to be migrated queue migrating to each target server in the server candidate queue. Virtual machine migration mapping table According to the virtual machine migration topology map Virtual machine migration mapping table Migrate virtual machines across servers in the data center. Preferably, create a virtual machine migration topology map. Virtual machine migration mapping table The time data corresponding to the current moment is stored in the system database.
[0102] When selecting a target server, the CPU interference of the target virtual machine and the future network bandwidth usage of each server in the candidate server queue can also be considered. This can be measured using the following formula:
[0103]
[0104] in, To measure the target server, select from the candidate server queue. The smallest server is selected as the target server; These are weight parameters; This represents the predicted bandwidth utilization of the server.
[0105] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments.
[0106] like Figure 4 As shown, an embodiment of the present invention provides a virtual machine migration device, including: a data acquisition module, a load detection module, a server candidate queue construction module, a virtual machine queue construction module to be migrated, and a migration module;
[0107] The data acquisition module is used to acquire all servers to be decided at the current moment; wherein each server to be decided includes several virtual machines;
[0108] The load detection module is used to perform load detection on each server to be decided at the current time, and to determine each overloaded server and each unoverloaded server at the current time.
[0109] The server queue construction module is used to construct a server candidate queue based on each unloaded server at the current time.
[0110] The virtual machine queue construction module is used to calculate the CPU interference degree of each virtual machine in the current overloaded server based on the total number of CPU cores of the current overloaded server, the total number of virtual CPU cores of each virtual machine, and the CPU utilization of each virtual machine for each overloaded server at the current time; construct the virtual machine CPU interference degree sequence of the current overloaded server based on the CPU interference degree of each virtual machine in the current overloaded server; construct an initial virtual machine queue to be migrated, and add each virtual machine of each overloaded server to the initial virtual machine queue to be migrated based on the virtual machine CPU interference degree sequence of each overloaded server to obtain the virtual machine queue to be migrated at the current time.
[0111] The migration module is used to migrate all virtual machines in the virtual machine queue to the unloaded servers in the server candidate queue at the current time, based on the bandwidth utilization of each unloaded server in the server candidate queue at the current time.
[0112] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0113] Those skilled in the art will clearly understand that, for convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0114] Based on the above method embodiments, the present invention provides corresponding terminal device embodiments.
[0115] One embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements a virtual machine migration method as described in any one of the present invention.
[0116] The terminal device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0117] The processor can be a Central Processing Unit (CPU), or 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, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.
[0118] The memory can be used to store the computer program. The processor implements various functions of the terminal device by running or executing the computer program stored in the memory and calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created based on the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0119] Based on the above method embodiments, the present invention provides corresponding storage medium embodiments.
[0120] One embodiment of the present invention provides a storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to execute a virtual machine migration method according to any one of the present invention.
[0121] The storage medium is a computer-readable storage medium, and the computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0122] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A virtual machine migration method, characterized in that, include: Retrieve all servers awaiting decision at the current moment; each server includes several virtual machines. Perform load testing on each server awaiting decision at the current moment to determine which servers are overloaded and which are not overloaded at the current moment. Construct a candidate queue of servers for the current time based on each unloaded server at the current time. For each overloaded server at the current moment, the CPU interference degree of each virtual machine in the current overloaded server is calculated based on the total number of CPU cores of the current overloaded server, the total number of virtual CPU cores of each virtual machine, and the CPU utilization of each virtual machine. The CPU interference degree is the average of the CPU utilization ratio of the virtual machine based on its own number of virtual CPU cores relative to the total number of CPU cores of the server within a specified time interval. Based on the CPU interference of each virtual machine in the current overloaded server, construct the virtual machine CPU interference sequence of the current overloaded server; Construct an initial queue of virtual machines to be migrated. Based on the CPU interference sequence of virtual machines on each overloaded server, add virtual machines whose CPU interference meets the threshold to the initial queue of virtual machines to be migrated to obtain the queue of virtual machines to be migrated at the current time. Based on the bandwidth utilization of each unloaded server in the server candidate queue at the current moment, all virtual machines in the virtual machine queue to be migrated at the current moment are migrated to the target servers of each unloaded server in the server candidate queue at the current moment. The target servers are selected based on the preset weight parameters and the bandwidth utilization of the servers, and the evaluation indicators are calculated accordingly.
2. The virtual machine migration method as described in claim 1, characterized in that, The step of migrating all virtual machines in the virtual machine queue to be migrated to the unloaded servers in the server candidate queue at the current moment, based on the bandwidth utilization of each unloaded server in the server candidate queue at the current moment, includes: Repeat the virtual machine migration operation until the queue of virtual machines to be migrated is empty at the current moment; The virtual machine migration operation includes: Get the bandwidth utilization of each unloaded server in the server candidate queue at the current time, and select a target server based on the bandwidth utilization of each unloaded server. Select a target virtual machine from the queue of virtual machines to be migrated, and migrate the target virtual machine to the target server; Remove the target virtual machine from the queue of virtual machines to be migrated.
3. The virtual machine migration method as described in claim 2, characterized in that, Also includes: When the queue of virtual machines to be migrated is empty at the current moment, generate a virtual machine migration topology map and a virtual machine migration mapping table for the current moment based on the queue of virtual machines to be migrated and the server candidate queue. Migrate each virtual machine based on the current virtual machine migration topology and virtual machine migration mapping table.
4. The virtual machine migration method as described in claim 3, characterized in that, The step of performing load detection on each server to be decided at the current moment to determine each overloaded server and each unoverloaded server at the current moment includes: Obtain the load of each server under historical overload, the load of each server under current time, the historical overload time of each server under historical overload, and the virtual machine migration topology map of each server under historical overload. Based on the historical overload time of each server to be decided and the virtual machine migration topology map under the historical overload time of each server to be decided, the predicted time of each server to be decided is determined. Obtain the CPU utilization of each server to be decided within a preset time period; wherein, the preset time period includes the start time, the current time, and the prediction time; The overload ratio is determined based on the load of each server at its historical overload time and the load of each server at the current time. If the server to be decided meets the preset overload judgment condition at any current moment, the server to be decided at the current moment is determined to be an overloaded server. If the server to be decided does not meet the preset overload judgment condition at any current moment, the server to be decided at the current moment is determined to be an unoverloaded server. The preset overload determination conditions include: the CPU utilization rate of the server to be decided is not less than the hot threshold or the overload ratio of the server to be decided is not less than the cumulative overload threshold within a preset time period.
5. A virtual machine migration method as described in claim 4, characterized in that, The step of determining the predicted time for each server to be decided based on its historical overload time and the virtual machine migration topology map under its historical overload time includes: Construct a virtual machine migration topology atlas based on the virtual machine migration topology at historical overload moments of each server to be decided; For each server to be decided, construct a time series dataset to be processed based on the server’s historical overload time and current time. Obtain time series data at a selected time from the time series dataset to be processed, obtain virtual machine migration topology map at a selected time from the virtual machine migration topology map set, and construct a binary data set to be processed based on the time series data at the selected time and the virtual machine migration topology map at the selected time. The binary data to be processed is input into a preset time series prediction model so that the preset time series prediction model outputs the predicted time series length. The prediction time of the server to be decided is determined based on the predicted time series length.
6. The virtual machine migration method as described in claim 5, characterized in that, The preset time series prediction model includes: a normalization layer, a first bidirectional recursive loop layer, a second bidirectional recursive loop layer, a prediction layer, and an inverse normalization layer; The step of inputting the binary data to be processed into a preset time series prediction model, so that the preset time series prediction model outputs the predicted time series length, includes: The binary data to be processed is input into the normalization layer so that the normalization layer outputs normalized binary data; wherein, the normalized binary data includes: normalized time series data at a selected time and virtual machine migration topology map at a selected time. Normalized binary data is input forward into the first bidirectional recursive loop layer so that the first bidirectional recursive loop layer outputs a forward processing result; The normalized binary data is input in reverse into the second bidirectional recursive loop layer so that the second bidirectional recursive loop layer outputs the reverse processing result; By combining the results of the forward and reverse processing, a bidirectional recursive loop result is obtained. The bidirectional recursive loop result is input into the prediction layer to obtain the output prediction time series length; The predicted time series length to be output is input into the denormalization layer so that the denormalization layer outputs the predicted time series length.
7. The virtual machine migration method as described in claim 1, characterized in that, Before migrating all virtual machines in the virtual machine queue to be migrated to the unloaded servers in the server candidate queue at the current moment based on the bandwidth utilization of each unloaded server in the server candidate queue at the current moment, the process also includes: Perform underload detection on each server that is not currently overloaded to identify the servers that are currently underloaded. Add all virtual machines on each underloaded server to the queue of virtual machines to be migrated.
8. A virtual machine migration device, characterized in that, include: The module includes a data acquisition module, a load detection module, a server candidate queue construction module, a virtual machine queue construction module to be migrated, and a migration module. The data acquisition module is used to acquire all servers to be decided at the current moment; wherein each server to be decided includes several virtual machines; The load detection module is used to perform load detection on each server to be decided at the current time, and to determine each overloaded server and each unoverloaded server at the current time. The server candidate queue construction module is used to construct a server candidate queue for the current time based on each unloaded server at the current time. The virtual machine queue construction module is used to calculate the CPU interference degree of each virtual machine in the current overloaded server based on the total number of CPU cores of the current overloaded server, the total number of virtual CPU cores of each virtual machine, and the CPU utilization of each virtual machine for each overloaded server at the current time; construct the virtual machine CPU interference degree sequence of the current overloaded server based on the CPU interference degree of each virtual machine in the current overloaded server; construct an initial virtual machine queue to be migrated, and add virtual machines whose CPU interference degree meets the threshold in each overloaded server to the initial virtual machine queue to be migrated according to the virtual machine CPU interference degree sequence of each overloaded server to obtain the virtual machine queue to be migrated at the current time. The CPU interference degree is calculated as the average of the CPU utilization ratio of the virtual machine based on its own number of virtual CPU cores relative to the total number of CPU cores of the server within a specified time interval. The migration module is used to migrate all virtual machines in the virtual machine queue to the target servers in the server candidate queue at the current time, based on the bandwidth utilization of each unloaded server in the server candidate queue at the current time. The target servers are selected based on preset weight parameters and server bandwidth utilization to calculate the measurement index.
9. A terminal device, characterized in that, The device includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements a virtual machine migration method as described in any one of claims 1 to 7.
10. A storage medium, characterized in that, The storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to perform a virtual machine migration method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Virtual machine migration method and device, terminal and storage medium
CN115858082A
Systems, apparatus and methods for cost and performance-based movement of applications and workloads in a multiple-provider system
US10346775B1