Method, device and electronic equipment for deploying virtual machine

By constructing an initial population and optimizing the virtual machine deployment scheme using a fitness function, the problem of high carbon emissions in virtual machine deployment in existing technologies is solved, achieving the effect of reducing carbon emissions while optimizing energy consumption.

CN123030367APending Publication Date: 2026-11-03CHINA TOWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611467272.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-20
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Existing technologies only use energy consumption as an optimization indicator for virtual machine deployment, resulting in high actual carbon emissions from virtual machine deployment schemes, which fail to meet the data center's requirements for equipment carbon emissions.

Method used

By acquiring the configuration information of virtual machines and physical machines, an initial population is constructed. Then, by utilizing the fitness function and iterative update operation, combined with the carbon footprint index value, the deployment scheme of virtual machines is optimized, the optimal mapping relationship between virtual machines and physical machines is selected, and carbon emissions are reduced.

Benefits of technology

This achieves both energy efficiency optimization and reduced carbon emissions from virtual machine deployment schemes, meeting the carbon emission requirements of data centers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123030367A_ABST
    Figure CN123030367A_ABST
Patent Text Reader

Abstract

The application discloses a virtual machine deployment method and device and electronic equipment. Relates to the field of computer resource configuration, the method comprises the following steps: obtaining the first configuration information of the virtual machine, obtaining the second configuration information of the physical machine; obtain a preset constraint condition, and construct an initial population according to the preset constraint condition; obtaining the target processor utilization of each virtual machine in a target time window, performing an iterative updating operation on the initial population according to the information, and obtaining a target population obtained by the last iterative updating operation; determine the fitness of each population individual in the target population, and determine the population individual with the maximum target fitness as the target individual; determine the deployment scheme according to the target individual, and deploy the virtual machine according to the deployment scheme. Through the application, the problem that only energy consumption is used as an optimization index for virtual machine deployment in the related art, resulting in high actual carbon emissions of the virtual machine deployment scheme, is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer resource allocation, and more specifically, to a method, apparatus, and electronic device for deploying a virtual machine. Background Technology

[0002] With the rapid development and widespread application of cloud computing technology, data centers have become an important infrastructure of modern information society. When building and operating data centers, a large number of virtual machines need to be deployed in the physical machine cluster of the data center to meet the usage requirements of the data center.

[0003] Currently, when deploying virtual machines to physical machine clusters, energy consumption is usually used as the core optimization indicator. It assumes that electricity from different sources has the same carbon intensity attribute and does not consider differences in carbon emissions. This optimization strategy based on the assumption of a single power source has a certain degree of rationality in traditional data centers.

[0004] However, as data centers increasingly demand higher carbon emission levels from their equipment and the proportion of new energy sources in data center power supply continues to rise, many data centers have evolved into architectures that combine green electricity and grid power. Different physical machines generate significant carbon emission differences due to accessing power sources with different carbon intensities, meaning that the optimal placement scheme for energy consumption may not correspond to the optimal scheme for carbon emissions, thus making virtual machine deployment schemes not meet carbon emission requirements.

[0005] There is currently no effective solution to the problem that virtual machine deployment schemes have high actual carbon emissions due to using only energy consumption as an optimization indicator in related technologies. Summary of the Invention

[0006] The main objective of this application is to provide a method, apparatus, and electronic device for deploying virtual machines, in order to solve the problem that virtual machine deployment schemes with only energy consumption as an optimization indicator in related technologies have high actual carbon emissions.

[0007] To achieve the above objectives, according to one aspect of this application, a method for deploying a virtual machine is provided. The method includes: obtaining first configuration information for M virtual machines and second configuration information for N physical machines, wherein the physical machines are used to deploy virtual machines, and M and N are both positive integers; obtaining preset constraints and constructing an initial population based on the preset constraints, wherein the initial population includes P population individuals, each population individual corresponds to a virtual machine deployment scheme, each population individual includes M elements, and the element value of each element is used to represent the physical machine number corresponding to a virtual machine, where P is a positive integer; obtaining the target processor utilization of each virtual machine within a target time window, obtaining M first prediction results, and performing iterative update operations on the initial population based on the M first prediction results, first configuration information, second configuration information, and fitness function, and obtaining the target population obtained from the last iterative update operation when the iteration termination condition is reached; determining the fitness of each population individual in the target population based on the fitness function, obtaining P target fitness, and determining the population individual with the largest target fitness as the target individual; determining the deployment scheme of the M virtual machines based on the element values ​​of each element in the target individual, and configuring the M virtual machines on the N physical machines according to the deployment scheme.

[0008] Optionally, constructing the initial population according to preset constraints includes: randomly selecting a physical machine for each virtual machine and obtaining the number of each physical machine to obtain M physical machine numbers; simulating the configuration of the M virtual machines according to the M physical machine numbers and determining whether each physical machine after simulation configuration meets the preset constraints; if each physical machine meets the preset constraints, determining the M physical machine numbers as a population individual; repeating the steps of randomly selecting a physical machine for each virtual machine and obtaining the number of each physical machine to obtain M physical machine numbers until the number of population individuals reaches P, and determining the P population individuals as the initial population.

[0009] Optionally, obtaining the target processor utilization of each virtual machine within the target time window and obtaining M first prediction results includes: for any virtual machine, obtaining Q historical processor utilization rates of the virtual machine under historical time windows, where each historical time window is the same size as the target time window, and Q is a positive integer; inputting the Q historical processor utilization rates into the target prediction model to obtain the target processor utilization rate of the virtual machine under the target time window and the prediction interval of the target processor utilization rate; determining the confidence level of the target processor utilization rate based on the prediction interval, and determining the target processor utilization rate and confidence level as the first prediction results of the virtual machine.

[0010] Optionally, the iterative update operation of the initial population based on M first prediction results, first configuration information, second configuration information, and fitness function includes: determining the first fitness of each individual in the initial population based on the M first prediction results, first configuration information, second configuration information, and fitness function, obtaining M first fitness values; determining the individual with the highest first fitness value to obtain candidate individuals, and obtaining the current iteration round; determining whether the first fitness value and / or the current iteration round of the candidate individuals meet the iteration termination condition; if the first fitness value and / or the current iteration round of the candidate individuals do not meet the iteration termination condition, selecting P first individuals from the initial population based on the M first fitness values, and performing crossover and mutation processing on the P first individuals to obtain P second individuals; determining the P second individuals as the updated initial population, and iteratively executing the step of determining the first fitness value of each individual in the initial population based on the updated initial population until the first fitness value and / or the current iteration round of the candidate individuals meet the iteration termination condition; and completing the iterative update operation if the first fitness value and / or the current iteration round of the candidate individuals meet the iteration termination condition.

[0011] Optionally, the first configuration information includes the number of processor cores of the virtual machine, and the second configuration information includes at least the processor capacity, idle power consumption, full-load power consumption, and carbon intensity value of the physical machine. Determining the first fitness of each individual in the initial population based on M first prediction results, the first configuration information, the second configuration information, and the fitness function includes: for any individual, determining the processor utilization rate of each virtual machine on the corresponding physical machine based on the M first prediction results, the number of processor cores, and the processor capacity, obtaining M processor utilization rates; determining the real-time power consumption of each physical machine within the target time window based on the M processor utilization rates, idle power consumption, and full-load power consumption, obtaining N real-time power consumptions; calculating the total carbon emissions of the N physical machines based on the N real-time power consumptions, the carbon intensity value, and the duration of the target time window; and inputting the total carbon emissions into the fitness function to obtain the first fitness of the individual in the population.

[0012] Optionally, selecting P first individuals from the initial population based on M first fitness values, and performing crossover and mutation on these P first individuals to obtain P second individuals includes: randomly selecting T third individuals from the initial population, and selecting the third individual with the highest first fitness, where T is a positive integer; copying the third individual with the highest first fitness to the first population, and repeating the step of randomly selecting T third individuals from the initial population and selecting the third individual with the highest first fitness until the first population contains P third individuals; if the first population contains P third individuals, pairwise grouping the P third individuals in the first population to obtain multiple groups of third individuals, and generating two offspring individuals for each group of third individuals to obtain multiple groups of offspring individuals; determining the multiple groups of offspring individuals as the second population, obtaining the mutation probability, and processing the offspring individuals in the second population according to the mutation probability to obtain the third population; and determining the individuals in the third population as P second individuals.

[0013] Optionally, the first prediction result includes the target processor utilization and confidence level, and the mutation probability is obtained as follows: calculate the overall confidence level within the target time window based on the target processor utilization and confidence level of each virtual machine; calculate the confidence level parameter based on the overall confidence level, and multiply the confidence level parameter by the preset probability to obtain the mutation probability.

[0014] Optionally, processing the offspring individuals in the second population according to the mutation probability to obtain the third population includes: obtaining individuals to be mutated from the second population according to the mutation probability, resulting in H individuals to be mutated, where H is a positive integer; randomly determining the mutation element of each individual to be mutated, resulting in H mutation elements; changing the element value of the mutation element in each individual to be mutated, resulting in H updated individuals to be mutated; and replacing the H individuals to be mutated in the second population with the updated H individuals to be mutated, resulting in the third population.

[0015] To achieve the above objectives, according to another aspect of this application, a virtual machine deployment apparatus is provided. The apparatus includes: an acquisition unit, configured to acquire first configuration information of M virtual machines and second configuration information of N physical machines, wherein the physical machines are used to deploy the virtual machines, and M and N are both positive integers; a construction unit, configured to acquire preset constraints and construct an initial population based on the preset constraints, wherein the initial population includes P population individuals, each population individual corresponds to a virtual machine deployment scheme, each population individual includes M elements, and the element value of each element is used to represent the physical machine number corresponding to a virtual machine, where P is a positive integer; and an iteration unit, configured to acquire the target processor utilization rate of each virtual machine within a target time window, and obtain... The system generates M first prediction results and iteratively updates the initial population based on the M first prediction results, first configuration information, second configuration information, and fitness function. Upon reaching the iteration termination condition, it obtains the target population obtained from the last iteration update. A determination unit is used to determine the fitness of each individual in the target population based on the fitness function, obtaining P target fitness values, and determining the individual with the highest target fitness as the target individual. A configuration unit is used to determine the deployment scheme of M virtual machines based on the element values ​​of each element in the target individual, and configure the M virtual machines on N physical machines according to the deployment scheme.

[0016] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, the electronic device including a memory storing an executable program; and a processor for running the program, wherein the program executes the above-described virtual machine deployment method during runtime.

[0017] To achieve the above objectives, according to another aspect of this application, a computer program product is provided, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the virtual machine deployment method described above.

[0018] In this embodiment, the following steps are taken: First configuration information for M virtual machines is obtained, and second configuration information for N physical machines is obtained, where the physical machines are used to deploy the virtual machines, and M and N are both positive integers; Preset constraints are obtained, and an initial population is constructed based on these constraints, wherein the initial population includes P individuals, each corresponding to a virtual machine deployment scheme, and each individual includes M elements, where the element value represents the physical machine number corresponding to a virtual machine, and P is a positive integer; The target processor utilization of each virtual machine within the target time window is obtained, resulting in M ​​first prediction results; The initial population is iteratively updated based on the M first prediction results, the first configuration information, the second configuration information, and the fitness function, and when the iteration termination condition is met, the target population obtained from the last iteration update is obtained; The fitness of each individual in the target population is determined according to the fitness function, resulting in P target fitness values. The individual with the highest target fitness is identified as the target individual. Based on the element values ​​of each element in the target individual, a deployment scheme for M virtual machines is determined. These M virtual machines are then configured on N physical machines according to the deployment scheme. By setting multiple initial populations representing virtual machine deployment schemes, and using the first prediction result, first configuration information, and second configuration information obtained from the target processor utilization of each virtual machine within the target time window, combined with a fitness function related to the carbon footprint index value, the deployment schemes in the initial populations are iteratively updated to obtain the target population. The individual with the highest target fitness is then selected as the target individual to determine the deployment scheme. This achieves the goal of reducing the carbon footprint index value of the virtual machine deployment scheme, thereby reducing the actual carbon emissions of the virtual machine deployment scheme. This solves the technical problem in related technologies where only energy consumption is used as an optimization indicator for virtual machine deployment, resulting in high actual carbon emissions from virtual machine deployment schemes. Attached Figure Description

[0019] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0020] Figure 1 A hardware structure block diagram of a computer terminal for implementing a virtual machine deployment method is shown.

[0021] Figure 2 This is a flowchart of a virtual machine deployment method according to Embodiment 1 of this application;

[0022] Figure 3 This is a schematic diagram of the population iterative update process provided in Embodiment 1 of this application;

[0023] Figure 4This is a schematic diagram of a virtual machine deployment apparatus according to Embodiment 2 of this application;

[0024] Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0025] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] It should be noted that the virtual machine deployment methods, apparatuses, and electronic devices defined in this disclosure can be used in the field of computer resource configuration, or in any field other than computer resource configuration. The application fields of the virtual machine deployment methods, apparatuses, and electronic devices defined in this disclosure are not limited.

[0029] It should be noted that all information, user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, and displayed data) used in this application are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of related data all comply with the relevant regulations and standards of the relevant regions, have taken necessary measures, do not violate public order and good morals, and provide corresponding operation entry points for users to choose to authorize or refuse use. If the user chooses to refuse, the process proceeds to the expert decision-making process. For example, this system has interfaces with relevant users or organizations. Before obtaining relevant information, a request to obtain the information needs to be sent to the aforementioned user or organization through the interface. After receiving consent from the aforementioned user or organization, the relevant information is obtained. Users can view the purpose of data use in real time through the authorization interface and have the right to withdraw authorization or delete data at any time. After authorization is withdrawn, the system will terminate the relevant data processing within 24 hours.

[0030] The embodiments or examples disclosed herein are not exhaustive, but merely illustrative of some embodiments or examples, and are not intended to limit the scope of protection of this disclosure. Unless otherwise specified, each step in a particular embodiment or example can be implemented as an independent embodiment, and the steps can be arbitrarily combined. For example, a solution after removing some steps in a particular embodiment or example can also be implemented as an independent embodiment, and the order of the steps in a particular embodiment or example can be arbitrarily interchanged. Furthermore, optional methods or examples in a particular embodiment or example can be arbitrarily combined; moreover, embodiments or examples can be arbitrarily combined. For example, some or all steps of different embodiments or examples can be arbitrarily combined, and a particular embodiment or example can be arbitrarily combined with optional methods or examples of other embodiments or examples.

[0031] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:

[0032] Carbon footprint index value: also known as cumulative carbon footprint, refers to the calculated value that reflects the total amount of greenhouse gas emissions generated by a specific object (such as a virtual machine deployment scheme, data center or product) during its life cycle or a specific period. The carbon footprint index value can quantify the carbon emissions of a specific object, thereby characterizing the carbon emission situation.

[0033] LSTM: Long Short-Term Memory.

[0034] CPU: Central Processing Unit.

[0035] vCPU: Virtual CPU, virtual processor.

[0036] Example 1

[0037] According to an embodiment of this application, an embodiment of a virtual machine deployment method is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0038] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal for implementing a virtual machine deployment method is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, processing devices such as microprocessors or programmable logic devices), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface, a universal serial bus port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0039] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0040] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the virtual machine deployment method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the virtual machine deployment method described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0041] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0042] The display may be, for example, a touchscreen LCD display that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).

[0043] Under the aforementioned operating environment, this application provides the following: Figure 2 The virtual machine deployment method is shown. Figure 2 This is a flowchart of a virtual machine deployment method according to Embodiment 1 of this application, as shown below. Figure 2 As shown, the method includes:

[0044] Step S201: Obtain the first configuration information of M virtual machines and the second configuration information of N physical machines, where the physical machines are used to deploy virtual machines, and M and N are both positive integers.

[0045] It should be noted that the execution entity in this embodiment can be a virtual machine deployment system. This system can determine how to deploy each virtual machine on the physical machines based on the various data of multiple virtual machines and multiple physical machines in the data center. For example, there are 5 virtual machines V1 to V5 and 3 physical machines P1 to P5. An optional configuration method can be: {P1, P1, P2, P3, P3}. This configuration method can represent: deploying V1 and V2 on P1, deploying V3 on P2, and deploying V4 and V5 on P3.

[0046] It should be noted that a virtual machine refers to a logical computing unit running in a data center; the first configuration information refers to the set of parameters describing the resource requirements of the virtual machine, and the i-th virtual machine... V i The first configuration information can be represented by the following triplet: ,in, CPU requirements for this virtual machine (unit: cores); Memory requirements (unit: GB); The first configuration refers to the number of vCPU cores configured for the virtual machine; the second configuration refers to the physical server hardware that hosts the virtual machine; the third configuration information refers to the set of parameters describing the resource supply capacity and environmental attributes of the physical machine. Taiwan Physical Machine The second configuration information can be represented by the following triple: ,in, The CPU capacity of the physical machine (unit: cores); Memory capacity (unit: GB); Carbon intensity value (unit: kgCO2 / kWh).

[0047] For example, when determining the configuration method of a virtual machine, it is first necessary to collect virtual machine resource information and physical machine resource information. The system traverses the list of tasks to be deployed and extracts the initial configuration information for each virtual machine. Specifically, for the i-th virtual machine, the system obtains its CPU requirements. This value represents the number of CPU cores required by the virtual machine during its operation, measured in units of cores; the system also obtains its memory requirements. This value represents the physical memory capacity required for the virtual machine to run, measured in gigabytes; the system also obtains the number of its virtual CPU cores. This value represents the total number of logical processor cores allocated to the virtual machine, used for resource isolation and scheduling at the virtualization layer. Through the combination of these three parameters, the system establishes a complete quantitative description of the virtual machine's resource requirements.

[0048] Furthermore, the system performs the task of collecting physical machine resource information. The system traverses the list of all available physical machines in the data center, and for each physical machine, extracts its second configuration information. Specifically, for the j-th physical machine, the system obtains its central processing unit capacity. This value represents the total number of central processing unit cores possessed by the physical machine hardware, and is the upper limit of the capacity constraint; the system obtains its memory capacity. This value represents the total physical memory capacity of the physical machine hardware, which is the upper limit of memory constraints; its carbon intensity value also needs to be obtained. This value represents the carbon emissions generated per unit of electricity consumption from the power source connected to the physical machine, measured in kilograms of carbon dioxide per kilowatt-hour. The carbon intensity value is obtained by the system administrator through manual assignment or automatic reading based on the actual grid type connected to the physical machine (such as direct green electricity supply or grid power access).

[0049] By obtaining the above information, an initial population that meets the constraint conditions can be constructed subsequently based on the preset constraint information.

[0050] It should be noted that in real-world data center scenarios, the number of virtual machines (M) is typically greater than the number of physical machines (N) (i.e., M ≥ N). This ensures full utilization of physical machine resources and avoids energy waste caused by a large number of physical machines running idle for extended periods. Simultaneously, due to limitations in the CPU and memory capacity of physical machines, there is an upper limit C to the number of virtual machines a single physical machine can support; therefore, M ≤ N × C. Those skilled in the art can determine reasonable values ​​for M and N based on the above constraints and the actual business scale.

[0051] Step S202: Obtain preset constraints and construct an initial population based on the preset constraints. The initial population includes P population individuals, each population individual corresponds to a virtual machine deployment scheme, and each population individual includes M elements. The element value of each element is used to represent the physical machine number corresponding to a virtual machine, where P is a positive integer.

[0052] It should be noted that the preset constraints refer to the set of logical rules used to select deployment schemes that meet the equipment requirements, which may include CPU constraints, memory constraints, and uniqueness constraints; the initial population refers to the set of candidate solutions generated by the genetic optimization algorithm before the iteration begins, representing the initial distribution of the search space; the population individual refers to each member in the initial population, representing a specific mapping relationship between virtual machines and physical machines, which can be called a coding chromosome; the M elements refer to the gene position sequences in the coding chromosome, the number of which is equal to the total number of virtual machines M, with each position corresponding to one virtual machine; the element value refers to the integer value at a specific gene position in the chromosome, representing the physical machine index number to which the virtual machine corresponding to that position is assigned. For example, the coding chromosome of a certain population individual can be represented as: {P1, P1, P2, P3, P3}, and the configuration method corresponding to this population individual can be characterized as: deploying V1 and V2 on P1, deploying V3 on P2, and deploying V4 and V5 on P3.

[0053] For example, when constructing the initial population, it is first necessary to obtain preset constraints, which may include:

[0054] 1. The CPU constraint stipulates that for any physical machine, the sum of the CPU requirements of all virtual machines placed on it must be less than or equal to the CPU capacity of that physical machine, which can be expressed as:

[0055]

[0056] in, Indicates placement in physical machine A collection of virtual machines.

[0057] 2. Memory constraints stipulate that for any physical machine, the sum of the memory requirements of all virtual machines placed on it must be less than or equal to the physical machine's memory capacity, which can be expressed as:

[0058]

[0059] in, Indicates placement in physical machine A collection of virtual machines.

[0060] 3. The uniqueness constraint stipulates that each virtual machine can only be assigned to one physical machine. It is not allowed for a virtual machine to be distributed on multiple physical machines at the same time, nor is it allowed for a virtual machine to be unassigned.

[0061] Furthermore, the system constructs an initial population that meets the above constraints. The initial population consists of P individuals, each represented by an integer encoding, i.e., a encoded chromosome. Each individual's chromosome has a length of M and contains M elements, corresponding to M virtual machines. For the i-th element of the chromosome, its value is an integer between 1 and N, which directly indicates that this virtual machine is placed on the j-th physical machine.

[0062] During the initial population construction, the system employs a combination of random generation and validity verification. The system randomly shuffles the order of the virtual machines and attempts to assign a physical machine to each virtual machine sequentially. During the allocation process, the system checks in real-time for any violations of the aforementioned constraints. If a virtual machine configuration fails to meet these constraints, the system randomly selects another physical machine until a valid location is found or all physical machines are traversed.

[0063] If a valid location cannot be found for the virtual machine in a certain attempt, the currently generated individual is discarded, and a new population of individuals is generated. The system repeats this process until P population individuals that all satisfy the preset constraints are generated, thus forming the initial population, ensuring that all individuals in the constructed initial population are feasible.

[0064] Step S203: Obtain the target processor utilization of each virtual machine within the target time window, obtain M first prediction results, and perform iterative update operations on the initial population based on the M first prediction results, first configuration information, second configuration information and fitness function. When the iteration termination condition is reached, obtain the target population obtained by the last iterative update operation.

[0065] It should be noted that the target time window refers to the future period for which load forecasting and carbon footprint index values ​​are predicted. The target time window can include at least one time period, and can be expressed as: Target processor utilization refers to the proportion of central processing unit resources that the virtual machine is expected to occupy within the target time window; the first prediction result refers to the processor utilization value of the virtual machine in each future time window calculated by the time-series prediction model; the fitness function refers to the mathematical model used to quantitatively evaluate the individual quality of the population under the carbon footprint index dimension, and its value is negatively correlated with the cumulative carbon footprint; the iterative update operation refers to the process of continuously improving the population through a preset iterative method in the genetic algorithm; the target population refers to the population set containing the optimal solution obtained after multiple generations of iterative evolution.

[0066] For example, after obtaining the initial population, a load prediction task needs to be performed first. The system collects historical load data for each virtual machine and uses a long short-term memory network model to predict the target processor utilization of each virtual machine within the target time window. Through model calculation, the system obtains M first prediction results, each corresponding to the predicted processor utilization and confidence level of a virtual machine within the target time window.

[0067] Furthermore, the system iteratively updates the initial population based on M first prediction results, first configuration information, second configuration information, and a fitness function related to the carbon footprint index value. In each iteration, the system uses the M first prediction results combined with the first and second configuration information to calculate the cumulative carbon footprint of each individual through the fitness function, and evaluates its fitness accordingly. The iteration process continues until the preset maximum number of generations is reached or the optimal fitness value shows no significant improvement over multiple consecutive generations, thus terminating the iteration. At this point, the system stops iterating and obtains the target population obtained from the last iteration update operation, which represents the optimal solution distribution searched by the algorithm.

[0068] Step S204: Determine the fitness of each individual in the target population according to the fitness function to obtain P target fitness values, and determine the individual with the highest target fitness value as the target individual.

[0069] It should be noted that target fitness refers to the quantitative value calculated by the fitness function for each individual in the target population, used to compare the merits of various schemes in terms of carbon footprint index value; target individual refers to the individual in the target population with the highest fitness value, representing the optimal deployment scheme found so far.

[0070] For example, after obtaining the target population, the fitness of each individual in the target population needs to be evaluated. For each individual, the system first parses its chromosome code to determine the physical machine to which each virtual machine is assigned. Further, the system combines M first prediction results, first configuration information, and second configuration information to calculate the cumulative carbon footprint of the deployment scheme within the target time window, i.e., the carbon footprint index value, according to the fitness function. The smaller the carbon footprint index value, the larger the fitness value.

[0071] Through the above calculations, the system obtains P target fitness values. Then, the system compares these P target fitness values ​​and selects the individual with the highest value as the target individual.

[0072] Step S205: Determine the deployment scheme of M virtual machines based on the element values ​​of each element in the target individual, and configure the M virtual machines in N physical machines according to the deployment scheme.

[0073] For example, after identifying the target individual, the chromosome code of the target individual can be obtained, and its M elements can be traversed. For each element, its element value is read, which directly corresponds to a physical machine number. By establishing a mapping relationship between element indices and element values, the system determines the j-th physical machine to which the i-th virtual machine is assigned.

[0074] Furthermore, the system can execute virtual machine deployment operations based on the deployment plan recorded in the target instance. The system can send instructions to the virtual machine management platform to start M virtual machine instances and configure them on their corresponding physical machines. After configuration, the M virtual machines can start running on their respective physical machines, and the data center enters a new operational state, thus completing the aforementioned virtual machine deployment process based on load prediction and carbon awareness. Moreover, based on this deployment plan, the carbon footprint index value can be reduced to meet carbon emission requirements.

[0075] The virtual machine deployment method provided in this application involves: acquiring first configuration information for M virtual machines and second configuration information for N physical machines, where the physical machines are used to deploy the virtual machines, and M and N are both positive integers; acquiring preset constraints and constructing an initial population based on these constraints, where the initial population includes P individuals, each corresponding to a virtual machine deployment scheme, and each individual includes M elements, where the element value of each element represents the physical machine number corresponding to a virtual machine, and P is a positive integer; acquiring the target processor utilization of each virtual machine within a target time window to obtain M first prediction results; iteratively updating the initial population based on the M first prediction results, first configuration information, second configuration information, and a fitness function; and, upon reaching the iteration termination condition, acquiring the target population obtained from the last iteration update operation; and determining the fitness of each individual in the target population based on the fitness function to obtain P target populations. Fitness is used to determine the target individual, and the individual with the highest fitness is selected as the target individual. Based on the element values ​​of each element in the target individual, a deployment scheme for M virtual machines is determined. The M virtual machines are then configured on N physical machines according to the deployment scheme. By setting multiple initial populations representing the virtual machine deployment schemes, and using the first prediction result, first configuration information, and second configuration information obtained from the target processor utilization of each virtual machine within the target time window, combined with the fitness function related to the carbon footprint index value, the deployment schemes in the initial populations are iteratively updated to obtain the target population. The individual with the highest fitness is selected as the target individual to determine the deployment scheme. This achieves the goal of reducing the carbon footprint index value of the virtual machine deployment scheme, thereby realizing the technical effect of reducing the actual carbon emissions of the virtual machine deployment scheme. This solves the technical problem in related technologies where only energy consumption is used as an optimization index for virtual machine deployment, resulting in high actual carbon emissions of the virtual machine deployment scheme.

[0076] Optionally, in the virtual machine deployment method provided in this application embodiment, constructing an initial population according to preset constraints includes: randomly selecting a physical machine for each virtual machine and obtaining the number of each physical machine to obtain M physical machine numbers; simulating the configuration of the M virtual machines according to the M physical machine numbers and determining whether each physical machine after simulation configuration meets the preset constraints; if each physical machine meets the preset constraints, determining the M physical machine numbers as a population individual; repeating the steps of randomly selecting a physical machine for each virtual machine and obtaining the number of each physical machine to obtain M physical machine numbers until the number of population individuals reaches P, and determining the P population individuals as the initial population.

[0077] It should be noted that this scheme uses integer encoding to construct encoded chromosomes, with each chromosome representing a complete virtual machine placement scheme. The chromosome encoding is defined as follows:

[0078]

[0079] in, As an individual within a population, The total number of virtual machines is 'm', where 'm' and 'M' are the same and both represent the total number of virtual machines. The chromosome contains a total of 'm' and 'M'. One gene locus. The first... Value of each gene locus Integer ( ), indicating virtual machine Placed in the physical machine Above. An initial population consists of P individuals. .

[0080] For example, when constructing the initial population, the system first parses the preset constraints and then executes the population individual generation process according to the constraints. For the population individual to be generated, the system traverses the M virtual machines, independently and randomly selects an available physical machine for each virtual machine, and records the physical machine's number, thus obtaining a physical machine number sequence containing M elements.

[0081] Furthermore, after obtaining the sequence, the system performs a simulated configuration based on it. Specifically, based on the first configuration information of the virtual machine and the second configuration information of the physical machines, it calculates the total resource consumption of each physical machine under this deployment scheme and checks each physical machine one by one to see if it violates pre-set constraints. If all involved physical machines meet the pre-set constraints, i.e., no resource overrun occurs, the physical machine number sequence is determined to be usable and included in the initial population. If any violation of the pre-set constraints is found during the simulated configuration, the currently generated number sequence is discarded, and the random selection step is re-executed.

[0082] The system continuously repeats the above process of random selection, simulated configuration, and judgment. Each time a legitimate individual is successfully generated, the count is incremented by one, until the total number of legitimate individuals reaches a preset value P. Finally, the set of P legitimate individuals generated is determined as the initial population for subsequent iterations.

[0083] This embodiment constructs an initial population by combining random generation with constraint verification, ensuring that each individual in the constructed population meets the preset constraints. This avoids the algorithm processing a large number of invalid individuals in the early stages, thereby improving the execution efficiency and effectiveness of subsequent iterative operations.

[0084] Optionally, in the virtual machine deployment method provided in this application embodiment, obtaining the target processor utilization of each virtual machine within the target time window and obtaining M first prediction results includes: for any virtual machine, obtaining Q historical processor utilizations of the virtual machine under a historical time window, wherein each historical time window is the same size as the target time window, and Q is a positive integer; inputting the Q historical processor utilizations into the target prediction model to obtain the target processor utilization of the virtual machine under the target time window and the prediction interval of the target processor utilization; determining the confidence level of the target processor utilization based on the prediction interval, and determining the target processor utilization and the confidence level as the first prediction result of the virtual machine.

[0085] It should be noted that the historical time window refers to the past time period used to collect historical load data, and its duration is consistent with the target time window; Q historical processor utilization rates refer to the utilization rate of the central processing unit of the virtual machine within the past Q historical time windows, with each historical processor utilization rate corresponding to one historical time window; the target prediction model refers to the machine learning model used for time series prediction, which can be a long short-term memory network; the prediction interval refers to the upper and lower limits of the target processor utilization rate given based on the prediction results; and the confidence score refers to a numerical value reflecting the reliability of the prediction results, with a value range between 0 and 1.

[0086] For example, when determining the first prediction result, for any selected virtual machine, the system retrieves its historical runtime logs and extracts CPU usage ratio data within Q consecutive or non-consecutive historical time windows to obtain Q historical processor utilization rates. Since each historical time window is the same size as the target time window, this sequence can accurately reflect the temporal distribution characteristics of the virtual machine load.

[0087] Furthermore, the system uses these Q historical processor utilization rates as input data and feeds them into a pre-trained target prediction model, for example, an LSTM model. The target prediction model then uses a time-series analysis algorithm to output the target processor utilization rate of the virtual machine within the target time window t. Simultaneously, the quantile regression method is used to output the prediction interval for this utilization rate. The prediction interval is defined by the upper limit value. and lower limit value The composition represents the range of fluctuation in the predicted value.

[0088] Furthermore, the system determines the confidence level of the target processor utilization based on the prediction interval. Specifically, the system calculates the ratio of the prediction interval width to the target processor utilization, and normalizes this ratio to a range of 0 to 1 to obtain the confidence level. When the prediction interval is narrow, the confidence level is close to 1, indicating high prediction reliability; when the prediction interval is wide, the confidence level is close to 0, indicating low prediction reliability.

[0089] The confidence level can be calculated using the formula shown in Formula 1:

[0090] (1)

[0091] in, Let be the confidence level of the i-th virtual machine.

[0092] Finally, the system combines the calculated target processor utilization and confidence level to define the first prediction result for the virtual machine.

[0093] This embodiment achieves accurate prediction of dynamic changes in virtual machine CPU utilization by introducing a time series prediction model and a confidence assessment mechanism. By generating a first prediction result, the system can use CPU utilization to assess the carbon footprint of the deployment scheme, while dynamically adjusting the mutation probability of the genetic algorithm using the confidence level. When the prediction confidence is high, the algorithm tends to refine the search to accelerate convergence; when the prediction confidence is low, the algorithm enhances its global exploration capability to avoid getting trapped in local optima. This mechanism allows the virtual machine deployment scheme to adapt to the periodic fluctuations in CPU utilization, improving the accuracy of deployment decisions and thus more effectively minimizing the carbon footprint.

[0094] Optionally, in the virtual machine deployment method provided in this application embodiment, the iterative update operation of the initial population based on M first prediction results, first configuration information, second configuration information, and fitness function includes: determining the first fitness of each individual in the initial population based on the M first prediction results, first configuration information, second configuration information, and fitness function, to obtain M first fitnesss; determining the individual with the highest first fitness to obtain a candidate individual, and obtaining the current iteration round; judging whether the first fitness of the candidate individual and / or the current iteration round meet the iteration termination condition; and updating the candidate individual's first fitness... If the current iteration round does not meet the iteration termination condition, select P first individuals from the initial population based on M first fitness values, and perform crossover and mutation on the P first individuals to obtain P second individuals; determine the P second individuals as the updated initial population, and iteratively execute the step of determining the first fitness of each individual in the initial population based on the updated initial population, until the first fitness of the candidate individuals and / or the current iteration round meets the iteration termination condition; if the first fitness of the candidate individuals and / or the current iteration round meets the iteration termination condition, complete the iterative update operation.

[0095] It should be noted that: the first fitness refers to the evaluation value of each individual in the population calculated based on the current population state during the iteration process of the genetic algorithm; the candidate individual refers to the individual with the highest fitness value in a certain iteration round, representing the currently discovered optimal solution; the current iteration round refers to the number of generations or iterations that the genetic algorithm has gone through since its start; the iteration termination condition refers to the preset criteria used to determine whether the algorithm has ended its iteration, including the convergence of the fitness of the optimal solution or the maximum number of iterations limit; the P first individuals refer to the P parent individuals selected from the current population based on their fitness values ​​for breeding the next generation; crossover update refers to the genetic operation of recombining the genes of two parent individuals to generate offspring individuals; mutation refers to the genetic operation of randomly changing the values ​​of certain gene positions in an individual to increase the diversity of the population; the P second individuals refer to the P offspring individuals generated after crossover update and mutation; the updated initial population refers to the new generation population composed of the P second individuals, used for the next round of iteration calculation.

[0096] For example, during the iterative update operation, the fitness of each individual in the current initial population is first evaluated using M first prediction results, first configuration information, second configuration information, and a fitness function. By parsing the chromosome code of each individual, calculating the carbon footprint index value in combination with the prediction load, and calculating the penalty term according to the constraint violation, the first fitness of each individual is obtained, forming M sets of first fitness.

[0097] Furthermore, the system iterates through the M first fitness values, finds the individual with the largest value as a candidate individual, and records the current iteration round.

[0098] Furthermore, the system determines whether the first fitness of a candidate individual reaches a preset convergence threshold, or whether the current iteration round reaches a preset maximum number of generations, to determine if the iteration termination condition is met. If the determination result is that the iteration termination condition is not met, the system enters an evolutionary loop. Based on the values ​​of the M first fitness values, the system selects P individuals with higher fitness from the current initial population as parents. Subsequently, crossover and mutation operations are performed on these P individuals to obtain P second individuals, which are then used directly as the new initial population, replacing the original population.

[0099] Furthermore, the system returns to the fitness determination step, recalculates the first fitness based on the new initial population, and checks the iteration termination condition again. This process is repeated until the first fitness of the candidate individuals converges or the number of iterations reaches the upper limit. At this point, the iteration termination condition is met, the system stops iterating, and outputs the deployment scheme corresponding to the final candidate individuals.

[0100] This embodiment uses a fitness function to guide the population to evolve in the direction of minimizing the carbon footprint index value. It achieves continuous optimization of the virtual machine deployment scheme through an iterative update mechanism. At the same time, it maintains the diversity and search ability of the population through crossover and mutation operations, and finally obtains the virtual machine placement scheme that meets the constraints and has the lowest carbon footprint index value.

[0101] Optionally, in the virtual machine deployment method provided in this application embodiment, the first configuration information includes the number of processor cores of the virtual machine, and the second configuration information includes at least the processor capacity, idle power consumption, full load power consumption, and carbon intensity value of the physical machine. Determining the first fitness of each individual in the initial population based on M first prediction results, the first configuration information, the second configuration information, and the fitness function includes: for any individual in the population, determining the processor utilization rate of each virtual machine on the corresponding physical machine based on the M first prediction results, the number of processor cores, and the processor capacity, obtaining M processor utilization rates; determining the real-time power consumption of each physical machine within the target time window based on the M processor utilization rates, idle power consumption, and full load power consumption, obtaining N real-time power consumptions; calculating the total carbon emissions of the N physical machines based on the N real-time power consumptions, the carbon intensity value, and the duration of the target time window; and inputting the total carbon emissions into the fitness function to obtain the first fitness of the individual in the population.

[0102] It should be noted that: processor core count refers to the number of virtual processor cores configured in the virtual machine; processor capacity refers to the total capacity of processor cores available from the physical machine; processor utilization rate refers to the proportion of processor resources actually used by the virtual machine on the physical machine; real-time power consumption refers to the power consumption of the physical machine at a certain moment or on average within the target time window; idle power consumption refers to the basic power consumption of the physical machine under no load; full-load power consumption refers to the maximum power consumption of the physical machine when the processor is running at full load; and carbon intensity value refers to the carbon emissions generated per unit of electrical energy consumed.

[0103] For example, when calculating the first fitness of each individual in the population, the processor utilization of each individual in the population is calculated first. For each individual in the population, the chromosome code of that individual is first parsed to determine the physical machine on which each virtual machine is deployed. For each virtual machine, the system obtains the number of processor cores in its first configuration information, and combines this with the processor capacity in the second configuration information of its physical machine, as well as the target processor utilization rate in the first prediction result of the virtual machine within the target time window, to calculate the processor utilization rate of the virtual machine on the corresponding physical machine. .

[0104] The calculation can be performed using Formula 2:

[0105] (2)

[0106] in, This represents the processor utilization of virtual machine i on the corresponding physical machine within the target time window. Let be the CPU utilization of virtual machine i within the target time window t. For virtual machines The number of vCPU cores configured; To configure the physical machine of virtual machine i Processor capacity; This is the virtualization overhead coefficient, which can be set to 0.1.

[0107] Furthermore, after calculating the processor utilization rate of each virtual machine using Formula 2, since the number, number, and processor utilization rate of the virtual machines configured on each physical machine are already known, the idle power consumption and full-load power consumption of each physical machine can be obtained. Based on the sum of the processor utilization rates of all virtual machines on that physical machine, combined with the idle power consumption and full-load power consumption, the real-time power consumption of that physical machine within the target time window can be calculated using a linear interpolation model, thus obtaining N real-time power consumption values.

[0108] For any physical machine, the real-time power consumption can be calculated using Equation 3:

[0109] (3)

[0110] in, For physical machines Real-time power consumption within the target time window For physical machines The idle power consumption can be read directly from the physical machine; For physical machines The full-load power consumption can be obtained by running a CPU-intensive stress testing tool. For placement in physical machines A collection of virtual machines on; For physical machines within the target time window The overall CPU utilization, that is, the physical machine The sum of processor utilization of virtual machines on the same platform.

[0111] Furthermore, after calculating the real-time power consumption of each physical machine using Formula 3, the carbon intensity value and the duration of the target time window for each physical machine can be obtained. The real-time power consumption and carbon intensity value of each physical machine are multiplied by the duration of the target time window to calculate the total carbon emissions of each physical machine within the target time window, resulting in N total carbon emissions. The total carbon emissions of all physical machines are then summed to obtain the cumulative carbon footprint corresponding to the individual in the population, which is the carbon footprint index value.

[0112] The carbon footprint index value can be calculated using Formula 4:

[0113] (4)

[0114] in, Here, T represents the carbon footprint index value of the individual, T is the number of time windows (in this example, T=1), and n is the number of physical machines. Let the carbon intensity value be the value of the j-th physical machine. For physical machines Real-time power consumption within the target time window The duration of the target time window.

[0115] Finally, the cumulative carbon footprint is used as the main input, combined with the constraint violation penalty term, and input into the fitness function to calculate the first fitness of the individual in the population.

[0116] The fitness function can be expressed as shown in Equation 5:

[0117] (5)

[0118] in, The value of fitness. This represents the number of physical machines in the population that violate the constraints. Specifically, if the physical machine... CPU constraint violation ( ) or memory constraints ( ), then include .

[0119] For feasible solutions ( ), The smaller the carbon footprint index value, the larger the fitness value, with a range of (0, 1); for infeasible solutions ( ), due to subtracting positive integers fitness value Therefore, the fitness value of feasible solutions is always greater than that of infeasible solutions. This fitness function enables the genetic algorithm to prioritize feasible solutions and evolve in a direction that gradually reduces the carbon footprint index value.

[0120] This embodiment introduces processor utilization, idle power consumption, full load power consumption, and carbon intensity values ​​to construct a complete mapping link from virtual machine load prediction to the total carbon emissions of physical machines. This allows for accurate estimation of the actual carbon emission level of each individual in the population within the target time window. Furthermore, the fitness function reflects the low-carbon performance of the deployment scheme, thereby guiding the genetic algorithm to evolve towards the direction of minimizing the cumulative carbon footprint.

[0121] Optionally, in the virtual machine deployment method provided in this application embodiment, selecting P first individuals from the initial population based on M first fitness values, and performing crossover updates and mutation processing on the P first individuals to obtain P second individuals includes: randomly selecting T third individuals from the initial population, and selecting the third individual with the highest first fitness, where T is a positive integer; copying the third individual with the highest first fitness to the first population, and repeating the step of randomly selecting T third individuals from the initial population and selecting the third individual with the highest first fitness until the first population includes P third individuals; if the first population includes P third individuals, grouping the P third individuals in the first population into pairs to obtain multiple groups of third individuals, and generating two offspring individuals for each group of third individuals to obtain multiple groups of offspring individuals; determining the multiple groups of offspring individuals as the second population, obtaining the mutation probability, and processing the offspring individuals in the second population according to the mutation probability to obtain the third population; and determining the individuals in the third population as P second individuals.

[0122] It should be noted that: the third individual refers to the candidate individuals randomly selected from the initial population; the first population refers to the subpopulation formed after the selection operation for crossover; P third individuals refer to the P selected and replicated individuals contained in the first population; pairwise grouping refers to pairing individuals to form parent pairs; offspring individuals refer to the new generation of individuals generated from parent individuals through crossover; the second population refers to the set of all offspring individuals; mutation probability refers to the probability of random changes in the genes of individuals; the third population refers to the final population formed after mutation; and P second individuals refer to the final set of offspring individuals obtained after crossover and mutation.

[0123] For example, when updating the initial population, T third individuals are randomly selected from the initial population, and their first fitness is compared with that of the T individuals. The third individual with the highest first fitness is selected.

[0124] Furthermore, the system copies the selected third individual and stores it in the first population. The system repeats the above random selection and maximum fitness selection process using a replacement-based operation, selecting one individual at a time to add to the first population, until the first population contains P third individuals.

[0125] Furthermore, the system performs crossover updates on the individuals in the first population. The system randomly pairs the P third individuals in the first population, forming multiple parent pairs. For each pair of third individuals, the system employs a uniform crossover strategy, randomly inheriting genes from each gene locus in both parents with a certain probability, generating two offspring individuals. The set of offspring individuals generated from all groups constitutes the second population.

[0126] Furthermore, the system performs mutation processing. The system obtains the current adaptive mutation probability, which is dynamically calculated based on the confidence level of the virtual machine load prediction. The system iterates through each offspring individual in the second population, and based on this mutation probability, randomly selects certain gene loci of the individual for single-point mutation, i.e., replacing them with new random legal physical machine numbers. If the mutated scheme violates preset constraints, the mutation is abandoned or retried. The set of offspring individuals after mutation processing constitutes the third population.

[0127] Finally, the system identifies all individuals in the third population as P second individuals, which will form the next generation population, thus completing one iteration operation.

[0128] This embodiment achieves the goal of preserving and passing on superior genes (high-fit individuals) to the next generation while also escaping local optima and enhancing global exploration when predictions are unreliable. This balances the convergence speed of the search with the probability of finding the global optimum, effectively improving the accuracy of the virtual machine deployment scheme.

[0129] Optionally, in the virtual machine deployment method provided in this application embodiment, the first prediction result includes the target processor utilization and confidence level, and the mutation probability is obtained in the following way: calculate the overall confidence level within the target time window based on the target processor utilization and confidence level of each virtual machine; calculate the confidence level parameter based on the overall confidence level, and multiply the confidence level parameter by the preset probability to obtain the mutation probability.

[0130] It should be noted that mutation probability refers to the probability of random changes in the genes of an individual in a genetic algorithm, and is used to adjust the exploratory ability of the population.

[0131] For example, when determining the mutation probability, it is first necessary to obtain the first prediction result for each virtual machine, including the target processor utilization and confidence level, and then calculate the overall confidence level within the target time window according to the following formula 6. :

[0132] (6)

[0133] in, Let be the confidence level of the i-th virtual machine. Let be the target processor utilization of the i-th virtual machine.

[0134] It should be noted that this overall confidence level This is used to drive the dynamic adjustment of the adaptive mutation rate. When the overall confidence is low, it indicates that the model lacks sufficient understanding of the load patterns of most virtual machines in the current period. The algorithm should not rely excessively on prediction information for refined searching, but should maintain a strong exploratory capability to avoid getting trapped in local optima based on unreliable information. At this time, the adaptive mutation rate increases, more individuals in the population mutate, and the search range expands. When the overall confidence is high, it indicates that the model's prediction of future load is relatively reliable. The algorithm can rely more on the guidance of the fitness function for refined searching. At this time, the mutation rate decreases, superior genes are preserved, and the search gradually converges.

[0135] Furthermore, after obtaining the overall confidence level, the probability of mutation can be determined using the following formula 7. :

[0136] (7)

[0137] in, As a preset probability, The confidence level parameter is calculated based on the overall confidence level.

[0138] when When it approaches 1, near A refined search is performed using a baseline variation rate; when When approaching 0, near The mutation rate is doubled to enhance exploratory capabilities. This design allows the mutation rate to dynamically change with the overall confidence level, prioritizing development when predictions are reliable and prioritizing exploration when predictions are unreliable, thus achieving an adaptive match between the intensity of genetic manipulation and the reliability of predictive information.

[0139] This embodiment achieves dynamic optimization of the genetic algorithm's search strategy by determining the mutation probability based on the overall confidence level. Specifically, when the prediction confidence is high, reducing the mutation probability helps retain superior genes and accelerates algorithm convergence; when the prediction confidence is low, increasing the mutation probability helps maintain population diversity and avoids the algorithm getting trapped in local optima based on erroneous predictions. This adaptive mechanism improves the algorithm's robustness and optimization efficiency under dynamic load environments and enhances the low-carbon performance stability of the virtual machine deployment scheme during long-term operation.

[0140] Optionally, in the virtual machine deployment method provided in this application embodiment, processing the offspring individuals in the second population according to the mutation probability to obtain the third population includes: obtaining individuals to be mutated from the second population according to the mutation probability, resulting in H individuals to be mutated, where H is a positive integer; randomly determining the mutation element of each individual to be mutated, resulting in H mutation elements; changing the element value of the mutation element in each individual to be mutated, resulting in updated H individuals to be mutated; and replacing the H individuals to be mutated in the second population with the updated H individuals to be mutated, resulting in the third population.

[0141] For example, when performing mutation updates on offspring individuals in the second population, the offspring individuals in the second population are first randomly selected based on the currently calculated mutation probability to determine which individuals need to undergo mutation processing.

[0142] The system randomly selects H individuals to be mutated from the second population based on the mutation probability, and performs a selection operation on the mutation element for each individual. The system randomly determines the mutation element for each individual, that is, it randomly selects one or more gene loci from the chromosome of that individual as mutation points, thus obtaining H mutation elements.

[0143] Furthermore, the system performs a mutation operation, changing the element value of the corresponding mutation element in each individual to be mutated. Specifically, the system replaces the original element value with a new randomly generated physical machine number. During the replacement process, the system checks whether the new scheme violates preset constraints. If it does, the mutation operation needs to be repeated or the mutation should be abandoned. After changing the element values ​​of all individuals to be mutated, H updated individuals to be mutated are obtained.

[0144] Finally, the system performs a population replacement operation, replacing the original H individuals to be mutated in the second population with these updated H individuals to be mutated. The offspring individuals in the second population that were not selected as mutated individuals remain unchanged. After the replacement, the second population transforms into the third population, which contains both the mutated and optimized individuals and those that remain unchanged, completing this round of iteration.

[0145] This embodiment effectively increases population diversity by performing a single-point mutation operation, preventing the genetic algorithm from prematurely converging to a local optimum during evolution. By randomly changing the element values ​​of the mutation element, the algorithm can explore new regions in the solution space, especially when the mutation probability is high, which enhances its global search capability. Simultaneously, the mutation operation helps break down gene associations between individuals, preserving potentially superior gene fragments. By replacing the original individuals with updated ones, the system achieves natural population evolution, enabling continuous optimization of the virtual machine deployment scheme, thereby further approaching the global optimum with the minimum cumulative carbon footprint while satisfying resource constraints.

[0146] Figure 3 This is a schematic diagram of the population iterative update process provided in Embodiment 1 of this application, as follows: Figure 3 As shown, the iterative process can be as follows:

[0147] Let the first generation population ,in Let be the population size. The goal of the algorithm is to start from the initial population. Departure, Passing through Through generational evolution, the individual with the highest fitness is obtained. .

[0148] Step 1: Initial Population The population is constructed using a random generation method. For each individual in the population, The virtual machines are randomly shuffled and placed sequentially: each virtual machine is randomly selected from a physical machine that meets the CPU and memory capacity constraints. If an attempt is made... If no usable physical machine can be found after this step, the individual will be regenerated. Repeat the above steps until a new individual is generated. A number of legitimate individuals constitute the initial population. The optimal individual with the highest fitness score in the initial population is calculated based on the fitness function. The fitness score is calculated from the physical carbon intensity data, the predicted value of virtual machine CPU demand, and the preset constraints. The predicted value of virtual machine CPU demand is predicted from the virtual machine's historical load and the LSTM model.

[0149] Step 2: Use a tournament selection method. Each time, select from the current population... Randomly selected From each individual, select the individual with the highest fitness to join the subpopulation. Repeat until Size reached .

[0150] Step 3: Employ a uniform crossover strategy. Transform the subpopulations... Individuals are randomly paired, and each pair of parents inherits genes from each of the two parents with a 50% probability, generating two offspring individuals. All offspring individuals constitute the offspring set. Its size is equal.

[0151] Step 4: Employ a single-point mutation strategy. For the offspring set... Each individual in the group has an adaptive mutation probability. Randomly select at least one individual from the population, and replace at least one element value in that individual with a randomly generated physical machine number. Based on the overall confidence level of the current time window The results are obtained through dynamic calculation. If the new scheme violates the preset constraints, the mutation operation is either re-executed or abandoned, ultimately yielding the population after the first iteration. .

[0152] Step 5: Calculate the population based on the fitness function The optimal individual with the highest fitness score is selected, and calculation is performed. and Differences in fitness.

[0153] Repeat steps 2-5 until the preset maximum number of generations is reached. Or the optimal fitness value is in continuous If there is no significant improvement within a generation, the algorithm terminates and outputs the virtual machine placement scheme corresponding to the individual with the highest fitness as the optimal solution.

[0154] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0155] Example 2

[0156] This application also provides a virtual machine deployment apparatus. It should be noted that the virtual machine deployment apparatus of this application can be used to execute the virtual machine deployment method provided in the above embodiments. The virtual machine deployment apparatus provided in this application will be described below.

[0157] According to an embodiment of this application, an apparatus for implementing the above-described virtual machine deployment method is also provided. Figure 4 This is a schematic diagram of a virtual machine deployment apparatus according to Embodiment 2 of this application, as shown below. Figure 4 As shown, the device includes:

[0158] The acquisition unit 41 is used to acquire the first configuration information of M virtual machines and the second configuration information of N physical machines, wherein the physical machines are used to deploy virtual machines, and M and N are both positive integers.

[0159] Construction unit 42 is used to obtain preset constraints and construct an initial population based on the preset constraints. The initial population includes P population individuals, each population individual corresponds to a virtual machine deployment scheme, and each population individual includes M elements. The element value of each element is used to represent the physical machine number corresponding to a virtual machine, where P is a positive integer.

[0160] The iteration unit 43 is used to obtain the target processor utilization of each virtual machine within the target time window, obtain M first prediction results, and perform iterative update operations on the initial population based on the M first prediction results, first configuration information, second configuration information and fitness function. When the iteration termination condition is reached, the target population obtained by the last iteration update operation is obtained.

[0161] The determination unit 44 is used to determine the fitness of each individual in the target population according to the fitness function, to obtain P target fitnesss, and to determine the individual with the largest target fitness as the target individual.

[0162] Configuration unit 45 is used to determine the deployment scheme of M virtual machines based on the element values ​​of each element in the target individual, and to configure the M virtual machines in N physical machines according to the deployment scheme.

[0163] The virtual machine deployment apparatus provided in this application sets up multiple initial populations representing virtual machine deployment schemes, and iteratively updates each deployment scheme in the initial populations based on the first prediction result, first configuration information, and second configuration information obtained by each virtual machine in the target time window according to the target processor utilization rate within the target time window, combined with a fitness function related to the carbon footprint index value, to obtain a target population. The individual in the population with the highest target fitness is selected as the target individual to determine the deployment scheme, thereby achieving the purpose of reducing the carbon footprint index value of the virtual machine deployment scheme, thus realizing the technical effect of reducing the actual carbon emissions of the virtual machine deployment scheme, and solving the technical problem in related technologies that only use energy consumption as an optimization index for virtual machine deployment, resulting in high actual carbon emissions of the virtual machine deployment scheme.

[0164] Optionally, in the virtual machine deployment apparatus provided in this application embodiment, the construction unit 42 includes: a first acquisition subunit, configured to randomly select a physical machine for each virtual machine and acquire the number of each physical machine to obtain M physical machine numbers; a first judgment subunit, configured to simulate the configuration of the M virtual machines according to the M physical machine numbers and determine whether each physical machine after the simulated configuration meets the preset constraints; a first determination subunit, configured to determine the M physical machine numbers as a population individual when each physical machine meets the preset constraints; and a second determination subunit, configured to repeatedly execute the steps of randomly selecting a physical machine for each virtual machine and acquiring the number of each physical machine to obtain M physical machine numbers until the number of population individuals reaches P, and determine the P population individuals as the initial population.

[0165] Optionally, in the virtual machine deployment apparatus provided in this application embodiment, the iteration unit 43 includes: a second acquisition subunit, configured to acquire, for any virtual machine, Q historical processor utilization rates under a historical time window, wherein each historical time window is the same size as the target time window, and Q is a positive integer; a first processing subunit, configured to input the Q historical processor utilization rates into the target prediction model to obtain the target processor utilization rate of the virtual machine under the target time window and the prediction interval of the target processor utilization rate; and a third determination subunit, configured to determine the confidence level of the target processor utilization rate based on the prediction interval, and determine the target processor utilization rate and the confidence level as the first prediction result of the virtual machine.

[0166] Optionally, in the virtual machine deployment apparatus provided in this application embodiment, the iteration unit 43 includes: a fourth determining subunit, configured to determine the first fitness of each individual in the initial population based on M first prediction results, first configuration information, second configuration information, and a fitness function, to obtain M first fitnesss; a third obtaining subunit, configured to determine the individual with the highest first fitness, obtain candidate individuals, and obtain the current iteration round; a second judging subunit, configured to judge whether the first fitness of the candidate individual and / or the current iteration round meets the iteration termination condition; and a second processing subunit, configured to process the candidate individual's first fitness and / or the current iteration round. If the iteration does not meet the termination condition, P first individuals are selected from the initial population based on M first fitness values, and crossover and mutation are performed on the P first individuals to obtain P second individuals; the execution subunit is used to determine the P second individuals as the updated initial population, and iteratively executes the step of determining the first fitness of each individual in the initial population based on the updated initial population, until the first fitness of the candidate individuals and / or the current iteration meets the termination condition; the third processing subunit is used to complete the iterative update operation if the first fitness of the candidate individuals and / or the current iteration meets the termination condition.

[0167] Optionally, in the virtual machine deployment apparatus provided in this application embodiment, the first configuration information includes the number of processor cores of the virtual machine, and the second configuration information includes at least the processor capacity, idle power consumption, full load power consumption, and carbon intensity value of the physical machine. The fourth determining subunit includes: a first determining module, used to determine the processor utilization rate of each virtual machine on the corresponding physical machine for any individual in the population based on M first prediction results, the number of processor cores, and the processor capacity, to obtain M processor utilization rates; a second determining module, used to determine the real-time power consumption of each physical machine within the target time window based on the M processor utilization rates, idle power consumption, and full load power consumption, to obtain N real-time power consumptions; a first calculation module, used to calculate the total carbon emissions of the N physical machines based on the N real-time power consumptions, the carbon intensity value, and the duration of the target time window; and a second calculation module, used to input the total carbon emissions into the fitness function to obtain the first fitness of the individual in the population.

[0168] Optionally, in the virtual machine deployment apparatus provided in this application embodiment, the second processing subunit includes: a first processing module, configured to randomly select T third individuals from the initial population and select the third individual with the highest first fitness, where T is a positive integer; a second processing module, configured to copy the third individual with the highest first fitness to the first population, and repeatedly execute the step of randomly selecting T third individuals from the initial population and selecting the third individual with the highest first fitness until the first population includes P third individuals; a generation module, configured to, when the first population includes P third individuals, group the P third individuals in the first population into pairs to obtain multiple groups of third individuals, and generate two offspring individuals for each group of third individuals to obtain multiple groups of offspring individuals; a third determination module, configured to determine the multiple groups of offspring individuals as the second population, obtain the mutation probability, and process the offspring individuals in the second population according to the mutation probability to obtain the third population; and a fourth determination module, configured to determine the individuals in the third population as P second individuals.

[0169] Optionally, in the virtual machine deployment apparatus provided in this application embodiment, the first prediction result includes target processor utilization and confidence level, and the mutation probability is obtained through the following apparatus: a first calculation unit, used to calculate the overall confidence level within the target time window based on the target processor utilization and confidence level of each virtual machine; a second calculation unit, used to calculate the confidence level parameter based on the overall confidence level, and multiply the confidence level parameter by a preset probability to obtain the mutation probability.

[0170] Optionally, in the virtual machine deployment apparatus provided in this application embodiment, the third determining module includes: an acquisition submodule, configured to acquire individuals to be mutated from the second population according to the mutation probability, obtaining H individuals to be mutated, where H is a positive integer; a determining submodule, configured to randomly determine the mutation element of each individual to be mutated, obtaining H mutation elements; a changing submodule, configured to change the element value of the mutation element in each individual to be mutated, obtaining updated H individuals to be mutated; and a replacement submodule, configured to replace the H individuals to be mutated in the second population with the updated H individuals to be mutated, obtaining a third population.

[0171] It should be noted that the acquisition unit 41, construction unit 42, iteration unit 43, determination unit 44, and configuration unit 45 mentioned above correspond to steps S201 to S205 in Embodiment 1. The instances and application scenarios implemented by each of the above units and the corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules can also be part of a device and can run in the computer terminal 10 provided in Embodiment 1.

[0172] Example 3

[0173] Embodiments of this application may provide an electronic device. Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 5 As shown, the electronic device may include: one or more ( Figure 5 (Only one is shown) Processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0174] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0175] Those skilled in the art will understand that Figure 5The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 5 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 5 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 5 The different configurations shown.

[0176] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0177] Example 4

[0178] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the virtual machine deployment method provided in Embodiment 1.

[0179] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.

[0180] Embodiments of this application also provide a computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-described virtual machine deployment method.

[0181] Embodiments of this application also provide a computer-readable storage medium, which includes a stored executable program, wherein the executable program controls the device where the computer-readable storage medium is located to execute the above-described virtual machine deployment method when it runs.

[0182] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0183] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0184] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0185] The units described as separate components may or may not be physically separate. 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 units can be selected to achieve the purpose of this embodiment according to actual needs.

[0186] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0187] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0188] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for deploying a virtual machine, characterized in that, include: Obtain the first configuration information of M virtual machines and the second configuration information of N physical machines, wherein the physical machines are used to deploy the virtual machines, and M and N are both positive integers; Obtain preset constraints and construct an initial population based on the preset constraints. The initial population includes P population individuals, each population individual corresponds to a virtual machine deployment scheme, and each population individual includes M elements. The element value of each element is used to represent the physical machine number corresponding to a virtual machine, where P is a positive integer. Obtain the target processor utilization of each virtual machine within the target time window, obtain M first prediction results, and perform iterative update operations on the initial population based on the M first prediction results, the first configuration information, the second configuration information, and the fitness function. When the iteration termination condition is reached, obtain the target population obtained by the last iterative update operation. The fitness of each individual in the target population is determined according to the fitness function to obtain P target fitness values, and the individual with the highest target fitness value is determined as the target individual. The deployment scheme of the M virtual machines is determined based on the element values ​​of each element in the target individual, and the M virtual machines are configured in the N physical machines according to the deployment scheme.

2. The method according to claim 1, characterized in that, Constructing the initial population based on the preset constraints includes: For each virtual machine, a physical machine is randomly selected, and the number of each physical machine is obtained, resulting in M ​​physical machine numbers; The M virtual machines are simulated and configured according to the M physical machine numbers, and it is determined whether each physical machine after simulation configuration meets the preset constraints. If all physical machines meet the preset constraints, the M physical machines are identified as one population individual. Repeat the steps of randomly selecting a physical machine for each virtual machine and obtaining the number of each physical machine to obtain M physical machine numbers until the number of individuals in the population reaches P, and then determine the P individuals in the population as the initial population.

3. The method according to claim 1, characterized in that, Obtain the target processor utilization for each virtual machine within the target time window, and obtain M first prediction results, including: For any virtual machine, obtain the Q historical processor utilization rates of the virtual machine under the historical time window, where each historical time window is the same size as the target time window, and Q is a positive integer; By inputting the Q historical processor utilization rates into the target prediction model, the target processor utilization rate of the virtual machine under the target time window and the prediction interval of the target processor utilization rate are obtained. The confidence level of the target processor utilization is determined based on the prediction interval, and the target processor utilization and the confidence level are determined as the first prediction result of the virtual machine.

4. The method according to claim 1, characterized in that, The iterative update operation of the initial population based on the M first prediction results, the first configuration information, the second configuration information, and the fitness function includes: The first fitness of each individual in the initial population is determined based on the M first prediction results, the first configuration information, the second configuration information, and the fitness function, resulting in M ​​first fitness values. Identify the individual in the population with the highest fitness to obtain candidate individuals, and obtain the current iteration round; Determine whether the first fitness of the candidate individual and / or the current iteration round meet the iteration termination condition; If the first fitness of the candidate individuals and / or the current iteration round does not meet the iteration termination condition, P first individuals are selected from the initial population based on the M first fitness values, and the P first individuals are subjected to crossover and mutation processing to obtain P second individuals; The P second individuals are determined as the updated initial population, and the step of determining the first fitness of each individual in the initial population is iteratively executed according to the updated initial population until the first fitness of the candidate individuals and / or the current iteration round meets the iteration termination condition. The iterative update operation is completed if the first fitness of the candidate individual and / or the current iteration round meets the iteration termination condition.

5. The method according to claim 4, characterized in that, The first configuration information includes the number of processor cores of the virtual machine, and the second configuration information includes at least the processor capacity, idle power consumption, full load power consumption, and carbon intensity value of the physical machine. Determining the first fitness of each individual in the initial population based on the M first prediction results, the first configuration information, the second configuration information, and the fitness function includes: For any individual in the population, the processor utilization rate of each virtual machine on the corresponding physical machine is determined based on the M first prediction results, the number of processor cores and the processor capacity, thus obtaining M processor utilization rates; Based on the utilization rates of the M processors, the idle power consumption, and the full-load power consumption, the real-time power consumption of each physical machine within the target time window is determined, resulting in N real-time power consumption values. The total carbon emissions of the N physical machines are calculated based on the N real-time power consumption, the carbon intensity value, and the duration of the target time window. The total carbon emissions are input into the fitness function to obtain the first fitness of the individuals in the population.

6. The method according to claim 4, characterized in that, Based on the M first fitness values, P first individuals are selected from the initial population, and crossover and mutation are performed on the P first individuals to obtain P second individuals, including: T third individuals are randomly selected from the initial population, and the third individual with the highest fitness is selected, where T is a positive integer; The third individual with the highest fitness is copied to the first population, and the steps of randomly selecting T third individuals from the initial population and selecting the third individual with the highest fitness are repeated until the first population includes P third individuals. If the first population includes P third individuals, the P third individuals in the first population are divided into pairs to obtain multiple groups of third individuals, and two offspring individuals are generated for each group of third individuals to obtain multiple groups of offspring individuals. The multiple groups of offspring individuals are identified as the second population, and the mutation probability is obtained. The offspring individuals in the second population are then processed according to the mutation probability to obtain the third population. Individuals in the third group are identified as the P second individuals.

7. The method according to claim 6, characterized in that, The first prediction result includes the target processor utilization and confidence level, and the mutation probability is obtained in the following way: Calculate the overall confidence level within the target time window based on the target processor utilization and confidence level of each virtual machine; The confidence parameter is calculated based on the overall confidence level, and the confidence parameter is multiplied by a preset probability to obtain the mutation probability.

8. The method according to claim 6, characterized in that, Based on the mutation probability, the offspring individuals in the second population are processed to obtain the third population, which includes: Based on the mutation probability, individuals to be mutated are obtained from the second population, resulting in H individuals to be mutated, where H is a positive integer; Randomly determine the mutation elements for each individual to be mutated, resulting in H mutation elements; The element values ​​of the mutated elements in each individual to be mutated are changed to obtain H updated individuals to be mutated. The third population is obtained by replacing the H individuals to be mutated in the second population with the updated H individuals to be mutated.

9. A virtual machine deployment apparatus, characterized in that, include: The acquisition unit is used to acquire first configuration information of M virtual machines and second configuration information of N physical machines, wherein the physical machines are used to deploy the virtual machines, and M and N are both positive integers; A construction unit is used to obtain preset constraints and construct an initial population according to the preset constraints. The initial population includes P population individuals, each population individual corresponds to a virtual machine deployment scheme, and each population individual includes M elements. The element value of each element is used to represent the physical machine number corresponding to a virtual machine, where P is a positive integer. An iterative unit is used to obtain the target processor utilization of each virtual machine within the target time window, obtain M first prediction results, and perform iterative update operations on the initial population based on the M first prediction results, the first configuration information, the second configuration information, and the fitness function. When the iteration termination condition is reached, the target population obtained by the last iterative update operation is obtained. The determination unit is used to determine the fitness of each individual in the target population according to the fitness function, to obtain P target fitnesss, and to determine the individual with the largest target fitness as the target individual; The configuration unit is used to determine the deployment scheme of the M virtual machines based on the element values ​​of each element in the target individual, and to configure the M virtual machines in the N physical machines according to the deployment scheme.

10. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, executes the virtual machine deployment method according to any one of claims 1 to 8.