Summary of the invention
The present invention provides a kind of virtual data center resource allocation methods and monitor of virtual machine, in order to reduce the excessive distribution of resource, improves resource utilization.
One aspect of the present invention provides a kind of virtual data center resource allocation methods, comprising:
Monitor of virtual machine selects to be used to move the execution server of said virtual machine according to the virtual machine of asking in the user's application request that receives to make up;
Be the initial resource that each said virtual machine distributes the resources requirement that can satisfy this virtual machine on said execution server, and make up said virtual machine based on this initial resource;
The historical consumed resource of this virtual machine of statistics in the preset operation period of said virtual machine;
Sell ratio O according to said historical consumed resource and definite surpassing of said resources requirement, wherein, O ∈ [0,100];
On said execution server, distribute final resource for each said virtual machine, this final resource=A (O), and rebuild said virtual machine based on this final resource, wherein, A is the cumulative distribution function of said historical consumed resource.
The present invention provides a kind of monitor of virtual machine on the other hand, comprising:
Server is selected module, is used for asking according to the user's application request that receives the virtual machine of structure, selects to be used to move the execution server of said virtual machine;
The original allocation module, being used on the said execution server that server selects module to select is the initial resource that each said virtual machine distributes the resources requirement that can satisfy this virtual machine, and makes up said virtual machine based on this initial resource;
The historical statistics module is used for the preset historical consumed resource that moves this virtual machine of statistics in the period at the said virtual machine of original allocation module construction;
Surpass and sell computing module, the said historical consumed resource and definite the surpassing of said resources requirement that are used for counting on according to the historical statistics module are sold ratio O, wherein, and O ∈ [0,100];
The final assignment module; Be used on the said execution server that server selects module to select, distributing final resource for each said virtual machine, this final resource=A (O), and rebuild said virtual machine based on this final resource; Wherein, A is the cumulative distribution function of said historical consumed resource.
The present invention is through reducing the resource distribute to virtual machine based on the ultra ratio O that sells that calculates, thereby under the prerequisite that guarantees the normal operation of virtual machine as far as possible, reduced the excessive distribution of resource, improved the utilization factor of resource.
Embodiment
Fig. 1 is the process flow diagram of the virtual resource allocation methods embodiment of data center according to the invention, and is as shown in the figure, and this method comprises the steps:
Step 100, monitor of virtual machine select to be used to move the execution server of said virtual machine according to the virtual machine of asking in the user's application request that receives to make up.
Wherein, said user's application request is to make up virtual machine so that realize concrete request of using by user's sent request, and virtual machine to be made up has one or more; Said execution server is used to that virtual machine to be made up provides resource so that the server of operation virtual machine.Concrete selection course can adopt greedy algorithm, will describe in subsequent content.
Step 200 is the initial resource that each said virtual machine distributes the resources requirement that can satisfy this virtual machine on said execution server, and makes up said virtual machine based on this initial resource.
Wherein, said initial resource is meant the resource of distributing according to user's demand, and the size of this initial resource can satisfy the resources requirement of each virtual machine.Of aforesaid background technology, user's request often has blindness, and therefore, this initial resource of being distributed often is greater than the actual consumed resource of virtual machine, and the part that wherein has more is called the ultra resource of selling in the present embodiment.
Step 300, the historical consumed resource of this virtual machine of statistics in the preset operation period of said virtual machine.
Wherein, be a period of time that virtual machine is moved based on initial resource in the said preset operation period, purpose is in order during this period of time to obtain the actual historical consumed resource that takies of virtual machine, so that the reference when selling resource as follow-up assessment is ultra.
Step 400 is sold ratio O according to said historical consumed resource and definite surpassing of said resources requirement, wherein, and O ∈ [0,100].
Wherein, the said ultra ratio O that sells is meant the ultra resource request that resource will satisfy the user with the probability of (1-O) % of selling.Can be expressed as with mathematical expression: Pr (x>A (O))<=O%, wherein, A (O) expression is sold ratio O ultra resource of selling for this virtual machine distribution with ultra, and x representes the historical consumed resource of this virtual machine, and Pr representes probability.Ultra variation range of selling ratio O is between 0~100, and O=0 representes not ultra selling, and asks Resources allocation according to the user fully; During O=100, then Resources allocation is zero.
Said ultra when selling ratio O when confirming, can consider that actual gain finds the solution following equation:
E(R|O)=Req×price-A(O)×price-(∑Req)×cost×Pr(x
>(A(O)+A′))
Wherein, E (R|O) is illustrated in and surpasses the prospective earnings value that makes up a virtual machine under the condition of selling ratio O, and Req representes the resources requirement of this virtual machine; Price representes resource income unit price; Can be according to service-level agreement (Service Level Agreement, abbreviation: confirm that SLA) A (O) expression is sold ratio O ultra resource of selling for this virtual machine distribution with ultra; It satisfies cumulative distribution function (the Cumulative Distribution Function of resource consumption probability; Be called for short: CDF), ∑ Req representes that this virtual machine belongs to the summation of the resources requirement of carrying out the whole virtual machines that move on server, and cost representes conflict reparations unit price; Can confirm according to SLA; X representes the historical consumed resource of this virtual machine, and this virtual machine place of A ' expression is carried out and is the final resource except that this virtual assigned virtual machine on the server, and Pr representes probability.
The practical significance of following formula is: the resource that is a virtual machine distribution is many more; Income is many more, but ultra sell resource and in fact be not fully utilized, and makes up more multi-dummy machine thereby hindered; Therefore deduct the ultra income that resource obtains of selling, also deduct the damages of paying when the virtual machine conflict takes place in addition.Relevant virtual machine conflict will be introduced in subsequent content.Concrete equation solution process can adopt process of iteration to realize, below lifts an example explanation:
Step 500 is distributed final resource for each said virtual machine on said execution server, this final resource=A (O), and rebuild said virtual machine based on this final resource.
Wherein, Said final resource is meant from initial resource removes the ultra resource that final assignment is given virtual machine after the resource of selling; A is the cumulative distribution function of said historical consumed resource, owing to saidly ultra sell the possibility that resource has only O% and can be utilized, therefore; Do not sell resources allocation to said virtual machine even this part is not surpassed, can not make a big impact yet it.
The said method of present embodiment is through reducing the resource distribute to virtual machine based on the ultra ratio O that sells that calculates, thereby under the prerequisite that guarantees the normal operation of virtual machine as far as possible, reduced the excessive distribution of resource, improved the utilization factor of resource.
In addition; The said ultra possibility of selling resource O% still being arranged of present embodiment can be utilized; When virtual machine has utilized this part ultra when selling resource, a real resource consumption of carrying out the whole virtual machines that move on the server might surpass the available volume of resources that this executions server can provide, and just the virtual machine conflict can take place at this moment; That is to say that the virtual machine that is distributed has exceeded the ability of place execution server, can continue to carry out following step 600 this moment.
Step 600 when clashing between a plurality of virtual machines on the said execution server, is carried out the virtual machine (vm) migration that clashes another in same alternative group on server.
Particularly, virtual machine (vm) migration that can committed memory space in the virtual machine that clash is minimum is carried out on the server to said another, so that reduce the expense that migration is produced.
Following with reference to Fig. 2, specify and adopt greedy algorithm in the above-mentioned steps 100 carrying out the selection course of server, as shown in Figure 2, comprise the steps:
Step 110, monitor of virtual machine is collected the available resource information of the whole servers that are positioned at Access Layer.
Existing Intel Virtualization Technology adopts three layers of tree topology structure usually: top layer is core layer (core level), is used to realize concrete application; The middle level is a polymer layer, includes many switches, is used to realize exchanges data; Bottom is an Access Layer, comprises multiple servers, is used to provide resource, like the computing power of CPU, memory headroom etc., to make up virtual machine.Owing to can move a plurality of virtual machines on the station server, so its available resources are dynamic changes, need carry out by the time collect.
Step 120, the server that can make up said virtual machine according to the available resource information of collecting is confirmed as the alternative services device.
Wherein, said alternative services device is meant to have the server that enough resources are provided for virtual machine to be made up, if enough resources can not be provided, then can not be chosen as the alternative services device.
Step 130 will be divided into one alternative group with the alternative services device that same switch in the polymer layer directly links to each other.
In the prior art; Comprise a plurality of switches in the polymer layer; Each switch directly links to each other with a plurality of servers; In this step, will be divided into one alternative group with the alternative services device that same switch in the polymer layer directly links to each other, will be divided into the alternative services device that another switch directly links to each other another alternative group (pod), the alternative services device in different alternative group will connect via the switch indirect communication.
Step 140, the quantity of adding up each said alternative group of virtual machine that can make up at most according to the resource requirement information of each said virtual machine.
Suppose that each virtual machine all needs the memory headroom of 2M; Alternative services device in first alternative group can provide the available memory space of 10M altogether; Alternative services device in second alternative group can provide the available memory space of 4M altogether, and the alternative services device in the 3rd alternative group can provide the available memory space of 6M altogether, and the alternative services device in the 4th alternative group can provide the available memory space of 2M altogether; Then through the statistics that obtains after this step be: first alternative group can make up 5 virtual machines at most; Second alternative group can make up 2 virtual machines at most, and the 3rd alternative group can make up 3 virtual machines at most, and the 4th alternative group can make up 1 virtual machine at most.
Need to prove that here in fact, the resources requirement of different virtual machine possibly have nothing in common with each other, and only illustrates, and does not do qualification here.
Step 150 is selected the respective alternative group successively according to the said quantity order from big to small that counts on, and equals the sum of virtual machine to be made up up to the summation of selected alternative group of corresponding said quantity.
For example; In last example; Suppose that the virtual machine that the user asks to make up adds up to 10; Then the selection course to alternative group is in this step: select first alternative group earlier so that make up 5 virtual machines, select the 3rd alternative group then so that make up 3 virtual machines, select second alternative group at last then so that make up 2 virtual machines.
Step 160 is chosen as said execution server with the alternative services device in selected said alternative group.
Through method shown in Figure 2; Three layers of tree topology structure of existing Intel Virtualization Technology when selecting to carry out server, have been considered for virtual machine; Virtual machine is placed on as far as possible in alternative group of the execution server that comprises maximum quantity; Because the execution server in alternative group all directly links to each other with same switch; Therefore operate in these communication datas of carrying out between the virtual machine on the server and need not forwarding, and reduced the communication interaction between the virtual machine in different alternative group as far as possible, thereby help reducing the burden of core layer via core layer.This method also can be called greedy algorithm.
Need to prove here; Because the execution server in selected each alternative group all directly links to each other with an exchange; Therefore concrete which virtual machine of operation is not having difference in essence aspect the communication data forwarding amount on concrete which execution server, does not do qualification here.
Fig. 3 is the structural representation of monitor of virtual machine embodiment according to the invention; In order to realize said method; As shown in the figure, this monitor of virtual machine 10 comprises at least: server is selected module 11, original allocation module 12, historical statistics module 13, ultra computing module 14 and the final assignment module 15 of selling.Need to prove that here the thick vertical line among the figure is represented bus, each template all is connected on the bus, but in the present embodiment, as long as can make above-mentioned each module realize necessary information interaction, adopts other connected modes also to be fine.Below introduce the principle of work of monitor of virtual machine 10 in detail:
When monitor of virtual machine 10 receives user's application request, select module 11 according to the virtual machine of asking in the user's application request that receives to make up by server, select to be used to move the execution server of said virtual machine; Be the initial resource that each said virtual machine distribution can be satisfied the resources requirement of this virtual machine on the said execution server that server selects module 11 to select by original allocation module 12 then, and make up said virtual machine based on this initial resource.
After this, in the preset operation period of the said virtual machine that original allocation module 12 makes up, add up the historical consumed resource of this virtual machine by historical statistics module 13; Wherein, be a period of time that virtual machine is moved based on initial resource in the said preset operation period, purpose is in order during this period of time to obtain the actual historical consumed resource that takies of virtual machine, so that the reference when selling resource as follow-up assessment is ultra.
After this, sell ratio O according to said historical consumed resource and definite surpassing of said resources requirement that historical statistics module 13 counts on by the ultra computing module 14 of selling, wherein, O ∈ [0,100].Said ultra when selling ratio O when confirming, can consider that actual gain finds the solution following equation:
E(R|O)=Req×price-A(O)×price-(∑Req)×cost×Pr(x
>(A(O)+A′))
Wherein relevant ultra detailed description of selling each several part in ratio O and the above-mentioned equation can be repeated no more referring to said method embodiment here.
At last; On the said execution server that server selects module 11 to select, distribute final resource by final assignment module 15 for each said virtual machine; This final resource=A (O); And rebuild said virtual machine based on this final resource, wherein, A is the cumulative distribution function of said historical consumed resource.
The said method of present embodiment is through reducing the resource distribute to virtual machine based on the ultra ratio O that sells that calculates, thereby under the prerequisite that guarantees the normal operation of virtual machine as far as possible, reduced the excessive distribution of resource, improved the utilization factor of resource.
In addition; As shown in Figure 3; When server is selected to clash between a plurality of virtual machines on the said execution server that module 11 selects, virtual machine (vm) migration module 16 can further be set, the virtual machine (vm) migration that clashes another in same alternative group carried out on server.Particularly, virtual machine (vm) migration that can committed memory space in the virtual machine that clash is minimum is carried out on the server to said another, so that reduce the expense that migration is produced.
Following with reference to Fig. 4, specify the inner structure that said server is selected module 11, as shown in the figure, this server selects module 11 to comprise at least: collector unit 1101, alternative unit 1102, division unit 1103, statistic unit 1104 and selected cell 1105.Need to prove that here the thick vertical line among the figure is represented bus, each template all is connected on the bus, but in the present embodiment, as long as can make above-mentioned each module realize necessary information interaction, adopts other connected modes also to be fine.Below the explanation server is selected the principle of work of module 11:
The available resource information of collecting the whole servers that are positioned at Access Layer by collector unit 1101 earlier; The available resource information of being collected according to collector unit 1101 by alternative unit 1102 then can make up the server of said virtual machine and confirm as the alternative services device; Wherein, said alternative services device is meant to have the server that enough resources are provided for virtual machine to be made up, if enough resources can not be provided, then can not be chosen as the alternative services device.
After this, to the said alternative services device of confirming by alternative unit 1102, will be divided into one alternative group with the alternative services device that same switch in the polymer layer directly links to each other by division unit 1103.The detailed description of three layers of tree topology structure of relevant Intel Virtualization Technology can be repeated no more referring to said method embodiment here.
After this, add up the quantity of each said alternative group of virtual machine that can make up at most of dividing by division unit 1103 according to the resource requirement information of each said virtual machine by statistic unit 1104; And select the respective alternative group successively according to the said quantity order from big to small that statistic unit 1104 counts on by selected cell 1105; Equal the sum of virtual machine to be made up up to the summation of selected alternative group of corresponding said quantity, and the alternative services device in selected said alternative group is chosen as said execution server.
Through structure shown in Figure 4; Three layers of tree topology structure of existing Intel Virtualization Technology when selecting to carry out server, have been considered for virtual machine; Virtual machine is placed on as far as possible in alternative group of the execution server that comprises maximum quantity; Because the execution server in alternative group all directly links to each other with same switch; Therefore operate in these communication datas of carrying out between the virtual machine on the server and need not forwarding, and reduced the communication interaction between the virtual machine in different alternative group as far as possible, thereby help reducing the burden of core layer via core layer.This method also can be called greedy algorithm.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can be accomplished through the relevant hardware of programmed instruction; Aforesaid program can be stored in the computer read/write memory medium; This program the step that comprises said method embodiment when carrying out; And aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
What should explain at last is: above embodiment is only in order to explaining technical scheme of the present invention, but not to its restriction; Although with reference to previous embodiment the present invention has been carried out detailed explanation, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment put down in writing, and perhaps part technical characterictic wherein is equal to replacement; And these are revised or replacement, do not make the spirit and the scope of the essence disengaging various embodiments of the present invention technical scheme of relevant art scheme.