Summary of the invention
The object of the invention is to overcome the deficiencies in the prior art, the virtual machine migration method at a kind of Energy-saving Data center, the consideration of increase to virtual machine service traffics, realize virtual machine (vm) migration energy-conservation in, reduce virtual machine service traffics, and with the migration number of times of trying one's best few, reach the object of optimization data center energy-saving effect.
For achieving the above object, the virtual machine migration method at Energy-saving Data of the present invention center, comprises the following steps:
S1: the set of all physical machine in existing virtual machine mapping scheme is designated as to S;
S2:, the virtual machine quantity of shining upon in each physical machine in statistics S set, select the physical machine m of virtual machine minimum number in S set, the virtual machine set of the upper mapping of this physical machine m is designated as to H (m), in statistics H (m), total service traffics of all virtual machines, are designated as E by H (m) other all virtual machine set in addition;
S3: if H (m) is empty set, enter step S4, if be not empty set, select the virtual machine i of total service traffics maximum in H (m), other physical machine in S set except physical machine m are searched the physical machine that surplus resources capacity can meet virtual machine i, resource comprises CPU, internal memory, rate of discharge, and if there is no, migration finishes; If only there is a physical machine meeting, using it as migration physical machine, enter step S6; If there are a plurality of physical machine that meet, enter step S5;
S4: physical machine m is deleted from S set, return to step S2;
S5: the physical machine t meeting for each, the service traffics cost T between the virtual machine after computation migration in virtual machine i and other physical machine, computing formula is:
T=Σ
j∈ED(i,j)×C(t,π(j))+Σ
j∈ED(j,i)×C(π(j),t)
Wherein, D (i, j) represents that virtual machine i is to the oriented service traffics of virtual machine j, π (j) is the physical machine of virtual machine j mapping, C (t, π (j)) represents that physical machine t is to the communication cost of the unit service traffics of physical machine π (j), j ∈ E; D (j, i) represents that virtual machine j is to the oriented service traffics of virtual machine i, and (π (j), t) represents that physical machine π (j) is to the communication cost of the unit service traffics of physical machine t to C;
Select the physical machine of service traffics cost T minimum as migration physical machine, enter step S6;
S6: the mapping address of change virtual machine i, virtual machine i is moved in migration physical machine, virtual machine i is deleted from set H (m), return to step S3.
Further, before searching in step S3, by each physical machine in physical machine S set according to the descending sort of surplus resources size
Wherein, in step S6, communication cost is two jumping figures between physical machine.
Wherein, the communication cost in step S6 is the link weight sum in path between two physical machine.
The virtual machine migration method at Energy-saving Data of the present invention center, in all physical machine in existing virtual machine mapping scheme, select successively the physical machine of virtual machine minimum number to carry out virtual machine (vm) migration, during migration, select successively the virtual machine of total service traffics maximum, search surplus resources capacity and can meet the physical machine of this virtual machine, if there is a plurality of physical machine that meet, calculate this virtual machine (vm) migration cost that virtual machine service traffics produce in each physical machine time, select the physical machine of Least-cost to move, until there is virtual machine cannot find the physical machine that meets capacity-constrained, finish virtual machine (vm) migration.Adopt the present invention, by virtual machine (vm) migration, close idle physical machine energy-conservation in, service traffics have also been considered, when appearring in migration, a plurality of physical machine that meets capacity-constrained selects the physical machine of service traffics minimum, further reduced the energy consumption of data center network, the present invention has simultaneously completed virtual machine (vm) migration with the least possible migration number of times, has optimized the energy consumption that migration brings.
Embodiment
Below in conjunction with accompanying drawing, the specific embodiment of the present invention is described, so that those skilled in the art understands the present invention better.Requiring particular attention is that, in the following description, when perhaps the detailed description of known function and design can desalinate main contents of the present invention, these are described in here and will be left in the basket.
Embodiment
The fundamental purpose of virtual machine (vm) migration is in order to concentrate virtual machine, reduces the unlatching quantity of physical machine, thereby saves energy consumption.In the virtual machine migration method at Energy-saving Data center, need to consider the following aspects in the present invention:
A: whether the new physical machine moving to can meet the physical machine resource requirement of physical machine to be migrated, virtual machine needs the resource that physical machine provides to comprise CPU(computational resource), internal memory, rate of discharge, and should each resource can both meet the demand of virtual machine;
B: virtual machine moves to new physical machine from the physical machine of original mapping, whether can minimize the cost that the virtual machine service traffics between physical machine produce, to reduce the use of data center network link resource and switching equipment, thereby reduce the energy consumption of data center network;
C: because the transition process of virtual machine itself also needs to take Internet resources, so whether can reach preferably migration effect with minimum migration number of times, thereby reduce the energy consumption that migration brings.
Between the virtual machine service traffics Least-cost between physical machine quantity minimum, physics, three optimization aim of migration least number of times, there is conflict, therefore in moving method, need necessarily to compromise, so that virtual machine (vm) migration reaches good effect.
Fig. 1 is a kind of embodiment process flow diagram of the virtual machine migration method at Energy-saving Data of the present invention center.As shown in Figure 1, the virtual machine migration method at Energy-saving Data of the present invention center comprises the following steps:
S101: initialization physical machine S set: the set of all physical machine in existing virtual machine mapping scheme is designated as to S.
S102: the virtual machine quantity of shining upon in each physical machine in statistics S set, select the physical machine m of virtual machine minimum number in S set, the virtual machine set of the upper mapping of this physical machine m is designated as to H (m), in statistics H (m), total service traffics of all virtual machines, are designated as E by H (m) other all virtual machine set in addition.
Select the physical machine of current virtual machine minimum number to move, can complete virtual machine (vm) migration with the least possible migration number of times, the energy consumption bringing to reduce migration.
S103: judge whether H (m)=φ, whether H (m) is empty set, if empty set enters step S104, if not empty set, enters step S105.
S104:S=S-{m}, is about to physical machine m and deletes from S set, returns to step S2.
S105: select the virtual machine i of total service traffics maximum in H (m) to move judgement, in S set, other physical machine except physical machine m are searched the physical machine that surplus resources capacity can meet virtual machine i, and resource comprises CPU, internal memory, rate of discharge.
Select the reason that the virtual machine of total service traffics maximum judges to be, for a physical machine, if there is a virtual machine to move, this physical machine cannot close so, cannot reach and close the next energy-conservation object of physical machine, therefore all judge the virtual machine of total service traffics maximum, to prevent that having moved part virtual machine still cannot close the situation of physical machine, reduces unnecessary migration number of times at every turn.
Before searching, can be in advance by each physical machine in physical machine S set according to the descending sort of surplus resources size, thereby can improve search efficiency.
S106: if the transportable physical machine quantity that step S105 finds is 0, does not find and meet capacity-constrained physical machine, migration finishes, if be not 0, enters step S107.
In the present invention, be all at every turn with the moving of the physical machine of virtual machine minimum number, if other physical machine cannot support that the virtual machine in this physical machine moves, illustrate that so whole virtual data center is more concentrated, therefore finish migration.In actual conditions, in a physical machine, conventionally can carry 30-50 physical machine, so the shared resource granularity of each virtual machine is very little, if there is a virtual machine cannot find transportable physical machine, can illustrate that other physical machine approach to saturation.
S107: if the transportable physical machine quantity that step S105 finds is 1,, using it as migration physical machine, enter step S109, if be not 1, more than one of transportable physical machine quantity is described, enter step S108 and select.
S108: the physical machine t meeting for each, the service traffics cost T between the virtual machine after computation migration in virtual machine i and other physical machine, computing formula is:
T=Σ
j∈ED(i,j)×C(t,π(j))+Σ
j∈ED(j,i)×C(π(j),t)
Wherein, D (i, j) represents that virtual machine i is to the oriented service traffics of virtual machine j, π (j) is the physical machine of virtual machine j mapping, C (t, π (j)) represents that physical machine t is to the communication cost of the unit service traffics of physical machine π (j), j ∈ E; Similarly, D (j, i) represents that virtual machine j is to the oriented service traffics of virtual machine i, and (π (j) t) represents that physical machine π (j) is to the communication cost of the unit service traffics of physical machine t to C.When the path of physical machine t to physical machine π (j) and physical machine π (j) to physical machine t is same, and C (t, π (j))=C (π (j), t).The communication cost of unit service traffics can directly adopt the jumping figure of path link, also can adopt path link weight sum.
Select the physical machine of service traffics cost T minimum as migration physical machine, enter step S109.
S109: migration virtual machine i, change the mapping address of virtual machine i, virtual machine i is moved in definite migration physical machine, upgrade the surplus resources capacity in this physical machine, and make H (m)=H (m)-{ i}, be about to virtual machine i and delete from set H (m), return to step S103.
The virtual machine migration method at Energy-saving Data of the present invention center, the virtual machine service traffics that in prior art, shortcoming is considered have been considered, reduce more really the energy consumption model of data center, thereby improved by virtual machine migration method, realized the energy-conservation efficiency of data center.Because the model of this problem is a nonlinear programming problem, possibly cannot tries to achieve optimum solution or need the very huge time just can obtain solution.The virtual machine migration method at Energy-saving Data of the present invention center is used heuritic approach, data center for the virtual machine of a physical machine that comprises M congruence property and N different demands, the present invention has reduced to O (M * N) by the time complexity solving, and has greatly improved the speed of solving.
Although above the illustrative embodiment of the present invention is described; so that those skilled in the art understand the present invention; but should be clear; the invention is not restricted to the scope of embodiment; to those skilled in the art; as long as various variations appended claim limit and definite the spirit and scope of the present invention in, these variations are apparent, all utilize innovation and creation that the present invention conceives all at the row of protection.