Virtual machine allocation method and device, electronic equipment and computer storage medium
By generating a CPU utilization model and dynamically allocating virtual machines, the problem of resource waste in the resource pool is solved, achieving the best energy-saving effect by minimizing the number of physical machines and maximizing resource utilization.
Patent Information
- Application Number
- CN202111474161.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-03
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2041-12-03
AI Technical Summary
In existing technologies, the virtual machine allocation method in the resource pool leads to low resource utilization during off-peak periods, resulting in resource waste, and it is difficult to achieve the best energy-saving effect between minimizing the number of physical machines and maximizing resource utilization.
By obtaining the CPU utilization of the deployment unit, a runtime metric model is generated to determine the number of virtual machines required to run at each point in time. Under the condition of satisfying the resource pool and virtual machine constraints, virtual machines are dynamically allocated to achieve the target CPU utilization and reasonable value.
It achieves optimal energy saving by minimizing the number of physical machines and maximizing resource utilization, and dynamically adjusts the number of virtual machines to optimize resource utilization and reduce resource waste.
Smart Images

Figure CN114138417B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a virtual machine allocation method and device, electronic equipment and computer storage medium. BACKGROUND
[0002] In the face of increasing data volume, the scale of the resource pool is also growing larger, and most application systems are built on the resource pool architecture. The existing production environment can be roughly divided into the following aspects:
[0003] (1) Taking a single application resource pool cluster as an example, the resource pool computing resources have been close to the end of allocation;
[0004] (2) The application system deployment unit contained in the resource pool is 3N architecture (N = 1 / 2 / 3…);
[0005] (3) The CPU utilization of some application deployment unit virtual machines is low (such as less than 20%) throughout the period;
[0006] (4) The CPU utilization of some application deployment unit virtual machines is in a fixed period (such as the CPU utilization of the online deployment unit during the day is within a reasonable range, and is low at night; the CPU utilization of the batch deployment unit is high during the batch period, and is low during other periods);
[0007] (5) The peak time period of the CPU utilization of some application deployment unit virtual machines is not fixed, which is determined by the operation time of the business personnel.
[0008] During the operation of the application system, the above situations exist more or less. At present, the resource application of most applications is basically based on the peak period of business volume, so there is a phenomenon of low resource utilization during the low peak period of business, resulting in unnecessary waste of resources. SUMMARY
[0009] Therefore, the present application provides a virtual machine allocation method, device, electronic equipment and computer storage medium, which can effectively and reasonably allocate virtual machines, thereby achieving the best energy-saving effect under the premise of minimizing the number of physical machines and maximizing resource utilization.
[0010] The first aspect of the present application provides a virtual machine allocation method, comprising:
[0011] For each deployment unit, the central processing unit utilization of the deployment unit within a first preset time is obtained;
[0012] generate a running index model of the central processor of the deployment unit according to the central processor utilization of the deployment unit within a first preset time; wherein the running index model of the central processor of the deployment unit comprises the central processor utilization of each time point within the first preset time;
[0013] determine the number of virtual machines needed to run at the time point according to the central processor utilization corresponding to each time point in the running index model of the central processor of the deployment unit.
[0014] Optionally, the determining the number of virtual machines needed to run at the time point according to the central processor utilization corresponding to each time point in the running index model of the central processor of the deployment unit comprises:
[0015] determining the constraint relationship between the resource pool and the virtual machine;
[0016] determining the target central processor utilization under the condition of meeting the constraint relationship between the resource pool and the virtual machine;
[0017] determining the reference central processor utilization corresponding to the central processor utilization corresponding to each time point in the running index model of the central processor of the deployment unit;
[0018] determining the number of virtual machines needed to run at the time point according to the target central processor utilization, the reference central processor utilization and the reasonable value of the central processor utilization.
[0019] Optionally, after the generating the running index model of the central processor of the deployment unit according to the central processor utilization of the deployment unit within a first preset time, the method further comprises:
[0020] predicting the central processor utilization of the future time point and generating a future running index model of the central processor of the deployment unit.
[0021] Optionally, the virtual machine allocation method further comprises:
[0022] predicting the central processor utilization of the future time point and generating a future running index model of the central processor of the deployment unit.
[0023] The second aspect of the application provides a virtual machine allocation device, comprising:
[0024] an acquisition unit configured to acquire, for each deployment unit, the central processor utilization of the deployment unit within a first preset time;
[0025] The first generation unit is configured to generate a CPU operation index model of the deployment unit based on the CPU utilization of the deployment unit within a first preset time period; wherein the CPU operation index model of the deployment unit includes the CPU utilization at each time point within the first preset time period.
[0026] The determining unit is used to determine the number of virtual machines that need to be run at each time point based on the CPU utilization rate at each time point in the CPU operation index model of the deployment unit.
[0027] Optionally, the determining unit includes:
[0028] The first determining subunit is used to determine the constraint relationship between the resource pool and the virtual machine;
[0029] The second determining subunit is used to determine the target CPU utilization rate under the condition that the constraint relationship between the resource pool and the virtual machine is satisfied.
[0030] The third determining subunit is used to determine the reference CPU utilization corresponding to the CPU utilization at each time point in the CPU operation index model of the deployment unit.
[0031] The fourth determining subunit is used to determine the number of virtual machines that need to be run at the time point based on the target CPU utilization, the reference CPU utilization, and a reasonable value of CPU utilization.
[0032] Optionally, the virtual machine allocation device further includes:
[0033] The second generation unit is used to predict the CPU utilization at future points in time and generate a future operating index model of the CPU of the deployment unit.
[0034] Optionally, the virtual machine allocation device further includes:
[0035] The determining unit is further configured to determine the number of virtual machines to be run at each future time point based on the CPU utilization rate corresponding to each future time point in the CPU operation index model of the deployment unit.
[0036] A third aspect of this application provides an electronic device, comprising:
[0037] One or more processors;
[0038] A storage device on which one or more programs are stored;
[0039] The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method for allocating a virtual machine according to any one of the first aspect.
[0040] The fourth aspect of the present application provides a computer storage medium, which stores a computer program, wherein the computer program is executed by a processor to implement the method for allocating a virtual machine according to any one of the first aspect.
[0041] From the above solution, the present application provides a method, device, electronic equipment and computer storage medium for allocating a virtual machine. The method for allocating a virtual machine comprises the following steps: firstly, for each deployment unit, the central processor utilization rate of the deployment unit within a first preset time is obtained; then, according to the central processor utilization rate of the deployment unit within the first preset time, a running index model of the central processor of the deployment unit is generated; wherein the running index model of the central processor of the deployment unit comprises the central processor utilization rate at each time point within the first preset time; finally, for the central processor utilization rate corresponding to each time point in the running index model of the central processor of the deployment unit, the number of virtual machines required to run at the time point is determined. Thus, the virtual machines can be effectively and reasonably allocated, and the best energy-saving effect is achieved under the premise of minimizing the number of physical machines and maximizing resource utilization. BRIEF DESCRIPTION OF DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor on the basis of the provided drawings.
[0043] Figure 1 A specific flowchart of a method for allocating a virtual machine provided by an embodiment of the present application is provided.
[0044] Figure 2 A schematic diagram of a running index model of a central processor of a deployment unit provided by another embodiment of the present application is provided.
[0045] Figure 3 A flowchart of a method for determining the number of virtual machines required to run at the time point provided by another embodiment of the present application is provided.
[0046] Figure 4 A schematic diagram of a virtual machine allocation device provided by another embodiment of the present application is provided.
[0047] Figure 5A schematic diagram of a determining unit provided for another embodiment of this application;
[0048] Figure 6 This is a schematic diagram of an electronic device that implements a virtual machine allocation method, as provided in another embodiment of this application. Detailed Implementation
[0049] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0050] It should be noted that the concepts of "first," "second," etc., mentioned in this application are used only to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0051] First, the terms appearing in this application will be explained:
[0052] Resource pools: Resource pools are a configuration mechanism used to partition host resources. Each host has a default resource pool, and all processes are initially bound to this resource pool. Newly created resource pools will obtain processors from the default pool. A host can be divided into multiple resource pools.
[0053] Data analysis refers to the process of analyzing large amounts of collected data using appropriate statistical analysis methods, summarizing, understanding, and digesting the data to maximize its functionality and effectiveness. Data analysis is the process of detailed study and summarization of data to extract useful information and draw conclusions.
[0054] Dynamic allocation refers to a method of allocating or reclaiming resource space dynamically during program execution. Unlike static resource allocation methods such as arrays, which require pre-allocation of resource space, dynamic allocation is performed by the system in real time according to the program's needs, and the allocated size is exactly the size required by the program.
[0055] Cloud computing refers to the network cloud through the huge data computing processing program is decomposed into countless small programs, and then through the system composed of multiple servers to process and analyze the small program to get the result and return to the user. Through cloud computing, the processing of tens of thousands of data can be completed in a very short time (a few seconds), so as to achieve powerful network service.
[0056] The embodiment of the application provides a virtual machine allocation method, as shown in the figure, specifically comprising the following steps: Figure 1
[0057] S101, for each deployment unit, obtaining the central processing unit utilization rate of the deployment unit within a first preset time.
[0058] The first preset time can be set, changed by a technician or a relevant authorized staff, which is not limited here. The central processing unit (CPU) utilization rate can be but is not limited to obtained through a cloud management platform. The cloud management platform can obtain the CPU utilization rate of the virtual machine at a second level, and can directly obtain the interface.
[0059] S102, generating a central processing unit running index model of the deployment unit according to the central processing unit utilization rate of the deployment unit within the first preset time.
[0060] The central processing unit running index model of the deployment unit includes the central processing unit utilization rate at each time point within the first preset time.
[0061] As shown in the figure, the obtained central processing unit utilization rate of the deployment unit within the first preset time is analyzed and integrated to generate the central processing unit running index model of the deployment unit. Figure 2
[0062] S103, determining the number of virtual machines required to run at each time point corresponding to the central processing unit utilization rate in the central processing unit running index model of the deployment unit.
[0063] Optionally, in another embodiment of the application, an embodiment of step S103, as shown in the figure, comprises: Figure 3
[0064] S301, determining the constraint relationship between the resource pool and the virtual machine.
[0065] Suppose that the resource pool vector in the cloud computing environment is Z=(z1,...,z k ), the virtual machine vector is V=(v1,...,v m ), and the virtual machine placement bit vector on the resource pool is L=(l i1 ,...lik )。
[0066] wherein, l ij =1 means that the virtual machine v j is placed on the resource pool z i R a represents the CPU demand of each virtual machine, C p represents the CPU size of each resource pool, R n represents the memory demand of each virtual machine, C n represents the memory size of each resource pool. Then, the constraint relationship between the resource pool and the virtual machine is:
[0067]
[0068] S302, under the condition of meeting the constraint relationship between the resource pool and the virtual machine, determining the target central processor utilization.
[0069] In the specific implementation process of the present application, the following function can be used to determine the target central processor utilization:
[0070]
[0071] wherein, Minimize represents the optimal virtual machine resource, u i represents the CPU utilization, v j represents the virtual machine resource vector to be allocated, l ij =1 means that the virtual resource v j is allocated on the physical resource z i .
[0072] On the basis of the constraint condition of the virtual machine resource placement established in step S301, the optimal virtual machine resource allocation scheme is obtained by solving the constraint condition, and then the allocation from the physical resource to the virtual resource is developed and implemented based on the optimal virtual machine resource allocation scheme, thereby realizing the optimal allocation of cloud computing resources.
[0073] S303, for each time point corresponding to the central processor utilization in the running index model of the central processor of the deployment unit, determining the reference central processor utilization corresponding to the central processor utilization corresponding to the time point.
[0074] It should be noted that each virtual machine CPU utilization will have a safety boundary, so it is necessary to determine the reference central processor utilization corresponding to the central processor utilization corresponding to each time point. The reference central processor utilization is the utilization rate that meets the safety boundary.
[0075] S304, determining the number of virtual machines needed to run at the time point according to the target CPU utilization rate, the reference CPU utilization rate and the reasonable value of the CPU utilization rate.
[0076] The reasonable value of the CPU utilization rate is a reasonable range of CPU utilization rate uniformly formulated by system operation and maintenance specifications.
[0077] For example, when the CPU utilization rate of a virtual machine is 75%, which is the safe boundary, and there are 9 virtual machines in a deployment unit, when the CPU utilization rate interval is 10-20%, and the method in the present application is not used, the number of virtual machines for load balancing within a deployment unit is 3, and the following calculation formula can be used to calculate the actual number of virtual machines needed to run S p :
[0078]
[0079] Wherein, V represents the number of virtual machines, C cpu represents the reference CPU utilization rate, P cpu represents the reasonable value of the CPU utilization rate, M cpu represents the target CPU utilization rate. The final data can be shown in Table 1:
[0080]
[0081]
[0082] Table 1
[0083] In the specific implementation process of the present application, the CPU utilization rate at future time points can also be predicted, and a running index model is also generated, that is, a future running index model of the CPU of the deployment unit is generated. And the calculation method of the above embodiment is used to calculate the number of virtual machines needed to run at the future time point.
[0084] According to the number of virtual machines needed to run at the current (or future) time point, the automatic operation and maintenance platform is dispatched, so as to dynamically close and start the virtual machines at each time point, and achieve the purpose of dynamically allocating computing resources. Further, the system with low CPU utilization rate can close part of the virtual machine servers for a long time, and the system with time regularity of CPU utilization rate can reduce the capacity by mistake. The following effects can be achieved:
[0085] (1) After the stable operation of the strategy, at least 1 / 3 of the current computing resources can be released, and the released resources can be reallocated and used;
[0086] (2) When the traffic grows to the expected time of the application system applying for resources, the closed virtual machine can be started directly, saving the time of recycling resources and then allocating, and improving the efficiency.
[0087] From the above scheme, the application provides a virtual machine allocation method: first, for each deployment unit, the central processor utilization of the deployment unit within the first preset time is obtained; then, according to the central processor utilization of the deployment unit within the first preset time, a running index model of the central processor of the deployment unit is generated; wherein the running index model of the central processor of the deployment unit includes the central processor utilization at each time point within the first preset time; finally, for the central processor utilization corresponding to each time point in the running index model of the central processor of the deployment unit, the number of virtual machines required to run at the time point is determined. Thus, the virtual machines can be effectively and reasonably allocated, and the best energy-saving effect is achieved under the premise of minimizing the number of physical machines and maximizing resource utilization.
[0088] Another embodiment of the application provides a virtual machine allocation device, as shown in Figure 4 , specifically comprising:
[0089] The acquisition unit 401 is configured to obtain, for each deployment unit, the central processor utilization of the deployment unit within the first preset time.
[0090] The first generation unit 402 is configured to generate, according to the central processor utilization of the deployment unit within the first preset time, a running index model of the central processor of the deployment unit.
[0091] The running index model of the central processor of the deployment unit includes the central processor utilization at each time point within the first preset time.
[0092] The determination unit 403 is configured to determine, for the central processor utilization corresponding to each time point in the running index model of the central processor of the deployment unit, the number of virtual machines required to run at the time point.
[0093] The specific working process of the units disclosed in the above embodiments of the application can be referred to the corresponding method embodiments, as shown in Figure 1 , which will not be described here.
[0094] Optionally, in another embodiment of the application, one embodiment of the determination unit 403 includes Figure 5 , as shown in
[0095] The first determination sub-unit 501 is configured to determine the constraint relationship between the resource pool and the virtual machine.
[0096] The second determining sub-unit 502 is configured to determine the target CPU utilization rate under the condition that the constraint relationship between the resource pool and the virtual machine is satisfied.
[0097] The third determining sub-unit 503 is configured to determine, for the CPU utilization rate corresponding to each time point in the running index model of the CPU of the deployment unit, a reference CPU utilization rate corresponding to the CPU utilization rate of the time point.
[0098] The fourth determining sub-unit 504 is configured to determine the number of virtual machines required to run at the time point according to the target CPU utilization rate, the reference CPU utilization rate, and the reasonable value of the CPU utilization rate.
[0099] The specific working process of the units disclosed in the above embodiments of the present application can be referred to the corresponding method embodiment contents, such as Figure 3 as shown, which will not be described here.
[0100] Optionally, in another embodiment of the present application, an embodiment of the virtual machine allocation apparatus further includes:
[0101] The second generating unit is configured to predict the CPU utilization rate at the future time point and generate a future running index model of the CPU of the deployment unit.
[0102] The specific working process of the units disclosed in the above embodiments of the present application can be referred to the corresponding method embodiment contents, which will not be described here.
[0103] Optionally, in another embodiment of the present application, the determining unit 403 is further configured to determine, for the CPU utilization rate corresponding to each future time point in the running index model of the CPU of the deployment unit, the number of virtual machines required to run at the future time point.
[0104] The specific working process of the units disclosed in the above embodiments of the present application can be referred to the corresponding method embodiment contents, which will not be described here.
[0105] From the above scheme, the application provides a virtual machine allocation apparatus: first, the acquisition unit 401 acquires the central processor utilization of each deployment unit in the first preset time; then, the first generation unit 402 generates the running index model of the central processor of the deployment unit according to the central processor utilization of the deployment unit in the first preset time; wherein the running index model of the central processor of the deployment unit includes the central processor utilization of each time point in the first preset time; finally, the determination unit 403 determines the number of virtual machines required to run at each time point in the running index model of the central processor of the deployment unit according to the central processor utilization corresponding to the time point. Thus, the virtual machine can be effectively and reasonably allocated, and the best energy-saving effect is achieved under the premise of minimizing the number of physical machines and maximizing resource utilization.
[0106] Another embodiment of the application provides an electronic device, as shown in the figure, comprising: Figure 6
[0107] One or more processors 601.
[0108] Storage device 602, one or more programs are stored on the storage device 602.
[0109] When the one or more programs are executed by the one or more processors 601, the one or more processors 601 implement the virtual machine allocation method as described in any one of the above embodiments.
[0110] Another embodiment of the application provides a computer storage medium, which stores a computer program, wherein the computer program is executed by a processor to implement the virtual machine allocation method as described in any one of the above embodiments.
[0111] In the above-described embodiments of the present disclosure, it should be understood that the disclosed apparatus and method can also be implemented in other manners. The above-described apparatus and method embodiments are merely exemplary but are not intended to limit the present disclosure. For example, the flowcharts and block diagrams in the accompanying drawings merely show the possible implementation manners of the apparatus, method and computer program product according to the present disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a segment or a portion of code which comprises one or more executable instructions for implementing the specified logic function. It should also be noted that in some alternative implementation manners, the functions described in the blocks can be performed in a different order from that described in the accompanying drawings. For example, the two consecutive blocks can actually be executed in parallel, or they can be executed in reverse order according to the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts and combinations thereof can be implemented by a dedicated hardware-based system that performs specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0112] In addition, each functional module in the various embodiments of the present disclosure can be integrated together to form a separate part, or each module can exist independently, or two or more modules can be integrated to form a separate part. When the functions are realized in the form of software functional modules and sold or used as separate products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present disclosure. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0113] The skilled person can implement or use the present application. Various modifications to the embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for allocating virtual machines, characterized in that, include: For each deployment unit, the CPU utilization rate of the deployment unit within a first preset time period is obtained; Based on the CPU utilization of the deployment unit within a first preset time period, a CPU operation index model for the deployment unit is generated; wherein, the CPU operation index model for the deployment unit includes the CPU utilization at each time point within the first preset time period. For each time point in the CPU utilization rate corresponding to the CPU operation index model of the deployment unit, determine the number of virtual machines that need to run at that time point. The CPU utilization rate at each time point in the CPU operation metric model for the deployment unit, used to determine the number of virtual machines required to run at that time point, includes: Determine the constraints between the resource pool and the virtual machines; Determine the target CPU utilization rate while satisfying the constraints between the resource pool and the virtual machine; For each time point in the CPU operation index model of the deployment unit, determine the reference CPU utilization corresponding to the CPU utilization at that time point. The number of virtual machines required to run at the specified time point is determined based on the target CPU utilization, the reference CPU utilization, and a reasonable value for CPU utilization.
2. The allocation method according to claim 1, characterized in that, After generating the CPU performance model of the deployment unit based on the CPU utilization of the deployment unit within a first preset time period, the method further includes: The utilization rate of the central processing unit at future points in time is predicted, and a future operating metric model of the central processing unit of the deployment unit is generated.
3. The allocation method according to claim 2, characterized in that, Also includes: For each future time point in the CPU utilization rate of the CPU in the CPU operation index model of the deployment unit, determine the number of virtual machines that need to be run at that future time point.
4. A virtual machine allocation device, characterized in that, include: The acquisition unit is used to acquire the CPU utilization rate of each deployment unit within a first preset time period. The first generation unit is configured to generate a CPU operation index model of the deployment unit based on the CPU utilization of the deployment unit within a first preset time period; wherein the CPU operation index model of the deployment unit includes the CPU utilization at each time point within the first preset time period. A determining unit is used to determine the number of virtual machines that need to be run at each time point based on the CPU utilization rate at each time point in the CPU operation index model of the deployment unit. The determining unit includes: The first determining subunit is used to determine the constraint relationship between the resource pool and the virtual machine; The second determining subunit is used to determine the target CPU utilization rate under the condition that the constraint relationship between the resource pool and the virtual machine is satisfied. The third determining subunit is used to determine the reference CPU utilization corresponding to the CPU utilization at each time point in the CPU operation index model of the deployment unit. The fourth determining subunit is used to determine the number of virtual machines that need to be run at the time point based on the target CPU utilization, the reference CPU utilization, and a reasonable value of CPU utilization.
5. The dispensing device according to claim 4, characterized in that, Also includes: The second generation unit is used to predict the CPU utilization at future points in time and generate a future operating index model of the CPU of the deployment unit.
6. The dispensing device according to claim 5, characterized in that, Also includes: The determining unit is further configured to determine the number of virtual machines to be run at each future time point based on the CPU utilization rate corresponding to each future time point in the CPU operation index model of the deployment unit.
7. An electronic device, characterized in that, include: One or more processors; A storage device on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the virtual machine allocation method as described in any one of claims 1 to 3.
8. A computer storage medium, characterized in that, It stores a computer program, wherein the computer program, when executed by a processor, implements the virtual machine allocation method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Device and method for determining operation for adjusting number of virtual machines
CN106170767A
Application cluster capacity reduction method and device
CN110008000A