Server resource dynamic allocation method and device, equipment and medium
By dynamically adjusting the reserved resources of virtualization services when creating virtual machines and allocating them to Numa nodes, the problem of waste and reserved resources in the performance guarantee of virtual machines in the existing technology is solved, and more efficient resource utilization and virtual machine creation success rate is achieved.
Patent Information
- Application Number
- CN202411746280.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-04-11
AI Technical Summary
In the performance guarantee of virtual machine, the existing technology has problems such as wasting resources and the reserved resources cannot be dynamically adjusted, resulting in problems such as high CPU load and energy consumption.
By setting a minimum resource reservation, the amount of virtualization service reserved resources is calculated when virtual machine creation is created, and reserved resources are dynamically adjusted to meet the performance needs of virtual machines, allocating resources to the Numa node to create a virtual machine.
It improves the success rate of virtual machine creation, improves the resource utilization rate of servers, and reduces resource waste and energy consumption.
Smart Images

Figure CN119806802A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cloud computing, and in particular to a method, device, equipment and medium for dynamically allocating server resources. Background Art
[0002] In cloud computing scenarios, users can obtain more convenient and flexible computing resources by using virtual machines (VMs). While providing users with high-performance virtual machines, cloud service providers must also consider how to maximize the use of server resources to achieve cost savings and green and low-carbon goals.
[0003] Currently, the main ways to ensure virtual machine performance include resource isolation and various virtualization acceleration technologies (DPDK optimizes virtual network performance, SPDK optimizes virtual machine storage performance, and Numa affinity optimizes computing performance). The objects of resource isolation include the resources consumed by the server operating system, the resources consumed by virtualization and virtual machine management services, the resources consumed by the network acceleration component DPDK, the resources consumed by the storage acceleration component SPDK, and the resources that each virtual machine needs to provide to users.
[0004] like Figure 1 As shown, the solution of the prior art is: (1) Based on experience, various virtualization reserved resources (system, control, DPDK, SPDK) are evaluated; taking the Intel Icelake 38-core dual-core server as an example, the operating system reserves 2 threads, the control service reserves 2 threads, the DPDK reserves 18 threads, and the SPDK reserves 16 threads. The server reserved resources may be as high as 38 threads (25%); (2) Various virtualization resources are restricted and isolated through technologies such as binding cores (CPU Pin) and cgroup to ensure the performance of virtualization services; (3) User virtual machine resources are allocated through technologies such as Numa averaging, Numa affinity, and CPU Pin to ensure virtual machine performance.
[0005] However, the existing technologies have the following deficiencies: (1) The reserved resources required for virtualization services are estimated based on experience. In order to ensure performance, they are generally estimated and reserved based on the maximum amount of resources required by the virtual machines on the server. In practice, this results in resource waste, inflated CPU load (DPDK / SPDK runs at full CPU by default), and energy waste. (2) All resource reservations are determined during the server deployment phase. However, the creation of virtual machines is dynamic, and creation failures often occur due to insufficient Numa resources. There is a lack of a mechanism for dynamically adjusting reserved resources. Summary of the invention
[0006] In view of this, the present invention provides a method, apparatus, device and medium for dynamically allocating server resources to solve the problem of resource waste caused by estimating and reserving the maximum amount of resources required by the virtual machines on the server.
[0007] In a first aspect, the present invention provides a method for dynamically allocating server resources, the method comprising:
[0008] Set minimum resource reservation;
[0009] When a virtual machine creation request is received, the reserved resources for the virtualization service are calculated, and the reserved resources include the reserved CPU resources and the reserved memory resources;
[0010] If the amount of virtualization service reserved resources cannot meet the performance requirements of the virtual machine, the amount of reserved resources that the virtual machine needs to increase is calculated, and the virtualization service reserved resources are dynamically increased;
[0011] Calculate the remaining resources of the server, and when the resources meet the requirements of the virtual machine, allocate resources on Numa, allocate and create the virtual machine.
[0012] The present invention sets the minimum resource reservation in the initial stage, calculates the amount of virtualization service reserved resources in the virtual machine creation stage, and dynamically adjusts the virtualization service reserved resources when the virtualization service reserved resources cannot meet the virtual machine performance requirements to meet the reserved resources required by all virtualization services, and allocates the reserved resources to Numa, thereby ensuring the performance of the virtual machine, improving the success rate of virtual machine creation, and improving the resource utilization of the server.
[0013] In an optional implementation, setting a minimum resource reservation includes:
[0014] Set the default CPU and memory reservations.
[0015] When the resource allocation rate exceeds the preset resource allocation rate threshold, the memory required by the virtual machine process is dynamically adjusted.
[0016] The present invention sets default CPU reserved resource amounts and memory reserved resource amounts to dynamically adjust the memory required by the virtualization process when the resource allocation rate exceeds a preset resource allocation rate threshold, thereby dynamically adjusting resource reservations and improving resource utilization of the server.
[0017] In an optional implementation, after setting the minimum resource reservation, the method includes:
[0018] Allocate reserved resources to each Numa node;
[0019] Start the virtualization service and set up resource isolation;
[0020] Set the resources available to the virtual machine.
[0021] The present invention distributes reserved resources to each Numa node to dynamically adjust the Numa requirements of the virtual machine, starts the virtualization service, sets resource isolation, sets virtualized available resources, and dynamically adjusts the distribution of reserved resources on Numa. When server resources are met, the success rate of virtual machine activation is improved.
[0022] In an optional implementation, calculating the amount of resources reserved for the virtualization service includes:
[0023] Calculate the amount of resources reserved for virtualization services based on the number of CPU cores, memory size, number of Numa nodes, network requirements, and storage QoS requirements required by the virtual machine.
[0024] The present invention calculates the amount of virtualization service reserved resources according to the virtual machine specifications, so as to dynamically adjust the reserved resources and improve the resource utilization of the server.
[0025] In an optional embodiment, the method further includes:
[0026] If resources cannot be allocated on each Numa, the reserved resources and services on Numa are adjusted according to the virtual machine requirements until the virtual machine requirements are met.
[0027] The present invention adjusts the resources and services reserved on Numa so that the server resources meet the requirements of the virtual machines, thereby improving the success rate of virtual machine activation.
[0028] In an optional embodiment, the method further includes:
[0029] When receiving a virtual machine destruction request, recalculate the reserved resources that can be released by the virtualization service;
[0030] Adjust the resources and services reserved on each Numa to release resources.
[0031] The present invention adjusts the resources and services reserved on each Numa and releases the resources when a virtual machine is destroyed, so as to reduce the adjustment workload when a virtual machine is created next time.
[0032] In a second aspect, the present invention provides a device for dynamically allocating server resources, the device comprising:
[0033] A setting module, used to set the minimum resource reservation;
[0034] A calculation module, used for calculating the amount of virtualization service reserved resources when receiving a virtual machine creation request, the reserved resources including the amount of CPU reserved resources and the amount of memory reserved resources;
[0035] An increasing module is used to calculate the amount of reserved resources that need to be increased for the virtual machine if the amount of reserved resources for the virtualization service cannot meet the performance requirements of the virtual machine, and dynamically increase the reserved resources for the virtualization service;
[0036] Create a module to calculate the remaining resources of the server and allocate resources on Numa when the resources meet the requirements of the virtual machine, and allocate and create the virtual machine.
[0037] 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 server resource dynamic allocation method of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0038] 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 method for dynamically allocating server resources according to the first aspect or any corresponding embodiment thereof.
[0039] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the method for dynamically allocating server resources according to the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] 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.
[0041] Figure 1 It is a schematic diagram of allocating resources in the prior art;
[0042] Figure 2 is a flow chart of a method for dynamically allocating server resources according to an embodiment of the present invention;
[0043] Figure 3 is a flow chart of an existing method for dynamically allocating server resources according to an embodiment of the present invention;
[0044] Figure 4 is a flow chart of an improved method for dynamically allocating server resources according to an embodiment of the present invention;
[0045] Figure 5 is a structural block diagram of a device for dynamically allocating server resources according to an embodiment of the present invention;
[0046] 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
[0047] 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.
[0048] First, the terms in the embodiments of the present invention are explained:
[0049] Numa: Non Uniform Memory Access, non-uniform memory access, is an architectural model about how multiple CPUs access memory. In the Numa architecture, the CPUs are divided into multiple Numa Nodes, each with its own independent memory space and PCIE bus system. The CPUs communicate with each other through the QPI bus.
[0050] DPDK: Intel Data Plane Development Kit is a data plane development tool set provided by Intel. It provides library functions and driver support for efficient user space data packet processing under the Intel architecture (IA) processor architecture. Unlike the Linux system, which is designed for general purpose, it focuses on high-performance processing of data packets in network applications.
[0051] SPDK: Storage Performance Development Kit, includes a set of drivers and a complete end-to-end storage reference architecture. SPDK provides zero-copy, high-concurrency direct access to SSDs from user mode based on the Nvme driver. Its original purpose was to optimize block storage. But with the continuous evolution of SPDK, everyone found that SPDK can optimize all aspects of the storage software stack. Many distributed storage systems are thinking about how to absorb the SPDK framework, or use the high-performance storage technology represented by SPDK to optimize the entire IO link.
[0052] According to an embodiment of the present invention, an embodiment of a method for dynamic allocation of server resources 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.
[0053] In this embodiment, a method for dynamically allocating server resources is provided. Figure 2 is a flow chart of a method for dynamically allocating server resources according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0054] Step S201, setting the minimum resource reservation.
[0055] In the embodiment of the present invention, at the initial stage, a minimum resource reservation is given, and the minimum system, management, network, and storage resource reservations CO and MO are determined.
[0056] Assume there are m cloud host flavors: F1, F2, F3, ... Fm. Each flavor contains definitions such as VCPU, MEM, BPS, PPS, IOPS, and Numa, which are set as follows:
[0057] VCPU fm MEM fm , BPS fm 、PPS fm , IOPS fm 、Numa fm .
[0058] Assume that the number of CPU threads on the host server is C, the memory is G, the bandwidth is B, and the number of Numas is N (N0, N1...N n-1 ).
[0059] The single-thread network forwarding capability on the host is P, the single-thread storage IOPS forwarding capability is I, and the required memory amount is MD per thread (about 0.5 GB).
[0060] Step S202: When a virtual machine creation request is received, the amount of resources reserved for the virtualization service is calculated.
[0061] In an embodiment of the present invention, the reserved resource amount includes the CPU reserved resource amount and the memory reserved resource amount. If it is a virtual machine creation, after receiving a virtual machine creation request, it is necessary to calculate the virtualization service reserved resource amount according to the virtual machine demand, the newly added host machine reserved resource demand, the resource reservation status of each Numa of the host machine, and the allocated status (occupancy of existing virtual machines) to meet the virtual machine creation request.
[0062] Step S203: If the amount of virtualization service reserved resources cannot meet the performance requirements of the virtual machine, the amount of reserved resources that the virtual machine needs to increase is calculated, and the virtualization service reserved resources are dynamically increased.
[0063] In the embodiment of the present invention, it is determined whether the virtualization service reserved resources can meet the virtual machine performance requirements. If the virtualization service reserved resources can meet the virtual machine performance requirements, the step of calculating the remaining resources of the server in step S104 is directly executed. If the virtualization service reserved resources cannot meet the virtual machine performance requirements, it is necessary to calculate the amount of reserved resources that the virtualization service needs to increase, and dynamically adjust the virtualization service reserved resources according to the calculation result to meet the virtual machine performance requirements.
[0064] Step S204, calculating the remaining resources of the server, and when the resources meet the requirements of the virtual machine, allocating resources on Numa, and allocating and creating the virtual machine.
[0065] In the embodiment of the present invention, when the virtualization service reserved resources can meet the virtual machine performance requirements, or the virtualization service reserved resources cannot meet the virtualization performance requirements, but after the virtualization service reserved resources are dynamically increased, it is determined whether the resource amount meets the virtual machine requirements. If the resource amount meets the virtual machine requirements and the resources can be allocated on each Numa, the virtual machine is allocated and created, and the process ends.
[0066] The server resource dynamic allocation method provided in this embodiment sets the minimum resource reservation in the initial stage, calculates the virtualization service reserved resource amount in the virtual machine creation stage, and dynamically adjusts the virtualization service reserved resources when the virtualization service reserved resource amount cannot meet the virtual machine performance requirements to meet the reserved resource amount required by all virtualization services, and allocates the reserved resources to Numa, thereby ensuring the virtual machine performance, improving the virtual machine creation success rate, and improving the server resource utilization.
[0067] In this embodiment, a method for dynamically allocating server resources is provided, and the process includes the following steps:
[0068] Step S301, setting the minimum resource reservation.
[0069] Specifically, the above step S301 includes:
[0070] Step S3011, setting the default CPU reserved resource amount and memory reserved resource amount.
[0071] Step S3012: When the resource allocation rate exceeds a preset resource allocation rate threshold, dynamically adjust the memory required by the virtual machine process.
[0072] In the embodiment of the present invention, the host operating system and management service reserve CPU CO by default and reserve memory MO by default, which is 2 threads and 4G memory at startup. When the resource allocation rate exceeds the preset resource allocation rate threshold (for example, more than 50%), it is increased to 4 threads and 8G memory.
[0073] At the same time, as the number of virtual machines increases, the memory required for the virtual machine process also needs to increase, specifically the number of virtual machines * V (memory required for a single virtual machine process).
[0074] By setting the default CPU reserved resources and memory reserved resources, when the resource allocation rate exceeds the preset resource allocation rate threshold, the memory required by the virtualization process is dynamically adjusted to dynamically adjust resource reservations and improve server resource utilization.
[0075] Step S302: Allocate the reserved resources to each Numa node.
[0076] Step S303, start the virtualization service and set resource isolation.
[0077] Step S304, setting available resources for the virtual machine.
[0078] In an embodiment of the present invention, after setting the minimum resource reservation, the reserved resources are allocated to Numa nodes in combination with the Numa situation, the virtualization service is started, resource isolation is set, and the available resources of the virtual machine are set.
[0079] Specifically, the host machine starts reserved CPU = CO + 1 (dpdk) + 1 (SPDK) = 4, which can be evenly distributed on multiple Numas or concentrated on one Numa, and dynamically adjusted later according to the activation of the virtual machine.
[0080] The host machine startup reserved memory = MO + 1 (dpdk) + 1 (SPDK) = 6, which can be evenly distributed on multiple Numas or concentrated on one Numa, and will be dynamically adjusted later according to the virtual machine activation situation.
[0081] The host is running, CPU reserved
[0082] When the host machine is running, the memory reserved MR = M0 + (CR-C0) * MD.
[0083] By allocating reserved resources to each Numa node to dynamically adjust the virtual machine Numa requirements, start the virtualization service, set resource isolation, set virtualization available resources, and dynamically adjust the distribution of reserved resources on Numa, the success rate of virtual machine activation can be improved when server resources are met.
[0084] Step S305: When a virtual machine creation request is received, the amount of resources reserved for the virtualization service is calculated.
[0085] Specifically, the above step S305 includes:
[0086] Step S3051, calculate the amount of resources reserved for virtualization services based on the number of CPU cores, required memory size, number of Numa nodes, network requirements and storage QoS requirements required by the virtual machine.
[0087] In the embodiment of the present invention, when a virtual machine is created, the CPU reserved resource amount CR and the memory reserved resource amount MR are calculated again. Specifically, the virtualization service reserved resource amount needs to be comprehensively calculated based on the number of CPU cores, required memory size, number of Numa nodes, network requirements and storage QoS requirements required by the virtual machine.
[0088] By calculating the amount of virtualization service reserved resources based on the virtual machine specifications, it is possible to dynamically adjust the reserved resources and improve server resource utilization.
[0089] Step S306: If the amount of virtualization service reserved resources cannot meet the performance requirements of the virtual machine, the amount of reserved resources that the virtual machine needs to increase is calculated, and the virtualization service reserved resources are dynamically increased.
[0090] For details, please see Figure 2 Step S203 of the illustrated embodiment will not be described in detail here.
[0091] Step S307, calculating the remaining resources of the server, and when the resources meet the requirements of the virtual machine, allocating resources on Numa, and allocating and creating the virtual machine.
[0092] For details, please see Figure 2 Step S204 of the illustrated embodiment will not be described in detail here.
[0093] In some optional embodiments, the method further comprises:
[0094] Step S308: If resources cannot be allocated on each Numa, the resources and services reserved on the Numa are adjusted according to the virtual machine requirements until the virtual machine requirements are met.
[0095] In an embodiment of the present invention, if resources cannot be allocated on each Numa, it is necessary to adjust the resources and services reserved on Numa to ensure that the virtual machine can run normally. First, check the resource usage of the current Numa node, check the number of CPU cores, memory usage, network bandwidth, and IOPS of each Numa node, and dynamically adjust the number of CPU cores, memory allocation, network bandwidth, and IOPS to meet the needs of the virtual machine and ensure that the virtual machine can be allocated and created.
[0096] While ensuring the performance of virtual machines, the success rate of virtual machine creation is greatly improved, thereby improving the resource utilization of the server.
[0097] By adjusting the resources and services reserved on Numa, the server resources can meet the needs of the virtual machines to improve the success rate of virtual machine provisioning.
[0098] Step S309: when a virtual machine destruction request is received, the reserved resources that can be released by the virtualization service are recalculated.
[0099] Step S310, adjusting the resources and services reserved on each Numa to release resources.
[0100] In the embodiment of the present invention, if the virtual machine is destroyed, when the virtual machine deletion request is received, CR and MR are calculated again to determine the new reserved resource amount, and compared with the last time to determine the specific reserved resources that need to be reduced. According to CR and MR, the corresponding reserved resources are reduced. Here, some prediction algorithms can be combined to release resources on certain selected Numas to reduce the adjustment workload when the virtual machine is created next time.
[0101] The server resource dynamic allocation method provided in this embodiment adjusts the resources and services reserved on each Numa to release resources when a virtual machine destruction request is made, thereby reducing the adjustment workload when a virtual machine is created next time.
[0102] like Figure 3 As shown, Figure 3 This is a flowchart of the existing server resource dynamic allocation method. When allocating resources, the number of salable resources is determined based on the server CPU, memory, and network card configuration, and the system and management service reserved resources are determined. The DPDK reservation is determined, with a single core of 100Mpps, and the SPDK reservation is determined, with a single core of 600,000 iops. When reserving system and virtualization resources, the reserved resources are allocated to each Numa node in combination with the Numa situation, the service is started and resource isolation is set, and the available resources for the virtual machine are set.
[0103] When a request to create a virtual machine is received, the remaining resources of the server are calculated according to the virtual machine specifications (CPU, memory, number of Numas, network, storage QoS). If the remaining resources of the server cannot meet the virtual machine requirements, or the remaining resources of the server can meet the virtual machine requirements but resources cannot be allocated on each Numa, it is determined that there are insufficient resources and the creation fails. If the remaining resources of the server can meet the virtual machine requirements and resources can be allocated on each Numa, the virtual machine is allocated and created.
[0104] As a specific application example of the embodiment of the present invention, Figure 4As shown, first determine the minimum reserved CO and MO of system, management, network, and storage resources, allocate the reserved resources to each Numa node based on the Numa situation, start the service, set resource isolation, and set the available resources for the virtual machine.
[0105] When a virtual machine deletion request is received, the reserved resources that can be released by the virtualization service are calculated according to the virtual machine specifications (CPU, memory, number of Numas, network, storage QoS), and the reserved resources and services on each Numa are adjusted to release resources.
[0106] When a virtual machine creation request is received, the virtualization service reserved resource amounts CR and MR are calculated according to the virtual machine specifications (CPU, memory, number of Numas, network, storage Qos). Determine whether the server virtualization reserved resources meet the virtual machine performance requirements. If the server virtualization reserved resources meet the virtual machine performance requirements, directly calculate the remaining resources of the server. If the server virtualization reserved resources cannot meet the virtual machine performance requirements, calculate the amount of reserved resources required to increase the virtualization service, dynamically increase the virtualization service reserved resources, and then calculate the remaining resources of the server. Determine whether the amount of resources meets the virtual machine requirements. If the amount of resources does not meet the virtual machine requirements, it is determined that the resources are insufficient and the creation fails. If the amount of resources meets the virtual machine requirements, determine whether resources can be allocated on each Numa. If resources can be allocated on each Numa, directly allocate and create the virtual machine. If resources cannot be allocated on each Numa, adjust the resources and services reserved on Numa according to the virtual machine requirements to meet the virtual machine requirements, and then allocate and create the virtual machine, and the process ends.
[0107] The following uses the first type of 7th generation cloud host as an example to explain:
[0108] Take the host server as an Intel Icelake 38-core dual-socket server (2Numa) as an example. According to the previous plan: the operating system reserves 2 threads, the management service reserves 2 threads, the DPDK reserves 18 threads, and the SPDK reserves 16 threads. The server reserved resources may be as high as 38 threads (25%).
[0109] In the no-load condition, the server CPU utilization is greater than (18+16) / (38*2*2)=22%.
[0110] A large amount of CPU idling not only wastes server resources but also causes energy waste.
[0111] By dynamically allocating server resources according to the embodiment of the present invention, the operating system reserves 1 thread, the management and control service reserves 1 thread, the DPDK reserves 1 thread, and the SPDK reserves 1 thread. Under no-load conditions, the CPU utilization rate is (1+1) / (38*2*2)=about 1.2%, which can save 20% of resources and energy consumption.
[0112] Icxlake single-core virtualization forwarding capability (DPDK single-thread) can provide a PPS capability of approximately 1.1-1.4 million.
[0113] Take the following 7th generation machine specifications as an example:
[0114]
[0115] The server resource reservation is as follows:
[0116]
[0117]
[0118] The maximum allocatable CPU resources are increased from 114 to 128, an increase of 12%.
[0119] The above is only an example and is not limited to the above table. It is calculated based on the virtual machines activated on the server.
[0120] Since the Intel Ice Lake server has only two Numas, the allocation of reserved resources on the two Numas can be quickly determined based on the resource requirements of the virtual machine on the server, so it is not described in this embodiment.
[0121] The following takes the second type of cloud host as an example to explain:
[0122] The host server is Feiteng S2500, 2-way 64-core (arm architecture without hyperthreading). According to the previous plan: 4 cores are reserved for the operating system, 4 cores are reserved for the management service, 16 cores are reserved for DPDK, and 16 cores are reserved for SPDK. The server reserved resources may be as high as 40 cores (31.25%).
[0123] In the no-load condition, the server CPU utilization is greater than (16+16) / (64*2)=25%.
[0124] A large amount of CPU idling not only wastes server resources but also causes energy waste.
[0125] With this solution, the operating system reserves 2 threads, the management service reserves 2 threads, the DPDK reserves 2 threads, and the SPDK reserves 2 threads. Under no-load conditions, the CPU utilization rate is (2+2) / (64*2)=about 3.1%, which can save 20% of resources and energy consumption.
[0126] The S2500 single-core virtualized forwarding capability (DPDK single-thread) can provide a PPS capability of approximately 400,000 to 600,000.
[0127] The virtual machine specifications are as follows:
[0128]
[0129] Server resource reservation:
[0130]
[0131]
[0132] By dynamically adjusting the distribution of CPU reserved resources on Numa, more than 4 Numa virtual machines can be opened.
[0133] The above is only an example and is not limited to the above table. It is calculated based on the virtual machines activated on the server.
[0134] The main advantages of the dynamic allocation of server resources in the embodiment of the present invention are as follows:
[0135] (1) Compared with the previous static reserved resources, this solution dynamically calculates and adjusts the reserved resources according to the performance requirements of the virtual machines, which can greatly improve the resource utilization of the server;
[0136] (2) According to the virtual machine Numa distribution requirements, especially from the perspective of domestic server Numa, the distribution of reserved resources on Numa can be dynamically adjusted to improve the success rate of virtual machine provisioning when server resources are sufficient;
[0137] (3) At the same time, the CPU utilization of the server is reduced by more than 20% when it is not loaded. Dynamic adjustment according to the needs of the virtual machine can achieve energy conservation and emission reduction, and further reduce operating costs.
[0138] In this embodiment, a server resource dynamic 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.
[0139] This embodiment provides a server resource dynamic allocation device, such as Figure 5 As shown, including:
[0140] The setting module 501 is used to set the minimum resource reservation.
[0141] The calculation module 502 is used to calculate the amount of resources reserved for the virtualization service when a virtual machine creation request is received. The reserved resources include the amount of CPU reserved resources and the amount of memory reserved resources.
[0142] The increasing module 503 is used to calculate the amount of reserved resources that need to be increased for the virtual machine if the amount of virtualization service reserved resources cannot meet the performance requirements of the virtual machine, and dynamically increase the virtualization service reserved resources.
[0143] The creation module 504 is used to calculate the remaining resources of the server, and when the resources meet the requirements of the virtual machine, allocate resources on Numa, allocate and create the virtual machine.
[0144] In some optional implementations, the setting module 501 includes:
[0145] The setting unit is used to set the default CPU reserved resources and memory reserved resources.
[0146] The adjustment unit is used to dynamically adjust the memory required by the virtual machine process when the resource allocation rate exceeds a preset resource allocation rate threshold.
[0147] In some optional embodiments, the device further comprises:
[0148] The resource allocation module is used to allocate reserved resources to each Numa node.
[0149] The first setting module is used to start the virtualization service and set resource isolation.
[0150] The second setting module is used to set available resources for the virtual machine.
[0151] In some optional implementations, the calculation module 502 includes:
[0152] The computing unit is used to calculate the amount of resources reserved for virtualization services based on the number of CPU cores, memory size, number of Numa nodes, network requirements, and storage QoS requirements required by the virtual machine.
[0153] In some optional embodiments, the device further comprises:
[0154] The adjustment module is used to adjust the resources and services reserved on Numa according to the needs of the virtual machines if resources cannot be allocated on each Numa until the needs of the virtual machines are met.
[0155] In some optional embodiments, the device further comprises:
[0156] The recalculation module is used to recalculate the reserved resources that can be released by the virtualization service when a virtual machine destruction request is received.
[0157] The release module is used to adjust the resources and services reserved on each Numa to release resources.
[0158] 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.
[0159] The server resource dynamic 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.
[0160] The embodiment of the present invention also provides a computer device having the above Figure 5 The server resource dynamic allocation device is shown.
[0161] 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.
[0162] 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.
[0163] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0164] 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.
[0165] 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.
[0166] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0167] The input device 30 can receive input digital or character information and generate key signal input related to user settings and function control of the computer device, such as a touch screen, etc. The output device 40 can include a display device, etc.
[0168] 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.
[0169] 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.
[0170] 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 all fall within the scope of the present application.
Claims
1. A method for dynamically allocating server resources, characterized in that: The method comprises: Set minimum resource reservation; When a virtual machine creation request is received, the reserved resource amount of the virtualization service is calculated, wherein the reserved resource amount includes the CPU reserved resource amount and the memory reserved resource amount; If the amount of virtualization service reserved resources cannot meet the performance requirements of the virtual machine, the amount of reserved resources that the virtual machine needs to increase is calculated, and the virtualization service reserved resources are dynamically increased; Calculate the remaining resources of the server, and when the resources meet the requirements of the virtual machine, allocate resources on Numa, allocate and create the virtual machine.
2. The method according to claim 1, characterized in that The setting of the minimum resource reservation includes: Set the default CPU and memory reservations. When the resource allocation rate exceeds the preset resource allocation rate threshold, the memory required by the virtual machine process is dynamically adjusted.
3. The method according to claim 1, characterized in that After setting the minimum resource reservation, the method includes: Allocate reserved resources to each Numa node; Start the virtualization service and set up resource isolation; Set the resources available to the virtual machine.
4. The method according to claim 1, characterized in that: The amount of resources reserved for computing virtualization services includes: Calculate the amount of resources reserved for virtualization services based on the number of CPU cores, memory size, number of Numa nodes, network requirements, and storage QoS requirements required by the virtual machine.
5. The method according to claim 1, characterized in that The method further comprises: If resources cannot be allocated on each Numa, the reserved resources and services on Numa are adjusted according to the virtual machine requirements until the virtual machine requirements are met.
6. The method according to claim 1, characterized in that The method further comprises: When receiving a virtual machine destruction request, recalculate the reserved resources that can be released by the virtualization service; Adjust the resources and services reserved on each Numa to release resources.
7. A server resource dynamic allocation device, characterized in that: The device comprises: A setting module, used to set the minimum resource reservation; A calculation module, configured to calculate the amount of virtualization service reserved resources when receiving a virtual machine creation request, wherein the reserved resources include a CPU reserved resource amount and a memory reserved resource amount; An increasing module is used to calculate the amount of reserved resources that need to be increased for the virtual machine if the amount of reserved resources for the virtualization service cannot meet the performance requirements of the virtual machine, and dynamically increase the reserved resources for the virtualization service; Create a module to calculate the remaining resources of the server and allocate resources on Numa when the resources meet the requirements of the virtual machine, and allocate and create the virtual machine.
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 server resource dynamic 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 server resource dynamic 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 method for dynamically allocating server resources according to any one of claims 1 to 6.