CN117873643A - Virtual machine placement method and device - Google Patents

Virtual machine placement method and device Download PDF

Info

Publication number
CN117873643A
CN117873643A CN202311731388.8A CN202311731388A CN117873643A CN 117873643 A CN117873643 A CN 117873643A CN 202311731388 A CN202311731388 A CN 202311731388A CN 117873643 A CN117873643 A CN 117873643A
Authority
CN
China
Prior art keywords
virtual machine
physical host
target
candidate
initial
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311731388.8A
Other languages
Chinese (zh)
Inventor
李智涵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianyi Cloud Technology Co Ltd
Original Assignee
Tianyi Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianyi Cloud Technology Co Ltd filed Critical Tianyi Cloud Technology Co Ltd
Priority to CN202311731388.8A priority Critical patent/CN117873643A/en
Publication of CN117873643A publication Critical patent/CN117873643A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Power Sources (AREA)

Abstract

The invention relates to a virtual machine placement method, a device, electronic equipment and a storage medium, belonging to the technical field of cloud computing, wherein the method comprises the following steps: setting up target parameters between a virtual machine to be placed and an initial physical host; determining candidate physical hosts from the initial physical hosts according to the size relation between the target parameters and a preset parameter threshold; determining a target physical host according to target parameters between the virtual machine to be placed and the candidate physical host and a preset rewarding function; and placing the virtual machine to be placed into the target physical host. According to the method, the situation of the placement of the current virtual machine is dynamically planned by calculating the rewarding function value based on the resource utilization rate, the risk probability, the communication distance and the energy consumption power, so that the placement scheme of the virtual machine is optimized, the finally output virtual machine placement scheme is higher in resource utilization rate, and meanwhile, the risk probability, the communication distance and the energy consumption power are lower.

Description

Virtual machine placement method and device
Technical Field
The invention belongs to the technical field of cloud computing, and particularly relates to a virtual machine placement method, a virtual machine placement device, electronic equipment and a storage medium.
Background
The cloud computing is used as a novel computing mode, and has the advantages of low investment cost, high expandability and the like in the earlier stage. With the development of cloud computing technology, many business scenarios rely on services provided by a cloud data center, which manages resources by using virtualization technology. In order to meet the increasing demands of clients, the scale of the cloud data center is continuously enlarged, and a large number of virtual machines are deployed on physical hosts, so that the increasing equipment energy consumption and network consumption are brought along with the increasing equipment energy consumption and network consumption. The virtual machine placement strategy has important effects on resource utilization, power consumption control and data center operation cost. The virtual machine placement strategy with low resource utilization rate leads to insufficient utilization rate of the physical host, and resource waste is increased. The virtual machine placement strategy with high resource utilization rate allows multiplexing and sharing of physical resources, but also brings the risk of security holes, and can lead to the theft of sensitive information by virtual machines sharing the same physical machine. Therefore, reducing vulnerability risk of user applications with security as an important goal is a concern in the process of virtual machine placement. In addition, when the virtual machine accesses to the physical network, the virtual machine needs to communicate with the virtual machines with dependency relations on different physical hosts, which may cause saturation of network links, surge of network traffic and influence the experience of the cloud client. Thus, placing virtual machines executing data-intensive applications in closer proximity can reduce communication costs within the data center. Comprehensively known that the virtual machine placement strategy problem is a multi-objective optimized NP difficulty problem, and the problems of safety, communication cost and the like are required to be considered while the utilization rate of physical machine resources is improved and the energy consumption of a cloud data center is reduced, so that the construction cost and efficiency of the data center are balanced.
In the prior art, the remaining resource conditions of the physical machines of the cloud platform are collected to classify physical rewards, and two resource dimensions of a CPU and a memory are comprehensively considered to continuously adjust the placement points of the virtual machines, so that resource fragments of the cloud platform are reduced, or the physical machines meeting the resource request of the virtual machines are divided into active physical machines and empty physical machines, and resource balance values are calculated, so that the virtual machines are placed according to the resource balance values.
In the prior art, the virtual machine placement strategy is adjusted only according to the dimension of the CPU and the memory of the physical machine, or the virtual machine is placed according to the collected residual resource quantity of the physical machine, and the main problems are as follows: the virtual machine placement scheme is adjusted only according to the dimension of the resource utilization amount, and a virtual machine placement strategy cannot be optimized from multiple target dimensions; security risks and communication costs issues from the user's perspective are not considered.
Disclosure of Invention
In view of the above shortcomings of the prior art, an object of the present invention is to provide a virtual machine placement method, a device, an electronic apparatus, and a storage medium, where the method dynamically plans the situation of the current virtual machine placement by calculating a reward function value based on a resource utilization rate, a risk probability, a communication distance, and an energy consumption power, so as to optimize a virtual machine placement scheme, so as to achieve a virtual machine placement scheme with a higher resource utilization rate and a lower risk probability, a communication distance, and an energy consumption power.
In a first aspect of the present invention, a virtual machine placement method is provided, including:
setting up target parameters between a virtual machine to be placed and an initial physical host; the target parameters comprise resource utilization rate, risk probability, communication distance and energy consumption power;
determining candidate physical hosts from the initial physical hosts according to the size relation between the target parameters and a preset parameter threshold;
determining a target physical host according to target parameters between the virtual machine to be placed and the candidate physical host and a preset rewarding function;
and placing the virtual machine to be placed into the target physical host.
Further, the step of setting up the target parameters between the virtual machine to be placed and the initial physical host specifically includes:
determining the resource utilization rate of each initial physical host according to the resource consumption and the resource quantity of each initial physical host;
calculating the risk probability of each initial physical machine according to the number of users to be placed with the virtual machines on each initial physical machine and the resource quantity of each initial physical machine;
according to the communication distance between each initial physical host, determining the communication distance between the virtual machine to be placed and each initial physical host;
and determining the total energy consumption power of the initial physical hosts according to the energy consumption power of each initial physical host.
Further, the step of determining the target physical host according to the target parameter between the virtual machine to be placed and the candidate physical host and a preset reward function specifically includes:
inputting a first target parameter between the virtual machine to be placed and a first candidate physical host into a preset rewarding function, and calculating a first rewarding function value;
calculating a second target parameter between the virtual machine to be placed and a second candidate physical host, inputting the second target parameter into a preset rewarding function, and calculating a second rewarding function value;
judging whether the first rewarding function value is larger than the second rewarding function value; if yes, determining the first candidate physical host as a target physical host; if not, the second candidate physical host is determined to be the target physical host.
Further, the step of inputting the first target parameter between the virtual machine to be placed and the first candidate physical host into a preset reward function, and calculating a first reward function value specifically includes:
acquiring the number of candidate physical hosts;
determining the time step of each candidate physical host according to the number of the candidate physical hosts;
determining the initial placement state of each virtual machine to be placed according to the time step and the target parameter;
placing the virtual machine to be placed on a first candidate physical machine according to the initial placement state, and generating a first mapping relation between the virtual machine to be placed and the first candidate physical host;
according to the first mapping relation, calculating a first target parameter between the virtual machine to be placed and a first candidate physical host;
and taking the first target parameter as an independent variable of a preset rewarding function, and calculating a first rewarding function value.
Further, the step of adjusting the initial placement state of the virtual machine to be placed into a candidate placement state, and determining a target physical host according to the adjustment times of the placement state and a target parameter between the virtual machine to be placed and the candidate physical host specifically includes:
adjusting the initial placement state to be a candidate placement state;
placing the virtual machine to be placed on a second candidate physical machine according to the candidate placement state, and generating a second mapping relation between the virtual machine to be placed and a second candidate physical host;
according to the second mapping relation, calculating a second target parameter between the virtual machine to be placed and the second candidate physical host;
and taking the second target parameter as an independent variable of a preset rewarding function to calculate a second rewarding function value.
In a second aspect of the present invention, a virtual machine placement device is provided, including:
the target parameter acquisition module is used for building target parameters between the virtual machine to be placed and the initial physical host;
the candidate physical host determining module is used for determining candidate physical hosts from the initial physical hosts according to the size relation between the target parameters and a preset parameter threshold;
the target physical host determining module is used for determining a target physical host according to target parameters between the virtual machine to be placed and the candidate physical host and a preset rewarding function;
and the virtual machine placement module is used for placing the virtual machine to be placed into the target physical host.
Further, the candidate physical host determination module includes:
a first reward value calculation unit, configured to input a first target parameter between the virtual machine to be placed and a first candidate physical host into a preset reward function, and calculate a first reward function value;
a second prize value calculating unit, configured to calculate a second target parameter of the virtual machine to be placed and a second candidate physical host, input the second target parameter into a preset prize function, and calculate a second prize function value;
a reward value comparing unit for comparing the magnitude relation between the first reward function value and the second reward function value;
and the target physical host determining unit is used for determining the first candidate physical host as the target host when the first rewarding function value is larger than the second rewarding function value.
In a third aspect of the present invention, an electronic device is provided, including: the virtual machine placement method comprises a memory and a processor, wherein the memory stores a computer program, and the computer program is executed by the processor to enable the processor to execute the steps of the virtual machine placement method.
In a fourth aspect of the present invention, a computer readable storage medium is provided, on which a computer program is stored, which when executed by a processor, causes the processor to perform the steps of the virtual machine placement method described above.
The invention has the following beneficial effects:
according to the virtual machine placement method, the situation of the placement of the current virtual machine is dynamically planned by calculating the rewarding function value based on the resource utilization rate, the risk probability, the communication distance and the energy consumption power, so that the virtual machine placement scheme is optimized, the finally output virtual machine placement scheme is higher in resource utilization rate, and meanwhile the risk probability, the communication distance and the energy consumption power are lower.
Drawings
The drawings are only for purposes of illustrating particular embodiments and are not to be construed as limiting the invention, like reference numerals being used to refer to like parts throughout the several views. It is apparent that the drawings in the following description are only some of the embodiments described in the embodiments of the present invention, and that other drawings may be obtained from these drawings by those of ordinary skill in the art.
Fig. 1 is a flowchart of a virtual machine placement method according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for placing a virtual machine according to a second embodiment of the present invention;
fig. 3 is a flowchart of a method for placing a virtual machine according to a third embodiment of the present invention;
fig. 4 is a flowchart of a method for placing a virtual machine according to a fourth embodiment of the present invention;
fig. 5 is a flowchart of a virtual machine placement method according to a fifth embodiment of the present invention;
fig. 6 is a block diagram of a virtual machine placement device according to a sixth embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the embodiments of the present invention better understood by those skilled in the art, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments. It should be understood that the description is only illustrative and is not intended to limit the scope of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, shall fall within the scope of the invention.
In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the invention. Rather, they are merely examples of methods and systems that are consistent with aspects of the invention as detailed in the accompanying claims.
The invention provides a virtual machine placement method and a virtual machine placement device, which aim to solve the problems that in the existing method, a virtual machine placement scheme is adjusted according to the dimension of the resource utilization amount, so that the virtual machine placement strategy cannot be optimized from multiple target dimensions, and the safety risk of a user view angle, the communication cost and the like are not considered.
In order to illustrate the technical scheme of the invention, the following description is made by specific examples.
Fig. 1 shows a flowchart of an implementation of a virtual machine placement method according to an embodiment of the present invention, which is described in detail below:
step S1, setting up target parameters between a virtual machine to be placed and an initial physical host; the target parameters include resource utilization, risk probability, communication distance and energy consumption power.
In this embodiment, the virtual machine to be placed refers to a virtual machine that is not determined to be placed on which physical host specifically, the initial physical host refers to a single physical host that is matched with the virtual machine to be placed in a randomly generated virtual machine initial placement scheme, and the target parameters refer to parameters related to a plurality of targets that can achieve maximization of resource utilization, minimization of risk probability, minimization of communication cost, minimization of power consumption, and the like in the virtual machine placement scheme.
In this embodiment, the resource utilization refers to an occupation ratio of the virtual machine to the resource amount of each physical host during the period when the virtual machine is placed on each physical host to run; the risk probability refers to the probability of conflict of resource usage of the same physical host among a plurality of virtual machines when the plurality of virtual machines are placed on the same physical host; power consumption refers to the energy loss per unit time of a single physical host.
In this embodiment, preferably, the target parameters specifically include four kinds of resource utilization, risk probability, communication distance, and power consumption. In the prior art, the virtual machine placement scheme is optimized only based on the resource utilization rate, but the virtual machine placement strategy cannot be optimized from multiple target dimensions, and the safety risk and the communication cost problem of a user perspective are not considered.
And S2, determining candidate physical hosts from the initial physical hosts according to the magnitude relation between the target parameters and the preset parameter threshold.
In this embodiment, the preset parameter threshold refers to the maximum amount of resources that a single physical host can provide to a virtual machine, and the amount of resources required by a virtual machine placed on the physical host must not exceed the preset parameter threshold. And when the target parameter is smaller than or equal to a preset parameter threshold, indicating that the pairing relation between the virtual machine to be placed and the initial physical host meets a basic constraint condition, and determining the initial physical host as a candidate physical host. When the target parameter is larger than a preset parameter threshold, the pairing relation between the virtual machine to be placed and the initial physical host is indicated to not meet the basic constraint condition, and the initial physical host cannot be used as a candidate physical host.
And step S3, determining a target physical host according to the target parameters between the virtual machine to be placed and the candidate physical host and a preset rewarding function.
In this embodiment, optionally, four target parameters including a resource utilization rate, a risk probability, a communication distance, and a power consumption of the preset reward function are taken as arguments for illustration. The higher the resource utilization rate after a single virtual machine is placed, the lower the risk probability, the communication distance and the energy consumption power are, and the larger the reward function value is. And calculating the resource utilization rate, risk probability, communication distance and energy consumption power of a single virtual machine to be placed and different physical hosts, inputting the resource utilization rate, the risk probability, the communication distance and the energy consumption power into a preset rewarding function, calculating a rewarding function value, and determining the corresponding physical host as a target physical host of the virtual machine and performing matching when the rewarding function value is maximum.
And S4, placing the virtual machine to be placed into the target physical host.
According to the virtual machine placement method provided by the embodiment of the invention, the virtual machine placement scheme is optimized through one or more target measurement dimensions, and the target physical host is determined for the virtual machine to be placed through the preset reward function, so that the virtual machine placement scheme with higher resource utilization rate, and lower risk probability, communication distance and energy consumption power is determined.
Fig. 2 shows a flowchart for implementing a virtual machine placement method according to a second embodiment of the present invention, which is different from the first embodiment only in that four target parameters including a resource utilization rate, a risk probability, a communication distance, and an energy consumption power are calculated, where the step S1 specifically includes:
step S11, determining the resource utilization rate of each initial physical host according to the resource consumption and the resource quantity of each initial physical host.
In this embodiment, the resource consumption of each initial physical host is the usage resource of the virtual machine, which is the sum of the CPU resource usage, the memory resource usage, and the capacity resource usage of a single virtual machine, and the resource of the initial physical host is the sum of the CPU resource, the memory resource, and the capacity resource on a single physical host.
The number of physical hosts in one data center is P, and the number of virtual machines is Q, and the corresponding physical host list and virtual machine list are S respectively 1 ,S 2 ,S 3 ,…,S P And V 1 ,V 2 ,V 3 ,…,V Q . The resources of the ith physical host include CPU resources of the physical hostMemory resource->And capacity resource->The use resources of the jth virtual machine include CPU resource +.>Memory resource->And capacity resource->Wherein, the CPU resource of the physical host refers to the computing power of the CPU of the computer, the memory resource refers to the running space provided by the running system and the application, and the capacity resource refers to the space for storing the data content. The sum of the CPU resource, the memory resource and the capacity resource of the physical host is the resource quantity of the physical host. A two-dimensional matrix ω of size is defined to represent the mapping relationship between the virtual machine and the physical host. If the ith virtual machine is installed on the ith physical host, the corresponding matrix vector value is 1, otherwise, the matrix vector value is 0. And respectively monitoring the resource use conditions of the CPU, the memory and the capacity on each physical host.
The calculation formula of the resource utilization RU is as follows:
wherein T1-T2 are time periods when the jth virtual machine is placed on the ith physical host, and CPU resource usage amounts of all virtual machines placed on the physical hostMemory resource usage of all virtual machines placed on physical hosts +.>Capacity resource usage of all virtual machines placed on physical hosts +.>Resource amount of i-th physical host +.>The i-th physical host is in the running mode, defining the status parameter +.>If in sleep mode, define the status parameter +.>The value of (2) is 0.
Step S12, calculating the risk probability of each initial physical machine according to the number of users to be placed with the virtual machines on each initial physical machine and the resource quantity of each initial physical machine.
In this embodiment, if there are M users on Q virtual machines, the user list is u 1 ,u 2 ,u 3 ,…,u M . Definition of kth user u k The mapping relation between the i-th physical host is alpha ki . When a physical host has single or multiple virtual machines of a single user, alpha ki 1, otherwise alpha ki Is 0. The number of virtual machine users distributed on the ith physical host is as follows
The risk probability calculation formula of the ith physical host is as follows:
wherein T1-T2 are time periods when the jth virtual machine is placed on the ith physical host,is the number of virtual machine users allocated on the ith physical host,/for>Is the total number of virtual machine users allocated across all physical hosts, |n| is the amount of resources of the ith physical host.
Step S13, according to the communication distance between each initial physical host, determining the communication distance between the virtual machine to be placed and each initial physical host.
In this embodiment, a plurality of physical hosts communicate with each other and are packed into a cluster according to a linear arrangement, and a communication distance between any two consecutive physical hosts in the cluster is defined as one hop, and the communication distance between the physical hosts is calculated in hops. Assuming that the ith virtual machine is placed on the jth physical host, the communication distance between the ith virtual machine and other physical hosts except the jth physical host is calculated according to the hop count between the jth physical host and the other physical hosts.
The communication distance delta between the physical hosts, the distance between the users and the physical hosts limits the threshold value parameter C, and the number of the users with the communication distance between the physical hosts larger than the threshold value of the distance limiting parameter isThe communication cost CC calculation formula is:
wherein T1-T2 are time periods when the virtual machines are placed on the physical hosts, |U| is the total number of users, the situation is increased when the communication distance delta between the physical hosts is greater than the distance limiting parameter threshold C,the increase in communication costs.
Step S14, determining the total energy consumption PW of the initial physical hosts according to the energy consumption power of each initial physical host.
In this embodiment, the total energy consumption power calculation formula is as follows:
wherein PW (pseudo wire) i Is the power consumption of the ith physical host.
In addition, the constraint that the jth virtual machine placed on the ith physical host needs to satisfy is as follows:
wherein,representing the processing unit resources required by the jth virtual machine,/->CPU resource for j-th virtual machine, and the like>Representing memory resources required by the jth virtual machine, < >>Representing the capacity resources required by the jth virtual machine,representing processing unit resources on the ith physical host,/->Representing CPU resources on the ith physical host,/-on>Representing memory resources on the ith physical host,/-for>Representing capacity resources, ω, on the ith physical host ji Representing the mapping relation of the jth virtual machine placed on the ith physical host.
Fig. 3 shows a flowchart for implementing a virtual machine placement method according to a third embodiment of the present invention, which is different from the above embodiment only in that a prize function value is calculated according to a target parameter, so as to determine a target physical host, where the step S3 specifically includes:
step S31, inputting a first target parameter between the virtual machine to be placed and the first candidate physical host into a preset rewarding function, and calculating a first rewarding function value.
In this embodiment, the virtual machine to be placed refers to a virtual machine for which a target physical host corresponding to the virtual machine is not determined, and the first candidate physical host refers to a physical host in an operating state, in which the number of virtual machines to be placed is small or the number of virtual machines to be placed is small. The preset reward function refers to a function constructed through target parameters and is used for optimizing the current virtual machine placement state through measurement indexes constructed through a plurality of target parameters.
According to the number of users of the virtual machine to be placed, the resource consumption and the resource quantity of the first candidate physical hosts and the communication distance between the first candidate physical hosts and other physical hosts, calculating first target parameters between the virtual machine to be placed and the first candidate physical hosts, wherein the first target parameters comprise a first resource utilization rate, a first risk probability, a first communication distance and a first energy consumption power, and meanwhile, the first resource utilization rate, the first risk probability, the first communication distance and the first energy consumption power are used as independent variables to input a preset reward function, and a first reward function value is calculated.
And S32, calculating a second target parameter between the virtual machine to be placed and a second candidate physical host, inputting the second target parameter into a preset rewarding function, and calculating a second rewarding function value.
In this embodiment, the second candidate physical host refers to a physical host other than the first physical host, where the number of virtual machines is not placed or is small, and the resource usage is not high, but is in a running state. According to the number of users of the virtual machine to be placed, the resource consumption and the resource quantity of the second candidate physical hosts and the communication distance between the second candidate physical hosts and other physical hosts, calculating second target parameters between the virtual machine to be placed and the second candidate physical hosts, wherein the second target parameters comprise a second resource utilization rate, a second risk probability, a second communication distance and a second energy consumption power, and meanwhile, the second resource utilization rate, the second risk probability, the second communication distance and the second energy consumption power are used as independent variables to input a preset rewarding function, and a second rewarding function value is calculated.
Step S33, judging whether the first rewarding function value is larger than the second rewarding function value; if yes, determining the first candidate physical host as a target physical host; if not, the second candidate physical host is determined to be the target physical host.
In this embodiment, the comparing the magnitude relation between the first reward function value and the second function value indicates that the resource utilization rate of placing the virtual machine to be placed on the first candidate physical host is higher, the risk probability, the communication distance, and the energy consumption power are lower, the first candidate physical host is determined to be the target physical host, and if the first reward function value is smaller than the second reward function value, the resource utilization rate of placing the virtual machine to be placed on the second candidate physical host is higher, the risk probability, the communication distance, and the energy consumption power are lower, the second candidate physical host is determined to be the target physical host, and then the virtual machine to be placed is placed on the target physical host.
According to the virtual machine placement method, the first rewarding function value and the second rewarding function value are calculated, the magnitude relation between the first rewarding function value and the second rewarding function value is compared, and then placement schemes with higher resource utilization rate, lower risk probability, lower communication distance and lower energy consumption power are selected from the first candidate physical hosts and the second candidate physical hosts, and the target physical hosts are determined.
The virtual machine placement method provided by the embodiment can be realized in a reinforcement learning mode, and the rewarding space vector is defined asAnd r is 1 ,r 2 ,r 3 ,r 4 Representing rewards under four targets of resource utilization rate, risk probability, communication distance and energy consumption power respectively. The virtual machine to be placed in the time step t is a virtual machine j, and a preset reward function is designed by taking the resource utilization rate, the risk probability, the communication distance and the energy consumption power as independent variables. The current state at time step t is s t An action is defined as a t ∈A t Then awards r 1 Is->E t Representing resource utilization, E ', of all physical hosts at time step t' t+1 Indicating when the jth virtual machine is assigned to a physical host, i.e., a t Resource utilization of all physical hosts after an action.
Representing a decision vector at time step t when the jth virtual machine is assigned to physical host a t Then->Is set to 1. Defining the associated decision vector as +.>Which is related to the possible next state. />And->Is different in thatPlacement of virtual machine j. The higher the resource utilization after virtual machine j placement, the bonus function r 1 The greater the value of (2).
Respectively represent a reward function r 2 ,r 3 ,r 4 The smaller the security vulnerability risk is, the smaller the communication cost is, the smaller the energy consumption is, and the reward function r is shown after the jth virtual machine is placed 2 ,r 3 ,r 4 The greater the value of (2).
And adjusting the placement state of the virtual machine to be placed as an action, taking four target parameters as independent variables of the rewarding function, and continuously adjusting the action according to the rewarding function value, so that the current virtual machine placement scheme is optimized. Setting the adjustment times value to be 1 when the placement state of the virtual machine is adjusted each time, setting the adjustment times threshold value to be G, judging whether the adjustment times k is smaller than the adjustment times threshold value G when the adjustment times are k, if so, continuing to adjust the virtual machine to be placed to other candidate physical machines for placement, and calculating the adjustment times; if not, comparing the magnitude of the rewarding function value between the virtual machine to be placed and each candidate physical host, and determining the corresponding candidate physical host as the target physical host when the rewarding function value is the largest. The placement state of the virtual machine to be placed is adjusted, and the adjustment times are limited according to the adjustment times threshold, so that the matching degree of the output target physical host and the virtual machine to be placed is higher, and the optimization requirements of the placement strategy of the virtual machine with higher resource utilization rate and smaller risk probability, communication distance and energy consumption are met.
Fig. 4 shows a flowchart of a virtual machine placement method according to a fourth embodiment of the present invention, which is different from the third embodiment only in that a first candidate physical host is determined, and a first bonus function value is calculated, where step S31 further includes:
step S311, the number of candidate physical hosts is acquired.
In this embodiment, the candidate physical hosts refer to physical hosts that are not placed with virtual machines or are placed with less virtual machines in the cluster, and have low resource usage, but are in a running state. The number of candidate physical hosts may be obtained by querying an operational database of the data center.
Step S312, determining the time step of each candidate physical host according to the number of the candidate physical hosts.
In this embodiment, the time step of each candidate physical host refers to a time period in which each virtual machine to be placed can be accommodated. And distributing time periods matched with the virtual machines to be placed to each candidate physical host according to the initial placement state of the virtual machines generated randomly through the number of the candidate physical hosts, so that the time step of each candidate physical host is determined.
Step S313, according to the time step and the target parameter, determining the initial placement state of each virtual machine to be placed.
In this embodiment, the initial placement state of each virtual machine to be placed refers to that, in an initialization process, each virtual machine to be placed that meets the constraint condition of the target parameter threshold is placed on each candidate physical host according to a time step of each candidate physical host.
Step S314, according to the initial placement state, placing the virtual machine to be placed on the first candidate physical machine, and generating a first mapping relationship between the virtual machine to be placed and the first candidate physical host.
In this embodiment, the first candidate physical host refers to a physical host that is not placed with virtual machines or is placed with a small number of virtual machines after the virtual machine placement policy is initialized, and has low resource usage, but is in an operating state. The first mapping relationship refers to a mapping relationship between the virtual machine to be placed and the first candidate physical host.
Step S315, calculating a first target parameter between the virtual machine to be placed and a first candidate physical host according to the first mapping relationship.
In this embodiment, the number of users to be placed on the virtual machine, the resource consumption and the resource quantity of the first candidate physical hosts, and the communication distance between the first candidate physical hosts and other physical hosts are obtained according to the first mapping relation, a first target parameter between the virtual machine to be placed on the virtual machine and the first candidate physical hosts is calculated, the first target parameter includes a first resource utilization rate, a first risk probability, a first communication distance and a first energy consumption power, and meanwhile the first resource utilization rate, the first risk probability, the first communication distance and the first energy consumption power are used as independent variables to input a preset reward function, and a first reward function value is calculated.
Step S316, calculating a first prize function value by using the first target parameter as an argument of a preset prize function.
Fig. 5 shows a flowchart of a virtual machine placement method according to a fifth embodiment of the present invention, which is different from the fourth embodiment in that a second candidate physical host is determined, and a second prize function value is calculated, where the step S32 specifically includes:
step S321, the initial placement state is adjusted to a candidate placement state.
In this embodiment, the initial placement state refers to a state in which each virtual machine to be placed that satisfies the constraint condition of the target parameter threshold is placed on each candidate physical host when the placement scheme is initialized. The corresponding physical host is the initial physical host in the initial placement state. The candidate placement state refers to that the virtual machine to be placed is adjusted from the initial physical host to the candidate physical host for placement. The candidate physical hosts refer to physical hosts which are not placed with virtual machines or are placed with less virtual machines except the initial physical host, have low resource usage amount and are in a running state.
And step S322, placing the virtual machine to be placed on a second candidate physical machine according to the candidate placement state, and generating a second mapping relation between the virtual machine to be placed and the second candidate physical host.
In this embodiment, the second candidate physical host refers to a physical host other than the initial physical host, where the number of virtual machines is not placed or is small, and the resource usage is not high, but is in a running state. The second mapping relationship refers to a mapping relationship between the virtual machine to be placed and a second candidate physical host.
Step S323, calculating a second target parameter between the virtual machine to be placed and the second candidate physical host according to the second mapping relationship.
In this embodiment, the number of users of the virtual machine to be placed, the resource consumption and the resource amount of the second candidate physical host, and the communication distance between the second candidate physical host and other physical hosts are obtained according to the second mapping relationship, and a second target parameter between the virtual machine to be placed and the second candidate physical host is calculated, where the second target parameter specifically includes a second resource utilization rate, a second risk probability, a second communication distance, and a second energy consumption.
Step S324, calculating a second prize function value by using the second target parameter as an argument of a preset prize function.
In addition, the invention also carries out simulation experiments aiming at the virtual machine placement method realized by the reinforcement learning mode, and the simulation experiments are specifically shown as follows:
the CPU of the physical host cluster is a 40-core processor with a clock speed of 2.20GHz. The computer is deployed on a 64-bit ubuntu with 128GB of memory. The data center environment consists of a set of physical hosts arranged in a linear topology, built using python, containing three different types of physical hosts and four different configurations of virtual machines, as shown in the table. Wherein features, e.g. power consumption (P Max ,P Min ) MIPS, memory and storage are all from real physical host configuration, and an example of virtual machine configuration is from Amazon website.
The dynamically generated user executes the application program in the form of task packages, and the number of tasks is randomly generated between 1 and 10 in the running process. And each user creates virtual machines according to the number of tasks, the total number of virtual machine requests does not exceed the size of the data center, and each virtual machine only belongs to one user at most. Thus, each user's application may be randomly assigned to multiple virtual machines for sharing.
TABLE 1
Physical host PE MIPS Memory (GB) Storage (GB) P Max P Min /P idle
S1 2 2660 4 160 135 93.7
S2 4 3067 8 250 113 42.3
S3 12 3067 16 500 222 58.4
TABLE 2
Virtual machine type PE MIPS Memory (GB) Auxiliary memory (GB)
VM S 1 500 0.5 40
VM M 2 1000 1 60
VM L 3 1500 2 80
VM XL 4 2000 3 100
Since the number of users in a real cloud environment is dynamic, in order to analyze conflicting physical hosts and communication costs, it is necessary to check the situation of different numbers corresponding to 100 virtual machines. Under the condition that the total number of virtual machines is fixed, as the number of users increases, the number of virtual machines which the users can possess is limited, the occupation ratio of conflict physical hosts increases, and the communication cost is reduced.
Firstly initializing a virtual machine list, a physical host list, an adjustment frequency threshold value and an adjustment frequency counter; randomly generating a virtual machine placement scheme, wherein the time step is dependent on the number of virtual machines and physical hosts, and limiting that each virtual machine allocation strategy meets the constraint condition of the resource quantity; and (3) performing next-step virtual machine placement scheme adjustment on the virtual machines of which the target physical hosts are not determined by using a reinforcement learning strategy until the maximum adjustment frequency threshold is met, calculating a reward function value based on four target parameters of resource utilization rate, risk probability, communication distance and energy consumption power for each virtual machine placement scheme, and outputting the virtual machine placement scheme with the maximum reward function value as an optimal virtual machine placement scheme.
Fig. 6 shows a block diagram of a virtual machine placement device according to a sixth embodiment of the present invention, which specifically includes:
the target parameter obtaining module 10 is used for building target parameters between the virtual machine to be placed and the initial physical host;
a candidate physical host determining module 20, configured to determine a candidate physical host from the initial physical hosts according to a magnitude relation between the target parameter and a preset parameter threshold;
a target physical host determining module 30, configured to determine a target physical host according to target parameters between the virtual machine to be placed and the candidate physical host and a preset reward function;
and a virtual machine placement module 40, configured to place the virtual machine to be placed into the target physical host.
The virtual machine placement device in this embodiment is a device corresponding to the above virtual machine placement method, and the function implementation of the target parameter obtaining module 10, the candidate physical host determining module 20, the target physical host determining module 30, and the virtual machine placement module 40 included in the virtual machine placement device corresponds to the step S1, the step S2, the step S3, and the step S4 in the above virtual machine placement method one by one, and for specific explanation of the content of each module in the virtual machine placement device, and related detailed and optimized content are referred to the specific description in the above virtual machine placement method, which is not repeated herein.
According to the virtual machine placement device provided by the embodiment of the invention, the placement situation of the current virtual machine is dynamically planned by calculating the rewarding function value based on the resource utilization rate, the risk probability, the communication distance and the energy consumption power, so that the virtual machine placement scheme is optimized, the finally output virtual machine placement scheme is higher in resource utilization rate, and meanwhile, the risk probability, the communication distance and the energy consumption power are lower.
While the applicant has described and illustrated the embodiments of the present invention in detail with reference to the drawings, it should be understood by those skilled in the art that the above embodiments are only preferred embodiments of the present invention, and the detailed description is only for the purpose of helping the reader to better understand the spirit of the present invention, and not to limit the scope of the present invention, but any improvements or modifications based on the spirit of the present invention should fall within the scope of the present invention.
Finally, it should be noted that the above embodiments are merely for illustrating the technical solution of the embodiments of the present invention, and are not limiting. Although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the embodiments of the invention, and any changes and substitutions that would be apparent to one skilled in the art are intended to be included within the scope of the present invention.

Claims (10)

1. A virtual machine placement method, comprising:
setting up target parameters between a virtual machine to be placed and an initial physical host; the target parameters comprise resource utilization rate, risk probability, communication distance and energy consumption power;
determining candidate physical hosts from the initial physical hosts according to the size relation between the target parameters and a preset parameter threshold;
determining a target physical host according to target parameters between the virtual machine to be placed and the candidate physical host and a preset rewarding function;
and placing the virtual machine to be placed into the target physical host.
2. The virtual machine placement method according to claim 1, wherein the target parameters include resource utilization, risk probability, communication distance, and power consumption.
3. The method for placing a virtual machine according to claim 1, wherein the step of setting up target parameters between the virtual machine to be placed and the initial physical host specifically includes:
determining the resource utilization rate of each initial physical host according to the resource consumption and the resource quantity of each initial physical host;
calculating the risk probability of each initial physical machine according to the number of users to be placed with the virtual machines on each initial physical machine and the resource quantity of each initial physical machine;
according to the communication distance between each initial physical host, determining the communication distance between the virtual machine to be placed and each initial physical host;
and determining the total energy consumption power of the initial physical hosts according to the energy consumption power of each initial physical host.
4. The method for placing a virtual machine according to claim 1, wherein the step of determining the target physical host according to the target parameters between the virtual machine to be placed and the candidate physical host and the preset reward function specifically includes:
inputting a first target parameter between the virtual machine to be placed and a first candidate physical host into a preset rewarding function, and calculating a first rewarding function value;
calculating a second target parameter between the virtual machine to be placed and a second candidate physical host, inputting the second target parameter into a preset rewarding function, and calculating a second rewarding function value;
judging whether the first rewarding function value is larger than the second rewarding function value; if yes, determining the first candidate physical host as a target physical host; if not, the second candidate physical host is determined to be the target physical host.
5. The method for placing a virtual machine according to claim 4, wherein the step of inputting a first target parameter between the virtual machine to be placed and a first candidate physical host into a preset bonus function, and calculating a first bonus function value, further comprises:
acquiring the number of candidate physical hosts;
determining the time step of each candidate physical host according to the number of the candidate physical hosts;
determining the initial placement state of each virtual machine to be placed according to the time step and the target parameter;
placing the virtual machine to be placed on a first candidate physical machine according to the initial placement state, and generating a first mapping relation between the virtual machine to be placed and the first candidate physical host;
according to the first mapping relation, calculating a first target parameter between the virtual machine to be placed and a first candidate physical host;
and taking the first target parameter as an independent variable of a preset rewarding function, and calculating a first rewarding function value.
6. The method for placing a virtual machine according to claim 4, wherein the step of calculating a second target parameter between the virtual machine to be placed and a second candidate physical host, inputting the second target parameter into a preset bonus function, and calculating a second bonus function value specifically includes:
adjusting the initial placement state to be a candidate placement state;
placing the virtual machine to be placed on a second candidate physical machine according to the candidate placement state, and generating a second mapping relation between the virtual machine to be placed and a second candidate physical host;
according to the second mapping relation, calculating a second target parameter between the virtual machine to be placed and the second candidate physical host;
and taking the second target parameter as an independent variable of a preset rewarding function to calculate a second rewarding function value.
7. A virtual machine placement device, comprising:
the target parameter acquisition module is used for building target parameters between the virtual machine to be placed and the initial physical host; the target parameters comprise resource utilization rate, risk probability, communication distance and energy consumption power;
the candidate physical host determining module is used for determining candidate physical hosts from the initial physical hosts according to the size relation between the target parameters and a preset parameter threshold;
the target physical host determining module is used for determining a target physical host according to target parameters between the virtual machine to be placed and the candidate physical host and a preset rewarding function; and
and the virtual machine placement module is used for placing the virtual machine to be placed into the target physical host.
8. The virtual machine placement apparatus of claim 7,
the target parameter comparison module comprises:
a first reward value calculation unit, configured to input a first target parameter between the virtual machine to be placed and a first candidate physical host into a preset reward function, and calculate a first reward function value;
a second prize value calculating unit, configured to calculate a second target parameter of the virtual machine to be placed and a second candidate physical host, input the second target parameter into a preset prize function, and calculate a second prize function value;
a reward value comparing unit for comparing the magnitude relation between the first reward function value and the second reward function value; and
and the target physical host determining unit is used for determining the first candidate physical host as the target host when the first rewarding function value is larger than the second rewarding function value.
9. An electronic device comprising a memory and a processor, the memory having stored therein a computer program which, when executed by the processor, causes the processor to perform the steps of the virtual machine placement method of any one of claims 1 to 6.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, causes the processor to perform the steps of the virtual machine placement method according to any one of claims 1 to 6.
CN202311731388.8A 2023-12-15 2023-12-15 Virtual machine placement method and device Pending CN117873643A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311731388.8A CN117873643A (en) 2023-12-15 2023-12-15 Virtual machine placement method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311731388.8A CN117873643A (en) 2023-12-15 2023-12-15 Virtual machine placement method and device

Publications (1)

Publication Number Publication Date
CN117873643A true CN117873643A (en) 2024-04-12

Family

ID=90578056

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311731388.8A Pending CN117873643A (en) 2023-12-15 2023-12-15 Virtual machine placement method and device

Country Status (1)

Country Link
CN (1) CN117873643A (en)

Similar Documents

Publication Publication Date Title
CN110869909B (en) System and method for applying machine learning algorithms to calculate health scores for workload scheduling
Li et al. Energy-efficient migration and consolidation algorithm of virtual machines in data centers for cloud computing
CN106776005B (en) Resource management system and method for containerized application
US9749208B2 (en) Integrated global resource allocation and load balancing
US9471394B2 (en) Feedback system for optimizing the allocation of resources in a data center
US20070226341A1 (en) System and method of determining an optimal distribution of source servers in target servers
US20070250837A1 (en) System and method for adjusting multiple resources across multiple workloads
Wang et al. Efficient straggler replication in large-scale parallel computing
US10198295B2 (en) Mechanism for controlled server overallocation in a datacenter
CN111966495B (en) Data processing method and device
Liu et al. CORP: Cooperative opportunistic resource provisioning for short-lived jobs in cloud systems
US9609054B2 (en) Load balancing scalable storage utilizing optimization modules
Chen et al. Cache contention aware virtual machine placement and migration in cloud datacenters
Omara et al. Optimum resource allocation of database in cloud computing
Liumei et al. Towards energy efficient cloud: an optimized ant colony model for virtual machine placement
Elsedimy et al. Toward enhancing the energy efficiency and minimizing the SLA violations in cloud data centers
CN112433853A (en) Heterogeneous sensing data partitioning method for parallel application of supercomputer data
Vishakha Performance Analysis of Cloud Load Balancing Algorithms
Çavdar et al. A Utilization Based Genetic Algorithm for virtual machine placement in cloud systems
CN117311998A (en) Large model deployment method and system
Jiao et al. Immune optimization of task scheduling on multidimensional QoS constraints
Devagnanam et al. Design and development of exponential lion algorithm for optimal allocation of cluster resources in cloud
Zhuang et al. Impact of instance seeking strategies on resource allocation in cloud data centers
CN116647560A (en) Method, device, equipment and medium for coordinated optimization control of Internet of things computer clusters
CN117873643A (en) Virtual machine placement method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination