Physical machine resource allocation method and device, equipment, storage medium and program product
By obtaining resource information of virtual machines and physical machines and the requirements of preset functions, determining the matching relationship between virtual machines and preset functions, and mapping and resource allocation between virtual machines and physical machines, the problem of insufficient virtual machine deployment based on past experience is solved, and a more efficient physical machine resource utilization and deployment success rate is achieved.
Patent Information
- Application Number
- CN202411720414.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-04-11
AI Technical Summary
In the prior art, virtual machine deployment is based on past experience. Due to limited historical data, the virtual machine deployment results are not accurate enough, which may lead to deployment failure.
By obtaining the required resource information of multiple virtual machines, the available resource information of multiple physical machines, the required resource information of multiple preset functions, and the number of virtual machines required, the preset functions matched by each virtual machine are determined, and the virtual machines are mapped to the corresponding physical machine based on this, and finally, the physical machine resource allocation is performed based on the mapping results.
It realizes the rational allocation of physical machine resources in the deployment scenario, so that physical machine resources are fully utilized when creating virtual machines, reduce resource waste, and improve load balancing of physical machines in the resource pool, thereby improving the performance and success rate during the deployment process.
Smart Images

Figure CN119806800A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic technology, and in particular to a physical machine resource allocation method, device, equipment, storage medium and program product. Background Art
[0002] With the development of computer technology, the demand for information storage and computing has increased. The emergence of virtualization technology has realized the mapping between physical machines and multiple virtual machines, solving the problem of high cost of using physical machines. When creating a virtual machine, it is necessary to consider the mapping relationship between the resources required by the virtual machine (memory, CPU, disk, etc.) between different physical machines to avoid the physical machine resources in the same resource pool not being fully utilized, resulting in some physical machine resources being idle and some physical machine resources being overused, which reduces the performance of the virtual machine and slows down the response time of the virtual machine during the deployment process, which may lead to deployment failure. Therefore, it is very important to deploy virtual machines reasonably.
[0003] In the related art, historical virtual machine deployment data is analyzed, and the past virtual machine deployment method is determined based on the analysis results, so as to perform subsequent virtual machine deployment. However, virtual machine deployment based on past experience is not accurate enough due to the limited historical data analyzed, which leads to deployment failure. Summary of the invention
[0004] In view of this, the present invention provides a physical machine resource allocation method, device, equipment, storage medium and program product to solve the problem in the related technology that virtual machine deployment is based on past experience, and the deployment results of the virtual machine are not accurate enough due to limited historical data analyzed, which leads to deployment failure.
[0005] In a first aspect, the present invention provides a method for allocating physical machine resources, the method comprising: obtaining required resource information of multiple virtual machines, available resource information of multiple physical machines, required resource information of multiple preset functions, and information on the number of required virtual machines; determining a preset function that matches each virtual machine based on the required resource information of each preset function, information on the number of required virtual machines, and the required resource information of each virtual machine; mapping different virtual machines to corresponding physical machines based on the required resource information of each virtual machine, the matching preset functions, and the available resource information of each physical machine to obtain a mapping result; and allocating physical machine resources based on the mapping result.
[0006] The physical machine resource allocation method provided by the present invention determines the preset functions matched by each virtual machine based on the required resource information of each preset function, the number information of the required virtual machines, and the required resource information of each virtual machine; maps different virtual machines to corresponding physical machines based on the required resource information of each virtual machine, the matched preset functions, and the available resource information of each physical machine to obtain mapping results; and allocates physical machine resources based on the mapping results. The method provided by the present invention determines the preset functions matched by each virtual machine through the required resource information of multiple preset functions, the number information of the required virtual machines, and the required resource information of multiple virtual machines; maps different virtual machines to corresponding physical machines based on the preset functions matched by each virtual machine, the required resource information of each virtual machine, and the available resource information of each physical machine; allocates physical machine resources of the virtual machine based on the mapping results; the method of the present invention allocates physical machine resources based on the preset functions matched by each virtual machine, the required resource information of the virtual machine, and the available resource information of the physical machine; reasonably allocates physical machine resources in the deployment scenario, so that the resources of the physical machine are fully utilized when creating the virtual machine, and the waste of resources is reduced, thereby improving the load balancing of the physical machine in the resource pool, and then improving the performance and success rate in the deployment process.
[0007] In an optional embodiment, the step of determining the preset function that matches each virtual machine based on the required resource information of each preset function, the number of required virtual machines, and the required resource information of each virtual machine includes: classifying multiple virtual machines based on the required resource information of each virtuality, determining multiple classification sets and the number of virtual machines in each classification set; determining the classification set that matches the corresponding preset function based on the required resource information of each preset function, the number of required virtual machines, and the number of virtual machines in each classification set; and determining the preset function that matches each virtual machine based on the classification set that matches each preset function.
[0008] The method provided by this optional implementation manner classifies multiple virtual machines according to the required resource information of each virtual machine, determines multiple classification sets and the number of virtual machines in each classification set, determines the classification set that matches the corresponding preset function based on the required resource information of each preset function and the number of required virtual machines, determines the preset function that matches each virtual machine based on the classification set that matches each preset function, and achieves the matching of each virtual machine with the preset function.
[0009] In an optional embodiment, the step of obtaining required resource information of multiple virtual machines, available resource information of multiple physical machines, required resource information of multiple preset functions, and information on the number of virtual machines required includes: obtaining resource information of multiple physical machines, resource information of multiple virtual machines, required resource information of multiple preset functions, and information on the number of virtual machines required, the resource information including memory resources, processing resources, and disk size information; determining available resource information of the corresponding physical machine based on the memory resources, processing resources, and disk size information of each physical machine; determining required resource information of the corresponding virtual machine based on the memory resources, processing resources, and disk size information of each virtual machine.
[0010] In an optional implementation, the step of determining the available resource information of the corresponding physical machine based on the memory resources, processing resources and disk size information of each physical machine includes: performing interval processing on the memory resources, processing resources and disk size information of each physical machine respectively to obtain the target memory resources, target processing resources and target disk size information of the corresponding physical machine; and performing dimension merging processing on the target memory resources, target processing resources and target disk size information of each physical machine to obtain the available resource information of the corresponding physical machine.
[0011] The method provided by this optional implementation converts the three-dimensional resources of a physical machine into one dimension, making it easier and more effective to measure machine resources.
[0012] In an optional implementation, the step of determining the required resource information of the corresponding virtual machine based on the memory resources, processing resources and disk size information of each virtual machine includes: performing interval processing on the memory resources, processing resources and disk size information of each virtual machine to obtain the target memory resources, target processing resources and target disk size information of the corresponding virtual machine; and performing dimension merging processing on the target memory resources, target processing resources and target disk size information of each virtual machine to obtain the required resource information of the corresponding virtual machine.
[0013] The method provided by this optional implementation manner converts the three-dimensional resources of the virtual machine into one dimension, making it easier and more effective to measure the virtual machine resources.
[0014] In an optional embodiment, different virtual machines are mapped to corresponding physical machines based on the required resource information of each virtual machine, the matched preset functions and the available resource information of each physical machine to obtain the mapping result, including: sorting multiple virtual machines based on the required resource information of each virtual machine to obtain a first sorting result; sorting multiple physical machines based on the available resource information of each physical machine to obtain a second sorting result; mapping different virtual machines to corresponding physical machines based on the first sorting result, the second sorting result and the matched preset functions of each virtual machine to obtain a mapping result.
[0015] In a second aspect, the present invention provides a physical machine resource allocation device, which includes: an acquisition module for acquiring required resource information of multiple virtual machines, available resource information of multiple physical machines, required resource information of multiple preset functions, and quantity information of required virtual machines; a determination module for determining the preset functions matched by each virtual machine based on the required resource information of each preset function, the quantity information of required virtual machines, and the required resource information of each virtual machine; a mapping module for mapping different virtual machines to corresponding physical machines based on the required resource information of each virtual machine, the matched preset functions, and the available resource information of each physical machine to obtain a mapping result; and an allocation module for allocating physical machine resources based on the mapping result.
[0016] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the physical machine resource allocation method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0017] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the physical machine resource allocation method of the first aspect or any corresponding embodiment thereof.
[0018] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the physical machine resource allocation method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 is a flow chart of a method for allocating physical machine resources according to an embodiment of the present invention;
[0021] Figure 2 is a flow chart of another physical machine resource allocation method according to an embodiment of the present invention;
[0022] Figure 3 is a flow chart of another physical machine resource allocation method according to an embodiment of the present invention;
[0023] Figure 4 This is a flowchart of a specific example of the process of mapping a virtual machine to a physical machine in an embodiment of the present application;
[0024] Figure 5 is a structural block diagram of a physical machine resource allocation device according to an embodiment of the present invention;
[0025] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0027] In the related art, historical virtual machine deployment data is analyzed, and the past virtual machine deployment method is determined based on the analysis results, so as to perform subsequent virtual machine deployment. However, virtual machine deployment based on past experience is not accurate enough due to the limited historical data analyzed, which leads to deployment failure.
[0028] In view of this, a physical machine resource allocation method provided in an embodiment of the present application can be applied to a server to implement the allocation of physical machine resources. The method provided by the present invention determines the preset functions matched by each virtual machine through the required resource information of multiple preset functions, the number information of the required virtual machines, and the required resource information of multiple virtual machines, and maps different virtual machines to corresponding physical machines based on the preset functions matched by each virtual machine, the required resource information of each virtual machine, and the available resource information of each physical machine, and allocates physical machine resources of the virtual machine based on the mapping results. The method of the present invention allocates physical machine resources based on the preset functions matched by each virtual machine, the required resource information of the virtual machine, and the available resource information of the physical machine, and reasonably allocates physical machine resources in the deployment scenario, so that the resources of the physical machine are fully utilized when creating a virtual machine, and resource waste is reduced, thereby improving the load balancing of the physical machine in the resource pool, and then improving the performance and success rate of the deployment process.
[0029] According to an embodiment of the present invention, an embodiment of a physical machine resource allocation method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] In this embodiment, a physical machine resource allocation method is provided, which can be used for the above-mentioned server. Figure 1 is a flow chart of a method for allocating physical machine resources according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0031] Step S101, obtaining required resource information of multiple virtual machines, available resource information of multiple physical machines, required resource information of multiple preset functions, and required number information of virtual machines.
[0032] Exemplarily, the multiple virtual machines may be multiple virtual clients that need physical resource allocation, and the multiple physical machines may be physical machines that can host the virtual machines. In the embodiment of the present application, the required resource information of the virtual machine includes memory, CPU, disk size, etc., and the available resource information of the physical machine includes memory, CPU, disk size, etc.
[0033] Step S102: determining a preset function matching each virtual machine based on the required resource information of each preset function, the required number of virtual machines, and the required resource information of each virtual machine.
[0034] Exemplarily, the preset functions may include but are not limited to functions that need to be highly available. In the embodiment of the present application, in order to achieve high availability of the resource pool, virtual machines with the same functions need to be deployed during the virtual machine deployment process, and these virtual machines need to be allocated to different physical machines in the resource pool. Therefore, the number of virtual machines required for each preset function is determined to facilitate the subsequent allocation of the preset functions to the corresponding multiple virtual machines.
[0035] Step S103 , based on the required resource information of each virtual machine, the matched preset function and the available resource information of each physical machine, different virtual machines are mapped to corresponding physical machines respectively to obtain a mapping result.
[0036] Exemplarily, in an embodiment of the present application, virtual machines are mapped to corresponding physical machines according to the required resource information of each virtual machine and the available resource information of each physical machine, and in the mapping process, virtual machines with the same preset function are preferentially mapped to different physical machines in the resource pool. When there is a virtual machine with the same function in the physical machine mapped to the virtual machine, this virtual machine is allocated to the next physical machine until it is mapped to a physical machine without a virtual machine with the same function. During the mapping process, if the available resources of a physical machine are lower than a preset threshold, this physical machine will no longer participate in the virtual machine mapping. The embodiment of the present application does not limit the specific content of the preset threshold, and those skilled in the art can determine it according to needs.
[0037] Step S104: Allocate physical machine resources based on the mapping result.
[0038] Exemplarily, in an embodiment of the present application, based on the physical machine information mapped to each virtual machine, different virtual machines are respectively deployed on corresponding physical machines, thereby realizing physical machine resource allocation in a resource pool.
[0039] The physical machine resource allocation method provided in this embodiment determines the preset functions matched by each virtual machine through the required resource information of multiple preset functions, the number of required virtual machines and the required resource information of multiple virtual machines, maps different virtual machines to corresponding physical machines based on the preset functions matched by each virtual machine, the required resource information of each virtual machine and the available resource information of each physical machine, and allocates physical machine resources of the virtual machines based on the mapping results. The method of the present invention allocates physical machine resources based on the preset functions matched by each virtual machine, the required resource information of the virtual machine and the available resource information of the physical machine, and reasonably allocates physical machine resources in the deployment scenario, so that the resources of the physical machine are fully utilized when creating the virtual machine, and resource waste is reduced, thereby improving the load balancing of the physical machines in the resource pool, and further improving the performance and success rate of the deployment process.
[0040] In this embodiment, a physical machine resource allocation method is provided, which can be used for the above-mentioned server. Figure 2 is a flow chart of a method for allocating physical machine resources according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0041] Step S201, obtain the required resource information of multiple virtual machines, the available resource information of multiple physical machines, the required resource information of multiple preset functions and the number of required virtual machines. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0042] Step S202: determining a preset function matching each virtual machine based on the required resource information of each preset function, the required number of virtual machines, and the required resource information of each virtual machine.
[0043] Specifically, the above step S202 includes:
[0044] Step S2021: classify multiple virtual machines based on the required resource information of each virtual machine, and determine multiple classification sets and the number of virtual machines in each classification set.
[0045] For example, a classification set includes at least one virtual machine. In the embodiment of the present application, virtual machines with the same CPU, memory, disk, etc. are classified into one category in order to achieve high availability. Traverse the virtual machines to be allocated, and use the string s consisting of CPU, memory, and disk size I As the key, the number of virtual machines g I As value, save the classification result as {s1 :g 1 ,s 2 :g 2 ,...,s r :g r}.
[0046] Step S2022: Based on the required resource information of each preset function, the required number of virtual machines, and the number of virtual machines in each classification set, determine the classification set that matches the corresponding preset function.
[0047] For example, in the embodiment of the present application, traversing {s 1 :g 1 ,s 2 :g 2 ,...,s r :g r}, get the classification with value greater than 1, and get class t {x 1 ,x 2 ,...,x t}, where x J ={s I :g I}. It is known that there are f types of functions (preset functions) that need to be highly available {y 1 ,y 2 ,...,y f}, where y a = {u a :w a}, according to each function y a Required resource size u a Locate x in class t J Then according to the function y a The number of virtual machines in order w a From x J Find the corresponding virtual machine in J ={s I :g I -w a}, thereby determining the classification set that matches each preset function.
[0048] Step S2023: determining the preset function matched by each virtual machine based on the classification set matched by each preset function.
[0049] Exemplarily, the preset function matched by each virtual machine in the corresponding set may be determined based on the classification set matched by each preset function.
[0050] The method provided in this optional embodiment uses a combination of category and function number as a label for the virtual machine in order to achieve high availability of deployment, based on the high availability functions and resource size and quantity of the virtual machines as needed, so that virtual machines with the same label can be assigned to different physical machines when mapping the physical machines later.
[0051] Step S203: Based on the required resource information of each virtual machine, the matching preset function and the available resource information of each physical machine, different virtual machines are mapped to corresponding physical machines to obtain mapping results. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.
[0052] Step S204: Allocate physical machine resources based on the mapping result. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0053] In this embodiment, a physical machine resource allocation method is provided, which can be used for the above-mentioned server. Figure 3 is a flow chart of a method for allocating physical machine resources according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0054] Step S301, obtaining required resource information of multiple virtual machines, available resource information of multiple physical machines, required resource information of multiple preset functions, and required number information of virtual machines.
[0055] Specifically, the above step S301 includes:
[0056] Step S3011, obtaining resource information of multiple physical machines, resource information of multiple virtual machines, required resource information of multiple preset functions, and information on the number of required virtual machines.
[0057] Exemplarily, the resource information includes memory resources, processing resources (CPU), and disk size information.
[0058] Step S3012: Determine available resource information of the corresponding physical machine based on the memory resources, processing resources, and disk size information of each physical machine.
[0059] In some optional implementations, the above step S3012 includes:
[0060] Step a1, performing interval processing on the memory resources, processing resources and disk size information of each physical machine respectively, and obtaining the target memory resources, target processing resources and target disk size information of the corresponding physical machine.
[0061] Exemplarily, the target memory resources of the physical machine refer to the memory resources of the physical machine after compartmentalization, the target processing resources of the physical machine refer to the processing resources of the physical machine after compartmentalization, and the target disk size information of the physical machine refers to the disk size information of the physical machine after compartmentalization. In the embodiment of the present application, because the memory, CPU, and disk sizes of the physical machine and the virtual machine are very different, in order to avoid ignoring other resources when calculating resources due to one of the resources being too large, these resources need to be compartmentalized so that the memory, CPU, and disk resources are within the same measurement interval. In the embodiment of the present application, the memory resources, processing resources, and disk size information of each physical machine are compartmentalized according to the following formula (1):
[0062]
[0063] Among them, m ju 、M ju They represent the value of one resource in a set of resources of a physical machine and the intervalized value, respectively. max 、m min Indicates the maximum and minimum values of a set of resources on a physical machine. u indicates memory, CPU, or disk. The default values of a and b are 1 and 2.
[0064] Step a2: Dimensionally merge the target memory resources, target processing resources, and target disk size information of each physical machine to obtain available resource information of the corresponding physical machine.
[0065] For example, in the embodiment of the present application, in order to balance the load of physical machines in the resource pool, the physical machine to which the virtual machine is mapped needs to measure the available resource size of the physical machine in the resource pool. In order to more simply and effectively measure the machine resource size, the embodiment of the present application combines the three dimensions of memory, CPU, and disk into one dimension based on interval data. j The calculation formula is shown in formula (2):
[0066]
[0067] in, represents the initial available resources of the jth physical machine after partitioning of memory, CPU, and disk, K represents the number of physical machines, M jm 、M jc 、M jd Indicates the remaining available memory, CPU, and disk resources of the j-th physical machine after compartmentalization.
[0068] Step S3013: Determine required resource information of the corresponding virtual machine based on the memory resources, processing resources, and disk size information of each virtual machine.
[0069] In some optional implementations, the above step S3013 includes:
[0070] Step b1, performing interval processing on the memory resources, processing resources and disk size information of each virtual machine respectively, and obtaining the target memory resources, target processing resources and target disk size information of the corresponding virtual machine.
[0071] Exemplarily, the target memory resource of the virtual machine refers to the memory resource of the virtual machine after the compartmentalization, the target processing resource of the virtual machine refers to the processing resource of the virtual machine after the compartmentalization, and the target disk size information of the virtual machine refers to the disk size information of the virtual machine after the compartmentalization. In the embodiment of the present application, the memory resource, processing resource and disk size information of each virtual machine are compartmentalized by the following formula (3):
[0072]
[0073] Among them, v ju 、V ju Indicates the value of one of the resources in a set of virtual machine resources, the interval value, v max 、v min Indicates the maximum and minimum values of a set of virtual machine resources.
[0074] The embodiment of the present application uses intervalization rather than normalization to process memory, CPU, and disk resource data in order to avoid the value of small resources being close to 0 after data processing, so that the proportion of such resources in the machine is ignored when measuring the available resources of the physical machine and the required resources of the virtual machine.
[0075] Step b2: Dimensionally merge the target memory resources, target processing resources, and target disk size information of each virtual machine to obtain the required resource information of the corresponding virtual machine.
[0076] For example, in the embodiment of the present application, when a virtual machine maps a physical machine, in order to improve the resource utilization of the physical machine, it is also necessary to know the resource size required by the virtual machine. u The calculation formula is shown in formula (4):
[0077]
[0078] Among them, v um 、v ic 、v id Indicates the memory, CPU, and disk size of the i-th virtual machine after compartmentalization.
[0079] Step S302: Determine the preset function that matches each virtual machine based on the required resource information of each preset function, the number of virtual machines required, and the required resource information of each virtual machine. Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.
[0080] Step S303 , based on the required resource information of each virtual machine, the matched preset function and the available resource information of each physical machine, different virtual machines are mapped to corresponding physical machines respectively to obtain a mapping result.
[0081] Specifically, the above step S303 includes:
[0082] Step S3031: sort multiple virtual machines based on the required resource information of each virtual machine to obtain a first sorting result.
[0083] Illustratively, in an embodiment of the present application, when a virtual machine is mapped to a physical machine, multiple virtual machines are sorted based on required resource information of each virtual machine to obtain a first sorting result.
[0084] Step S3032: sort the multiple physical machines based on the available resource information of each physical machine to obtain a second sorting result.
[0085] Exemplarily, in an embodiment of the present application, multiple physical machines are sorted based on available resource information of each physical machine to facilitate subsequent virtual machine mapping.
[0086] Step S3033: Map different virtual machines to corresponding physical machines based on the first sorting result, the second sorting result, and the preset functions matched by each virtual machine to obtain a mapping result.
[0087] For example, in the present application, in an embodiment, a flowchart of mapping a virtual machine to a physical machine may be as follows: Figure 4 As shown. To reduce the amount of calculation in the mapping process, the available resources of the physical machine are sorted in the first and even rounds of mapping. The first round of mapping can be understood as mapping the first virtual machine, the second round can be understood as mapping the second virtual machine, and so on. To ensure the performance of the physical machine, in each round (L represents the number of rounds) of mapping, when the available amount of physical machine resources in the resource pool is less than b% (b can be set according to demand), this physical machine will no longer participate in the virtual machine mapping. To ensure high availability of deployment, virtual machines with the same preset functions are preferentially deployed to different physical machines in the resource pool during the mapping process. When there are virtual machines with the same functions in the mapped physical machines, this virtual machine will be allocated to the next physical machine until it is mapped to a physical machine without a virtual machine with the same function.
[0088] Step S304: Allocate physical machine resources based on the mapping result. Figure 1Step S204 of the illustrated embodiment will not be described in detail here.
[0089] The embodiment of the present application maps the virtual machine to the physical machine according to the required resources of the virtual machine and the available resources of the physical machine re-measured based on the intervalized data and the label of the virtual machine. In the first round and even rounds of the mapping process, the re-measured available resources of the physical machine are sorted, thereby balancing the allocation of physical machine resources and reducing the amount of calculation.
[0090] In this embodiment, a physical machine resource allocation device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0091] This embodiment provides a physical machine resource allocation device, such as Figure 5 As shown, including:
[0092] An acquisition module 501 is used to acquire required resource information of multiple virtual machines, available resource information of multiple physical machines, required resource information of multiple preset functions, and quantity information of required virtual machines;
[0093] A determination module 502 is used to determine the preset function matched by each virtual machine based on the required resource information of each preset function, the number of required virtual machines and the required resource information of each virtual machine;
[0094] A mapping module 503 is used to map different virtual machines to corresponding physical machines based on the required resource information of each virtual machine, the matching preset function and the available resource information of each physical machine to obtain a mapping result;
[0095] The allocation module 504 is used to allocate physical machine resources based on the mapping result.
[0096] In some optional implementations, the determining module 502 includes:
[0097] A first determination submodule is used to classify multiple virtual machines based on required resource information of each virtual machine, and determine multiple classification sets and the number of virtual machines in each classification set;
[0098] A second determination submodule is used to determine a classification set matching the corresponding preset function based on the required resource information of each preset function, the number of virtual machines required, and the number of virtual machines in each classification set;
[0099] The third determination submodule is used to determine the preset function matched by each virtual machine based on the classification set matched by each preset function.
[0100] In some optional implementations, the acquisition module 501 includes:
[0101] An acquisition submodule is used to acquire resource information of multiple physical machines, resource information of multiple virtual machines, required resource information of multiple preset functions, and quantity information of required virtual machines, wherein the resource information includes memory resources, processing resources, and disk size information;
[0102] A fourth determination submodule is used to determine available resource information of a corresponding physical machine based on memory resources, processing resources, and disk size information of each physical machine;
[0103] The fifth determination submodule is used to determine the required resource information of the corresponding virtual machine based on the memory resources, processing resources and disk size information of each virtual machine.
[0104] In some optional implementations, the fourth determining submodule includes:
[0105] The first processing unit is used to perform interval processing on the memory resources, processing resources and disk size information of each physical machine respectively, and obtain the target memory resources, target processing resources and target disk size information of the corresponding physical machine;
[0106] The second processing unit is used to perform dimension merging processing on the target memory resources, target processing resources and target disk size information of each physical machine to obtain available resource information of the corresponding physical machine.
[0107] In some optional implementations, the fifth determining submodule includes:
[0108] The third processing unit is used to perform interval processing on the memory resources, processing resources and disk size information of each virtual machine respectively, and obtain the target memory resources, target processing resources and target disk size information of the corresponding virtual machine;
[0109] The fourth processing unit is used to perform dimension merging processing on the target memory resources, target processing resources and target disk size information of each virtual machine to obtain the required resource information of the corresponding virtual machine.
[0110] In some optional implementations, the mapping module 503 includes:
[0111] A first sorting submodule, used to sort the multiple virtual machines based on the required resource information of each virtual machine to obtain a first sorting result;
[0112] A second sorting submodule, used to sort the multiple physical machines based on the available resource information of each physical machine to obtain a second sorting result;
[0113] The mapping submodule is used to map different virtual machines to corresponding physical machines based on the first sorting result, the second sorting result and the preset functions matched by each virtual machine to obtain a mapping result.
[0114] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0115] The physical machine resource allocation device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0116] The embodiment of the present invention also provides a computer device having the above Figure 5 The physical machine resource allocation device is shown.
[0117] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0118] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0119] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0120] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0121] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0122] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0123] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0124] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0125] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for allocating physical machine resources, characterized in that: The method comprises: Obtaining required resource information of multiple virtual machines, available resource information of multiple physical machines, required resource information of multiple preset functions, and quantity information of required virtual machines; Determine the preset function that matches each virtual machine based on the required resource information of each preset function, the required number of virtual machines, and the required resource information of each virtual machine; Based on the required resource information of each virtual machine, the matching preset functions and the available resource information of each physical machine, different virtual machines are mapped to corresponding physical machines to obtain mapping results; Physical machine resources are allocated based on the mapping result.
2. The method according to claim 1, characterized in that The step of determining the preset function matched by each virtual machine based on the required resource information of each preset function, the required number information of virtual machines and the required resource information of each virtual machine includes: Classifying the multiple virtual machines based on the required resource information of each virtual machine, determining multiple classification sets and the number of virtual machines in each classification set; Determine a classification set matching the corresponding preset function based on the required resource information of each preset function, the required number of virtual machines, and the number of virtual machines in each classification set; The preset functions matched by each virtual machine are determined based on the classification set matched by each preset function.
3. The method according to claim 1, characterized in that The step of obtaining required resource information of multiple virtual machines, available resource information of multiple physical machines, required resource information of multiple preset functions, and required number information of virtual machines includes: Obtain resource information of multiple physical machines, resource information of multiple virtual machines, required resource information of multiple preset functions, and quantity information of required virtual machines, wherein the resource information includes memory resources, processing resources, and disk size information; Determine available resource information of the corresponding physical machine based on the memory resources, processing resources, and disk size information of each physical machine; Based on the memory resources, processing resources, and disk size information of each virtual machine, required resource information of the corresponding virtual machine is determined.
4. The method according to claim 3, characterized in that The step of determining the available resource information of the corresponding physical machine based on the memory resources, processing resources and disk size information of each physical machine includes: Performing interval processing on the memory resources, processing resources and disk size information of each physical machine respectively, to obtain target memory resources, target processing resources and target disk size information of the corresponding physical machine; The target memory resources, target processing resources, and target disk size information of each physical machine are dimensionally merged to obtain the available resource information of the corresponding physical machine.
5. The method according to claim 3, characterized in that: The step of determining the required resource information of the corresponding virtual machine based on the memory resources, processing resources and disk size information of each virtual machine includes: Performing interval processing on the memory resources, processing resources and disk size information of each virtual machine respectively to obtain target memory resources, target processing resources and target disk size information of the corresponding virtual machine; The target memory resources, target processing resources and target disk size information of each virtual machine are dimensionally merged to obtain the required resource information of the corresponding virtual machine.
6. The method according to any one of claims 1 to 5, characterized in that: The steps of mapping different virtual machines to corresponding physical machines based on the required resource information of each virtual machine, the matching preset functions and the available resource information of each physical machine to obtain the mapping results include: Sorting the multiple virtual machines based on the required resource information of each virtual machine to obtain a first sorting result; Sorting the multiple physical machines based on available resource information of each physical machine to obtain a second sorting result; Based on the first sorting result, the second sorting result and the preset functions matched by each virtual machine, different virtual machines are respectively mapped to corresponding physical machines to obtain a mapping result.
7. A physical machine resource allocation device, characterized in that: The device comprises: An acquisition module, used to acquire required resource information of multiple virtual machines, available resource information of multiple physical machines, required resource information of multiple preset functions, and quantity information of required virtual machines; A determination module, used to determine the preset function matched by each virtual machine based on the required resource information of each preset function, the number of required virtual machines and the required resource information of each virtual machine; A mapping module, used to map different virtual machines to corresponding physical machines based on the required resource information of each virtual machine, the matching preset functions and the available resource information of each physical machine, to obtain a mapping result; An allocation module is used to allocate physical machine resources based on the mapping result.
8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the physical machine resource allocation method according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the physical machine resource allocation method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to cause a computer to execute the physical machine resource allocation method according to any one of claims 1 to 6.