Resource allocation method and device, electronic equipment and medium

By performing preset super-score calculations on the vCPU resources of the virtual machine and the logical CPU resources of the server, finer-grained CPU resource scheduling is achieved, which solves the waste of resources caused by the coarse granularity of logical CPU resource allocation in the existing technology. problem and improve resource utilization.

CN118733236APending Publication Date: 2024-10-01CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310328650.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-30
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In the prior art, in the allocation of virtual machine resources, the granularity of logical CPU resource allocation is relatively coarse, resulting in a waste of resources.

Method used

By performing preset over-score calculations on the vCPU resources required by the virtual machine, matching logical CPU resources are obtained, and the same proportion of over-score calculations are performed on the allocable logical CPU resources of the server to achieve a more fine-grained CPU resource scheduling.

Benefits of technology

It reduces the waste of CPU resource allocation and improves resource utilization and allocation accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733236A_ABST
    Figure CN118733236A_ABST
Patent Text Reader

Abstract

The invention provides a resource allocation method and apparatus, and an electronic device. The method comprises the steps of obtaining a first vCPU resource required by a virtual machine; a second vCPU resource is obtained by carrying out preset super-division proportion multiple super-division calculation on the first vCPU resource, a first logic CPU resource is obtained by carrying out preset super-division proportion multiple super-division calculation on allocable logic CPU resources of the first server, and the preset super-division proportion is an integer greater than 1; and allocating second logic CPU resources to second vCPU resources required by the virtual machine based on the first logic CPU resources, wherein the number of the second logic CPU resources is matched with the number of the second vCPU resources. Namely, in the embodiment, the first vCPU resource required by the virtual machine and the allocable logic CPU resource in the first server are subjected to super-division according to the same preset super-division proportion and then are scheduled, so that the CPU resource scheduling with finer granularity can be realized, and the CPU resource allocation waste is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a resource allocation method, device and electronic device. Background Art

[0002] When creating a virtual machine (VM), you need to configure virtual central processing unit (vCPU) resources, and vCPU generally needs to be mapped to the host hardware resources. The physical CPU chip actually inserted into the host is the physical CPU, that is, the CPU. The physical CPU core is the physical processor in the CPU chip. A CPU chip can have one or more physical processors (i.e., one core or multiple cores). Each processor can process one thread, allowing one or more threads to run on each physical CPU core. A physical CPU core can be logically presented as one or more cores, that is, one or more logical CPUs. Logical CPUs are allocated to the vCPU requirements of the virtual machine, and vCPU threads can be carried by the allocated logical CPUs.

[0003] However, in the current related art, in the process of allocating logical CPU resources, the granularity of logical CPU resource allocation is relatively coarse, which easily causes waste of allocated resources. Summary of the invention

[0004] The embodiments of the present application provide a resource allocation method, device and electronic device to solve the problem of waste in existing resource allocation.

[0005] To solve the above technical problems, this application is implemented as follows:

[0006] In a first aspect, an embodiment of the present application provides a resource allocation method, the method comprising:

[0007] Determine the first virtual central processing unit vCPU resources required by the virtual machine;

[0008] Performing a super-resolution calculation of a preset super-resolution ratio times the first vCPU resource to obtain a second vCPU resource, and performing a super-resolution calculation of the preset super-resolution ratio times the allocatable logical CPU resource of the first server to obtain a first logical CPU resource, wherein the preset super-resolution ratio is an integer greater than 1;

[0009] A second logical CPU resource is allocated to the second vCPU resource required by the virtual machine based on the first logical CPU resource, and the quantity of the second logical CPU resource matches the quantity of the second vCPU resource.

[0010] In a second aspect, an embodiment of the present application provides a resource allocation device, including:

[0011] A first determination module, used to determine a first virtual central processing unit vCPU resource required by the virtual machine;

[0012] a super-resolution computing module, configured to perform a preset super-resolution ratio operation on the first vCPU resource to obtain a second vCPU resource, and perform a preset super-resolution ratio operation on the allocatable logical CPU resource of the first server to obtain a first logical CPU resource, wherein the preset super-resolution ratio is an integer greater than 1;

[0013] An allocation module is used to allocate a second logical CPU resource to the second vCPU resource required by the virtual machine based on the first logical CPU resource, and the number of the second logical CPU resources matches the number of the second vCPU resources.

[0014] In a third aspect, an embodiment of the present application provides an electronic device, including: a transceiver and a processor,

[0015] The processor is configured to:

[0016] Determine the first virtual central processing unit vCPU resources required by the virtual machine;

[0017] Performing a super-resolution calculation of a preset super-resolution ratio times the first vCPU resource to obtain a second vCPU resource, and performing a super-resolution calculation of the preset super-resolution ratio times the allocatable logical CPU resource of the first server to obtain a first logical CPU resource, wherein the preset super-resolution ratio is an integer greater than 1;

[0018] A second logical CPU resource is allocated to the second vCPU resource required by the virtual machine based on the first logical CPU resource, and the quantity of the second logical CPU resource matches the quantity of the second vCPU resource.

[0019] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the resource allocation method described in the first aspect above.

[0020] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the resource allocation method described in the first aspect are implemented.

[0021] In an embodiment of the present application, the first vCPU resource can be super-resolved by a preset super-resolution ratio times to obtain the second vCPU resource, and the allocatable logical CPU resource of the first server can be super-resolved by a preset super-resolution ratio times to obtain the first logical CPU resource. Resource allocation is based on super-resolving the first vCPU resource and the allocatable logical CPU resource of the first server at the same preset super-resolution ratio to obtain the second vCPU resource and the first logical CPU resource. That is, the second logical CPU resource that matches the data is allocated to the second vCPU resource required by the virtual machine in the first logical CPU resource. That is, in this embodiment, the first vCPU resource required by the virtual machine and the allocatable logical CPU resource in the first server are super-resolved and then scheduled. In this way, finer-grained CPU resource scheduling can be achieved and waste of CPU resource allocation can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0023] Figure 1 It is a schematic diagram of a virtual machine creation process in the related art;

[0024] Figure 2 It is a schematic diagram of CPU resource allocation in the related art;

[0025] Figure 3 is a flow chart of a resource allocation method provided in an embodiment of the present application;

[0026] Figure 4 is a schematic diagram of CPU resource allocation provided in an embodiment of the present application;

[0027] Figure 5 It is a module schematic diagram of a resource allocation device provided in an embodiment of the present application;

[0028] Figure 6 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0030] The following is a description of the relevant contents of this application:

[0031] Scheduling can be understood as the process of deploying a virtual machine to the most appropriate server based on its resource requirements (demands) and operating requirements. This process is an essential part of most virtual machine lifecycle management processes (including creation, expansion, migration, and rebirth in a different location). The advancement of its functional mechanism directly determines the extent to which the cloud computing resource pool can fully utilize the scale effect and thus improve resource utilization.

[0032] At present, in the private cloud market, OpenStack is a relatively mainstream and popular cloud platform software, which is an open source cloud computing management platform. According to statistics from relevant authoritative organizations, cloud platform software developed based on OpenStack has occupied a large private cloud market and is growing steadily. However, these cloud platform software generally inherit the scheduling mechanism of OpenStack. When commercially deployed, they have found that there are many resource fragments and the overall utilization rate is not ideal, especially the relatively expensive CPU resources. Therefore, the embodiment of this application mainly optimizes and improves the existing CPU scheduling allocation mechanism to improve its resource efficiency during commercial deployment.

[0033] At present, in the relevant technical solutions, the cloud platform software can be divided into the following functional modules: interface module, scheduling module, execution module, as well as the communication middleware required for communication between these modules and the database required for recording data. Figure 1 As shown, the relationship and working principle of the above modules are as follows:

[0034] Interface module: a module used to receive lifecycle management instructions from the management orchestrator, notify other modules to execute, and respond to the execution results. It is the only external entrance to the cloud platform software.

[0035] Scheduling module: Based on the lifecycle management instructions conveyed by the interface module, it selects a unique server that meets the required resource quantity and operating conditions of the virtual machine to host the virtual machine, and notifies the execution module on the server to actually execute;

[0036] Execution module: allocates resources required by virtual machines, configures and starts virtual machines according to the lifecycle management instructions conveyed by the scheduling module. Generally, one execution module is configured for each server;

[0037] Communication middleware: used for message communication between modules. When these modules are redundantly deployed, it also assumes the master-slave or load balancing functions between modules. For example, when the interface module transmits lifecycle management instructions to the redundantly deployed scheduling module through the communication middleware, the communication middleware selects a scheduling module instance for execution through the master-slave or load balancing mechanism.

[0038] Database: Each module records, transmits or queries data through the database. For example, the interface module registers the virtual machine in the database and maintains its status in real time. The execution module detects the health status and resource information of the server where it is located in real time and updates it to the database. The scheduling module obtains server information by querying the database and performs scheduling, etc.

[0039] It should be noted that when the cloud platform is operating normally, step 1.1 is executed: the execution module regularly obtains server status data and updates the database. The status data may include but is not limited to the total amount of various resources, usage / remaining amount, deployed virtual machines, and fault status, etc., and the server status is regularly maintained and updated.

[0040] Taking the creation of a virtual machine during the lifecycle management process as an example, when the cloud platform creates a virtual machine, the process is as follows: 2.1-2.12, accepting lifecycle management instructions, scheduling the server and creating the virtual machine. The specific process is as follows:

[0041] Step 2.1: The management scheduler sends a virtual machine creation request, which may include: the demand for various resources, virtual machine requirements (for example, some special requirements, etc.), and the interface module returns a confirmation signal (the virtual machine is created in asynchronous mode);

[0042] Step 2.2: The interface module sends a scheduling request to the scheduling module, which may carry information including: the demand for various resources and the requirements (demand) of the virtual machine;

[0043] Step 2.3: The scheduling module obtains server status data from the database, which may include the total amount of various resources, usage / remaining amount, deployed virtual machines, and fault status;

[0044] Step 2.4: The scheduling module sends the virtual machine request information to the filter submodule, where the virtual machine request information may include the demand for various resources, virtual machine requirements, and server status data. The server status data may include the total amount of various resources, usage / remaining amount, deployed virtual machines, and fault status;

[0045] Step 2.5: The filter submodule calls each driver to perform filtering, that is, to exclude servers with insufficient remaining resources or unable to meet the requirements of the virtual machine. One driver is responsible for one type of driver;

[0046] Step 2.6: The filter submodule takes the intersection of the results of each driver filter, that is, obtains the server set that meets the virtual machine creation requirements (that is, the filtered server set), and returns the server set to the scheduling module;

[0047] Step 2.7: The scheduling module sends the filtered server set to the weighter submodule;

[0048] Step 2.8: The weighter submodule calls its driver (only one driver is effective) to select a unique server from the server set;

[0049] Step 2.9: The weighter submodule passes the unique server information (e.g., identification, etc.) back to the scheduling module;

[0050] Step 2.10: The scheduling module sends the virtual machine creation request to the execution module on the only server through the interface module or byte;

[0051] Step 2.11: The execution module on the server sends the virtual machine creation result to the interface module;

[0052] Step 2.12: The management orchestrator queries the virtual machine creation result.

[0053] At present, in the scheduling and allocation of CPU resources on cloud platforms, there are concepts of CPU including: physical CPU (PhysicalCPU), physical CPU core (core), logical CPU (LogicalCPU), and virtual CPU (VirtualCPU, vCPU). Their detailed definitions and interrelationships are described as follows:

[0054] Physical CPU (abbreviated as "CPU"): the physical CPU chip actually inserted into the physical server.

[0055] Physical CPU core (referred to as "physical core"): The physical processor inside the CPU chip. A CPU chip can have one or more processors. Each processor can process one thread, and multiple processors can communicate through the chip's internal bus. Multiple processors enable the CPU chip to have stronger processing performance.

[0056] Logical CPU: A CPU that has introduced hyperthreading technology. Hyperthreading technology allows multiple threads to run on each physical CPU core, so one physical CPU core is logically presented as multiple logical cores. When hyperthreading is enabled on a CPU, the number of logical CPUs = the number of physical CPUs * the number of physical cores per CPU * the hyperthreading multiple; when hyperthreading is not enabled on a CPU, the number of logical CPUs = the number of physical CPUs * the number of physical cores per CPU. For example, the hyperthreading multiple can be 2.

[0057] Virtual CPU (abbreviated as "vCPU"): A common term in cloud platforms and virtual machine environments, used to provide computing resources for virtual machines. The above interface modules, scheduling modules, and execution modules all complete resource scheduling and allocation based on the number of vCPU resources required by the business. vCPU resources generally need to be mapped to host hardware resources. Currently, in relevant cloud platform solutions, the number of original available vCPU resources for each server is generally equal to the number of logical CPU resources.

[0058] For example, if a server's CPU is configured as a dual-core 12-core server, then the server has two CPUs (i.e., two physical CPUs), each of which contains 12 physical cores. The server has a total of 24 physical cores, and the number of logical CPU resources is 24. The number of vCPU resources available to virtual machines in a virtualized environment is 24 (not considering an ideal environment for resource consumption such as cloud platform management and operating system).

[0059] Logical CPU resources are allocated to vCPU resources, so that the threads of the vCPU resources can be scheduled to the logical CPU resources allocated to them for processing. In the relevant solution, for example, the virtual machine has 4 vCPU resources, such as vCPU resource 0, vCPU resource 1, vCPU resource 2, and vCPU resource 3. vCPU resources 0-3 can be run on logical CPU resources 0-3 (i.e., logical CPU resource 0, logical CPU resource 1, logical CPU resource 2, and logical CPU resource 3) respectively.

[0060] However, there are cases where the vCPU resources required by a virtual machine are not integers. However, since the vCPU resources allocated to a virtual machine must be integers, i.e., the resource allocation method is integer, in the relevant integer resource allocation scheme, the vCPU resources allocated to the virtual machine are the rounded-up of the required vCPU resources, which will result in redundant vCPU resources. Figure 2 As shown, the server has two physical CPUs, namely CPU0 and CPU1, each of which has 12 cores, that is, the server CPU is configured as a dual-channel 12-core system. Two virtual machines need to be created, namely virtual machine 1 (VM1) and virtual machine 2 (VM2). Each virtual machine requires the computing power of 1.5 vCPU resources. The number of vCPU resources allocated to each virtual machine is 2, and the total vCPU resources are 4, namely vCPU resource 0, vCPU resource 1, vCPU resource 2, and vCPU resource 3. VM1 corresponds to vCPU resource 0 and vCPU resource 1, and VM2 corresponds to vCPU resource 3 and vCPU resource 4. In this way, when allocating logical CPU resources to the vCPU resources of the virtual machines, 4 logical CPU resources need to be allocated to the vCPU resources of the two virtual machines. Through the above-mentioned related resource allocation schemes, the CPU allocation granularity is coarse, which is easy to cause waste of allocated logical resources.

[0061] That is, in the resource allocation process of the related technology, when the vCPU required by the virtual machine is not an integer, due to the current usage habit constraints, the vCPU allocated to the virtual machine must be an integer, that is, the allocated vCPU is the rounded up of the required vCPU, which will cause redundant vCPU resources. For example, if two virtual machines need to be created, and each virtual machine needs 1.5 vCPU computing power, then according to the current rounding allocation method, the number of vCPUs actually allocated to each virtual machine is 2, and the total vCPU is 4. In this way, when allocating and binding logical CPUs to the vCPUs of the virtual machines, 4 logical CPUs need to be allocated to the vCPUs of these two virtual machines. If the computing power required by the virtual machine is considered alone, the total computing power actually required by the two virtual machines is 3 (2*1.5), that is, 3 logical CPUs can provide the required computing power, and the logical CPU consumption is less than the 4 logical CPUs allocated according to the rounding allocation method. This situation causes a certain waste of resources.

[0062] Based on this, an embodiment of the present application provides a resource allocation method, which optimizes and improves the CPU scheduling allocation mechanism to reduce resource allocation waste.

[0063] See also Figure 3 , Figure 3 is a flow chart of a resource allocation method provided in an embodiment of the present application, which can be executed by an electronic device, wherein the electronic device can be a server device, etc. Figure 3 As shown, the resource allocation method provided in this embodiment includes the following steps:

[0064] Step 301: Determine the first virtual central processing unit vCPU resources required by the virtual machine;

[0065] Step 302: performing a super-resolution calculation of a preset super-resolution ratio times the first vCPU resource to obtain a second vCPU resource, and performing a super-resolution calculation of a preset super-resolution ratio times the allocatable logical CPU resource of the first server to obtain a first logical CPU resource, wherein the preset super-resolution ratio is an integer greater than 1;

[0066] Step 303: Allocate second logical CPU resources to second vCPU resources required by the virtual machine based on the first logical CPU resources, and the number of the second logical CPU resources matches the number of the second vCPU resources.

[0067] It can be understood that the second vCPU resource obtained by super-resolution calculation is the preset super-resolution ratio times of the first vCPU resource. For example, if the first vCPU resource actually required by the virtual machine (i.e., the actual vCPU resource requirement of the virtual machine) is x, and the preset super-resolution ratio is m, then the required vCPU resource obtained by super-resolution calculation is x×m. For example, if the first vCPU resource required by the virtual machine is 1.5 vCPU resources, and the preset super-resolution ratio is 4, then the second vCPU resource is 6 vCPU resources.

[0068] It should be noted that the preset super-resolution ratio may be set in advance according to actual performance requirements. For example, illustratively, the value range of the preset super-resolution ratio may be [2, 16].

[0069] In the above step 302, not only is it necessary to perform super-resolution calculation on the first vCPU resource according to the preset super-resolution ratio, but correspondingly, it is also necessary to perform super-resolution calculation on the allocable logical CPU resources of the first server by multiple times of the preset super-resolution ratio, so as to ensure that the vCPU resources required by the virtual machine and the allocable logical CPU resources are super-resolved synchronously according to the same preset super-resolution ratio, so as to ensure that in the subsequent process of allocating logical CPU resources to the vCPU resources of the virtual machine, resources are allocated in the resource space after super-resolvation at the same preset super-resolv ratio, thereby improving the accuracy of resource allocation. For example, illustratively, if the first server has a total of 48 allocable logical CPU resources remaining, the total amount of available logical CPU resources after super-resolvation is 48×m; if the current first server has 15 allocable logical CPU resources remaining, the amount of available logical CPU resources after super-resolvation is 15×m. In addition, in an example, the allocable logical CPU resources after super-resolvation can be stored in a database as resource information for subsequent scheduling.

[0070] The first vCPU resource is super-resolved by a preset super-resolved ratio times the super-resolved calculation to obtain the second vCPU resource, and the allocatable logical CPU resource of the first server is super-resolved by a preset super-resolved ratio times the super-resolved calculation to obtain the first logical CPU resource, and then, in the first logical CPU resource, a matching number of second logical CPU resources is allocated for the second vCPU resource required by the virtual machine. After super-resolved, the first vCPU resources actually required by the virtual machine and the allocatable logical CPU resources in the first server can be divided into CPU resources of finer granularity, so that scheduling can be performed according to the finer granularity resources.

[0071] For example, virtual machine 1 and virtual machine 2 actually need the computing power of 1.5 vCPU resources respectively, that is, the first vCPU resources corresponding to virtual machine 1 and virtual machine 2 are 1.5 vCPU resources respectively, and the preset super-resolution ratio is 4. After 4 times super-resolution calculation, virtual machine 1 and virtual machine 2 need 6 vCPU resources after super-resolution, that is, the second vCPU resources corresponding to virtual machine 1 and virtual machine 2 are 6 vCPU resources respectively, and virtual machine 1 and virtual machine 2 need 12 vCPU resources after super-resolution. There are 2 physical CPUs in the first server, each of which has 12 cores, that is, there are 12 logical CPU resources. There are 24 (12×2) logical CPU resources in the first server. If these 24 logical CPU resources in the first server are not allocated, then the logical CPU resources that can be allocated in the first server are 24 logical CPU resources. After 4 times super-resolution calculation, the first logical CPU resources obtained are 96 (24×4) logical CPU resources, that is, 96 vCPU resources after super-resolution. In this way, the second logical CPU resource (in this example, 12 logical CPU resources) of the 96 super-allocated logical CPU resources can be allocated to the 12 vCPU resources required by virtual machines 1 and 2 after super-allocation, and the number of logical CPU resources allocated corresponding to these 12 logical CPU resources in the logical CPU resources that can be allocated in the first server is 3, such as Figure 4 As shown, that is, the logical CPU resources allocated to the vCPU resources required by virtual machine 1 and virtual machine 2 in the logical CPU resources that can be allocated in the first server are 3 logical CPU resources. Compared with the 4 logical CPU resources allocated to the vCPU resources required by virtual machine 1 and virtual machine 2 when allocating resources in the above-mentioned related resource allocation scheme, the allocation of 1 logical CPU resource is reduced, thereby reducing the waste of resource allocation.

[0072] In an embodiment of the present application, the first vCPU resource can be super-resolved by a preset super-resolution ratio times to obtain the second vCPU resource, and the allocatable logical CPU resource of the first server can be super-resolved by a preset super-resolution ratio times to obtain the first logical CPU resource. Resource allocation is based on super-resolving the first vCPU resource and the allocatable logical CPU resource of the first server at the same preset super-resolution ratio to obtain the second vCPU resource and the first logical CPU resource. That is, the second logical CPU resource that matches the data is allocated to the second vCPU resource required by the virtual machine in the first logical CPU resource. That is, in this embodiment, the first vCPU resource required by the virtual machine and the allocatable logical CPU resource in the first server are super-resolved and then scheduled. In this way, finer-grained CPU resource scheduling can be achieved and waste of CPU resource allocation can be reduced.

[0073] In one embodiment, after allocating the second logical CPU resource to the second vCPU resource required by the virtual machine based on the first logical CPU resource, the method further includes:

[0074] The second vCPU resource is bound to the second logical CPU resource, wherein after the binding, the thread corresponding to the second vCPU resource is scheduled to the second logical CPU resource for processing.

[0075] In order to improve performance, the virtual layer execution module often binds the virtual machine vCPU resources with the first server logical CPU resources, that is, by configuring a certain vCPU resource thread to be fixedly scheduled to a certain logical CPU resource for processing, to avoid the virtual machine vCPU resource thread being scheduled back and forth between multiple logical CPU resources and causing performance loss. For example, if the virtual machine has 4 vCPU resources, vCPU resources 0-3 can be specified to run on logical CPU resources 0-3 respectively.

[0076] It should be noted that core binding can be understood as setting the affinity between a thread and a CPU core. After the setting, the thread will only run on the bound CPU core. Binding the second vCPU resource to the second logical CPU resource can be understood as binding the thread on the second vCPU resource to the second logical CPU resource.

[0077] In this embodiment, the second vCPU resource can be bound to the second logical CPU resource. In this way, the thread corresponding to the second vCPU resource will be fixedly scheduled to the second logical CPU resource for processing. In this way, performance loss caused by the threads on the virtual machine's vCPU resource switching back and forth between multiple different logical CPU resources can be avoided.

[0078] In one embodiment, the number of virtual machines is N, where N is a positive integer. The first vCPU resources required by the virtual machines include the first vCPU resources required by each of the N virtual machines. Among the allocatable logical CPU resources, the number of allocated logical CPU resources corresponding to the second logical CPU resources is less than or equal to the sum of the first vCPU resources required by the N virtual machines after rounding up. The number of allocated logical CPU resources is the result of rounding up the number of second logical CPU resources divided by a preset over-resolution ratio.

[0079] It can be understood that the number of virtual machines is N, and the first vCPU resources required by the virtual machines obtained include the first vCPU resources required by each of the N virtual machines, so that N first vCPU resources can be obtained, and one virtual machine corresponds to one first vCPU resource. In this way, the first vCPU resource of each virtual machine can be super-resolved by a preset super-resolution ratio to obtain the second vCPU resource required by each virtual machine, so that N second vCPU resources can be obtained, and one virtual machine corresponds to one second vCPU resource. The second logical CPU resources are allocated to the second vCPU resources required by the N virtual machines, that is, the allocated second logical CPU resources are the sum of the logical CPU resources allocated in the first logical CPU resources to the second vCPU resources required by each of the N virtual machines.

[0080] For example, the preset over-resolution ratio is 4, N is 2, and the first vCPU resources required by virtual machine 1 and virtual machine 2 are 1.5 vCPU resources respectively. The number of vCPU resources (1.5 vCPU resources) of the first vCPU resources required by virtual machine 1 and virtual machine 2 is rounded up to 2 (i.e., 2 vCPU resources), and the sum of the two is 4. After the first vCPU resources required by virtual machine 1 and virtual machine 2 are over-resolved, the second vCPU resources required by virtual machine 1 and virtual machine 2 are 6 vCPU resources respectively. The logical CPU resources that can be allocated to the first server are 24 logical CPU resources. After calculation, the first logical CPU resources obtained are 96 logical CPU resources. Thus, 6 logical CPU resources are allocated to the second vCPU resources of virtual machine 1 and 6 logical CPU resources are allocated to the second vCPU resources of virtual machine 2 among the 96 logical CPU resources after over-allocation, that is, a total of 12 logical CPU resources are allocated to 2 virtual machines among the 96 logical CPU resources after over-allocation, that is, the number of second logical CPU resources is 12, corresponding to the originally allocable 24 logical CPU resources of the first server, and the number of allocated logical CPU resources is 3, that is, the number of second logical CPU resources 12 divided by the preset over-allocation ratio 4 and rounded up. The number 3 is less than the sum of the first vCPU resources required by virtual machine 1 and virtual machine 2 after rounding up, which is 4. In the relevant resource allocation plan, it is necessary to allocate 4 logical CPU resources from the allocatable logical CPU resources in the first server to the vCPU resources of virtual machine 1 and virtual machine 2. Through the super-resolution calculation and allocation in the embodiment of the present application, it is only necessary to allocate 12 super-resolution logical CPU resources to the vCPU resources of virtual machine 1 and virtual machine 2, which corresponds to 3 logical CPU resources allocatable in the first server, and the number is less than 4. In this way, 1 logical CPU resource can be saved in the allocatable logical CPU resources of the first server.

[0081] That is, in this embodiment, among the allocatable logical CPU resources, the number of allocated logical CPU resources corresponding to the second logical CPU resources is less than or equal to the sum of the first vCPU resources required by each virtual machine in the virtual machine after rounding up. In this way, it can be ensured that among the allocatable logical CPU resources, the number of allocated logical CPU resources corresponding to the second logical CPU resources does not exceed the sum of the first vCPU resources required by N virtual machines after rounding up, thereby reducing resource allocation waste.

[0082] In one embodiment, after performing a preset super-resolution ratio multiplication super-resolution calculation on the first vCPU resource to obtain the second vCPU resource, before allocating the second logical CPU resource to the second vCPU resource required by the virtual machine based on the first logical CPU resource, the method includes:

[0083] The second vCPU resource is rounded up to update the second vCPU resource.

[0084] It should be noted that the first vCPU resource required by the virtual machine can be arbitrarily taken according to the actual computing power required by the business. The first vCPU resource can be an integer greater than 0 or a decimal. In the case of an integer, since the preset super-resolution ratio is an integer greater than 1, the result of rounding up the preset super-resolution ratio times the super-resolution calculation of the first vCPU resource is the result of the preset super-resolution ratio times the super-resolution calculation of the first vCPU resource. The second vCPU resource is the result of the preset super-resolution ratio times the super-resolution calculation of the first vCPU resource. In the case of a decimal, the result of the preset super-resolution ratio times the super-resolution calculation of the first vCPU resource may still be a decimal. Since the vCPU resource allocation must be an integer, the result after the super-resolution calculation needs to be rounded up and the second vCPU resource is updated to facilitate the subsequent allocation of logical CPU resources to the vCPU resources of the virtual machine and improve the accuracy of CPU resource allocation. For example, the first vCPU resource actually required by the virtual machine (i.e., the actual vCPU resource requirement of the virtual machine) is x, and the preset super-resolution ratio is m. Then, the required vCPU resources obtained by the super-resolution calculation are x×m. If it is rounded up, the second vCPU resource is Indicates that x×m is rounded up.

[0085] In the resource allocation method of the above embodiment of the present application, the resource utilization rate can be improved by binding the virtual machine vCPU resources with the logical CPU resources of the first server, that is, specifying the vCPU resources and the CPU physical core that carries the vCPU resources to ensure that each CPU physical core can be allocated a fixed vCPU resource, thereby improving the resource utilization rate; and allocating vCPU resources with a computing association relationship to the same CPU physical core can reduce the time cost and further improve the CPU utilization rate. In addition, on the basis of the above-mentioned CPU binding core, an over-resolution strategy is added, so that the CPU computing power can be applied and scheduled at a smaller granularity, so that the virtual machine can apply for CPU resources more finely according to its own computing power requirements, thereby improving resource utilization. After over-resolution, the core binding is completed at a smaller granularity. On the one hand, it retains the advantage of the original core binding solution in reducing the time cost. On the other hand, it realizes that the threads of different virtual machines can be scheduled to the same CPU for processing, further avoiding the waste of resources caused by coarse-grained core binding.

[0086] In one embodiment, before performing super-resolution calculation of the allocable logical CPU resources of the first server by multiple super-resolution of the preset super-resolution ratio, the method further includes:

[0087] Get resource status data of multiple servers;

[0088] Based on resource status data of a plurality of servers, at least one server that meets the resource requirements of the virtual machine is selected from the plurality of servers, and the first server is one of the at least one server.

[0089] That is, there are multiple servers to choose from for deploying virtual machines. However, the resource status in each server is not only the same, but there may be servers among the multiple servers that cannot meet the resource requirements of the virtual machine for the relevant requirements corresponding to the above-mentioned virtual machine (for example, the requirement for resources, etc. In this embodiment, the requirement of the above-mentioned virtual machine for vCPU resources is the first vCPU resource). In this case, the above-mentioned virtual machine cannot be successfully deployed, and it is necessary to select at least one server that meets the resource requirements of the above-mentioned virtual machine from the above-mentioned multiple servers to ensure the possibility of successful creation of the virtual machine, select a server from at least one server (that is, corresponding to the above-mentioned first server), allocate the corresponding second logical CPU to the second vCPU required by the above-mentioned virtual machine, that is, deploy the virtual machine in this server.

[0090] In one embodiment, the resource status data includes at least one item of the total amount of at least one type of resources, the usage amount of at least one type of resources, and the remaining amount of at least one type of resources, and the at least one type of resources includes at least logical CPU resources.

[0091] For example, if the number of remaining logical CPU resources in a server is greater than or equal to the number of resources required by a virtual machine, the server meets the resource requirements of the virtual machine. For example, a virtual machine requires 1.5 vCPU resources, which means it needs the computing power of 1.5 logical CPUs. In a server, the remaining logical CPU resources include 48 logical CPUs, which means that there are currently 48 logical resources available for allocation. The server meets the resource requirements of the virtual machine.

[0092] In this embodiment, for each of the multiple servers, corresponding resource status data including at least one item of the total amount of at least one type of resource, the usage of at least one type of resource, and the remaining amount of at least one type of resource can be obtained. By using the resource status data of the multiple servers, at least one server that can meet the resource requirements of the above-mentioned virtual machine is selected from the multiple servers, and a server that allocates corresponding logical CPU resources to the vCPU required by the virtual machine is selected from the at least one server to improve the success rate of resource allocation.

[0093] like Figure 5 As shown, Figure 5 is a schematic diagram of a resource allocation device provided in an embodiment of the present application. Figure 5 As shown, the resource allocation device 500 includes:

[0094] A first determination module 501 is used to determine a first virtual central processing unit vCPU resource required by the virtual machine;

[0095] The super-resolution computing module 502 is used to perform a preset super-resolution ratio operation on the first vCPU resource to obtain a second vCPU resource, and to perform a preset super-resolution ratio operation on the allocatable logical CPU resource of the first server to obtain a first logical CPU resource, where the preset super-resolution ratio is an integer greater than 1;

[0096] The allocation module 503 is used to allocate the second logical CPU resources to the second vCPU resources required by the virtual machine based on the first logical CPU resources, and the number of the second logical CPU resources matches the number of the second vCPU resources.

[0097] In one embodiment, the resource allocation device 500 further includes:

[0098] The core binding module is used to bind the second vCPU resource to the second logical CPU resource; wherein, after the core binding is performed, the thread corresponding to the second vCPU resource is scheduled to the second logical CPU resource for processing.

[0099] In one embodiment, the number of virtual machines is N, where N is a positive integer. The first vCPU resources required by the virtual machines include the first vCPU resources required by each of the N virtual machines. Among the allocatable logical CPU resources, the number of allocated logical CPU resources corresponding to the second logical CPU resources is less than or equal to the sum of the first vCPU resources required by the N virtual machines after rounding up. The number of allocated logical CPU resources is the result of rounding up the number of second logical CPU resources divided by a preset over-resolution ratio.

[0100] In one embodiment, the apparatus 500 further includes:

[0101] The rounding processing module is used to round up the second vCPU resource to update the second vCPU resource.

[0102] In one embodiment, the apparatus 500 further includes:

[0103] A data acquisition module is used to acquire resource status data of multiple servers;

[0104] The selection module is used to select at least one server that meets the resource requirements of the virtual machine from the multiple servers based on the resource status data of the multiple servers, and the first server is one of the at least one server.

[0105] In one embodiment, the resource status data includes at least one item of the total amount of at least one type of resources, the usage amount of at least one type of resources, and the remaining amount of at least one type of resources, and the at least one type of resources includes at least logical CPU resources.

[0106] The resource allocation device provided in this embodiment can implement each process of each embodiment of the above-mentioned resource allocation method, the technical features correspond one to one, and can achieve the same technical effect. To avoid repetition, it will not be described here.

[0107] An embodiment of the present application also provides an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor. When the program is executed by the processor, each process of the above-mentioned resource allocation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0108] For details, see Figure 6 The embodiment of the present application further provides an electronic device, including a bus 601, a transceiver 602, an antenna 603, a bus interface 604, a processor 605 and a memory 606.

[0109] The processor 605 is used for:

[0110] Determine the first virtual central processing unit vCPU resources required by the virtual machine;

[0111] Performing a preset super-resolution ratio operation on the first vCPU resource to obtain a second vCPU resource, and performing a preset super-resolution ratio operation on the allocatable logical CPU resource of the first server to obtain a first logical CPU resource, wherein the preset super-resolution ratio is an integer greater than 1;

[0112] The second logical CPU resources are allocated to the second vCPU resources required by the virtual machine based on the first logical CPU resources, and the quantity of the second logical CPU resources matches the quantity of the second vCPU resources.

[0113] In one embodiment, the processor 605 is further used to bind the second vCPU resource to the second logical CPU resource; wherein, after the binding is performed, the thread corresponding to the second vCPU resource is scheduled to the second logical CPU resource for processing.

[0114] In one embodiment, the number of virtual machines is N, where N is a positive integer. The first vCPU resources required by the virtual machines include the first vCPU resources required by each of the N virtual machines. Among the allocatable logical CPU resources, the number of allocated logical CPU resources corresponding to the second logical CPU resources is less than or equal to the sum of the first vCPU resources required by the N virtual machines after rounding up. The number of allocated logical CPU resources is the result of rounding up the number of second logical CPU resources divided by a preset over-resolution ratio.

[0115] In one embodiment, the processor 605 is further configured to round up the second vCPU resources to update the second vCPU resources.

[0116] In one embodiment, the processor 605 is further configured to:

[0117] Get resource status data of multiple servers;

[0118] Based on resource status data of a plurality of servers, at least one server that meets the resource requirements of the virtual machine is selected from the plurality of servers, and the first server is one of the at least one server.

[0119] In one embodiment, the resource status data includes at least one item of the total amount of at least one type of resources, the usage amount of at least one type of resources, and the remaining amount of at least one type of resources, and the at least one type of resources includes at least logical CPU resources.

[0120] In one embodiment, the processor 605 is specifically configured to perform a preset super-resolution ratio multiplication calculation on the first vCPU resource and then round up to obtain a second vCPU resource.

[0121] exist Figure 6In the embodiment, a bus architecture (represented by bus 601) is shown, bus 601 may include any number of interconnected buses and bridges, bus 601 links various circuits including one or more processors represented by processor 605 and memory represented by memory 606. Bus 601 may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. Bus interface 604 provides an interface between bus 601 and transceiver 602. Transceiver 602 may be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. Data processed by processor 605 is transmitted on a wireless medium via antenna 603, and further, antenna 603 also receives data and transmits the data to processor 605.

[0122] The processor 605 is responsible for managing the bus 601 and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management and other control functions. The memory 606 can be used to store data used by the processor 605 when performing operations.

[0123] Optionally, the processor 605 may be a CPU, an ASIC, an FPGA or a CPLD.

[0124] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned resource allocation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. Among them, the computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0125] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0126] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a first server, an air conditioner, or a network device, etc.) to execute the methods of each embodiment of the present application.

[0127] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A resource allocation method, characterized in that: The method comprises: Determine the first virtual central processing unit vCPU resources required by the virtual machine; Performing a super-resolution calculation of a preset super-resolution ratio times the first vCPU resource to obtain a second vCPU resource, and performing a super-resolution calculation of the preset super-resolution ratio times the allocatable logical CPU resource of the first server to obtain a first logical CPU resource, wherein the preset super-resolution ratio is an integer greater than 1; A second logical CPU resource is allocated to the second vCPU resource required by the virtual machine based on the first logical CPU resource, and the quantity of the second logical CPU resource matches the quantity of the second vCPU resource.

2. The method according to claim 1, characterized in that: After allocating the second logical CPU resource to the second vCPU resource required by the virtual machine based on the first logical CPU resource, the method further includes: The second vCPU resource is bound to the second logical CPU resource, wherein after the binding, the thread corresponding to the second vCPU resource is scheduled to the second logical CPU resource for processing.

3. The resource allocation method according to claim 1, characterized in that: The number of virtual machines is N, where N is a positive integer. The first vCPU resources required by the virtual machines include the first vCPU resources required by each of the N virtual machines. Among the allocatable logical CPU resources, the number of allocated logical CPU resources corresponding to the second logical CPU resources is less than or equal to the sum of the first vCPU resources required by the N virtual machines after rounding up. The number of allocated logical CPU resources is the result of rounding up the number of the second logical CPU resources divided by the preset over-resolution ratio.

4. The method according to claim 1, characterized in that After performing super-resolution calculation on the first vCPU resource at a preset super-resolution ratio to obtain a second vCPU resource, and before allocating a second logical CPU resource to the second vCPU resource required by the virtual machine based on the first logical CPU resource, the method includes: The second vCPU resources are rounded up to update the second vCPU resources.

5. The method according to claim 1, characterized in that Before performing the preset super-resolution ratio times super-resolution calculation on the allocatable logical CPU resources of the first server, the method further includes: Get resource status data of multiple servers; Based on the resource status data of the multiple servers, at least one server that meets the resource requirements of the virtual machine is selected from the multiple servers, and the first server is one of the at least one server.

6. The method according to claim 1, characterized in that The resource status data includes at least one item of the total amount of at least one type of resources, the usage amount of at least one type of resources, and the remaining amount of at least one type of resources, and the at least one type of resources includes at least logical CPU resources.

7. A resource allocation device, characterized in that: include: A first determination module, used to determine a first virtual central processing unit vCPU resource required by the virtual machine; a super-resolution computing module, configured to perform a preset super-resolution ratio operation on the first vCPU resource to obtain a second vCPU resource, and perform a preset super-resolution ratio operation on the allocatable logical CPU resource of the first server to obtain a first logical CPU resource, wherein the preset super-resolution ratio is an integer greater than 1; An allocation module is used to allocate a second logical CPU resource to the second vCPU resource required by the virtual machine based on the first logical CPU resource, and the number of the second logical CPU resources matches the number of the second vCPU resources.

8. An electronic device, characterized in that: Including transceiver and processor, The processor is configured to: Determine the first virtual central processing unit vCPU resources required by the virtual machine; Performing a super-resolution calculation of a preset super-resolution ratio times the first vCPU resource to obtain a second vCPU resource, and performing a super-resolution calculation of the preset super-resolution ratio times the allocatable logical CPU resource of the first server to obtain a first logical CPU resource, wherein the preset super-resolution ratio is an integer greater than 1; A second logical CPU resource is allocated to the second vCPU resource required by the virtual machine based on the first logical CPU resource, and the quantity of the second logical CPU resource matches the quantity of the second vCPU resource.

9. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program implements the steps of the method according to any one of claims 1 to 6 when executed by the processor.

10. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any one of the methods of claims 1-6.