WO2013123650A1 - 虚拟机分配方法和虚拟机分配装置 - Google Patents

虚拟机分配方法和虚拟机分配装置 Download PDF

Info

Publication number
WO2013123650A1
WO2013123650A1 PCT/CN2012/071458 CN2012071458W WO2013123650A1 WO 2013123650 A1 WO2013123650 A1 WO 2013123650A1 CN 2012071458 W CN2012071458 W CN 2012071458W WO 2013123650 A1 WO2013123650 A1 WO 2013123650A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
machine
attribute information
physical
physical machine
Prior art date
Application number
PCT/CN2012/071458
Other languages
English (en)
French (fr)
Inventor
胡斐然
于文化
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201280000263.1A priority Critical patent/CN103548324B/zh
Priority to PCT/CN2012/071458 priority patent/WO2013123650A1/zh
Publication of WO2013123650A1 publication Critical patent/WO2013123650A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources

Definitions

  • the present invention relates to the field of information technologies, and in particular, to a virtual machine allocation method and a virtual machine allocation apparatus. Background technique
  • VMs virtual machines
  • PMs physical machines
  • Embodiments of the present invention provide a virtual machine allocation method and a virtual machine allocation apparatus, which improve resource utilization of a physical machine in a network.
  • an embodiment of the present invention provides a virtual machine allocation method, including:
  • the attribute information of the virtual machine listed in the sample table determines the target physical machine, where the attribute information of the virtual machine listed in the reference sample table of the target physical machine matches the attribute information of the requested virtual machine;
  • the virtual machine allocation reference model is an analog virtual machine allocation model in which each physical machine has the highest average resource occupancy rate, and the virtual machine allocation reference model includes a reference sample table corresponding to each physical machine, and the reference sample table
  • the method includes: attribute information of the physical machine, and a virtual object that can be created The attribute information of the virtual machine and the number of virtual machines that can be created, the resource occupancy rate of the physical machine; and the virtual machine requested in the virtual machine allocation request is created in the target physical machine.
  • an embodiment of the present invention provides a virtual machine allocation apparatus, including:
  • a receiver configured to obtain a virtual machine allocation request, where the virtual machine allocation request includes attribute information of the requested virtual machine
  • the virtual machine allocation reference model is a virtual machine allocation model in which each physical machine has the highest average resource occupancy rate, and the virtual machine allocation reference model includes a reference sample table corresponding to each physical machine,
  • the reference sample table includes: attribute information of the physical machine, attribute information of the virtual machine that can be created, and the number of virtual machines that can be created, resource occupancy rate of the physical machine; and an actuator for the target physical machine Create the virtual machine requested in the virtual machine allocation request.
  • an embodiment of the present invention provides a computer program product, including computer program code, when the computer program code is executed by a computer unit, the computer unit executes the virtual machine allocation method.
  • an embodiment of the present invention provides a computer readable medium for storing computer program code, and when the computer program code is executed by a computer unit, the computer unit executes the virtual machine allocation method.
  • the virtual machine allocation method and the virtual machine allocation apparatus pre-set a virtual machine allocation reference model, and allocate a virtual machine according to the virtual machine allocation reference model to ensure an average resource of each physical machine in the network.
  • the occupancy rate is high.
  • the reference virtual machine allocation model includes a reference sample table of each physical machine. When the virtual machine allocation request is obtained, the resource occupancy rate of the physical machines in the reference sample table of each physical machine is traversed from highest to lowest. Finding the requested virtual machine attribute information conforms to the target physical machine of the reference sample table, thereby creating the requested virtual machine on the target physical machine, thereby improving the average resource utilization of each physical machine in the network.
  • FIG. 1 is a flowchart of an embodiment of a virtual machine allocation method provided by the present invention
  • FIG. 2 is a flowchart of an embodiment of determining a virtual machine allocation reference model according to the present invention
  • FIG. 3 is a flowchart of still another embodiment of a virtual machine allocation method according to the present invention
  • FIG. 4 is a schematic structural diagram of an embodiment of a virtual machine distribution apparatus according to the present invention
  • FIG. 5 is a schematic structural diagram of still another embodiment of a virtual machine distribution apparatus according to the present invention.
  • FIG. 1 is a flowchart of an embodiment of a virtual machine allocation method according to the present invention. As shown in FIG. 1, the method includes:
  • the virtual machine allocation reference model includes a reference sample table corresponding to each physical machine.
  • the reference sample table includes: physical machine attribute information, a virtual machine that can be created. Attribute information and the number of virtual machines that can be created, the resource occupancy rate of the physical machine;
  • the attribute information of the virtual machine may include resource capacity information of the virtual machine and/or virtual machine type information.
  • the virtual machine attribute information may include virtual machine type information.
  • virtual The information about the type of the virtual machine may be the type of the existing type of the virtual machine; or the attribute information of the virtual machine may include the resource capacity information.
  • the resource capacity information of the virtual machine may include: CPU processor capacity, memory capacity, and bandwidth capacity.
  • the resource capacity information of the virtual machine may further include: a hard disk capacity, an I/O capacity, and the like, which are not enumerated herein; or, the virtual machine attribute information may include both a resource capacity and a virtual machine type.
  • the virtual machine type information may also be the serial number identifier of the virtual machine.
  • the virtual machine attribute information requested in the virtual machine allocation request may include: virtual machine type VM1; resource capacity: CPU core number 81, memory It is 15254MB and the bandwidth is 409MB.
  • the attribute information of the physical machine may also include resource capacity information and/or physical machine type information of the physical machine.
  • the attribute information of the virtual machine requested by the virtual machine allocation request sent by the user is usually not in a certain order (this order may be the order of the size of any resource capacity of the requested virtual machine, or may be requested)
  • this order may be the order of the size of any resource capacity of the requested virtual machine, or may be requested
  • the attribute information of each physical machine when querying the attribute information of each physical machine, it is usually possible to follow the order of the physical capacity of the physical machine in any order, or in the order of the physical machine type, or In order to query.
  • the order of the attribute information of the virtual machine requested by the virtual machine allocation request and the order of querying the attribute information of the physical machine on which the attribute information of each physical machine is based have a great influence on the average resource occupancy rate of each physical machine in the network. .
  • the virtual machine allocation reference model is preset, and the virtual machine is allocated according to the virtual machine allocation reference model to ensure that the average resource occupancy rate of each physical machine in the network is high;
  • the reference model table includes a reference sample table for each physical machine, and the reference sample table of each physical machine may include: attribute information of the physical machine, attribute information of the virtual machine that can be created, and a virtual machine that can be created Quantity, the resource occupancy of the physical machine.
  • the attribute information of the virtual machine that can be created specifically refers to: allocating a virtual machine according to the virtual machine allocation reference model, and the resource capacity and/or virtual machine type of the virtual machine allowed to be created on the physical machine;
  • the number of virtual machines refers to: a virtual machine is allocated according to the virtual machine allocation reference model, and the maximum number of virtual machines allowed to be created on the physical machine
  • the resource occupancy rate of the physical machine specifically refers to: The resource occupancy of the physical machine after the maximum number of virtual machines of various specifications listed in the reference sample table is created.
  • the resource occupancy rate of the physical machine may be: a sum of a CPU capacity, a memory capacity, and a 1/3 bandwidth capacity of the physical machine. If a physical machine in the network is idle, it may not be included in the calculation of the average.
  • the following is a specific example of a reference sample table of a physical machine included in a virtual machine allocation reference model.
  • the reference sample table of the physical machine may be:
  • the physical machine includes: physical machine type PM1, physical machine resource capacity: 100 CPUs, memory 40960MB, bandwidth 1000MB;
  • the attribute information of the virtual machine that can be created is:
  • VM type VM1 its resource capacity: 81 CPUs, memory 15254MB, bandwidth 409MB; the number of virtual machines that can be created is 1;
  • VM type VM2 its resource capacity: 16 CPUs, 3233MB of memory, 149MB of bandwidth; the number of virtual machines that can be created is 1;
  • the virtual machine type VM3 has a resource capacity of 1 CPU, 367 MB of memory, and 49 MB of bandwidth.
  • the number of VMs of this type can be 2;
  • the resource utilization rate of the physical machine is 47.2%.
  • the process of obtaining the virtual machine allocation reference model and the reference sample table of each physical machine is implemented as a feasible implementation manner: It can be in various simulation scenarios (specifically, the attribute information requested by the various virtual machine allocation requests)
  • the order, and various simulation scenarios for querying the order of the attribute information of the physical machine on which the attribute information of each physical machine is based can be used in various existing virtual machine allocation methods, such as: Greedy or round robin
  • the method of scheduling algorithm (Round Robin) simulates assigning a set number of virtual machines to each physical machine in the network, and obtains a simulated virtual machine allocation model in each simulation scenario, and a simulated virtual machine allocation model in each simulation scenario.
  • a simulation sample table of each physical machine in the current simulation scenario (the simulation sample table includes content corresponding to the content included in the reference sample table), and calculates physical machines in the network in each simulation scenario. Average resource usage.
  • the simulated virtual machine allocation model corresponding to the highest resource occupancy rate or the higher simulation scenario of each physical machine may be selected as the reference virtual machine allocation model, that is, the subsequent model is determined.
  • Virtual machine allocation will be based on the average physical resource occupancy of the physical machine
  • the virtual machine allocation result in the highest or higher simulation scenario is allocated, and the virtual machine allocation according to the final reference virtual machine allocation model enables each physical machine in the network to have the highest or higher average resource. Occupancy rate.
  • Table 1 is a list of simulated virtual machine allocation models obtained by simulating the allocation of virtual machines in various simulation scenarios and a simulation example table of each physical machine included in the simulation scenarios provided by the embodiments of the present invention, and each simulated scenario corresponds to one simulated virtual
  • the model is assigned by the machine, and the simulated virtual machine allocation model in each simulation scenario contains the simulation sample sub-table corresponding to each physical machine.
  • Each row in Table 1 corresponds to an analog virtual machine allocation model obtained under a simulation scenario. It includes a simulation sample table corresponding to each of the physical machine 1 to the physical machine n, and an average resource occupancy rate of the physical machine 1 to the physical machine n in each simulation scenario.
  • the specific content included in each of the simulation sample tables can be referred to the foregoing description, and details are not described herein again.
  • the simulated virtual machine allocation model B can be determined as the virtual machine allocation reference model for subsequent virtual machine allocation, correspondingly
  • the simulation sample table corresponding to each physical machine obtained under the simulation scenario B can be used as a reference sample table for each physical machine.
  • the empirical value of the average resource occupancy rate of each physical machine in the network is used in the network.
  • Each physical machine determines a virtual machine allocation reference model and a reference sample table, that is, when the average resource occupancy rate of each physical machine in the network is high, the type and number of virtual machines created on each physical machine and the physical machines are counted.
  • the resource occupancy rate is used to obtain a virtual machine allocation reference model and a reference sample table for each physical machine.
  • the average resource occupancy rate of each physical machine in the network under various simulated allocation scenarios can be obtained firstly, and then the network in various scenarios is determined according to the empirical value.
  • the average resource occupancy rate of each physical machine, and the virtual machine allocation model corresponding to the highest resource occupancy rate of each physical machine or the higher simulation scenario is selected as the virtual machine allocation reference model and the reference sample table of each physical machine.
  • the reference sample table of each physical machine in the network may be traversed in order of high to low, and the attribute information of the requested virtual machine is determined to be consistent.
  • the target physical machine of the sample table is a sample table capable of making the average resource utilization of each physical machine in the network the highest or higher, when receiving the virtual machine allocation request of the user, The final resource occupancy rate of each physical machine can be improved.
  • reference samples of physical machines in the network can be traversed in descending order according to the resource occupancy rate of the physical machine in the reference sample table. table.
  • the reference sample table of the second highest resource occupancy rate of the physical machine may be further searched until the reference is found.
  • the virtual machine allocation method provided by the embodiment of the present invention increases the average resource occupancy rate of each physical machine in the network. It can be understood that, after receiving each virtual machine allocation request, the virtual machine is in accordance with the virtual machine. The resource usage of the physical machines in each physical machine reference sample table in the reference model is traversed in descending order.
  • This virtual machine allocation method can concentrate the virtual machines on some physical machines in the network as much as possible (usually It is capable of realizing a high resource occupancy rate on a physical machine). Therefore, the virtual machine allocation method provided by the embodiment of the present invention can be shut down for the idle physical machine in the network to save power and reduce the cost. Or, physical machines that are always idle in the case of normal virtual machine allocation can also be deployed to the network, thereby reducing costs.
  • a virtual machine allocation reference model is preset, according to the high.
  • the reference virtual machine allocation model includes a reference sample table of each physical machine.
  • the requested virtual machine attribute information is found to conform to the target physical machine of the reference sample table, thereby creating a location on the target physical machine.
  • the requested virtual machine realizes the improvement of the average resource utilization rate of each physical machine in the network.
  • FIG. 2 is a flow chart of an embodiment of determining a virtual machine allocation reference model provided by the present invention, as shown in FIG.
  • the method includes:
  • S201 predicting, by the plurality of virtual machines acquired in the set time, the attribute information of the virtual machine requested by the request, and obtaining the virtual machine of the plurality of predicted attribute information.
  • the virtual machine that obtains the predicted multiple attribute information may be represented by a virtual machine attribute information specification list, and the virtual machine attribute information specification list includes multiple attribute letters. Virtual machine.
  • the attribute information of the virtual machine requested by the virtual machine allocation request received in the future may be predicted to obtain a virtual machine attribute information specification list.
  • the list may be referred to the following table 2.
  • Table 2 includes eight specifications of virtual Machine, the number of CPU cores, memory capacity and broadband capacity in each type are as follows:
  • Table 2 shows the virtual machines of different specifications based on the resource capacity of the virtual machine. It can be understood that virtual machines of different specifications can also be represented by the virtual machine type and/or the resource capacity of the virtual machine.
  • the simulated virtual machine allocation model includes: attribute information of a physical machine that allocates a virtual machine, and a physical machine number of the allocated virtual machine, attribute information of the allocated virtual machine, and The number of allocated virtual machines, the average resource occupancy of each physical machine, and the simulation sample table corresponding to each physical machine.
  • the simulation environment may include: an order of attribute information of the virtual machines requested by the plurality of virtual machine allocation requests; and/or, simulating a virtual machine that sets the plurality of attribute information by using a greedy algorithm or a round-robin scheduling algorithm In the process of giving each physical machine in the network, the order of the attribute information of the physical machine on which the physical machine is based is searched.
  • the simulation environment 1 the virtual machine allocation request is sorted according to the number of CPU cores of the requested virtual machine from small to large, and the physical machines are arranged in an out-of-order arrangement waiting for the search and distribution;
  • Simulation environment 2 The virtual machine allocation request is sorted according to the number of CPU cores of the requested virtual machine from small to large, and the physical machine is searched for the allocation according to the CPU resources of the physical machine from small to large;
  • Simulation scenario 3 The virtual machine allocation request is sorted according to the number of CPU cores of the requested virtual machine from small to large, and the physical machine is searched for the allocation according to the CPU resources of the physical machine from large to small;
  • Simulation scenario 4 The virtual machine allocation request is sorted according to the number of CPU cores of the requested virtual machine, and the physical machine is searched for the allocation according to the CPU resources of the physical machine from large to small;
  • Simulation scenario 5 The virtual machine allocation request is sorted according to the number of CPU cores of the requested virtual machine, and the physical machine is searched for allocation according to the CPU resources of the physical machine from small to large;
  • Simulation environment six The virtual machine allocation request is sorted in the order of the requested order, and the physical machine is sorted out of order to wait for the allocation.
  • the number of virtual machines to be allocated may be set to 160, including eight types of virtual machines as shown in Table 1, and the number of virtual machines of each specification is set to be about 1:1: 1:1:1:1:1:1.
  • the set 160 virtual machines can be assigned to the network according to various existing algorithms, such as: greedy algorithm or round-robin scheduling algorithm. 80 physical machines.
  • the simulated virtual machine allocation model obtained in each simulation environment may include: attribute information of the physical machine that allocates the virtual machine and the number of physical machines that allocate the virtual machine, attribute information of the allocated virtual machine, and the number of allocated virtual machines, each physical The average resource occupancy of the machine.
  • a simulated virtual machine allocation model obtained in a simulated environment can include:
  • the attribute information of the physical machine that allocates the virtual machine is: CPU100, memory 40960MB, bandwidth 1000MB; the number of physical machines can be 40;
  • the attribute information of the allocated virtual machine is: VM type VM1, whose resource capacity is: 81 CPUs, 15254 MB of memory, 409 MB of bandwidth, and the number of virtual machines allocated for this specification is 1;
  • the average resource occupancy rate of each physical machine in the network in the simulation environment is 47.201%.
  • the simulated virtual machine allocation model obtained in another simulation environment may include:
  • the attribute information of the physical machine that allocates the virtual machine is: 100 CPUs, 40960MB of memory, 1000MB of bandwidth; the number of physical machines can be 40;
  • the attribute information of the assigned virtual machine is: VM type VM2, whose resource capacity is: CPU1, memory 367MB, bandwidth 49MB, and the number of virtual machines allocated for this specification is 2;
  • the average resource occupancy rate of each physical machine in the network in the simulation environment is 47.203%.
  • the simulation sample table of a physical machine included in the simulation virtual machine allocation model obtained in a simulation environment may be, for example:
  • the physical machine includes: physical machine type PM1, physical machine resource capacity: 100 CPUs, memory 40960MB, bandwidth 1000MB;
  • the attribute information of the virtual machine that can be created is:
  • VM type VM1 its resource capacity: 81 CPUs, memory 15254MB, bandwidth 409MB; the number of virtual machines that can be created is 1;
  • VM type VM2 its resource capacity: 16 CPUs, 3233MB of memory, 149MB of bandwidth; the number of virtual machines that can be created is 1;
  • the virtual machine type VM3 has a resource capacity of 1 CPU, 367 MB of memory, and 49 MB of bandwidth.
  • the number of VMs of this type can be 2;
  • the resource utilization rate of the physical machine is 47.2%.
  • some of the virtual machines that are to be allocated may be deleted during the allocation process. To make the simulation scenario closer to the actual virtual machine allocation process.
  • 16 virtual machines can be randomly deleted, and 16 virtual machines are randomly added.
  • the supplementary virtual machines are randomly selected from 8 specifications. Can be executed 50 times.
  • a simulated virtual machine allocation model with the highest average resource occupancy rate of each physical machine is used as a virtual machine allocation reference model, and the virtual machine allocation reference model includes corresponding
  • the simulation sample table of the physical machine is used as a reference sample table.
  • a simulation virtual machine allocation model and a simulation sample table of each physical machine are obtained for each simulation of each simulation environment.
  • some supplementary simulation virtual machine allocation models and simulation sample tables of each physical machine can be obtained based on the empirical values.
  • the simulation virtual machine allocation model with the highest average resource occupancy rate of each physical machine in the network may be selected, and the simulation sample table of each physical machine corresponding to the simulated virtual machine allocation model may be selected.
  • the simulation sample table of each physical machine corresponding to the simulated virtual machine allocation model may be selected.
  • the simulated virtual machine allocation model B can be determined as the virtual machine allocation reference model for subsequent virtual machine allocation.
  • the simulation sample table corresponding to each physical machine obtained under the simulation scenario B can be used as a reference sample table for each physical machine.
  • the embodiment may further include a process of generating a sub-sample of each reference sample by S205.
  • the sub-sample table includes: attribute information of the virtual machine of at least one specification in the reference sample table, where the number of the sub-sample table is in the reference sample table.
  • the number of combinations of virtual machines of various specifications. Each combination is constructed as a subsample table.
  • the sample table of a physical machine is:
  • the attribute information of the physical machine is: 100 CPUs, 40960 MB of memory, 1000 MB of bandwidth, VMs that can be created.
  • the attribute information includes: VM VM1, its resource capacity is CPU81, memory is 15254MB, bandwidth is 409MB, the number of devices that can be created is 1; virtual machine VM2, its resource capacity is CPU16, memory is 3233MB, bandwidth is 149MB, number of devices can be created 1; virtual machine VM3, its resource capacity is CPU1, memory 367MB, bandwidth 49MB, the number of devices that can be created is 2; the resource occupancy rate of the physical machine is 47.2%.
  • the reference sample table with the highest resource occupancy rate in the reference sample table of each physical machine in the reference virtual machine allocation model may be first found, and then the corresponding reference sample table of the physical machine is searched for. Whether all the sub-sample tables include the attribute information of the virtual machine requested by the virtual machine allocation request. If yes, the virtual machine can be created on the physical machine. If not, the resource occupancy rate of the physical machine can be continuously searched. Whether the attribute information of the virtual machine requested by the virtual machine allocation request is included in all the sub-sample tables corresponding to the high reference sample table until the sub-sample table including the virtual machine type requested by the virtual machine allocation request is found.
  • the resource occupancy rate of the physical machine is lower than the physical machine in the reference sample table of the physical machine. Resource occupancy rate.
  • the method for determining a reference sample table of each physical machine simulates the specification and proportion of the virtual machine requested by the virtual machine allocation request for a period of time, and the number of virtual machine applications when stable, and
  • the virtual machine is simulated and allocated, and the virtual machine allocation reference model with the highest average resource occupancy rate of each physical machine in the network or the reference sample table of each physical machine included therein is obtained.
  • the simulation process is close to the actual virtual machine allocation process.
  • the virtual machine allocation reference model is used to allocate virtual machines, which can improve the allocation efficiency and increase the average resource occupancy rate of each physical machine in the network.
  • the number of physical machines planned to be deployed can be reduced, or the number of physical machines that need to be used for a period of time is reduced, thereby achieving cost reduction.
  • FIG. 3 is a flowchart of still another embodiment of a virtual machine allocation method according to the present invention. As shown in FIG. 3, this embodiment provides a whole process of a user issuing a virtual machine allocation request to a virtual machine allocation end.
  • the method includes:
  • the user sends a virtual machine allocation request through a webpage according to requirements.
  • the background server After obtaining the virtual machine allocation request, the background server sends the virtual machine allocation request virtual machine request to the virtual machine request scheduler through a Simple Object Access Protocol (SOAP).
  • SOAP Simple Object Access Protocol
  • the virtual machine allocation request virtual machine request can also be sent to the virtual machine request scheduler through other network protocols.
  • the virtual machine request scheduler can place the request in the virtual machine allocation task queue.
  • the scheduler searches for a first reference sample table with the highest resource occupancy rate of the physical machine in the virtual machine allocation reference model. 5304. The scheduler determines whether the attribute information of the virtual machine requested by the virtual machine allocation request is included in the corresponding sub-sample table in the first reference sample table. If yes, execute S305; otherwise, execute S307.
  • the scheduler determines, according to the attribute information of the virtual machine that has been created in the target physical machine and the attribute information of the virtual machine listed in the reference sample table of the target physical machine, whether the target physical machine can create the requested virtual machine; If it is created, then execute S306, otherwise execute S307.
  • the scheduler may compare the attribute information of the virtual machine listed in the reference sample table of the physical machine with the attribute information of the created virtual machine on the physical machine to determine the physical machine.
  • the attribute information of the virtual machine is not created in the attribute information of the virtual machine listed in the reference sample table. If the virtual machine attribute information that is not created matches the attribute information of the requested virtual machine, S306 is performed, otherwise, S307 is performed.
  • the S305 is an optional implementation manner.
  • the scheduler may also query an existing resource of the target physical machine to determine whether the target physical machine can create the requested virtual machine.
  • the scheduler uses the physical machine corresponding to the first reference sample table as the target physical machine. Then execute S311 directly.
  • the scheduler sequentially traverses the virtual machine that is requested by the virtual machine allocation request in the sub-sample table corresponding to the other reference sample table in the virtual machine allocation reference model according to the order of the resource occupancy of the physical machine in descending order.
  • the attribute information if a reference sample table including the virtual machine specification requested by the virtual machine allocation request is found, then S308 is performed, otherwise S310 is performed.
  • the scheduler determines, according to the attribute information of the virtual machine that has been created in the target physical machine and the attribute information of the virtual machine listed in the reference sample table of the target physical machine, whether the target physical machine can create the requested virtual machine; If it is created, then execute S309, otherwise execute S307.
  • the physical machine with the highest resource occupancy rate of the physical machine in the reference sample table may be first found, and then all the sub-sample tables corresponding to the reference sample table of the physical machine are found. Whether to include the virtual machine type requested by the virtual machine allocation request. If yes, you can create a virtual machine on the physical machine. If not, you can continue to search for all the corresponding reference samples in the physical device with the highest resource usage. Whether the virtual machine type requested by the virtual machine allocation request is included in the child sample table until the child of the virtual machine type requested by the virtual machine allocation request is found Sample form. Since the subsample table only includes the type of virtual machine, the way to find the virtual machine type in the subsample table is more efficient than the way in which the reference sample table is looked up.
  • the scheduler determines the target physical machine by using a greedy algorithm or a round-robin scheduling algorithm. Then execute S311 directly.
  • the scheduler records attribute information of the virtual machine that has been created in the target physical machine.
  • S310 is an optional step, and the scheduler can also directly query the resource allocation of the physical machine to the bottom layer.
  • the scheduler sends a virtual machine request to the target physical machine through a Remote Procedure Call Protocol (RPC).
  • RPC Remote Procedure Call Protocol
  • scheduler can also send the virtual machine request to the target physical machine through other network protocols.
  • the target physical machine may use a virtualization technology (for example, may be Xen technology, etc.) to create a virtual machine in the target physical machine.
  • a virtualization technology for example, may be Xen technology, etc.
  • a virtual machine allocation reference model is preset, according to the high.
  • the reference virtual machine allocation model includes a reference sample table of each physical machine.
  • the requested virtual machine attribute information is found to conform to the target physical machine of the reference sample table, thereby creating a location on the target physical machine.
  • the requested virtual machine realizes the improvement of the average resource utilization rate of each physical machine in the network.
  • the virtual machine created on the physical machine can be recorded on the scheduler, so that when the virtual machine allocation request is received again, the resource allocation of the underlying query physical machine can be omitted to improve the query efficiency.
  • FIG. 4 is a schematic structural diagram of an embodiment of a virtual machine distribution apparatus according to the present invention. As shown in FIG. 4, the apparatus includes: a receiver 11, a scheduler 12, and an actuator 13;
  • the receiver 11 is configured to obtain a virtual machine allocation request, where the virtual machine allocation request includes attribute information of the requested virtual machine;
  • the scheduler 12 is configured to traverse the reference sample table of each physical machine in descending order of the resource occupancy rate of each physical machine in the virtual machine allocation reference model, according to the attribute information of the requested virtual machine and each physical machine.
  • the attribute information of the virtual machine listed in the reference sample table determines the target physical machine, wherein the attribute information of the virtual machine listed in the reference sample table of the target physical machine matches the attribute information of the requested virtual machine;
  • the allocation reference model is a virtual machine allocation model with the highest average resource occupancy rate of each physical machine, and the virtual machine allocation reference model includes a reference sample table corresponding to each physical machine, and the reference sample table includes: attribute information of the physical machine, The attribute information of the created virtual machine and the number of virtual machines that can be created, and the resource occupancy rate of the physical machine;
  • FIG. 5 is a schematic structural diagram of still another embodiment of a virtual machine allocation apparatus according to the present invention, as shown in FIG.
  • the device comprises: a receiver 11, a scheduler 12 and an actuator 13;
  • the attribute information may include: resource capacity information and/or type information. That is, the attribute information of the virtual machine may include resource capacity information of the virtual machine and/or type information of the virtual machine; the attribute information of the physical machine may include resource capacity information of the physical machine and/or type information of the physical machine.
  • the resource capacity information may include: a capacity of the central processing unit CPU, a memory capacity, and a bandwidth capacity.
  • the resource occupancy rate of the physical machine can be: sum of CPU capacity, memory capacity, and 1/3 bandwidth capacity.
  • the virtual machine allocation device may further include:
  • the simulator 14 is used to determine a virtual machine allocation reference model for each physical machine having the highest average resource occupancy.
  • the simulator 14 may be specifically configured to: predict a virtual machine attribute information requested by a plurality of virtual machine allocation requests acquired within a set time, and obtain a virtual machine that predicts multiple attribute information;
  • a virtual machine that sets a plurality of kinds of attribute information is allocated to each physical machine by using a greedy algorithm or a round-robin scheduling algorithm; acquiring a simulated virtual machine allocation model in each simulation environment, where The machine allocation model includes: attribute information of the physical machine that allocates the virtual machine and the number of allocated virtual machines, attribute information of the allocated virtual machine, and assigned
  • the sample combiner 15 is configured to use the simulated virtual machine allocation model with the highest average resource occupancy rate of each physical machine as the virtual machine allocation reference mode in the simulated virtual machine allocation model in various simulation environments.
  • Type and the virtual machine allocation reference model table corresponding to each physical machine included in the reference model is used as a reference sample table.
  • the simulation environment based on the simulator 14 may include: an order of attribute information of virtual machines requested by a plurality of virtual machine allocation requests; and/or a virtual machine that simulates setting a plurality of attribute information by using a greedy algorithm Or in the process of assigning a scheduling algorithm to each physical machine, the order of the attribute information of the physical machine on which the physical machine is based is searched.
  • the scheduler 12 is further configured to: generate a sub-sample table of the reference sample table, where the sub-sample table includes: attribute information of the virtual machine of at least one specification in the reference sample table, the sub-sample The number of tables is the combined number of virtual machines of various specifications in the reference sample table.
  • the scheduler 12 is further configured to: in the virtual machine allocation reference model, look up a first reference sample table with the highest resource occupancy rate of the physical machine, and determine whether the corresponding sub-sample table in the first reference sample table includes virtual The attribute information of the virtual machine requested by the machine allocation request, if included, the physical machine corresponding to the first reference sample table is used as the target physical machine; otherwise, the resource occupancy rate of the physical machine in turn is in descending order Traverse the attribute information of the virtual machine requested by the virtual machine allocation request in the sub-sample table corresponding to the other reference sample tables in the virtual machine allocation reference model.
  • the scheduler 12 may also be used to:
  • the target physical machine is determined by a greedy algorithm or a round-robin scheduling algorithm.
  • scheduler 12 is further configured to: record attribute information of the virtual machine that has been created in the target physical machine.
  • the scheduler 12 is further configured to: determine, according to the attribute information of the virtual machine that has been created in the target physical machine and the attribute information of the virtual machine listed in the reference sample table of the target physical machine, whether the target physical machine can create the location The requested virtual machine. Or, query the existing resources of the target physical machine to determine whether the target physical machine can create the requested virtual machine.
  • each component unit such as a receiver, a scheduler, and an actuator in the above-described virtual machine distribution apparatus may be composed of hardware, or may be executed by computer software.
  • the virtual machine allocation apparatus provided in this embodiment corresponds to the virtual machine allocation method provided by the embodiment of the present invention, and is an execution device of the virtual machine allocation method.
  • the specific process of executing the virtual machine allocation method refer to the method embodiment, where No longer.
  • the virtual machine allocation apparatus pre-sets a virtual machine allocation reference model, according to the High.
  • the reference virtual machine allocation model includes a reference sample table of each physical machine.
  • the requested virtual machine attribute information is found to conform to the target physical machine of the reference sample table, thereby creating a location on the target physical machine.
  • the requested virtual machine realizes the improvement of the average resource utilization rate of each physical machine in the network.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Information Transfer Between Computers (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

本发明实施例涉及一种虚拟机分配方法和虚拟机分配装置。方法包括:获取虚拟机分配请求,虚拟机分配请求中包括所请求的虚拟机的属性信息;按照虚拟机分配参考模型中的各物理机的资源占用率从高至低的顺序遍历各物理机的参考样例表,根据所请求的虚拟机的属性信息与各物理机的参考样例表所列的虚拟机的属性信息确定目标物理机,目标物理机的参考样例表所列的虚拟机的属性信息与所请求的虚拟机的属性信息相符合,虚拟机分配参考模型为各物理机具有最高平均资源占用率的虚拟机分配模型;在目标物理机中创建虚拟机分配请求中所请求的虚拟机。提高网络中物理机的资源利用率。

Description

虚拟机分配方法和虚拟机分配装置 技术领域 本发明实施例涉及信息技术领域, 特别涉及一种虚拟机分配方法和虚拟 机分配装置。 背景技术
随着云计算技术的发展,按用户需求为用户提供虚拟机 ( Virtul Machine, VM )已经成为一项重要的服务。 而提供虚拟机服务需要提高虚拟机在物理机 ( Physical Machine, PM )中的分配效率, 在保证资源供给的情况下, 降低成 本。
现有技术中, 对于待分配的虚拟机, 遍历各物理机, 判断各物理机是否 满足待分配虚拟机的资源需求,若某一物理机满足待分配虚拟机的资源需求, 则将该虚拟机分配给该物理机, 并且不再对下一物理机进行判断。 然而, 采 用这种方法网络中所有物理机的平均资源利用率较低, 并且, 可能需要不断 增加新的物理机, 才能满足虚拟机的分配需求, 成本较高。 发明内容
本发明实施例提供一种虚拟机分配方法和虚拟机分配装置, 提高网络中 物理机的资源利用率。
一方面, 本发明实施例提供了一种虚拟机分配方法, 包括:
获取虚拟机分配请求, 所述虚拟机分配请求中包括所请求的虚拟机的属 性信息;
按照虚拟机分配参考模型中的各物理机的资源占用率从高至低的顺序遍 历所述各物理机的参考样例表, 根据所请求的虚拟机的属性信息与所述各物 理机的参考样例表所列的虚拟机的属性信息确定目标物理机, 其中, 所述目 标物理机的参考样例表所列的虚拟机的属性信息与所请求的虚拟机的属性信 息相符合; 所述虚拟机分配参考模型为所述各物理机具有最高平均资源占用 率的模拟虚拟机分配模型, 所述虚拟机分配参考模型包含对应于每台物理机 的参考样例表, 所述参考样例表包括: 所述物理机的属性信息, 可创建的虚 拟机的属性信息和可创建的虚拟机数量, 所述物理机的资源占用率; 在所述目标物理机中创建所述虚拟机分配请求中所请求的虚拟机。
另一方面, 本发明实施例提供了一种虚拟机分配装置, 包括:
接收器, 用于获取虚拟机分配请求, 所述虚拟机分配请求中包括所请求 的虚拟机的属性信息;
调度器, 用于按照虚拟机分配参考模型中的各物理机的资源占用率从高 至低的顺序遍历所述各物理机的参考样例表, 根据所请求的虚拟机的属性信 息与所述各物理机的参考样例表所列的虚拟机的属性信息确定目标物理机, 其中, 所述目标物理机的参考样例表所列的虚拟机的属性信息与所请求的虚 拟机的属性信息相符合; 所述虚拟机分配参考模型为所述各物理机具有最高 平均资源占用率的虚拟机分配模型, 所述虚拟机分配参考模型包含对应于每 台物理机的参考样例表, 所述参考样例表包括: 所述物理机的属性信息, 可 创建的虚拟机的属性信息和可创建的虚拟机数量,所述物理机的资源占用率; 执行器, 用于在所述目标物理机中创建所述虚拟机分配请求中所请求的 虚拟机。
又一方面, 本发明实施例提供了一种计算机程序产品, 包括计算机程序 代码, 当所述计算机程序代码被计算机单元执行时, 所述计算机单元执行上 述所述虚拟机分配方法。
再一方面, 本发明实施例提供了一种计算机可读介质, 用于存储计算机 程序代码, 当所述计算机程序代码被计算机单元执行时, 所述计算机单元执 行上述所述虚拟机分配方法。
由上述技术方案可知, 本发明实施例提供的虚拟机分配方法和虚拟机分 配装置, 预先设置虚拟机分配参考模型, 根据该虚拟机分配参考模型分配虚拟 机可以保证网络中各物理机的平均资源占用率较高。 该参考样虚拟机分配模型 中包含每个物理机的参考样例表, 当获取虚拟机分配请求时, 按照各物理机 的参考样例表中物理机的资源占用率从高至低的顺序遍历, 找到请求的虚拟 机属性信息符合参考样例表的目标物理机, 从而在目标物理机上创建所请求 的虚拟机, 实现提高网络中各物理机的平均资源利用率。 附图说明 为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面 描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图 1为本发明提供的虚拟机分配方法一个实施例的流程图;
图 2为本发明提供的确定虚拟机分配参考模型一个实施例的流程图; 图 3为本发明提供的虚拟机分配方法又一个实施例的流程图;
图 4为本发明提供的虚拟机分配装置一个实施例的结构示意图; 图 5为本发明提供的虚拟机分配装置又一个实施例的结构示意图。 具体实施方式 下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行 清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而 不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有做 出创造性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。
图 1为本发明提供的虚拟机分配方法一个实施例的流程图, 如图 1所示, 该方法包括:
S101、 获取虚拟机分配请求, 虚拟机分配请求中包括所请求的虚拟机的 属性信息;
S102、 按照虚拟机分配参考模型中的各物理机的资源占用率从高至低的 顺序遍历各物理机的参考样例表, 根据所请求的虚拟机的属性信息与各物理 机的参考样例表所列的虚拟机的属性信息确定目标物理机, 其中, 目标物理 机的参考样例表所列的虚拟机的属性信息与所请求的虚拟机的属性信息相符 合; 虚拟机分配参考模型为各物理机具有最高平均资源占用率的虚拟机分配 模型, 虚拟机分配参考模型包含对应于每台物理机的参考样例表, 参考样例 表包括: 物理机的属性信息, 可创建的虚拟机的属性信息和可创建的虚拟机 数量, 物理机的资源占用率;
S103、 在目标物理机中创建虚拟机分配请求中所请求的虚拟机。
其中, 虚拟机的属性信息可以包括虚拟机的资源容量信息和 /或虚拟机类型 信息。 虚拟机的属性信息中可以包括虚拟机类型信息, 在这种实施场景下, 虚 拟机类型信息可以为现有的各种类型的虚拟机的类型标识; 或者, 虚拟机的属 性信息中可以包括资源容量信息, 作为一种可行的实施方式, 虚拟机的资源容 量信息可以包括: 中央处理器 CPU的容量、 内存容量和带宽容量。 可选的, 虚拟机的资源容量信息还可以包括: 硬盘容量、 I/O容量等, 在此不——列举; 或者, 虚拟机的属性信息中可以既包括资源容量又包括虚拟机类型, 这种实施 场景下, 虚拟机类型信息也可以为虚拟机的序号标识, 例如: 虚拟机分配请求 中所请求的虚拟机属性信息可以包括: 虚拟机类型 VM1; 资源容量为: CPU核 数 81、 内存为 15254MB和带宽为 409MB。
同样的, 物理机的属性信息也可以包括物理机的资源容量信息和 /或物理机 类型信息。 为了对用户发出的虚拟机分配请求进行快速响应, 通常需要每接收 到一条虚拟机分配请求便执行一次虚拟机分配的操作。 而一段时间内, 用户发 出的虚拟机分配请求所请求的虚拟机的属性信息通常没有一定的顺序 (这个顺 序可以是所请求的虚拟机的任一种资源容量的大小顺序, 也可以是所请求的虚 拟机类型顺序), 而在分配虚拟机的过程中, 查询各物理机的属性信息时, 通常 可以按照物理机的任一种资源容量从大到小顺序, 或者按照物理机类型顺序, 或者乱序来查询。 而虚拟机分配请求所请求的虚拟机的属性信息的顺序, 以及 查询各物理机的属性信息所基于的物理机的属性信息的顺序对网络中的各物理 机的平均资源占用率有着较大影响。
据此, 本发明实施例提供的虚拟机分配方法, 预先设置虚拟机分配参考模 型, 根据该虚拟机分配参考模型分配虚拟机可以保证网络中各物理机的平均资 源占用率较高; 该虚拟机分配参考模型中包含每个物理机的参考样例表, 该 每个物理机的参考样例表中可以包括: 该物理机的属性信息, 可创建的虚拟 机的属性信息和可创建的虚拟机数量, 该物理机的资源占用率。
需要说明的是, 可创建的虚拟机的属性信息具体是指: 根据该虚拟机分 配参考模型分配虚拟机, 在该台物理机上允许创建的虚拟机的资源容量和 /或 虚拟机类型; 可创建的虚拟机数量具体是指: 根据该虚拟机分配参考模型分 配虚拟机, 在该台物理机上允许创建的各种虚拟机的最大数量, 该物理机的 资源占用率具体是指: 在该台物理机上创建了参考样例表中所列的最大数量 的各种规格的虚拟机之后, 该台物理机的资源占用率。 可选的, 该台物理机 的资源占用率可以为:该物理机的 CPU容量、 内存容量与 1/3带宽容量之和。 数, 若网络中的某一台物理机为空闲态, 可以不纳入平均数的计算之中。 以下以一个具体例子对虚拟机分配参考模型中包含的某台物理机的参考 样例表进行说明, 该物理机的参考样例表可以为:
该物理机的包括: 物理机类型 PM1 , 物理机的资源容量: CPU100个, 内 存 40960MB, 带宽 1000MB;
可创建的虚拟机的属性信息为:
虚拟机类型 VM1 , 其资源容量: CPU81个, 内存 15254MB, 带宽 409MB; 该种 ¾各的虚拟机可创建的台数为 1;
虚拟机类型 VM2, 其资源容量: CPU16个, 内存 3233MB, 带宽 149MB; 该种 ¾各的虚拟机可创建的台数为 1;
虚拟机类型 VM3, 其资源容量 CPU1个, 内存 367MB, 带宽 49MB, 该种 规格的虚拟机可创建的台数为 2;
在该台物理机上分别创建 1台虚拟机 VM1、 1台虚拟机 VM2和 2台虚拟 机 VM3后, 该台物理机的的资源占用率为 47.2%。
需要说明的是, 实践中, 一般通过资源容量信息来表示不同的物理机或虚 拟机, 因此上述实施例中的可以不用明示物理机类型信息或虚拟机类型信息, 而只说明物理机或虚拟机的资源容量信息即可。
获取虚拟机分配参考模型以及各物理机的参考样例表的过程, 作为一种 可行的实施方式: 可以在各种模拟场景下 (具体可以是在各种虚拟机分配请 求所请求的属性信息的顺序 , 以及各种查询各物理机的属性信息所基于的物理 机的属性信息的顺序的模拟场景下), 可以采用现有的各种虚拟机分配方法, 例如: 贪婪算法(Greedy )或轮叫调度算法(Round Robin )等方法, 模拟将 设定数量的虚拟机分配给网络中的各物理机, 得到每种模拟场景下的模拟虚 拟机分配模型, 每种模拟场景下的模拟虚拟机分配模型包含当前模拟场景下 各物理机的模拟样例表(该模拟样例表包括的内容与参考样例表中包括的内 容对应一致), 并计算在每种模拟场景下网络中的各物理机的平均资源占用 率。 各种模拟分配场景模拟分配虚拟机结束之后, 可以选择各物理机的平均 资源占用率最高的或者较高的模拟场景所对应的模拟虚拟机分配模型作为参 考虚拟机分配模型, 即, 确定后续的虚拟机分配将按照物理机平均资源占用 率最高或者较高的模拟场景下的虚拟机分配结果来分配, 按照最终确定的参 考虚拟机分配模型来进行虚拟机分配能够使得网络中的各物理机将会具有最 高的或者较高的平均资源占用率。
表一为本发明实施例提供的各种模拟场景下模拟分配虚拟机得到的模拟 虚拟机分配模型及其中包括的各物理机的模拟样例表的情况列表, 每种模拟 场景都对应一个模拟虚拟机分配模型, 而每种模拟场景下的模拟虚拟机分配 模型 都包含每个物理机相对应的模拟样例分表。
Figure imgf000008_0001
表一
表一中的每一行对应一个模拟场景下得到的一个模拟虚拟机分配模型 , 其中包括物理机 1〜物理机 n分别对应的模拟样例表, 以及在每个模拟场景下 物理机 1〜物理机 n的平均资源占用率。 其中, 每个模拟样例表所包含的具体 内容可参见前面的描述, 在此不再赘述。
假设表一所示的模拟场景 B对应的网络中各物理机的资源占用率 X2%的 数值最高, 则可以将模拟虚拟机分配模型 B确定为后续进行虚拟机分配的虚 拟机分配参考模型, 相应的, 可以将模拟场景 B下得到的各物理机对应的模 拟样例表作为为各物理机的参考样例表。
作为另一种可行的实施方式: 还可以根据通常各种场景下, 不同类型的 虚拟机分配给网络中各物理机时, 网络中各物理机的平均资源占用率的经验 值, 来为网络中的各物理机确定虚拟机分配参考模型以及参考样例表, 即, 可以在网络中各物理机的平均资源占用率较高时, 统计各物理机上创建的虚 拟机类型和数量以及各物理机的资源占用率来得到虚拟机分配参考模型以及 各物理机的参考样例表。
作为又一种可行的实施方式, 还可以在各种模拟场景下模拟将设定数量 的虚拟机分配给网络中的各物理机得到模拟虚拟机分配模型和各物理机的模 拟样例表的实施基础上, 结合经验值的实施方式, 具体是, 可以在前一实施 场景下首先得到各种模拟分配场景下网络中各物理机的平均资源占用率, 再 根据经验值确定通常各种场景下网络中各物理机的平均资源占用率, 选择其 中各物理机的平均资源占用率最高的或者较高的模拟场景所对应的虚拟机分 配模型作为虚拟机分配参考模型以及各物理机的参考样例表。
确定各物理机的参考样例表之后, 在接收到虚拟机分配请求时, 可以按 高至低的顺序, 遍历网络中各物理机的参考样例表, 确定所请求的虚拟机的 属性信息符合参考样例表的目标物理机。 具体的, 由于各物理机的参考样例 表为能够使网络中的各物理机的平均资源利用率最高的或者较高的样例表, 因此, 在接收到用户的虚拟机分配请求时, 为了能够提高每台物理机最终的 资源占用率, 作为一种可行的实施方式, 可以按照参考样例表中的物理机的 资源占用率从高至低的顺序遍历网络中各物理机的参考样例表。 即, 对于一 个虚拟机分配请求, 可以首先查找物理机的资源占用率最高的参考样例表, 查看该参考样例表中包括的可创建的虚拟机的属性信息和虚拟机数量与虚拟 机分配请求中所请求的虚拟机的属性信息是否相符(即, 假设在该样例表对 应的物理机上创建该虚拟机分配请求中所请求的虚拟机后, 物理机上所创建 的虚拟机是否包含于样例表中), 如果相符, 则可以在该参考样例表对应的物 理机上创建该虚拟机分配请求所请求的虚拟机; 如果物理机的资源占用率最 高的参考样例表中包括的可创建的虚拟机的属性信息和虚拟机数量与虚拟机 分配请求中所请求的虚拟机的属性信息不相符, 则可以进一步查找物理机的 资源占用率次高的参考样例表, 直至找到参考样例表中包括的可创建的虚拟 机的属性信息和虚拟机数量与虚拟机分配请求中所请求的虚拟机的属性信息 相符的物理机。
需要说明的是, 本发明实施例提供的虚拟机分配方法, 使得网络中各物 理机的平均资源占用率提高, 可以理解的是, 由于接收到每个虚拟机分配请 求之后, 均是按照虚拟机分配参考模型中各物理机参考样例表中的物理机的 资源占用率从高至低的顺序进行遍历, 这种虚拟机分配方式能够将虚拟机尽 量集中创建在网络中某些物理机上(通常是能够实现资源占用率较高的物理 机上)。 因此, 采用本发明实施例提供的虚拟机分配方法, 对于网络中空闲的 物理机, 可以关机, 以节电降低成本。 或者, 对于通常的虚拟机分配情况下 总是处于空闲状态的物理机, 也可以不再部署到网络中, 从而降低成本。
本实施例提供的虚拟机分配方法, 预先设置虚拟机分配参考模型,根据该 高。 该参考样虚拟机分配模型中包含每个物理机的参考样例表, 当获取虚拟 的顺序遍历, 找到请求的虚拟机属性信息符合参考样例表的目标物理机, 从 而在目标物理机上创建所请求的虚拟机, 实现提高网络中各物理机的平均资 源利用率。
图 2为本发明提供的确定虚拟机分配参考模型一个实施例的流程图, 如图
2所示, 该方法包括:
S201、 预测设定时间内获取的数个虚拟机分配请求所请求的虚拟机的属 性信息, 得到预测的多种属性信息的虚拟机。
作为一种可行的实施方式, 得到预测的多种属性信息的虚拟机可以采用 虚拟机属性信息规格列表表示, 虚拟机属性信息规格列表中包括多种属性信 息的虚拟机。
可以对今后一段时间内接收到的虚拟机分配请求所请求的虚拟机的属性信 息进行预测, 得到虚拟机属性信息规格列表, 该列表可以参考如下表二, 表二 中包括了 8种规格的虚拟机, 每种 ¾各中的 CPU核数、 内存容量及宽带容量如 下:
Figure imgf000011_0002
Figure imgf000011_0001
表二是以虚拟机的资源容量来表示不同规格的虚拟机, 可以理解的是, 还 可以通过虚拟机类型和 /或虚拟机的资源容量来表示不同规格的虚拟机。
5202、 在各种模拟环境下, 模拟将设定数量的所述多种属性信息的虚拟 机采用贪婪算法或轮叫调度算法分配给各物理机。
5203、 获取每种模拟环境下的模拟虚拟机分配模型, 其中, 模拟虚拟机 分配模型包括:分配虚拟机的物理机的属性信息和分配虚拟机的物理机台数, 分配的虚拟机的属性信息和分配的虚拟机的台数, 各物理机的平均资源占用 率以及对应于各物理机的模拟样例表。
其中, 模拟环境可以包括: 数个虚拟机分配请求所请求的虚拟机的属性 信息排列顺序; 和 /或, 模拟将设定数量的多种属性信息的虚拟机采用贪婪算 法或轮叫调度算法分配给网络中红各物理机的过程中, 查找物理机所基于的 物理机的属性信息的排列顺序。
本实施例中给出了下述六种模拟环境, 具体为:
模拟环境一:虚拟机分配请求按照所请求的虚拟机的 CPU核数从小到大排 序, 查找物理机乱序排列等待查找分配; 模拟环境二:虚拟机分配请求按照所请求的虚拟机的 CPU核数从小到大排 序, 查找物理机按物理机的 CPU资源从小到大排序等待查找分配;
模拟场景三:虚拟机分配请求按照所请求的虚拟机的 CPU核数从小到大排 序, 查找物理机按物理机的 CPU资源从大到小排序等待查找分配;
模拟场景四:虚拟机分配请求按照所请求的虚拟机的 CPU核数从大到小排 序, 查找物理机按物理机的 CPU资源从大到小排序等待查找分配;
模拟场景五:虚拟机分配请求按照所请求的虚拟机的 CPU核数从大到小排 序, 查找物理机按物理机的 CPU资源从小到大排序等待查找分配;
模拟环境六: 虚拟机分配请求按照所请求乱序排序, 查找物理机乱序排列 等待查找分配。
上述列举的模拟环境只是本实施例提供的可行实施方式, 并不对本发明实 施例构成局限。
本实施例中, 可以设定待分配的虚拟机数量为 160台, 其中包括了表一所 示的 8种 ¾各虚拟机, 每种规格的虚拟机的台数比设定约为 1:1:1:1:1:1:1:1。
本实施例中, 设定网络中有 80台物理机, 分别包括以下两种规格, 每种规 格中的 CPU核数、 内存容量及宽带容量分别如表三所示:
Figure imgf000012_0002
Figure imgf000012_0001
每种模拟环境下, 可以进行若干次模拟分配, 在分配过程中, 可以根据 现有的各种算法, 例如: 贪婪算法或者轮叫调度算法, 将设定的 160台虚拟 机分配给网络中的 80台物理机。
在每种模拟环境的每次模拟后, 可以得到一个模拟虚拟机分配模型和 80 台物理机中每台物理机的模拟样例表。
每个模拟环境下得到的模拟虚拟机分配模型可以包括: 分配虚拟机的物 理机的属性信息和分配虚拟机的物理机台数, 分配的虚拟机的属性信息和分 配的虚拟机的台数, 各物理机的平均资源占用率。
例如: 一个模拟环境下得到的模拟虚拟机分配模型可以包括:
分配虚拟机的物理机的属性信息为: CPU100 个, 内存 40960MB, 带宽 1000MB; 该物理机的台数可以为 40台;
分配的虚拟机的属性信息为: 虚拟机类型 VM1 , 其资源容量为: CPU81 个, 内存 15254MB, 带宽 409MB, 分配的该规格的虚拟机台数为 1;
该模拟环境下网络中各物理机的平均资源占用率为: 47.201%。
另一个模拟环境下得到的模拟虚拟机分配模型可以包括:
分配虚拟机的物理机的属性信息为: CPU100 个, 内存 40960MB, 带宽 1000MB; 该物理机的台数可以为 40台;
分配的虚拟机的属性信息为: 虚拟机类型 VM2, 其资源容量为: CPU1个, 内存 367MB, 带宽 49MB , 分配的该规格的虚拟机台数为 2;
该模拟环境下网络中各物理机的平均资源占用率为: 47.203%。
在一个模拟环境下得到的模拟虚拟机分配模型中包括的某台物理机的模 拟样例表可以为, 例如:
该物理机的包括: 物理机类型 PM1 , 物理机的资源容量: CPU100个, 内 存 40960MB, 带宽 1000MB;
可创建的虚拟机的属性信息为:
虚拟机类型 VM1 , 其资源容量: CPU81个, 内存 15254MB, 带宽 409MB; 该种 ¾各的虚拟机可创建的台数为 1;
虚拟机类型 VM2, 其资源容量: CPU16个, 内存 3233MB, 带宽 149MB; 该种 ¾各的虚拟机可创建的台数为 1;
虚拟机类型 VM3, 其资源容量 CPU1个, 内存 367MB, 带宽 49MB, 该种 规格的虚拟机可创建的台数为 2;
在该台物理机上分别创建 1台虚拟机 VM1、 1台虚拟机 VM2和 2台虚拟 机 VM3后, 该台物理机的资源占用率为 47.2%。
由于在实际的虚拟机分配过程中, 用户可能会取消已发出的虚拟机分配请 求, 因此, 对于待分配的若干台虚拟机, 可能会在分配过程中删除其中的某些 台。 为了使模拟场景更接近于实际的虚拟机分配过程。 作为一种可行的实施方 式, 在每种模拟环境下, 每次模拟分配结束后, 可以随机删除 16台虚拟机, 再 随机补充 16台虚拟机, 补充的虚拟机从 8种规格中随机 这个步骤可以执 行 50次。
需要说明的是, 在 S203的基础上, 还可以根据通常各种场景下, 不同类 型的虚拟机分配给网络中各物理机时, 网络中各物理机的平均资源占用率的 经验值, 来进一步补充一些模拟虚拟机分配模型及各物理机的模拟样例表。
5204、 在各种模拟环境下的模拟虚拟机分配模型中将各物理机的平均资 源占用率最高的模拟虚拟机分配模型作为虚拟机分配参考模型, 并将虚拟机 分配参考模型包含的对应于各物理机的模拟样例表作为参考样例表。
具体的, 在上述六种模拟环境都模拟结束之后, 对于每种模拟环境的每 次模拟都会得到一个模拟虚拟机分配模型以及各物理机的模拟样例表, 具体 可以参见表一。 另外, 在 S22的基础上, 还可以基于经验值得到一些补充模拟 虚拟机分配模型及各物理机的模拟样例表。 可以在最终得到的所有模拟虚拟 机分配模型中, 选择网络中各物理机的平均资源占用率最高的模拟虚拟机分 配模型, 并将该模拟虚拟机分配模型对应的各物理机的模拟样例表作为参考 样例表。 例如: 表一所示的模拟场景 B对应的网络中各物理机的资源占用率 X2%的数值最高,则可以将模拟虚拟机分配模型 B确定为后续进行虚拟机分配 的虚拟机分配参考模型, 相应的, 可以将模拟场景 B下得到的各物理机对应 的模拟样例表作为为各物理机的参考样例表。
在确定各物理机的参考样例表之后, 可选的, 本实施例还可以包括 S205 生成每个参考样例的子样例的过程。
5205、 生成参考样例表的子样例表, 其中, 子样例表包括: 参考样例表 中的至少一种规格的虚拟机的属性信息, 子样例表的数量为参考样例表中的 各种规格的虚拟机的组合数量。 每种组合构造为一个子样例表, 例如: 某台物理机的样例表为: 该物理机的属 性信息(包括资源容量)为: CPU100个, 内存 40960MB, 带宽 1000MB, 可 创建的虚拟机的属性信息包括: 虚拟机 VM1 , 其资源容量为 CPU81 个, 内存 15254MB,带宽 409MB,可创建的台数为 1;虚拟机 VM2,其资源容量为 CPU16 个, 内存 3233MB, 带宽 149MB, 可创建的台数为 1; 虚拟机 VM3 , 其资源容 量为 CPU1个, 内存 367MB, 带宽 49MB, 可创建的台数为 2; 该物理机的资 源占用率为 47.2%。
则其对应的子样例表可以包括:( VM1 ), ( VM2 ), ( VM3 )、 ( VM1和 VM2 ), ( VM1和 VM3 )、 ( VM2和 VM3 ) 以及( VM1、 VM2和 VM3 )。 当接收到虚拟机分配请求后, 可以首先找到参考虚拟机分配模型中各物 理机的参考样例表中资源占用率最高的参考样例表, 然后查找该台物理机的 参考样例表对应的所有的子样例表中是否包括虚拟机分配请求所请求的虚拟 机的属性信息, 如果有, 则可以在该台物理机上创建虚拟机, 如果没有, 则 可以继续查找物理机的资源占用率次高的参考样例表对应的所有的子样例表 中是否包括虚拟机分配请求所请求的虚拟机的属性信息, 直至找到包括虚拟 机分配请求所请求的虚拟机类型的子样例表。
需要说明的是, 当某台物理机上创建的虚拟机符合该台物理机对应的子样 例表时, 该台物理机的资源占用率低于该台物理机的参考样例表中的物理机的 资源占用率。
本实施例提供的确定各物理机的参考样例表的方法, 对一段时间内虚拟机 分配请求所请求的虚拟机的规格及比例, 以及稳定时的虚拟机申请数量进行模 拟, 并在各种模拟环境下对上述虚拟机进行模拟分配, 得到网络中的各物理机 的平均资源占用率最高或者较高情况下的虚拟机分配参考模型及其包含的各物 理机的参考样例表。 模拟过程与实际的虚拟机分配过程接近, 采用得到的虚拟 机分配参考模型进行虚拟机分配, 能够提高分配效率, 使得网络中各物理机的 平均资源占用率提高。 进而可以减少规划部署物理机的数量, 或者一段时间内 需要使用的物理机数量减少, 实现降低成本。
图 3为本发明提供的虚拟机分配方法又一个实施例的流程图,如图 3所示, 本实施例提供用户发出虚拟机分配请求至虚拟机分配结束的全过程。 该方法包 括:
5301、 用户根据需求通过网页发出虚拟机分配请求。
5302、后台服务器获得虚拟机分配请求后,通过简单对象访问协议(Simple Object Access Protocol, SOAP )将虚拟机分配请求虚拟机请求发给虚拟机请求 调度器。
可以理解的是, 后台服务器获得虚拟机分配请求后, 还可以通过其他网络 协议将虚拟机分配请求虚拟机请求发给虚拟机请求调度器。
虚拟机请求调度器可以将请求放到虚拟机分配任务队列中。
S303、 调度器在虚拟机分配参考模型中查找物理机的资源占用率最高的 第一参考样例表。 5304、 调度器判断第一参考样例表中对应的子样例表中是否包括虚拟机 分配请求所请求的虚拟机的属性信息,若包括,则执行 S305;否则执行 S307。
5305、 调度器根据目标物理机中已创建的虚拟机的属性信息和目标物理 机的参考样例表所列的虚拟机的属性信息, 判断目标物理机是否能够创建所 请求的虚拟机; 若能够创建, 则执行 S306, 否则执行 S307。
作为一种可行的实施方式, 调度器可以将该物理机的参考样例表所列的 虚拟机的属性信息, 与记录的该物理机上已创建的虚拟机的属性信息进行比 较, 确定该物理机的参考样例表所列的虚拟机的属性信息中, 未创建虚拟机 的属性信息。 若未创建的虚拟机属性信息中与所请求的虚拟机的属性信息相 符合, 则执行 S306, 否则执行 S307。
其中, S305为一种可选的实施方式, 作为另一种可选的实施方式, 调度 器还可以查询目标物理机底层现有资源, 判断该目标物理机是否能够创建所 请求的虚拟机。
5306、 调度器将第一参考样例表对应的物理机作为目标物理机。 之后直 接执行 S311。
5307、 调度器依次按照物理机的资源占用率从高至低的顺序, 依次遍历 虚拟机分配参考模型中其他参考样例表对应的子样例表中是否包括虚拟机分 配请求所请求的虚拟机的属性信息, 若找到包括虚拟机分配请求所请求的虚 拟机规格的参考样例表, 则执行 S308 , 否则执行 S310。
S308、 调度器根据目标物理机中已创建的虚拟机的属性信息和目标物理 机的参考样例表所列的虚拟机的属性信息, 判断目标物理机是否能够创建所 请求的虚拟机; 若能够创建, 则执行 S309, 否则执行 S307。
S309、将包括虚拟机分配请求所请求的虚拟机规格的参考样例表对应的 物理机作为目标物理机。 之后直接执行 S311。
其中, 当接收到虚拟机分配请求后, 可以首先找到参考样例表中物理机 的资源占用率最高的物理机, 然后查找该台物理机的参考样例表对应的所有 的子样例表中是否包括虚拟机分配请求所请求的虚拟机类型, 如果有, 则可 以在该台物理机上创建虚拟机, 如果没有, 则可以继续查找物理机的资源占 用率次高的参考样例表对应的所有的子样例表中是否包括虚拟机分配请求所 请求的虚拟机类型, 直至找到包括虚拟机分配请求所请求的虚拟机类型的子 样例表。 由于子样例表中仅包括虚拟机的类型, 因此, 在子样例表中查找虚 拟机类型的方式相对于在参考样例表查找的方式具有更高的效率。
S310、 调度器采用贪婪算法或轮叫调度算法确定目标物理机。 之后直接 执行 S311。
S311、 调度器对目标物理机中已创建的虚拟机的属性信息进行记录。
S310为可选步骤,调度器也可以直接到底层查询物理机的资源分配情况。 S312、调度器将创建虚拟机请求通过远程过程调用协议 ( Remote Procedure Call Protocol, RPC )发送给目标物理机。
可以理解的是, 调度器还可以通过将创建虚拟机请求通过其他网络协议发 送给目标物理机。
S313、 目标物理机可以采用虚拟化技术(例如可以是 Xen技术等)在目 标物理机中创建虚拟机。
本实施例提供的虚拟机分配方法, 预先设置虚拟机分配参考模型,根据该 高。 该参考样虚拟机分配模型中包含每个物理机的参考样例表, 当获取虚拟 的顺序遍历, 找到请求的虚拟机属性信息符合参考样例表的目标物理机, 从 而在目标物理机上创建所请求的虚拟机, 实现提高网络中各物理机的平均资 源利用率。 在目标物理机上创建虚拟机之后, 可以在调度器上记录物理机上 已创建的虚拟机, 从而再次接收到虚拟机分配请求时, 可以省去到底层查询 物理机的资源分配情况, 以提高查询效率。
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分步骤 可以通过程序指令相关的硬件来完成, 前述的程序可以存储于一计算机可读 取存储介质中, 该程序在执行时, 执行包括上述方法实施例的步骤; 而前述 的存储介质包括: ROM、 RAM, 磁碟或者光盘等各种可以存储程序代码的介 质。
图 4为本发明提供的虚拟机分配装置一个实施例的结构示意图, 如图 4 所示, 该装置包括: 接收器 11、 调度器 12和执行器 13;
接收器 11 , 用于获取虚拟机分配请求, 虚拟机分配请求中包括所请求的 虚拟机的属性信息; 调度器 12, 用于按照虚拟机分配参考模型中的各物理机的资源占用率从 高至低的顺序遍历各物理机的参考样例表, 根据所请求的虚拟机的属性信息 与各物理机的参考样例表所列的虚拟机的属性信息确定目标物理机, 其中, 目标物理机的参考样例表所列的虚拟机的属性信息与所请求的虚拟机的属性 信息相符合; 虚拟机分配参考模型为各物理机具有最高平均资源占用率的虚 拟机分配模型, 虚拟机分配参考模型包含对应于每台物理机的参考样例表, 参考样例表包括: 物理机的属性信息, 可创建的虚拟机的属性信息和可创建 的虚拟机数量, 物理机的资源占用率;
执行器 13 ,用于在目标物理机中创建虚拟机分配请求中所请求的虚拟机。 图 5为本发明提供的虚拟机分配装置又一个实施例的结构示意图, 如图
5所示, 该装置包括: 接收器 11、 调度器 12和执行器 13;
其中, 属性信息可以包括: 资源容量信息和 /或类型信息。 即, 虚拟机的 属性信息可以包括虚拟机的资源容量信息和 /或虚拟机的类型信息; 物理机的 属性信息可以包括物理机的资源容量信息和 /或物理机的类型信息。
可选的, 资源容量信息可以包括: 中央处理器 CPU的容量、 内存容量和 带宽容量。
物理机的资源占用率可以为: CPU容量、 内存容量与 1/3带宽容量之和。 进一步的, 该虚拟机分配装置还可以进一步包括:
模拟器 14, 用于确定各物理机具有最高平均资源占用率的虚拟机分配参 考模型。
作为一种可行的实施方式, 模拟器 14可以具体用于: 预测设定时间内获 取的数个虚拟机分配请求所请求的虚拟机的属性信息, 得到预测的多种属性 信息的虚拟机; 在各种模拟环境下, 模拟将设定数量的多种属性信息的虚拟 机采用贪婪算法或轮叫调度算法分配给各物理机; 获取每种模拟环境下的模 拟虚拟机分配模型, 其中, 模拟虚拟机分配模型包括: 分配虚拟机的物理机 的属性信息和分配虚拟机的 数, 配的虚拟机的属性信息和分配的
Figure imgf000018_0001
, ' 、
样例合并器 15 , 用于在各种模拟环境下的模拟虚拟机分配模型中将各物 理机的平均资源占用率最高的模拟虚拟机分配模型作为虚拟机分配参考模 型, 并将虚拟机分配参考模型包含的对应于各物理机的模拟样例表作为参考 样例表。
其中, 模拟器 14中基于的模拟环境可以包括: 数个虚拟机分配请求所请 求的虚拟机的属性信息排列顺序; 和 /或, 模拟将设定数量的多种属性信息的 虚拟机采用贪婪算法或轮叫调度算法分配给各物理机的过程中, 查找物理机 所基于的物理机的属性信息的排列顺序。
进一步的, 调度器 12还可以用于: 生成参考样例表的子样例表, 其中, 子样例表包括: 参考样例表中的至少一种规格的虚拟机的属性信息, 子样例 表的数量为参考样例表中的各种规格的虚拟机的组合数量。
调度器 12还可以具体用于:在虚拟机分配参考模型中查找物理机的资源 占用率最高的第一参考样例表, 判断第一参考样例表中对应的子样例表中是 否包括虚拟机分配请求所请求的虚拟机的属性信息, 若包括, 则将第一参考 样例表对应的物理机作为目标物理机, 否则, 按照依次物理机的资源占用率 从高至低的顺序, 依次遍历虚拟机分配参考模型中其他参考样例表对应的子 样例表中是否包括虚拟机分配请求所请求的虚拟机的属性信息。
作为一种可行的实施方式, 若虚拟机分配参考模型中所有参考样例表对 应的子样例表中均不包括虚拟机分配请求所请求的虚拟机规格, 则调度器 12 还可以用于: 采用贪婪算法或轮叫调度算法确定目标物理机。
进一步的, 调度器 12还可以用于: 对目标物理机中已创建的虚拟机的属 性信息进行记录。
相应的, 调度器 12还可以用于: 根据目标物理机中已创建的虚拟机的属 性信息和目标物理机的参考样例表所列的虚拟机的属性信息, 判断目标物理 机是否能够创建所请求的虚拟机。 或者, 查询目标物理机底层现有资源, 判 断目标物理机是否能够创建所请求的虚拟机。
需要说明的是上述虚拟机分配装置中的接收器、 调度器以及执行器等各 组成单元, 可以是硬件组成, 也可以是由计算机软件执行相应功能。
本实施例提供的虚拟机分配装置, 与本发明实施例提供的虚拟机分配方 法相对应, 为虚拟机分配方法的执行设备, 其执行虚拟机分配方法的具体过 程可参见方法实施例, 在此不再赘述。
本实施例提供的虚拟机分配装置, 预先设置虚拟机分配参考模型,根据该 高。 该参考样虚拟机分配模型中包含每个物理机的参考样例表, 当获取虚拟 的顺序遍历, 找到请求的虚拟机属性信息符合参考样例表的目标物理机, 从 而在目标物理机上创建所请求的虚拟机, 实现提高网络中各物理机的平均资 源利用率。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通 过硬件来完成, 也可以通过程序来指令相关的硬件完成, 所述的程序可以存 储于一种计算机可读存储介质中, 上述提到的存储介质可以是只读存储器, 磁盘或光盘等。
最后应说明的是: 以上实施例仅用以说明本发明的技术方案, 而非对其 限制; 尽管参照前述实施例对本发明进行了详细的说明, 本领域的普通技术 人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修改, 或 者对其中部分技术特征进行等同替换; 而这些修改或者替换, 并不使相应技 术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims

权 利 要求
1、 一种虚拟机分配方法, 其特征在于, 包括:
获取虚拟机分配请求, 所述虚拟机分配请求中包括所请求的虚拟机的属 性信息;
按照虚拟机分配参考模型中的各物理机的资源占用率从高至低的顺序遍 历所述各物理机的参考样例表, 根据所请求的虚拟机的属性信息与所述各物 理机的参考样例表所列的虚拟机的属性信息确定目标物理机, 其中, 所述目 标物理机的参考样例表所列的虚拟机的属性信息与所请求的虚拟机的属性信 息相符合; 所述虚拟机分配参考模型为所述各物理机具有最高平均资源占用 率的虚拟机分配模型, 所述虚拟机分配参考模型包含对应于每台物理机的参 考样例表, 所述参考样例表包括: 所述物理机的属性信息, 可创建的虚拟机 的属性信息和可创建的虚拟机数量, 所述物理机的资源占用率;
在所述目标物理机中创建所述虚拟机分配请求中所请求的虚拟机。
2、 根据权利要求 1所述的方法, 其特征在于, 所述属性信息包括: 资源 容量信息和 /或类型信息。
3、 根据权利要求 2所述的方法, 其特征在于, 所述资源容量信息包括: 中央处理器 CPU的容量、 内存容量和带宽容量。
4、 根据权利要求 3所述的方法, 其特征在于, 所述物理机的资源占用率 为: 所述 CPU容量、 所述内存容量与 1/3所述带宽容量之和。
5、根据权利要求 1-4任一项所述的方法, 其特征在于, 所述方法还包括: 确定所述各物理机具有最高平均资源占用率的虚拟机分配参考模型。
6、 根据权利要求 5所述的方法, 其特征在于, 所述确定所述各物理机具 有最高平均资源占用率的虚拟机分配参考模型, 包括:
预测设定时间内获取的数个虚拟机分配请求所请求的虚拟机的属性信 息, 得到预测的多种属性信息的虚拟机;
在各种模拟环境下 , 模拟将设定数量的所述多种属性信息的虚拟机采用 贪婪算法或轮叫调度算法分配给所述各物理机;
获取每种模拟环境下的模拟虚拟机分配模型, 其中, 所述模拟虚拟机分 配模型包括: 分配虚拟机的物理机的属性信息和分配虚拟机的物理机台数, 分配的虚拟机的属性信息和分配的虚拟机的台数, 所述各物理机的平均资源 占用率以及对应于所述各物理机的模拟样例表;
在各种模拟环境下的所述模拟虚拟机分配模型中将各物理机的平均资源 占用率最高的模拟虚拟机分配模型作为所述虚拟机分配参考模型 , 并将所述 虚拟机分配参考模型包含的对应于所述各物理机的模拟样例表作为所述参考 样例表。
7、 根据权利要求 6所述的方法, 其特征在于, 所述模拟环境包括: 所述 数个虚拟机分配请求所请求的虚拟机的属性信息排列顺序; 和 /或, 所述模拟 将设定数量的所述多种属性信息的虚拟机采用贪婪算法或轮叫调度算法分配 给所述各物理机的过程中, 查找所述物理机所基于的物理机的属性信息的排 列顺序。
8、 根据权利要求 6或 7所述的方法, 其特征在于, 所述在各种模拟环境 下的所述模拟虚拟机分配模型中将各物理机的平均资源占用率最高的模拟虚 拟机分配模型作为所述虚拟机分配参考模型, 并将所述虚拟机分配参考模型 包含的对应于所述各物理机的模拟样例表作为所述参考样例表之后,还包括: 生成所述参考样例表的子样例表, 其中, 所述子样例表包括: 所述参考 样例表中的至少一种规格的虚拟机的属性信息, 所述子样例表的数量为所述 参考样例表中的各种规格的虚拟机的组合数量。
9、 根据权利要求 8所述的方法, 其特征在于, 所述按照虚拟机分配参考 模型中的网络中各物理机的资源占用率从高至低的顺序遍历所述各物理机的 参考样例表, 根据所请求的虚拟机的属性信息与所述各物理机的参考样例表 所列的虚拟机的属性信息确定目标物理机, 包括:
在所述虚拟机分配参考模型中查找物理机的资源占用率最高的第一参考 样例表, 判断所述第一参考样例表中对应的子样例表中是否包括所述虚拟机 分配请求所请求的虚拟机的属性信息, 若包括, 则将所述第一参考样例表对 应的物理机作为目标物理机, 否则, 按照依次物理机的资源占用率从高至低 的顺序, 依次遍历所述虚拟机分配参考模型中其他参考样例表对应的子样例 表中是否包括所述虚拟机分配请求所请求的虚拟机的属性信息。
10、 根据权利要求 9所述的方法, 其特征在于, 若所述虚拟机分配参考 所请求的虚拟机的属性信息, 则采用贪婪算法或轮叫调度算法确定所述目标 物理机。
11、 根据权利要求 1-10任一项所述的方法, 其特征在于, 所述在所述目 标物理机中创建所述虚拟机分配请求中所请求的虚拟机之后, 还包括:
对所述目标物理机中已创建的虚拟机的属性信息进行记录。
12、 根据权利要求 11所述的方法, 其特征在于, 所述在所述目标物理机 中创建所述虚拟机分配请求中所请求的虚拟机之前, 还包括:
根据所述目标物理机中已创建的虚拟机的属性信息和所述目标物理机的 参考样例表所列的虚拟机的属性信息, 判断所述目标物理机是否能够创建所 请求的虚拟机; 或者, 查询所述目标物理机底层现有资源, 判断所述目标物 理机是否能够创建所请求的虚拟机。
13、 一种虚拟机分配装置, 其特征在于, 包括:
接收器, 用于获取虚拟机分配请求, 所述虚拟机分配请求中包括所请求 的虚拟机的属性信息;
调度器, 用于按照虚拟机分配参考模型中的各物理机的资源占用率从高 至低的顺序遍历所述各物理机的参考样例表, 根据所请求的虚拟机的属性信 息与所述各物理机的参考样例表所列的虚拟机的属性信息确定目标物理机, 其中, 所述目标物理机的参考样例表所列的虚拟机的属性信息与所请求的虚 拟机的属性信息相符合; 所述虚拟机分配参考模型为所述各物理机具有最高 平均资源占用率的虚拟机分配模型, 所述虚拟机分配参考模型包含对应于每 台物理机的参考样例表, 所述参考样例表包括: 所述物理机的属性信息, 可 创建的虚拟机的属性信息和可创建的虚拟机数量,所述物理机的资源占用率; 执行器, 用于在所述目标物理机中创建所述虚拟机分配请求中所请求的 虚拟机。
14、 根据权利要求 13所述的装置, 其特征在于, 所述属性信息包括: 资 源容量信息和 /或类型信息。
15、根据权利要求 14所述的装置,其特征在于,所述资源容量信息包括: 中央处理器 CPU的容量、 内存容量和带宽容量。
16、 根据权利要求 15所述的装置, 其特征在于, 所述物理机的资源占用 率为: 所述 CPU容量、 所述内存容量与 1/3所述带宽容量之和。
17、 根据权利要求 13-16任一项所述的装置, 其特征在于, 还包括: 模 拟器, 用于确定所述各物理机具有最高平均资源占用率的虚拟机分配参考模 型。
18、 根据权利要求 17所述的装置, 其特征在于, 所述模拟器具体用于: 预测设定时间内获取的数个虚拟机分配请求所请求的虚拟机的属性信息, 得 到预测的多种属性信息的虚拟机; 在各种模拟环境下, 模拟将设定数量的所 述多种属性信息的虚拟机采用贪婪算法或轮叫调度算法分配给所述各物理 机; 获取每种模拟环境下的模拟虚拟机分配模型, 其中, 所述模拟虚拟机分 配模型包括: 分配虚拟机的物理机的属性信息和分配虚拟机的物理机台数, 分配的虚拟机的属性信息和分配的虚拟机的台数, 所述各物理机的平均资源 占用率以及对应于所述各物理机的模拟样例表;
样例合并器, 用于在各种模拟环境下的所述模拟虚拟机分配模型中将各 物理机的平均资源占用率最高的模拟虚拟机分配模型作为所述虚拟机分配参 考模型, 并将所述虚拟机分配参考模型包含的对应于所述各物理机的模拟样 例表作为所述参考样例表。
19、 根据权利要求 18所述的装置, 其特征在于, 所述模拟器中基于的模 拟环境包括:所述数个虚拟机分配请求所请求的虚拟机的属性信息排列顺序; 和 /或, 所述模拟将设定数量的所述多种属性信息的虚拟机采用贪婪算法或轮 叫调度算法分配给所述各物理机的过程中, 查找所述物理机所基于的物理机 的属性信息的排列顺序。
20、 根据权利要求 18或 19所述的装置, 其特征在于, 所述调度器还用 于: 生成所述参考样例表的子样例表, 其中, 所述子样例表包括: 所述参考 样例表中的至少一种规格的虚拟机的属性信息, 所述子样例表的数量为所述 参考样例表中的各种规格的虚拟机的组合数量。
21、 根据权利要求 20所述的装置, 其特征在于, 所述调度器具体用于: 在所述虚拟机分配参考模型中查找物理机的资源占用率最高的第一参考样例 表, 判断所述第一参考样例表中对应的子样例表中是否包括所述虚拟机分配 请求所请求的虚拟机的属性信息, 若包括, 则将所述第一参考样例表对应的 物理机作为目标物理机, 否则, 按照依次物理机的资源占用率从高至低的顺 序, 依次遍历所述虚拟机分配参考模型中其他参考样例表对应的子样例表中 是否包括所述虚拟机分配请求所请求的虚拟机的属性信息。
22、 根据权利要求 21所述的装置, 其特征在于, 若所述虚拟机分配参考 所请求的虚拟机规格, 则所述调度器还用于: 采用贪婪算法或轮叫调度算法 确定所述目标物理机。
23、 根据权利要求 13-22任一项所述的装置, 其特征在于, 所述调度器 还用于: 对所述目标物理机中已创建的虚拟机的属性信息进行记录。
24、 根据权利要求 23所述的装置, 其特征在于, 所述调度器还用于: 根 据所述目标物理机中已创建的虚拟机的属性信息和所述目标物理机的参考样 例表所列的虚拟机的属性信息, 判断所述目标物理机是否能够创建所请求的 虚拟机。 或者, 查询所述目标物理机底层现有资源, 判断所述目标物理机是 否能够创建所请求的虚拟机。
25、 一种计算机程序产品, 其特征在于, 包括计算机程序代码, 当所述 计算机程序代码被计算机单元执行时, 所述计算机单元执行所述权利要求 1-12任一项所述的方法。
26、 一种计算机可读介质, 其特征在于, 用于存储计算机程序代码, 当 所述计算机程序代码被计算机单元执行时, 所述计算机单元执行所述权利要 求 1-12任一项所述的方法。
PCT/CN2012/071458 2012-02-22 2012-02-22 虚拟机分配方法和虚拟机分配装置 WO2013123650A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201280000263.1A CN103548324B (zh) 2012-02-22 2012-02-22 虚拟机分配方法和虚拟机分配装置
PCT/CN2012/071458 WO2013123650A1 (zh) 2012-02-22 2012-02-22 虚拟机分配方法和虚拟机分配装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2012/071458 WO2013123650A1 (zh) 2012-02-22 2012-02-22 虚拟机分配方法和虚拟机分配装置

Publications (1)

Publication Number Publication Date
WO2013123650A1 true WO2013123650A1 (zh) 2013-08-29

Family

ID=49004927

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/071458 WO2013123650A1 (zh) 2012-02-22 2012-02-22 虚拟机分配方法和虚拟机分配装置

Country Status (2)

Country Link
CN (1) CN103548324B (zh)
WO (1) WO2013123650A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407925A (zh) * 2014-12-10 2015-03-11 中国电信集团系统集成有限责任公司 一种动态的资源分配方法
CN106502761A (zh) * 2016-10-18 2017-03-15 华南师范大学 一种资源高效利用的虚拟机部署方法
CN106911809A (zh) * 2017-04-28 2017-06-30 郑州云海信息技术有限公司 一种数据中心用户请求信息的存储和分发的方法及装置

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108572871B (zh) * 2017-12-13 2021-03-26 北京金山云网络技术有限公司 一种资源分配方法、装置、电子设备及存储介质
CN109684074A (zh) * 2018-11-12 2019-04-26 平安科技(深圳)有限公司 物理机资源分配方法及终端设备
CN112631766B (zh) * 2019-10-08 2023-09-19 中国移动通信集团浙江有限公司 项目环境资源的动态调整方法及装置
CN112148426A (zh) * 2020-08-25 2020-12-29 新华三大数据技术有限公司 一种带宽分配方法及装置
CN114185676B (zh) * 2021-12-06 2022-12-16 深圳威科软件科技有限公司 服务器分配方法、装置、电子设备和计算机可读存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090113422A1 (en) * 2007-10-31 2009-04-30 Toshimitsu Kani Dynamic allocation of virtual machine devices
CN102185759A (zh) * 2011-04-12 2011-09-14 田文洪 一种满足需求特性的多物理服务器负载均衡的方法及装置
CN102307133A (zh) * 2011-03-25 2012-01-04 国云科技股份有限公司 一种公有云平台虚拟机调度方法

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7669029B1 (en) * 2006-11-15 2010-02-23 Network Appliance, Inc. Load balancing a data storage system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090113422A1 (en) * 2007-10-31 2009-04-30 Toshimitsu Kani Dynamic allocation of virtual machine devices
CN102307133A (zh) * 2011-03-25 2012-01-04 国云科技股份有限公司 一种公有云平台虚拟机调度方法
CN102185759A (zh) * 2011-04-12 2011-09-14 田文洪 一种满足需求特性的多物理服务器负载均衡的方法及装置

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407925A (zh) * 2014-12-10 2015-03-11 中国电信集团系统集成有限责任公司 一种动态的资源分配方法
CN106502761A (zh) * 2016-10-18 2017-03-15 华南师范大学 一种资源高效利用的虚拟机部署方法
CN106502761B (zh) * 2016-10-18 2020-04-03 华南师范大学 一种资源高效利用的虚拟机部署方法
CN106911809A (zh) * 2017-04-28 2017-06-30 郑州云海信息技术有限公司 一种数据中心用户请求信息的存储和分发的方法及装置

Also Published As

Publication number Publication date
CN103548324A (zh) 2014-01-29
CN103548324B (zh) 2016-06-15

Similar Documents

Publication Publication Date Title
WO2013123650A1 (zh) 虚拟机分配方法和虚拟机分配装置
Agarwal et al. Efficient optimal algorithm of task scheduling in cloud computing environment
Ge et al. GA-based task scheduler for the cloud computing systems
Kc et al. Scheduling hadoop jobs to meet deadlines
James et al. Efficient VM load balancing algorithm for a cloud computing environment
Palanisamy et al. Purlieus: locality-aware resource allocation for MapReduce in a cloud
Chien et al. Load balancing algorithm based on estimating finish time of services in cloud computing
Park et al. Locality-aware dynamic VM reconfiguration on MapReduce clouds
JP5837206B2 (ja) 分離された仮想空間を提供するための方法および装置
Gupta et al. Optimizing VM Placement for HPC in the Cloud
Li et al. CAM: a topology aware minimum cost flow based resource manager for MapReduce applications in the cloud
Sharma et al. A Comparative Analysis of Min-Min and Max-Min Algorithms based on the Makespan Parameter.
Shah et al. Allocation of virtual machines in cloud computing using load balancing algorithm
WO2015058377A1 (zh) 一种创建虚拟机的方法和装置
WO2014131317A1 (zh) 一种核资源分配方法、装置及众核系统
US11307802B2 (en) NVMe queue management multi-tier storage systems
KR101557747B1 (ko) 클라우드에서 다중 자원의 효율적인 활용을 위한 가상머신 할당 시스템 및 방법
Ullah et al. Enhancing the dynamic load balancing technique for cloud computing using HBATAABC algorithm
Begam et al. Timer-cloud: Time-sensitive vm provisioning in resource-constrained clouds
Ma et al. vLocality: Revisiting data locality for MapReduce in virtualized clouds
Kaneria et al. Analysis and improvement of load balancing in cloud computing
Ashwin et al. A novel bio-inspired load balancing of virtualmachines in cloud environment
Pastorelli et al. Practical size-based scheduling for MapReduce workloads
Lloyd et al. Dynamic scaling for service oriented applications: implications of virtual machine placement on IaaS clouds
Himthani et al. Comparative analysis of VM scheduling algorithms in cloud environment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12869432

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12869432

Country of ref document: EP

Kind code of ref document: A1