Virtual machine dynamic migration method oriented to energy collaboration
By constructing an energy management module and a virtual machine dynamic migration module, and combining the Q-learning algorithm to optimize virtual machine allocation, the technical problems of low resource utilization and electricity arbitrage opportunities in traditional data centers have been solved, thereby improving the energy efficiency and enhancing the stability of data centers.
Patent Information
- Application Number
- CN202511926024.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2045-12-19
AI Technical Summary
Traditional data center virtual machine scheduling strategies fail to effectively integrate with uninterruptible power supply systems, resulting in low resource utilization, high service costs, and an inability to adjust charging and discharging strategies according to electricity price fluctuations, thus reducing the energy efficiency of data centers.
An energy management module and a virtual machine dynamic migration module are constructed. The Q-learning algorithm is used to optimize virtual machine allocation. Combined with the grid electricity price and data center energy demand, the charging and discharging of the uninterruptible power supply is finely controlled, the virtual machine migration strategy is reasonably adjusted, and the resource allocation is optimized.
It enables flexible adjustment of charging and discharging strategies based on electricity price fluctuations, reducing data center electricity costs, improving resource utilization efficiency and system stability, and avoiding damage to battery life caused by over-discharge.
Smart Images

Figure CN121349600A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of virtual machine migration, and particularly relates to an energy coordination-oriented virtual machine dynamic migration method. BACKGROUND
[0002] With the rapid iteration of artificial intelligence technology, the breakthroughs represented by deep learning and large models are promoting the intelligent transformation of various industries. These cutting-edge AI applications all rely on the computing resources provided by data centers. As the demand for computing power for AI model training, inference and other tasks grows exponentially, the computing pressure faced by data centers is also increasing. To this end, effective virtual machine scheduling algorithms are needed to allocate computing power. However, traditional data centers generally use static virtual machine scheduling strategies, focusing only on task efficiency and ignoring energy consumption, and have problems such as low resource utilization, high service level agreement violation rate, etc., resulting in high service costs for AI computing applications and limiting their widespread development. Virtual machine scheduling mainly targets the computing power resources of data centers, allocating computing tasks through effective algorithms to solve the computing pressure problem caused by the growth of AI task computing power demand. The uninterruptible power supply system is a device that provides emergency power support for data centers. The functions of the two are relatively independent. The uninterruptible power supply system of the data center is single-function, focusing only on passive defense, i.e., as an emergency backup power supply, and has not been coordinated with the management of computing power resources involved in virtual machine scheduling. This single-function mode makes the uninterruptible power supply system unable to play a more important role in the overall operation of the data center, and lacks correlation with the goal of efficient resource utilization pursued by virtual machine scheduling, limiting the overall efficiency improvement of the data center.
[0003] Traditional uninterruptible power supplies (UPS) serve only as emergency backup power, creating "data silos" with the data center's energy system. Electricity arbitrage typically involves charging during off-peak hours and discharging during peak hours to reduce costs. However, due to their limited functionality and lack of effective integration with the energy system, traditional UPSs cannot adjust their charging and discharging strategies based on electricity price fluctuations. For example, during off-peak hours, they fail to utilize excess power to charge and store energy; conversely, during peak hours, they rely on externally supplied, more expensive electricity instead of utilizing stored energy, thus missing opportunities to reduce electricity costs and achieve arbitrage through strategic charging and discharging, increasing data center operating costs. The "data silo" effect stems from the fact that traditional UPSs, acting solely as emergency backup power, lack effective connection and information exchange with the data center's energy system, functioning independently. Because they are isolated from the energy system, they cannot adjust their operation based on electricity price information. While off-peak hours offer a good opportunity to charge and store energy, traditional UPSs, due to their limited functionality, fail to perform this charging operation. During peak electricity seasons, electricity prices soar. If traditional uninterruptible power supplies (UPS) are insufficient, they still need to obtain expensive electricity from the external grid to meet the data center's needs, or even if there is electricity, it is not properly discharged and utilized. This situation of not charging during off-peak hours and relying on expensive electricity or improper discharge during peak hours prevents data centers from reducing electricity costs through the proper charging and discharging of UPS systems, missing opportunities for electricity arbitrage and leading to increased annual operating costs. Furthermore, the batteries are in a floating charge state for extended periods, resulting in very low average utilization while continuously generating charging and discharging losses. Consequently, it is impossible to rationally plan virtual machine migration based on energy status, such as the remaining capacity of the UPS and charging progress, or to adjust virtual machine migration strategies in real time according to dynamic changes in grid electricity prices.
[0004] Chinese Patent Publication No. CN115292000A discloses a method, apparatus, and electronic device for dynamic migration of virtual machines. The method includes: determining the type of the virtual machine to be migrated on the source host; in response to the type matching a preset type, storing the data structure corresponding to a qualified interrupt controller; adding the data structure to the migration transmission data of the virtual machine to be migrated; and migrating the virtual machine from the source host to the target host based on the migration transmission data. While this solution can migrate the migration transmission data from the source host to the target host, achieving hardware-based virtual machine migration, it lacks consideration for the coordinated operation of uninterruptible power supply charging / discharging and virtual machine migration. It cannot dynamically adjust the virtual machine migration strategy according to energy status and grid electricity prices, thus reducing the energy efficiency of the data center. Summary of the Invention
[0005] To address this, the present invention provides a dynamic virtual machine migration method oriented towards energy coordination, which overcomes the problem in the prior art that lacks coordination between uninterruptible power supply charging and discharging and virtual machine migration, and cannot dynamically adjust virtual machine migration strategies according to energy status and grid electricity prices, thereby reducing the energy utilization efficiency of data centers.
[0006] To achieve the above objectives, this invention provides a method for dynamic migration of virtual machines oriented towards energy coordination, comprising the following steps: S1. Construct the energy management module and the virtual machine dynamic migration module, and initialize the parameters of the energy management module and the virtual machine dynamic migration module respectively to obtain the parameter-initialized energy management module and the parameter-initialized virtual machine dynamic migration module. S2. Perform energy management analysis on the energy management module after parameter initialization, including: Determine whether to enable the uninterruptible power supply's discharge function based on the grid electricity price level and the total energy demand of the data center, and output the discharge status indicator. If the discharge status is enabled, during the uninterruptible power supply (UPS) discharge period, it is determined whether to terminate the UPS discharge function according to the preset termination discharge conditions. If yes, the UPS discharge function is terminated and a discharge termination signal is output; otherwise, it is skipped. Reacquire the grid electricity price level and the total energy demand of the data center, and determine whether to enable the charging function of the uninterruptible power supply based on the preset charging conditions. If yes, charge the uninterruptible power supply; otherwise, skip the process. S3. Repeat step S2 until the first preset execution termination condition is met, then stop executing step S2 and output the updated energy demand parameters. S4. Perform virtual machine migration analysis on the virtual machine dynamic migration module after parameter initialization, including: In the virtual machine dynamic migration module after parameter initialization, the list of virtual machines and the list of physical servers are obtained by combining the updated energy demand parameters. The virtual machines in the virtual machine list are used as the state space, and the physical servers in the physical server list are used as the action set. The state space and action set are input into the Q-learning algorithm to construct the Q table, and the virtual machine allocation sequence is optimized by iteratively calculating the Q value, and the final virtual machine allocation sequence is output. according to - The greedy strategy simulates the allocation process of virtual machines to physical servers in the final virtual machine allocation sequence to obtain the simulated allocation result; Based on the grouping results of the physical servers and the preset adaptation principles, a list of virtual machines to be assigned is obtained, and the virtual machines in the list of virtual machines to be assigned are reassigned to the target physical servers; S5. Repeat step S4 until the second preset execution termination condition is met, then stop executing step S4 and output the virtual machine migration result.
[0007] Compared with the prior art, the beneficial effects of this application are as follows: By initializing the parameters, the energy management module can determine whether to enable the uninterruptible power supply (UPS) discharge function based on the grid electricity price level and the total energy demand of the data center. During the UPS discharge process, once the preset termination discharge conditions are met, a discharge termination signal is output in a timely manner. This achieves fine-grained control over the UPS discharge process, avoiding damage to battery life from over-discharge. At the same time, it ensures that the UPS energy can be fully utilized at critical moments. It can also determine whether to enable the UPS charging function based on preset charging conditions, and flexibly adjust the UPS charging and discharging strategy according to grid electricity price fluctuations and the actual energy demand of the data center. Charging is done during off-peak hours and discharging is done during peak hours, thereby effectively reducing the electricity cost of the data center and improving the overall energy utilization efficiency.
[0008] In the virtual machine dynamic migration module after parameter initialization, this application initializes the virtual machine migration environment based on updated energy demand parameters, obtains a virtual machine list and a physical server list, uses the virtual machines in the virtual machine list as the state space, and the physical servers in the physical server list as the action set, inputs the state space and action set into the Q-learning algorithm to construct the Q-table, and iteratively calculates the Q-value to output the final virtual machine allocation sequence. When energy is scarce, the optimized virtual machine allocation sequence can migrate virtual machines to physical servers with higher energy efficiency, avoiding operation under high energy consumption and reducing energy waste. For example, when the grid electricity price is high and the total energy demand of the data center is large, some non-critical business virtual machines can be migrated to physical servers with lower energy consumption, prioritizing the energy supply for critical businesses, realizing the rational allocation of energy and computing resources, and improving the overall resource utilization efficiency and operational stability of the data center. By analyzing the physical servers based on their CPU utilization and combining preset adaptation principles and the final virtual machine allocation sequence, a more reasonable virtual machine allocation sequence is formulated, making the virtual machine migration process closely related to the real-time status of the physical servers, enabling timely adaptation to changes in server status and enhancing the stability of the data center system.
[0009] Furthermore, in S2, determining whether to enable the uninterruptible power supply's discharge function includes: Step A1: Obtain the parameters in the energy management module after parameter initialization. Real-time grid electricity price level , The total amount of energy stored by an uninterruptible power supply And in The total energy required by the time data center is ; Step A2, according to Real-time grid electricity price level , The total amount of energy stored by an uninterruptible power supply and in The total energy required by the time data center is The conditions for activating the discharge function of the uninterruptible power supply are determined, and the mathematical expression for the discharge function conditions is as follows: In the formula, Indicates uninterruptible power supply The minimum energy required for backup power function. This indicates the energy required under peak load. express The power grid is currently experiencing high electricity prices.
[0010] In this solution, the energy management module after parameter initialization is used to obtain... The system uses the current grid electricity price level, the total energy demand of the data center, and the total amount of energy stored in the uninterruptible power supply (UPS) to determine the conditions for activating the UPS discharge function. It comprehensively considers factors such as the total amount of energy stored in the UPS, the minimum energy required for backup, the energy required for peak load, and the high grid electricity price level. This allows for a more accurate and scientific judgment on whether to activate the discharge function, optimize energy utilization, and reduce electricity costs.
[0011] Furthermore, in S2, the preset discharge termination conditions include a first preset discharge termination condition and a second preset discharge termination condition. When either the first or second preset discharge termination condition is met, it is determined whether to terminate the discharge function of the uninterruptible power supply. The mathematical expression for the first preset discharge termination condition is: The second preset discharge termination condition is: In the formula, express The power grid is currently experiencing low electricity prices.
[0012] In this scheme, two types of preset discharge termination conditions are clearly defined. The judgment is triggered when either condition is met, which facilitates flexible control of the uninterruptible power supply discharge and provides a basis for accurate judgment of discharge termination.
[0013] Furthermore, in step S2, the mathematical expression for the preset charging condition is: .
[0014] In this solution, by setting preset charging conditions, it can accurately determine whether to charge the uninterruptible power supply, making the charging operation more scientific and reasonable, avoiding blind charging, and effectively improving energy management efficiency.
[0015] Furthermore, in step S4, inputting the state space and action set into the Q-learning algorithm to construct the Q-table, and optimizing the virtual machine allocation sequence by iteratively calculating the Q-value includes: Step B1: Define the state space For the list of virtual machines to be assigned, the action set A list of active physical servers; Step B2: Initialize the Q table and define the Q value as 0 or 1; Step B3, the mathematical expression for iteratively calculating the Q value is: In the formula, Representing state Take action below Q value, express The state at any given moment, express The state at any given moment, express Actions at any moment The learning rate represents the rate at which the algorithm converges. Indicates the discount factor. Indicates the agent's state The reward value obtained when selecting an action. Indicates the state All possible actions, Indicates the state Below, all possible actions The largest Q value.
[0016] In this scheme, by explicitly defining the state space as the list of virtual machines to be allocated and the action set as the list of activated physical servers in S4, and providing a detailed mathematical expression for iteratively calculating the Q value, the value of actions taken under different states can be quantified more accurately. This allows the Q-learning algorithm to construct the Q table more scientifically, iteratively update the Q value, and optimize the virtual machine allocation strategy.
[0017] Furthermore, in S4, according to - The greedy strategy simulates the allocation process of virtual machines to physical servers in the final virtual machine allocation sequence, including: Step C1, with probability Randomly select a physical server as the first action; Step C2, with probability Select the physical server with the highest current Q value as the second action; Step C3: Based on the selected action, simulate allocating virtual machines from the final virtual machine allocation sequence to physical servers, calculate the total energy consumption of the physical servers and the execution cost of the virtual machines, and update the reward value and Q value.
[0018] In this solution, by adopting - Greedy strategy selects actions based on probability. Randomly selecting a physical server is the first action, and then using probability... The second action is to select the physical server with the highest current Q value. By leveraging existing experience and combining the two, virtual machines are simulated and allocated. The total energy consumption of the physical server and the execution cost of the virtual machines are calculated, and the reward value and Q value are updated. This approach can balance exploration and utilization, find the optimal virtual machine allocation scheme more efficiently, and reduce allocation costs.
[0019] Furthermore, in step S4, the virtual machine allocation list obtained based on the physical server grouping results and preset adaptation principles includes: Step D1: Based on the preset upper limit and lower limit of CPU utilization threshold for physical servers, divide the physical servers into overloaded, underloaded and normal groups to obtain the grouping results. Step D2: Perform a matching analysis on the grouping results and the optimized virtual machine allocation sequence according to the preset adaptation principle to obtain the matching analysis results; Step D3: Based on the matching analysis results, determine the migration correspondence of virtual machines among various physical servers, and obtain the list of virtual machines to be allocated according to the migration correspondence.
[0020] In this solution, by dividing physical server groups based on clearly defined upper and lower limits of CPU utilization, the server load status can be accurately distinguished. Then, the grouping results are matched with the optimized virtual machine allocation sequence according to the preset adaptation principle, thereby determining the migration correspondence and obtaining the virtual machine to be allocated list. This makes the virtual machine to be allocated list more targeted, effectively balancing server load and improving resource utilization efficiency and system stability.
[0021] Furthermore, step D2 includes: Step D21: Analyze the preset adaptation principles, clarify the virtual machine allocation adaptation conditions corresponding to the overload group, underload group, and normal group, and form an adaptation rule set; Step D22: Input the grouping results and the optimized virtual machine allocation sequence into the adaptation rule set, and match the groups and virtual machines item by item to obtain the initial matching results; Step D23: According to the preset priority rules, deduplication is performed on the conflicting items in the initial matching results to determine the unique matching relationship and form the matching analysis result.
[0022] In this solution, by parsing the preset adaptation principles to form a set of adaptation rules, the adaptation conditions for different server groups and virtual machine allocation can be clearly defined; by matching the grouping and allocation sequence input sets item by item, the adaptation situation can be accurately identified; and by handling conflict items according to preset priority rules to determine the unique matching relationship, the problem of chaotic matching and difficult conflict resolution in the existing technology is effectively avoided, and the rationality of virtual machine allocation and server load matching is improved. Attached Figure Description
[0023] Figure 1 This is a flowchart illustrating a method for dynamic migration of virtual machines oriented towards energy coordination, according to an embodiment of the present invention. Figure 2 This is a schematic diagram illustrating the implementation process of the energy management module and the virtual machine dynamic migration module in this embodiment of the invention. Detailed Implementation
[0024] The following detailed description illustrates the specific implementation method: like Figure 1 As shown, it is a flowchart illustrating a method for dynamic migration of virtual machines oriented towards energy coordination according to an embodiment of the present invention, including the following steps: S1. Construct the energy management module and the virtual machine dynamic migration module, and initialize the parameters of the energy management module and the virtual machine dynamic migration module respectively to obtain the parameter-initialized energy management module and the parameter-initialized virtual machine dynamic migration module. S2. Perform energy management analysis on the energy management module after parameter initialization, including: Determine whether to enable the uninterruptible power supply's discharge function based on the grid electricity price level and the total energy demand of the data center, and output the discharge status indicator. If the discharge status is enabled, during the uninterruptible power supply (UPS) discharge period, it is determined whether to terminate the UPS discharge function according to the preset termination discharge conditions. If yes, the UPS discharge function is terminated and a discharge termination signal is output; otherwise, it is skipped. Reacquire the grid electricity price level and the total energy demand of the data center, and determine whether to enable the charging function of the uninterruptible power supply based on the preset charging conditions. If yes, charge the uninterruptible power supply; otherwise, skip the process. S3. Repeat step S2 until the first preset execution termination condition is met, then stop executing step S2 and output the updated energy demand parameters. S4. Perform virtual machine migration analysis on the virtual machine dynamic migration module after parameter initialization, including: In the virtual machine dynamic migration module after parameter initialization, the list of virtual machines and the list of physical servers are obtained by combining the updated energy demand parameters. The virtual machines in the virtual machine list are used as the state space, and the physical servers in the physical server list are used as the action set. The state space and action set are input into the Q-learning algorithm to construct the Q table, and the virtual machine allocation sequence is optimized by iteratively calculating the Q value, and the final virtual machine allocation sequence is output. according to - The greedy strategy simulates the allocation process of virtual machines to physical servers in the final virtual machine allocation sequence to obtain the simulated allocation result; Based on the grouping results of the physical servers and the preset adaptation principles, a list of virtual machines to be assigned is obtained, and the virtual machines in the list of virtual machines to be assigned are reassigned to the target physical servers; S5. Repeat step S4 until the second preset execution termination condition is met, then stop executing step S4 and output the virtual machine migration result.
[0025] Specifically, in S2, determining whether to enable the uninterruptible power supply's discharge function includes: Step A1: Obtain the parameters in the energy management module after parameter initialization. Real-time grid electricity price level , The total amount of energy stored by an uninterruptible power supply And in The total energy required by the time data center is ; Step A2, according to Real-time grid electricity price level , The total amount of energy stored by an uninterruptible power supply and in The total energy required by the time data center is The conditions for activating the discharge function of the uninterruptible power supply are determined, and the mathematical expression for the discharge function conditions is as follows: In the formula, Indicates uninterruptible power supply The minimum energy required for backup power function. This indicates the energy required under peak load. express The power grid is currently experiencing high electricity prices.
[0026] Specifically, in S2, the preset discharge termination conditions include a first preset discharge termination condition and a second preset discharge termination condition. When either the first or second preset discharge termination condition is met, it is determined whether to terminate the discharge function of the uninterruptible power supply. The mathematical expression for the first preset discharge termination condition is: The second preset discharge termination condition is: In the formula, express The power grid is currently experiencing low electricity prices.
[0027] Specifically, in S2, preset charging conditions are constructed based on the reacquired grid electricity price level and the total energy demand of the data center. The mathematical expression for the preset charging conditions is: .
[0028] Specifically, in S4, the state space and action set are input into the Q-learning algorithm to construct the Q-table, and the virtual machine allocation sequence is optimized by iteratively calculating the Q-value, including: Step B1: Define the state space For the list of virtual machines to be assigned, the action set A list of active physical servers; Step B2: Initialize the Q table and define the Q value as 0 or 1; Step B3, the mathematical expression for iteratively calculating the Q value is: In the formula, Representing state Take action below Q value, express The state at any given moment, express The state at any given moment, express Actions at any moment The learning rate represents the rate at which the algorithm converges. Indicates the discount factor. Indicates the agent's state The reward value obtained when selecting an action. Indicates the state All possible actions, Indicates the state Below, all possible actions The largest Q value.
[0029] In this embodiment, the learning rate at which the algorithm converges Take values in the interval (0, 1] because Ensure parameters are updated. To avoid oscillations and divergence, a value of 0.1-0.3 is generally used. Discount factor Values are taken in the interval [0, 1), and the reinforcement learning standard is set as follows: Considering only immediate rewards, Considering long-term returns, using 0.9 to balance "current returns" and "future potential" is a classic configuration for Q-learning.
[0030] Specifically, in S4, according to - The greedy strategy simulates the allocation process of virtual machines to physical servers in the final virtual machine allocation sequence, including: Step C1, with probability Randomly select a physical server as the first action; Step C2, with probability Select the physical server with the highest current Q value as the second action; Step C3: Based on the selected action, simulate allocating virtual machines from the final virtual machine allocation sequence to physical servers, calculate the total energy consumption of the physical servers and the execution cost of the virtual machines, and update the reward value and Q value.
[0031] In step C1, a parameter is set in the Q-learning algorithm. (0 < <1), representing the probability of randomly selecting an action. A random value between 0 and 1, `rand`, is generated each time an action needs to be selected (i.e., selecting a target physical server to allocate a virtual machine). Purely greedy (prone to getting trapped in local optima). Purely random (no learning). The initial value of 0.2+ and the decay strategy are standard practices in the industry (such as OpenAI Spinning Up). The value range of rand is (0, 1), which is the standard random number generation interval. It has no special physical meaning and is only used for probability comparison.
[0032] If rand < If a server is randomly selected from all available physical servers, it will be chosen as the first action. This random selection helps the algorithm explore more possibilities in the early stages and avoid getting trapped in local optima. For example, with 10 physical servers, the system will randomly select one from these 10, regardless of the server's current Q-value.
[0033] In step C2, when rand is greater than or equal to When the time comes, the process proceeds to select the physical server with the highest current Q-value as the second action. First, the Q-values of all physical servers corresponding to the current state (including virtual machine resource requirements, physical server resource status, etc.) are retrieved from the Q-table. Then, these Q-values are compared, and the physical server with the highest Q-value is selected as the second action. This step makes the optimal choice based on current knowledge (i.e., the information in the Q-table) to maximize the long-term reward. For example, if calculations show that physical server A has the highest Q-value in the current state, then physical server A is selected as the second action.
[0034] In step C3, after selecting the first and second actions, the process of allocating virtual machines under these two actions is simulated. The cost corresponding to each action is calculated; in this embodiment, the cost includes factors such as resource consumption, migration time, and impact on business operations. A reward value is calculated based on the cost. The reward value should reflect the merits of the action; for example, the lower the cost, the higher the reward value. Then, the Q-value is updated using the update formula of the Q-learning algorithm. By continuously updating the Q-value, the algorithm can gradually learn the strategy of selecting the optimal action under different states.
[0035] Specifically, in S4, the list of virtual machines to be allocated, obtained based on the grouping results of the physical servers and the preset adaptation principles, includes: Step D1: Based on the preset upper limit and lower limit of CPU utilization threshold for physical servers, divide the physical servers into overloaded, underloaded and normal groups to obtain the grouping results. Step D2: Perform a matching analysis on the grouping results and the optimized virtual machine allocation sequence according to the preset adaptation principle to obtain the matching analysis results; Step D3: Based on the matching analysis results, determine the migration correspondence of virtual machines among various physical servers, and obtain the list of virtual machines to be allocated according to the migration correspondence.
[0036] Step D2 includes: Step D21: Analyze the preset adaptation principles, clarify the virtual machine allocation adaptation conditions corresponding to the overload group, underload group, and normal group, and form an adaptation rule set; Step D22: Input the grouping results and the optimized virtual machine allocation sequence into the adaptation rule set, and match the groups and virtual machines item by item to obtain the initial matching results; Step D23: According to the preset priority rules, deduplication is performed on the conflicting items in the initial matching results to determine the unique matching relationship and form the matching analysis result.
[0037] In this embodiment, determining the preset upper and lower limits of CPU utilization thresholds for the physical server requires consideration of multiple factors. The upper limit must take into account server hardware performance and heat dissipation capabilities. If the hardware performance is strong and heat dissipation is good, a higher upper limit can be set to ensure stable operation under high loads. However, a high upper limit increases the risk of hardware wear and tear; a balance must be struck between performance and lifespan. The lower limit is set based on resource utilization efficiency. Too low a limit would lead to resource idleness and waste. Historical data on server performance under different loads can be used to analyze the relationship between performance and load, and a reasonable range can be determined by considering the business requirements for response time and throughput. Furthermore, by referencing industry standards and experience with similar server configurations, and after multiple tests and adjustments, the final upper and lower limits of CPU utilization thresholds suitable for the specific business scenario are determined.
[0038] The determination of the pre-defined adaptation principles is based on business needs, clearly defining the server performance requirements of different businesses. For example, critical businesses require high-performance servers and have high requirements for resource stability. Secondly, the resource requirements of virtual machines are considered, including CPU and memory usage. Matching rules are formulated based on the performance status of physical server groups (overloaded, underloaded, and normal groups). For example, the overloaded group should minimize the allocation of new virtual machines, prioritizing the migration of virtual machines with high resource requirements; the underloaded group can be appropriately allocated virtual machines with moderate or high resource requirements to improve resource utilization; and the normal group should be allocated virtual machines according to regular business needs. Simultaneously, the affinity and anti-affinity requirements of virtual machines must be considered to ensure that the matching principles meet business continuity and efficient resource utilization.
[0039] The pre-defined priority rules prioritize virtual machine allocation and migration based on business importance. For critical business operations, virtual machine allocation and migration have higher priority to ensure stable operation. Resource urgency is also a crucial factor; virtual machines urgently needing resources to complete tasks are prioritized. From a server performance perspective, servers with severe underload are allocated virtual machines first to quickly balance resources. Furthermore, considering virtual machine migration costs, including migration time and impact on business operations, those with lower migration costs are prioritized. Historical operational data can also be used to assign lower priority to virtual machines or server-related operations that frequently experience resource issues. By considering these factors and setting priority orders for different situations, a unique matching relationship can be quickly and reasonably determined in the event of conflicts.
[0040] The physical servers are divided into overloaded, underloaded, and normal groups. This involves grouping the physical servers based on preset upper and lower limits for CPU utilization. CPU utilization data for each physical server is collected in real time and compared to the thresholds. If a server's CPU utilization consistently exceeds the upper limit, it indicates excessive load and potential performance degradation and response latency issues; this server is then classified as an overloaded server. If CPU utilization consistently falls below the lower limit, it means server resources are not being fully utilized and are idle; these servers are classified as underloaded. Servers with CPU utilization between the upper and lower limits are operating stably and utilizing resources reasonably, thus being classified as normal servers. This classification provides a clear understanding of the load status of each server, laying the foundation for subsequent virtual machine allocation and migration. For overloaded groups, virtual machines are migrated to bring the physical server's CPU utilization below the upper limit. For underloaded groups, all virtual machines are migrated out, and the physical servers are put into hibernation to conserve energy. The virtual machines to be migrated are then added to the virtual machine allocation list.
[0041] The matching analysis of the grouping results and optimized virtual machine allocation sequence based on preset adaptation principles includes: First, parsing the preset adaptation principles to clarify the virtual machine allocation adaptation conditions for each of the overloaded, underloaded, and normal groups, forming a set of adaptation rules. For example, the adaptation rule for the overloaded group might be not to allocate new virtual machines, but to prioritize migrating out virtual machines with high resource consumption; the adaptation rule for the underloaded group is to allocate virtual machines with moderate or high resource requirements; and the normal group is allocated according to regular business needs. The grouping results and optimized virtual machine allocation sequence are input into the set of adaptation rules and compared item by item. It is checked whether the resource requirements and business attributes of each virtual machine meet the adaptation conditions of its physical server group. If they do, it is marked as a match; otherwise, the reason for the mismatch is recorded, ultimately obtaining the initial matching result, which reflects the preliminary adaptation status between the grouping and virtual machine allocation.
[0042] Determining the migration correspondence between virtual machines (VMs) on various physical servers and developing a VM migration plan based on this correspondence includes: determining the migration correspondence based on matching analysis results. For VMs in the overload group that need to be migrated, based on the resource status and adaptation rules of the underload and normal groups, physical servers that can meet their resource requirements and business requirements are identified as migration targets. VM affinity and anti-affinity are considered to ensure normal operation after migration and without affecting other VMs. Simultaneously, migration costs are taken into account, prioritizing solutions with shorter migration paths and less impact on business. After determining the migration correspondence, a detailed migration plan is developed. This includes a migration schedule, selecting off-peak periods to minimize impact; clearly defining migration steps, such as performing data backups before performing migration operations; and developing contingency plans to address potential failures during the migration process and ensure a smooth migration.
[0043] Define the virtual machine allocation adaptation conditions for each of the overloaded, underloaded, and normal groups, forming a set of adaptation rules. This includes comprehensively considering multiple factors when defining the virtual machine allocation adaptation conditions for each group. For the overloaded group, since its load is already high, the adaptation conditions should focus on reducing the load. For example, do not allocate new virtual machines to avoid further increasing the burden; prioritize migrating out virtual machines with high resource consumption and relatively low performance requirements to free up resources. The underloaded group has idle resources, and the adaptation conditions can be set to allocate virtual machines with moderate or high resource requirements to improve resource utilization; at the same time, consider business relevance and allocate related business virtual machines together for easier management and collaboration. The normal group allocates virtual machines according to regular business needs to ensure stable business operation. Combining business characteristics, server performance, virtual machine resource requirements, etc., these adaptation conditions are organized into clear and explicit rules to form a set of adaptation rules, providing a basis for subsequent matching analysis.
[0044] When matching groups and virtual machines item by item, the grouping results and optimized virtual machine allocation sequence information are first obtained. For each physical server group (overloaded group, underloaded group, normal group), the servers within the group are examined sequentially according to the formed set of adaptation rules. For each server, it is compared with the virtual machines in the virtual machine allocation sequence. The resource requirements of the virtual machine (such as CPU, memory, etc.) are checked to see if they are within the allowable range of the server group's adaptation rules, while also considering whether the virtual machine's business attributes are consistent with the server group's business positioning. For example, if the server group is a critical business group, the virtual machine should also be related to critical business. If all conditions of the virtual machine meet the server group's adaptation rules, it is marked as a match; if any condition is not met, the reason for the mismatch is recorded. Through this detailed item-by-item comparison, the compatibility between groups and virtual machines is comprehensively analyzed to obtain the initial matching results.
[0045] The process of deduplicating conflicting items in the initial matching results according to preset priority rules includes: First, identifying the specific circumstances of each conflicting item to determine which virtual machines and physical servers are involved. Based on the preset business importance priority, if the conflict involves critical business virtual machines, their matching relationship is prioritized, and the matching of other non-critical business virtual machines is adjusted. Considering the urgency of resource needs, virtual machines urgently requiring resources are prioritized, and their matching is readjusted to meet their needs. From a server performance perspective, if the conflict causes underloaded groups to be unable to effectively utilize resources, conflicts related to underloaded groups are resolved first to ensure reasonable resource allocation. Simultaneously, considering migration costs, the lowest-cost matching scheme is selected. Based on these priority rules, conflicting items are weighed and adjusted, duplicate or unreasonable matching is removed, a unique matching relationship is determined, and a final matching analysis result that meets business needs and resource utilization requirements is formed.
[0046] The migration target selection process includes: From the overload group, select virtual machines for migration according to priority (such as response time sensitivity, migration overhead, etc.) until the server utilization drops below the upper limit of the CPU utilization threshold.
[0047] For underloaded servers, migrate all virtual machines on them and trigger the server hibernation mechanism (shut down or enter low power mode) to reduce static power consumption.
[0048] The Q-learning algorithm is used to select the optimal target server for the virtual machine to be migrated (considering factors such as energy consumption, execution cost, and SLA guarantee).
[0049] like Figure 2 As shown, it is a flowchart of the implementation of the energy management module and the virtual machine dynamic migration module in this embodiment of the invention. The first step is system initialization: (1) System component initialization, setting up the energy management module and the virtual machine dynamic migration module. (2) Initializing the parameters of the modules respectively.
[0050] Step 2: Energy Management Module Implementation: (1) Determine whether to enable the uninterruptible power supply's discharge function. (2) Determine whether to disable the uninterruptible power supply's discharge function. (3) Determine whether to charge the uninterruptible power supply.
[0051] Step 3: Implementation of the virtual machine dynamic migration module: (1) Initialize the virtual machine migration environment. (2) Treat the virtual machine and physical server as the state space and action set respectively, and optimize the virtual machine allocation sequence using the Q-learning algorithm in reinforcement learning. (3) According to - Greedy strategy selects actions, simulates the allocation of virtual machines to physical servers, calculates energy consumption and execution costs, and updates reward value and Q value; (4) According to the CPU utilization of physical servers, physical servers are divided into overload group, underload group and normal group, and virtual machines that need to be migrated are added to the virtual machine allocation list based on grouping strategy and best adaptation principle. (5) Virtual machines in the virtual machine allocation list are reassigned to the target physical server to complete the dynamic integration of virtual machine resources.
[0052] Step 4: The module iterative execution system repeats Step 2 and Step 3 respectively until the first preset execution termination condition is met and the second preset execution termination condition is met.
[0053] Specifically, the first preset execution termination condition includes a first preset number of iterations, or a first optimization target obtained based on the first total energy consumption of the physical server and the first execution cost of the virtual machine; the second preset execution termination condition includes a second preset number of iterations, or a second optimization target obtained based on the second total energy consumption of the physical server and the second execution cost of the virtual machine.
[0054] In this embodiment, the first preset number of iterations is typically determined based on the complexity of the energy management module and the scale of the simulation scenario. If energy management involves numerous variables, such as electricity price fluctuations at different times and the coordination of multiple energy devices, the complexity is high, and more iterations are needed to fully analyze the effectiveness of the energy management strategy. In this case, the first preset number of iterations will be set relatively large. Conversely, if the scenario is simple and there are few variables, fewer iterations are needed to cover various situations, and the number of iterations will be smaller. At the same time, by combining historical data and experimental tests, the stability of energy management indicators under different number of iterations is observed. The number of iterations corresponding to when the indicators tend to stabilize can be used as a reasonable reference to determine the first preset number of iterations.
[0055] The second preset number of iterations is primarily determined based on the characteristics of the virtual machine dynamic migration module. The number of virtual machines, the physical server architecture, and the complexity of the migration rules are key factors. When the number of virtual machines is large, the physical server architecture is complex, and the migration rules are diverse, a larger number of iterations is needed to ensure the Q-learning algorithm fully converges and finds a better virtual machine allocation sequence. In this case, the second preset number of iterations will be set higher. Furthermore, by conducting multiple experiments in simulation environments of different scales and complexities, the change in virtual machine migration performance with the number of iterations is analyzed. When the migration performance no longer significantly improves, the corresponding number of iterations can serve as an important basis for determining the second preset number of iterations.
[0056] use To indicate time Time The CPU utilization of each physical server is then measured in time periods. The total energy consumption of a physical server is represented by the integral of the internal power consumption function. ,Right now In the formula, Indicates time Time CPU utilization of each physical server The power consumption function.
[0057] Meanwhile, the execution cost of the virtual machines allocated on each server Represented as: ; In the formula, This represents the i-th virtual machine. , Indicates time CPU utilization of the i-th virtual machine. This represents the computational workload of the i-th virtual machine. This represents the execution cost of the i-th virtual machine. This represents the resource quantity of the i-th virtual machine. Indicates the first One physical server, , Indicates time Time CPU utilization of each physical server Indicates the first The computing performance of a physical server Indicates the first The amount of resources per physical server Indicates that the i-th virtual machine is in the i-th position. Resource efficiency on a physical server This represents the computational workload weight of the i-th virtual machine; Considering only the power consumption of physical server computing resources, a power consumption model can be derived, and its mathematical expression is as follows: ; This indicates the power of the physical server when it is idle. This represents the power consumption of the physical server at maximum utilization. This represents the CPU utilization of the physical server. Indicates the shape parameter of the power consumption curve. A power consumption function representing the CPU utilization of a physical server; Based on the power consumption model, the goal is to minimize the total energy consumption of the physical server and the execution cost of the virtual machine in a real-time environment. In the formula, This represents a set of physical servers.
[0058] The calculation of the total energy consumption of the physical server and the execution cost of the virtual machine can be used to determine the first optimization objective obtained based on the first total energy consumption of the physical server and the first execution cost of the virtual machine, and the second optimization objective obtained based on the second total energy consumption of the physical server and the second execution cost of the virtual machine.
[0059] Based on the above content, conduct experimental analysis: To verify the effectiveness of this application in energy synergistic optimization, systematic experiments were conducted in a constructed simulation environment. The simulation platform, built using Python, simulated the operation of a data center under a time-of-use pricing scenario, comparing the performance differences in energy cost, resource utilization, and SLA guarantees between traditional static scheduling (Baseline), energy-only scheduling, and the proposed joint optimization method. The simulation parameter settings are shown in Table 1, covering the core parameters of physical servers, virtual machines, uninterruptible power supply (UPS) systems, and reinforcement learning algorithms. All parameters were reasonably set with reference to typical small and medium-sized data center configurations.
[0060] Table 1. Basic Parameter Configuration Table for Simulation Experiment
[0061] Design three sets of comparative experiments: Baseline: Static VM allocation + UPS for emergency backup only; Energy-only: Enable UPS intelligent charging and discharging + static VM allocation; Proposed: The joint optimization method of this application (UPS + Q-learning dynamic migration).
[0062] The performance metrics evaluated include: total energy cost (RMB); average server utilization (%); number of SLA defaults (response timeout > 200ms); and UPS system utilization (%).
[0063] In actual system deployment, the state space should be designed as a composite state containing information such as the current resource utilization of each physical server and the resource requirement characteristics of the virtual machines to be migrated. This simulation simplifies the calculation.
[0064] The simulation ran for 24 hours, with one decision cycle per hour, and a total of 500 training rounds were performed before performance evaluation. The experimental results are shown in Table 2.
[0065] Table 2 Comparison of 24-hour simulation experiment performance
[0066] Compared to the baseline, the joint optimization method in this application reduces energy costs by 32.6%, mainly due to UPS discharge during peak hours replacing expensive grid power purchases, and reduced static power consumption from server hibernation. Server average utilization increased by 58.6%, validating the effectiveness of Q-learning dynamic migration in load balancing. The number of SLA defaults decreased from 18 to 3, indicating that dynamic migration not only did not sacrifice service quality but also improved system stability by avoiding overload. UPS system utilization increased from 0% to 52.3%, realizing a functional transformation from "backup equipment" to "active energy asset."
[0067] The above are merely embodiments of the present invention. Commonly known structures and characteristics are not described in detail here. Those skilled in the art are aware of all common technical knowledge in the field prior to the application date or priority date, are aware of all existing technologies in that field, and have the ability to apply conventional experimental methods prior to that date. Those skilled in the art can, under the guidance of this application, improve and implement this solution in combination with their own capabilities. Some typical known structures or methods should not be obstacles for those skilled in the art to implement this application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the structure of the present invention. These should also be considered within the scope of protection of the present invention, and will not affect the effectiveness of the implementation of the present invention or the practicality of the patent. The scope of protection claimed in this application should be determined by the content of its claims, and the specific embodiments described in the specification can be used to interpret the content of the claims.
Claims
1. A method for dynamic migration of virtual machines oriented towards energy coordination, characterized in that: Includes the following steps: S1. Construct the energy management module and the virtual machine dynamic migration module, and initialize the parameters of the energy management module and the virtual machine dynamic migration module respectively to obtain the parameter-initialized energy management module and the parameter-initialized virtual machine dynamic migration module. S2. Perform energy management analysis on the energy management module after parameter initialization, including: Determine whether to enable the uninterruptible power supply's discharge function based on the grid electricity price level and the total energy demand of the data center, and output the discharge status indicator. If the discharge status is enabled, during the uninterruptible power supply (UPS) discharge period, it is determined whether to terminate the UPS discharge function according to the preset termination discharge conditions. If yes, the UPS discharge function is terminated and a discharge termination signal is output; otherwise, it is skipped. Reacquire the grid electricity price level and the total energy demand of the data center, and determine whether to enable the charging function of the uninterruptible power supply based on the preset charging conditions. If yes, charge the uninterruptible power supply; otherwise, skip the process. S3. Repeat step S2 until the first preset execution termination condition is met, then stop executing step S2 and output the updated energy demand parameters. S4. Perform virtual machine migration analysis on the virtual machine dynamic migration module after parameter initialization, including: In the virtual machine dynamic migration module after parameter initialization, the list of virtual machines and the list of physical servers are obtained by combining the updated energy demand parameters. The virtual machines in the virtual machine list are used as the state space, and the physical servers in the physical server list are used as the action set. The state space and action set are input into the Q-learning algorithm to construct the Q table, and the virtual machine allocation sequence is optimized by iteratively calculating the Q value, and the final virtual machine allocation sequence is output. according to - The greedy strategy simulates the allocation process of virtual machines to physical servers in the final virtual machine allocation sequence to obtain the simulated allocation result; Based on the grouping results of the physical servers and the preset adaptation principles, a list of virtual machines to be assigned is obtained, and the virtual machines in the list of virtual machines to be assigned are reassigned to the target physical servers; S5. Repeat step S4 until the second preset execution termination condition is met, then stop executing step S4 and output the virtual machine migration result.
2. The method for dynamic migration of virtual machines oriented towards energy coordination according to claim 1, characterized in that: In S2, determining whether to enable the uninterruptible power supply's discharge function includes: Step A1: Obtain the parameters in the energy management module after parameter initialization. Real-time grid electricity price level , The total amount of energy stored by an uninterruptible power supply And in The total energy required by the time data center is ; Step A2, according to Real-time grid electricity price level , The total amount of energy stored by an uninterruptible power supply and in The total energy required by the time data center is The conditions for activating the discharge function of the uninterruptible power supply are determined, and the mathematical expression for the discharge function conditions is as follows: In the formula, Indicates uninterruptible power supply The minimum energy required for backup power function. This indicates the energy required under peak load. express The power grid is currently experiencing high electricity prices.
3. The method for dynamic migration of virtual machines oriented towards energy coordination according to claim 2, characterized in that: In S2, the preset discharge termination conditions include a first preset discharge termination condition and a second preset discharge termination condition. When either the first or second preset discharge termination condition is met, it is determined whether to terminate the discharge function of the uninterruptible power supply. The mathematical expression for the first preset discharge termination condition is: The second preset discharge termination condition is: In the formula, express The power grid is currently experiencing low electricity prices.
4. The method for dynamic migration of virtual machines oriented towards energy coordination according to claim 3, characterized in that: In step S2, the mathematical expression for the preset charging condition is: .
5. The method for dynamic migration of virtual machines oriented towards energy coordination according to claim 1, characterized in that: In step S4, the state space and action set are input into the Q-learning algorithm to construct the Q-table, and the virtual machine allocation sequence is optimized by iteratively calculating the Q-value, including: Step B1: Define the state space For the list of virtual machines to be assigned, the action set A list of active physical servers; Step B2: Initialize the Q table and define the Q value as 0 or 1; Step B3, the mathematical expression for iteratively calculating the Q value is: In the formula, Representing state Take action below Q value, express The state at any given moment, express The state at any given moment, express Momentary actions The learning rate represents the rate at which the algorithm converges. Indicates the discount factor. Indicates the agent's state The reward value obtained when selecting an action. Indicates the state All possible actions, Indicates the state Below, all possible actions The largest Q value in the range.
6. The method for dynamic migration of virtual machines oriented towards energy coordination according to claim 1, characterized in that: In the S4, according to - The greedy strategy simulates the allocation process of virtual machines to physical servers in the final virtual machine allocation sequence, including: Step C1, with probability Randomly select a physical server as the first action; Step C2, with probability Select the physical server with the highest current Q value as the second action; Step C3: Based on the selected action, simulate allocating virtual machines from the final virtual machine allocation sequence to physical servers, calculate the total energy consumption of the physical servers and the execution cost of the virtual machines, and update the reward value and Q value.
7. The method for dynamic migration of virtual machines oriented towards energy coordination according to claim 1, characterized in that: In step S4, the virtual machine allocation list obtained based on the physical server grouping results and preset adaptation principles includes: Step D1: Based on the preset upper limit and lower limit of CPU utilization threshold for physical servers, divide the physical servers into overloaded, underloaded and normal groups to obtain the grouping results. Step D2: Perform a matching analysis on the grouping results and the optimized virtual machine allocation sequence according to the preset adaptation principle to obtain the matching analysis results; Step D3: Based on the matching analysis results, determine the migration correspondence of virtual machines among various physical servers, and obtain the list of virtual machines to be allocated according to the migration correspondence.
8. A method for dynamic migration of virtual machines oriented towards energy coordination according to claim 7, characterized in that: Step D2 includes: Step D21: Analyze the preset adaptation principles, clarify the virtual machine allocation adaptation conditions corresponding to the overload group, underload group, and normal group, and form an adaptation rule set; Step D22: Input the grouping results and the optimized virtual machine allocation sequence into the adaptation rule set, and match the groups and virtual machines item by item to obtain the initial matching results; Step D23: According to the preset priority rules, deduplication is performed on the conflicting items in the initial matching results to determine the unique matching relationship and form the matching analysis result.
Citation Information
Patent Citations
Virtual machine migration method based on dynamic integration and multi-target cuckoo algorithm
CN114928542A
Data center energy-saving control method and control system based on intelligent self-adaptive migration of virtual machine
CN115934250A
Machine room energy-saving operation and maintenance management method and system
CN120123043A
Data center machine room AI energy-saving control method and system
CN121091656A
Systems and methods for intelligent UPS shutdown sequencing in virtualization environments
US11822403B1