Resources of virtual machine dispatching method and dispatching patcher in a kind of cloud computing platform
Technical field
The present invention relates to field of cloud calculation, particularly relate to resources of virtual machine dispatching method and dispatching patcher in a kind of cloud computing platform.
Background technology
Composition cloud computing center operating system generally comprises following module: the management of large-scale basis software and hardware, virtual computing management, distributed file system, several big module such as business/resource scheduling management, safety management control etc. form.Resource management is the key problem of cloud computing system.In cloud computing infrastructure i.e. service field, the through engineering approaches of cloud computing is the most difficult, and person skilled does not finds exercisable system architecture and implementation.The cloud computing infrastructure solution that technical staff proposes at present, relates to the optimisation technique of scheduling of resource in cloud computing infrastructure but without emphasis.The effectiveness of cloud computing resource management system and acceptability are largely dependent upon realized resource scheduling system.Resource in cloud computing system has the feature of highly dynamic property, uses demand according to real resource, and the suitable dispatching method of real-time selection is to ensure that resource obtains the guarantee the most effectively utilized.But, existing cloud computing operating system resource regulating method, do not account for item types and the type of service of virtual machine, and there is unicity, it is impossible to carry out scheduling of resource flexibly.
Summary of the invention
Technical problem:The technical problem to be solved in the present invention is: provides resources of virtual machine dispatching method and dispatching patcher in a kind of cloud computing platform, overcomes the unicity that existing resources of virtual machine is dispatched, improves the high availability of virtual machine.
Technical scheme:For solving above-mentioned technical problem, on the one hand, the present invention provides resources of virtual machine dispatching method in a kind of cloud computing platform, comprises the following steps: S10 obtains distribution resource situation information in physical machine, generates physical machine the Resources list;Physical machine is ranked up by S20 according to the virtual machine quantity created in each physical machine, generates physical machine sorted lists;Resources of virtual machine to be created is compared by S30 with residue physical resource in each physical machine, generates physical machine list to be allocated;S40 chooses physical machine from physical machine list to be allocated, and creates virtual machine in this physical machine.
As a kind of embodiment, in described S10, containing the virtual machine quantity created in the general unique identifier of physical machine, physical machine in physical machine the Resources list, and the residue physical resource in physical machine, this residue physical resource includes CPU, disk and internal memory.
As a kind of embodiment, in described S20, the process generating physical machine sorted lists is: first, according to the type of service of virtual machine to be created, with virtual machine to be created, there is the virtual machine quantity of identical services type according to created in physical machine, from small to large physical machine is ranked up;Secondly, if the virtual machine quantity with identical services type created in physical machine is equal, then with virtual machine to be created, there is the virtual machine quantity of identical items type according to created in physical machine, from small to large physical machine is ranked up;Finally, if the virtual machine quantity with identical items type created in physical machine is equal, then physical machine is carried out randomly ordered.
As a kind of embodiment, in described S30, the process generating physical machine list to be allocated is: first inquire about physical machine the Resources list according to the general unique identifier of physical machine, the physical resource of consumption needed for residue physical resource and virtual machine to be created in each physical machine is compared, if the former is less than the latter, from physical machine sorted lists, then filter out this physical machine, if the former is more than or equal to the latter, then in physical machine sorted lists, retain this physical machine;Finally the physical machine retained in physical machine sorted lists is generated physical machine list to be allocated;This list comprises assignable physical machine.
As a kind of embodiment, in described S40, from physical machine list to be allocated, choose the physical machine made number one, and create virtual machine thereon.
On the other hand, the present invention also provides for resources of virtual machine dispatching patcher in a kind of cloud computing platform, and this dispatching patcher includes: physical machine the Resources list generation module, for obtaining distribution resource situation information in physical machine, generates physical machine the Resources list;Physical machine sorted lists generation module, for being ranked up physical machine according to the virtual machine quantity created in physical machine, generates physical machine sorted lists;Physical machine List Generating Module to be allocated, for comparing resources of virtual machine to be created with residue physical resource in each physical machine, generates physical machine list to be allocated;Creation module, for choosing physical machine from physical machine list to be allocated, and creates virtual machine in this physical machine.
As a kind of embodiment, described physical machine sorted lists generation module includes: the first physical machine sorted lists generates submodule, for the type of service according to virtual machine to be created, with virtual machine to be created, there is the virtual machine quantity of identical services type according to created in physical machine, from small to large physical machine is ranked up;Second physical machine sorted lists generates submodule, for when the virtual machine quantity with identical services type created in physical machine equal, then with virtual machine to be created, there is the virtual machine quantity of identical items type according to created in physical machine, from small to large physical machine is ranked up;3rd physical machine sorted lists generates submodule, is used for when the virtual machine quantity with identical items type created in physical machine is equal, then arranging physical machine at random.
As a kind of embodiment, described physical machine List Generating Module to be allocated includes: inquiry submodule: inquire about physical machine the Resources list for the general unique identifier according to physical machine, find out the residue physical resource in each physical machine;Comparison sub-module: the physical resource of consumption compares needed for by residue physical resource and the virtual machine to be created in physical machine;Select submodule: during the physical resource consumed needed for the residue physical resource in physical machine is less than virtual machine to be created, then from physical machine sorted lists, filter this physical machine;If the residue physical resource in physical machine is more than or equal to the physical resource consumed needed for virtual machine to be created, then in physical machine sorted lists, retain this physical machine;Generate submodule: for the physical machine that will retain in physical machine sorted lists, generate physical machine list to be allocated.
Beneficial effect:Compared with prior art, the method have the advantages that physical machine is ranked up according to the virtual machine quantity created in each physical machine by the present invention, generate physical machine sorted lists, from this list, then select to create the physical machine of virtual machine.By arranging physical machine sorted lists, according to the virtual machine quantity of identical services type or item types, from small to large physical machine is ranked up so that the physical machine with virtual machine to be created with different service types or item types is preferentially stood out.So overcome existing resources of virtual machine to dispatch unicity, improve the high availability of virtual machine.
Accompanying drawing explanation
Fig. 1 is a kind of application structure frame diagram of the present invention.
Fig. 2 is the flow chart of the embodiment of the present invention 1.
Fig. 3 is the system architecture diagram of the embodiment of the present invention 2.
Fig. 4 is the structured flowchart of physical machine sorted lists generation module in the embodiment of the present invention 2.
Fig. 5 is the structured flowchart of physical machine List Generating Module to be allocated in the embodiment of the present invention 2.
Detailed description of the invention
Below in conjunction with the accompanying drawings and embodiment, technical scheme is carried out detailed discussion.
Embodiment 1
As it is shown in figure 1, be a kind of application structure frame diagram of the present invention.In FIG, server communicates to connect with each physical machine, and physical machine is run virtual machine (VM).Server is responsible for gathering the information of virtual machine in each physical machine, such as virtual machine number, residue CPU, free memory, remanence disk space.Server selects to create virtual machine in which platform physical machine according to the dispatching method of the present invention.
As in figure 2 it is shown, resources of virtual machine dispatching method in a kind of cloud computing platform, comprise the following steps:
S10 obtains distribution resource situation information in physical machine, generates physical machine the Resources list;
Physical machine is ranked up by S20 according to the virtual machine quantity created in each physical machine, generates physical machine sorted lists;
Resources of virtual machine to be created is compared by S30 with residue physical resource in each physical machine, generates physical machine list to be allocated;
S40 chooses physical machine from physical machine list to be allocated, and creates virtual machine in this physical machine.
In S10, the virtual machine quantity created in general unique identifier (corresponding English abbreviation: UUID) containing physical machine, physical machine in physical machine the Resources list, and the residue physical resource in physical machine.By creating physical machine the Resources list, it is possible to obtain the situation of the physical machine of each operation.Residue physical resource includes residue CPU of physical machine, residue disk and free memory.Virtual machine to be created is also required to consume CPU, disk and internal memory, so remaining physical resource in physical machine must to be fulfilled for the physical resource that the required consumption of virtual machine to be created takies.On the premise of meeting this condition, virtual machine could be created in this physical machine.Before carrying out the comparison of physical resource, step S10 of the present invention, generate physical machine the Resources list, the residue physical resource Information in each operation physical machine is stored in the table.
As a kind of preferred version, in S20, the process generating physical machine sorted lists is: first, according to the type of service of virtual machine to be created, with virtual machine to be created, there is the virtual machine quantity of identical services type according to created in physical machine, from small to large physical machine is ranked up;Secondly, if the virtual machine quantity with identical services type created in physical machine is equal, then with virtual machine to be created, there is the virtual machine quantity of identical items type according to created in physical machine, from small to large physical machine is ranked up;Finally, if the virtual machine quantity with identical items type created in physical machine is equal, then physical machine is carried out randomly ordered.
Above-mentioned preferred version, first, determines the sequence of physical machine according to type of service, then the sequence of physical machine is determined according to item types, last the most identical with item types in type of service, and in the case of the virtual machine quantity run in each physical machine is the most identical, the most randomly ordered.Such as, as shown in table 1, having 3 physical machine running, the resource status of each physical machine is as shown in table 1.
The resource status of virtual machine to be created is as shown in table 2.
When virtual machine 1 to be created during virtual machine to be created is table 2, the generation process of physical machine sorted lists is: first according to the type of service of virtual machine 1 to be created, the virtual machine quantity of type of service identical with virtual machine 1 to be created in physical machine 1 is 3, the virtual machine quantity of type of service identical with virtual machine 1 to be created in physical machine 2 is 0, the virtual machine quantity of type of service identical with virtual machine 1 to be created in physical machine 3 is 4, then physical machine sorted lists is physical machine 2, physical machine 1, physical machine 3.
When virtual machine 2 to be created during virtual machine to be created is table 2, the generation process of physical machine sorted lists is: first according to the type of service of virtual machine 2 to be created, the virtual machine quantity of type of service identical with virtual machine 2 to be created in physical machine 1 is 3, the virtual machine quantity of type of service identical with virtual machine 2 to be created in physical machine 2 is 3, and the virtual machine quantity of type of service identical with virtual machine 2 to be created in physical machine 3 is 0.Because physical machine 1 is equal with the virtual machine quantity of type of service identical with virtual machine 2 to be created in physical machine 2, then physical machine 1 and physical machine 2 are ranked up by the item types further according to virtual machine 2 to be created.The virtual machine quantity of item types identical with virtual machine 2 to be created in physical machine 1 is 1, and the virtual machine quantity of item types identical with virtual machine 2 to be created in physical machine 2 is 3.Therefore, for virtual machine 2 to be created, physical machine sorted lists is physical machine 3, physical machine 1, physical machine 2.
In S20, successively according to type of service and the item types of virtual machine to be created, according to the virtual machine quantity of identical services type or item types, from small to large physical machine is ranked up.So, the physical machine sorted lists obtained according to this condition, will as far as possible virtual machine distribution to be created be had in the physical machine of different service types or item types with virtual machine to be created.In table 2, when virtual machine 1 to be created creates in physical machine 2, the virtual machine that physical machine 2 is originally present there is no Web service type.When virtual machine 2 to be created creates in physical machine 3, the virtual machine that physical machine 3 is originally present there is no MQ type of service.So, the virtual machine of same type (type of service or item types) will not be built in same physical machine as far as possible, thus ensure that high availability.When a physical machine delays machine, virtual machine present on other properly functioning physical machine has the type of service identical with the virtual machine of the machine of delaying or item types, may ensure that the properly functioning of business, it is ensured that the high availability of whole system.
Item types such as workflow engine, propelling movement platform, cloud disk system etc..Type of service such as webpage (Web), application program (App), data base (DB), cache (Cache), Message Queuing (MQ) etc..
In S30, the process generating physical machine list to be allocated is: first inquire about physical machine the Resources list according to the general unique identifier of physical machine, the physical resource of consumption needed for residue physical resource and virtual machine to be created in each physical machine is compared, if the former is less than the latter, from physical machine sorted lists, then filter out this physical machine, if the former is more than or equal to the latter, then in physical machine sorted lists, retain this physical machine;Finally the physical machine retained in physical machine sorted lists is generated physical machine list to be allocated;This list comprises assignable physical machine.Physical resource refers to CPU, disk and internal memory.
In aforementioned table 2, the CPU of virtual machine 1 to be created is 2 cores, and taking disk is 1T, and committed memory is 2G.Residue CPU, residue disk and free memory in physical machine 2, physical machine 1, physical machine 3 are all higher than the CPU needed for virtual machine 1 to be created, disk, internal memory.Therefore, physical machine 2, physical machine 1, physical machine 3 can create virtual machine 1 to be created.The physical machine list to be allocated generated is physical machine 2, physical machine 1, physical machine 3.
The CPU of virtual machine 2 to be created is 2 cores, and taking disk is 1T, and committed memory is 3.5G.Residue CPU, residue disk and free memory in physical machine 1, physical machine 3 are all higher than the CPU needed for virtual machine 2 to be created, disk, internal memory.The free memory of physical machine 2 is less than the internal memory needed for virtual machine 2 to be created.Virtual machine 2 the most to be created can not create in physical machine 2.The physical machine list to be allocated generated is physical machine 3, physical machine 1.
Virtual machine to be created needs to take physical resource, then in the final physical machine selected, it is necessary to leave enough physical resources to virtual machine to be created.In step S10, containing the residue physical resource in physical machine in physical machine the Resources list.All physical machine being connected with server are sorted by step S20.The physical machine with virtual machine to be created with different service types or item types is stood out by this sequence, as the physical machine of prioritizing selection.But, in this physical machine sorted lists, the most all of physical machine all leaves enough physical resources to virtual machine to be created.The purpose of step S30 is exactly residue physical resource can not to be met the physical machine of virtual machine to be created filter from physical machine sorted lists.In the present embodiment, first inquire about physical machine the Resources list according to the general unique identifier of physical machine, the physical resource of consumption needed for the residue physical resource in each physical machine and virtual machine to be created is compared.Disclosure satisfy that and create the physical machine that virtual machine needs, be then retained in physical machine sorted lists, it is impossible to enough physical machine meeting establishment virtual machine needs, then filter from physical machine sorted lists, thus generate physical machine list to be allocated.This list comprises assignable physical machine.It is to say, present in the physical machine list to be allocated physical machine, may be used to create virtual machine.But as method for optimizing, select First physical machine to create virtual machine from physical machine list to be allocated.Through the sequence of step S20 and the filtration of step S30 and reservation, make number one in physical machine list to be allocated physical machine, has the probability with virtual machine different service types to be created or item types maximum.The virtual machine of identical services type or item types is distributed in different physical machine, beneficially system high-available.
When prior art carries out scheduling of resource, do not consider type of service and item types, cause the virtual machine of identical type of service or item types to be likely to build in same physical machine.The present embodiment by compare physical machine residue physical resource and virtual machine needed for consume physical resource, select physical machine, not only compare physical resource, further comprises the judgement of type of service and item types, it is ensured that high availability.
Embodiment
2
As it is shown on figure 3, resources of virtual machine dispatching patcher in a kind of cloud computing platform, including:
Physical machine the Resources list generation module, for obtaining distribution resource situation information in physical machine, generates physical machine the Resources list;
Physical machine sorted lists generation module, for being ranked up physical machine according to the virtual machine number created in physical machine, generates physical machine sorted lists;
Physical machine List Generating Module to be allocated, for comparing resources of virtual machine to be created with residue physical resource in each physical machine, generates physical machine list to be allocated;
Creation module, for choosing physical machine from physical machine list to be allocated, and creates virtual machine in this physical machine.
Containing the residue physical resource in the virtual machine number created in the general unique identifier of physical machine, physical machine, physical machine in physical machine the Resources list generation module, this residue physical resource includes CPU, disk and internal memory.Physical resource refers to CPU, disk and internal memory.
As shown in Figure 4, physical machine sorted lists generation module includes: the first physical machine sorted lists generates submodule, for the type of service according to virtual machine to be created, to each physical machine with virtual machine to be created with identical services type, according to the virtual machine quantity created in physical machine, it is ranked up from small to large.
Second physical machine sorted lists generates submodule, for when there is the virtual machine quantity created in the physical machine of identical services type being equal, item types according to virtual machine to be created, to the physical machine with virtual machine to be created with identical items type, according to the virtual machine quantity created in physical machine, it is ranked up from small to large.
3rd physical machine sorted lists generates submodule, for when having the virtual machine quantity created in the physical machine of identical items type and being equal, arranges physical machine at random.
Generate submodule by arranging three physical machine sorted lists, all physical machine are ranked up, the physical machine sorted lists of generation.Physical machine sorted lists generation module, successively according to type of service and the item types of virtual machine to be created, according to the virtual machine quantity of identical services type or item types, is ranked up physical machine from small to large.So, the physical machine sorted lists obtained according to this condition, will as far as possible virtual machine distribution to be created be had in the physical machine of different service types or item types with virtual machine to be created.So, the virtual machine of same type (type of service or item types) is not built in same physical machine as far as possible, thus ensure that high availability.When a physical machine delays machine, virtual machine present on other properly functioning physical machine has the type of service identical with the virtual machine of the machine of delaying or item types, may ensure that the properly functioning of business, it is ensured that the high availability of whole system.
Existing dispatching patcher only the most enough determines whether according to physical resource to create virtual machine.And in the dispatching patcher of the present invention, not only according to physical resource, also to determine whether to create virtual machine according to type of service and item types, fine granularity is higher.Physical resource is scheduling by the present invention in the highest fine-grained mode, reasonably utilizes physical resource.
As it is shown in figure 5, physical machine List Generating Module to be allocated includes:
Inquiry submodule: inquire about physical machine the Resources list for the general unique identifier according to physical machine, find out the residue physical resource in each physical machine.
Comparison sub-module: the physical resource of consumption compares needed for by residue physical resource and the virtual machine to be created in physical machine.
Select submodule: during the physical resource consumed needed for the residue physical resource in physical machine is less than virtual machine to be created, from physical machine sorted lists, then filter out this physical machine, if the residue physical resource in physical machine is more than or equal to the physical resource consumed needed for virtual machine to be created, then in physical machine sorted lists, retain this physical machine.
Generate submodule: for the physical machine that will retain in physical machine sorted lists, generate physical machine list to be allocated.
Each physical machine has a general unique identifier.Inquiry submodule inquires about the residue physical resource in physical machine by general unique identifier from physical machine the Resources list.This work being comparison sub-module is laid a good foundation.Comparison sub-module physical resource of consumption needed for by the residue physical resource in the inquiry physical machine that finds of submodule and virtual machine to be created compares.During the physical resource consumed needed for the residue physical resource in physical machine is less than virtual machine to be created, module is selected to filter out this physical machine from physical machine sorted lists.During the physical resource consumed needed for the residue physical resource in physical machine is more than or equal to virtual machine to be created, module is selected to retain this physical machine in physical machine sorted lists.After filtration and reservation operations, in physical machine sorted lists, physical machine is incomplete same with the physical machine that step S20 generates in physical machine sorted lists.Through filtering and physical machine sorted lists after reservation operations, generated physical machine list to be allocated by generating submodule.Creation module generates from generation submodule and chooses First physical machine physical machine list to be allocated, and creates virtual machine in this physical machine.
All physical machine are sorted and physical machine List Generating Module to be allocated is to the filtration of physical machine and reservation through physical machine sorted lists generation module, make number one in physical machine list to be allocated physical machine, has the probability with virtual machine different service types to be created or item types maximum.Creation module generates from generation submodule and chooses First physical machine establishment virtual machine physical machine list to be allocated.So the virtual machine of identical services type or item types is distributed in different physical machine, beneficially system high-available.
In the dispatching patcher of the present invention, physical machine sorted lists generation module, successively according to type of service and the item types of virtual machine to be created, according to the virtual machine quantity of identical services type or item types, from small to large physical machine is ranked up.So, the physical machine having different service types or item types with virtual machine to be created is preferentially stood out.
Physical machine List Generating Module to be allocated, the physical resource of consumption needed for residue physical resource and virtual machine to be created in each physical machine is compared, if the former is less than the latter, from physical machine sorted lists, then filter out this physical machine, if the former is more than or equal to the latter, then in physical machine sorted lists, retain this physical machine;Finally the physical machine retained in physical machine sorted lists is generated physical machine list to be allocated.In physical machine list to be allocated, the sequence of each physical machine is identical with the sequencing that they arrange in physical machine sorted lists.Creation module chooses First physical machine from physical machine list to be allocated, and creates virtual machine in this physical machine.So, the virtual machine of same type (type of service or item types) will not be built in same physical machine as far as possible, thus ensure that high availability.When a physical machine delays machine, virtual machine present on other properly functioning physical machine has the type of service identical with the virtual machine of the machine of delaying or item types, may ensure that the properly functioning of business, it is ensured that the high availability of whole system.
Those skilled in the art should know, it is achieved the method for above-described embodiment or system, can be realized by computer program instructions.This computer program instructions is loaded in programmable data processing device, such as computer, thus performs corresponding instruction in programmable data processing device, the function that the method or system for realizing above-described embodiment realizes.
Those skilled in the art, according to above-described embodiment, can carry out the technological improvement of non-creativeness, without deviating from the spirit of the present invention to the application.These improvement still should be regarded as within the application scope of the claims.