WO2022063273A1 - Resource allocation method and apparatus based on numa attribute - Google Patents

Resource allocation method and apparatus based on numa attribute Download PDF

Info

Publication number
WO2022063273A1
WO2022063273A1 PCT/CN2021/120706 CN2021120706W WO2022063273A1 WO 2022063273 A1 WO2022063273 A1 WO 2022063273A1 CN 2021120706 W CN2021120706 W CN 2021120706W WO 2022063273 A1 WO2022063273 A1 WO 2022063273A1
Authority
WO
WIPO (PCT)
Prior art keywords
resource
numa
management
management resource
allocated
Prior art date
Application number
PCT/CN2021/120706
Other languages
French (fr)
Chinese (zh)
Inventor
贾金科
徐安
秦洲
Original Assignee
华为云计算技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为云计算技术有限公司 filed Critical 华为云计算技术有限公司
Publication of WO2022063273A1 publication Critical patent/WO2022063273A1/en

Links

Images

Classifications

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

Definitions

  • the present application relates to the field of cloud computing technologies, and in particular, to a method and device for resource allocation based on NUMA attributes.
  • the server architecture used by the cloud management platform is a non-uniform memory access (NUMA) architecture.
  • NUMA non-uniform memory access
  • the central processing unit (CPU) and memory of the server can be divided into multiple NUMA nodes.
  • each NUMA node has multiple CPU cores, some CPU cores are used for running virtual machines, and the other CPU cores are used for running management processes of the cloud management platform.
  • the present application provides a NUMA attribute-based resource allocation method and device to improve resource utilization.
  • the present application provides a resource allocation method based on NUMA attributes, which can be applied to computing nodes.
  • the method includes: obtaining a resource allocation policy issued by a cloud management platform and NUMA attributes of management resources; The acquired resource allocation policy and the NUMA attribute of the management resource allocate the central processing unit CPU of the computing node for the management resource.
  • the computing node can configure different resource allocation strategies according to the NUMA attributes of the management resources, which can improve the flexibility of resource allocation, reduce resource fragmentation, and improve resource utilization.
  • the management resources include a first management resource, a second management resource, and a third management resource.
  • the attributes of the first management resource include: the CPU of the first NUMA node of the computing node needs to be allocated to the first management resource; the attributes of the second management resource include: the CPU of any NUMA node in the computing nodes can be allocated to the second management resource.
  • Management resource; the attributes of the third management resource include: CPUs can be allocated to the third management resource across NUMA nodes in the computing node.
  • different management resources have different NUMA attributes, and for different management resources, the assignable NUMA nodes may be the same or different, so that management resources can be allocated to NUMA nodes according to the NUMA node attributes of the management resources.
  • the resource allocation strategy includes a balanced resource allocation strategy, and according to the resource allocation strategy and the NUMA attribute of the management resource, the central processing unit CPU of the computing node is allocated to the management resource, including :
  • the computing node can allocate the management resources to different NUMA nodes according to the NUMA attributes of the management resources, and when the management resources are allocated according to the balanced resource allocation strategy, the management resources on different NUMA nodes can be occupied by the management resources.
  • the CPU cores are balanced, which can reduce resource fragmentation on computing nodes and improve resource utilization.
  • the CPU cores available to the virtual machine on each NUMA node can be equalized, thereby improving the creation specification of the virtual machine.
  • the method further includes: after the third management resource is allocated to the third NUMA node, if the third management resource still needs to occupy H CPU cores, the first The NUMA node and the second NUMA node, whichever has the most remaining CPU cores, allocates H CPU cores to the third management resource, or allocates H/2 CPU cores from the first NUMA node and the second NUMA node to the third management resource. management resources, or allocating H CPU cores from the fourth NUMA node to the third management resources.
  • the computing node can allocate the remaining third management resources to NUMA nodes with relatively few CPU cores according to the number of CPU cores occupied by the remaining third management resources, or can also allocate the remaining third management resources to NUMA nodes that occupy less CPU cores. Resources are evenly distributed to other NUMA nodes, which can ensure that the CPU cores occupied by management resources on different NUMA nodes are balanced and improve resource utilization.
  • the resource allocation strategy includes a centralized resource allocation strategy, and according to the centralized resource allocation strategy and the NUMA attribute of the management resource, the CPU of the computing node is allocated to the management resource,
  • the method includes: sequentially classifying the first management resource, the second management resource and the third management resource according to the NUMA attributes corresponding to the first management resource, the second management resource and the third management resource respectively Resources are allocated to the first NUMA node.
  • the computing node can centrally allocate management resources of different NUMA attributes to one NUMA node, so that the performance of the computing node can be improved, and a larger size virtual machine can be created on a single NUMA.
  • the method further includes: after the third management resource is allocated to the first NUMA node, if the third management resource still needs to occupy H CPU cores, the second The NUMA node or the third NUMA node allocates H CPU cores to the third management resource.
  • the remaining third management resources can be allocated to other NUMA nodes, thereby avoiding resource waste and improving resource utilization.
  • the present application provides a resource allocation device based on NUMA attributes, including: an acquisition unit, where the acquisition unit is configured to acquire a resource allocation strategy issued by a cloud management platform and NUMA attributes of management resources; an allocation unit, used for The central processing unit CPU of the computing node is allocated to the management resource according to the resource allocation policy and the NUMA attribute of the management resource obtained by the obtaining unit.
  • the management resource includes a first management resource, a second management resource, and a third management resource;
  • the attributes of the first management resource include: the first NUMA node to which the computing node needs to be allocated.
  • attributes of the second management resource include: the CPU of any NUMA node of the computing node can be allocated to the second management resource;
  • attributes of the third management resource include: CPUs may be allocated to the third management resource in the compute nodes across NUMA nodes.
  • the allocation unit is specifically configured to, according to the resource allocation strategy and the NUMA attribute of the management resource, provide the The management resource is allocated to the central processing unit CPU of the computing node: according to the NUMA attributes corresponding to the first management resource, the second management resource, and the third management resource, respectively, the first management resource, all the The second management resource and the third management resource are allocated to the first NUMA node, the second NUMA node and the third NUMA node.
  • the allocating unit is further configured to: after the third management resource is allocated to the third NUMA node, if the third management resource still needs to occupy H CPU cores, then The first NUMA node and the second NUMA node, whichever has the most remaining CPU cores, allocate H CPU cores to the third management resource, or allocate H/2 CPU cores from the first NUMA node and the second NUMA node to the third management resource.
  • the third management resource, or H CPU cores are allocated from the fourth NUMA node to the third management resource.
  • the allocation unit is specifically configured to, according to the centralized resource allocation strategy and the NUMA attribute of the management resource, be as follows:
  • the management resource is allocated to the CPU of the computing node: according to the NUMA attributes corresponding to the first management resource, the second management resource and the third management resource, the first management resource, the The second management resource and the third management resource are allocated to the first NUMA node.
  • the allocating unit is further configured to: after the third management resource is allocated to the first NUMA node, if the third management resource still needs to occupy H CPU cores, then The second NUMA node or the third NUMA node allocates H CPU cores to the third management resource.
  • the present application provides a NUMA attribute-based resource allocation apparatus, which has the function of implementing the resource allocation method in the first aspect or any possible implementation manner of the first aspect.
  • the functions can be implemented by hardware, or can be implemented by hardware executing corresponding software.
  • the apparatus includes a communication interface for receiving and sending data, a processor and a memory, the processor being configured to support the apparatus to perform the first aspect or any of the possible implementations of the first aspect corresponding function.
  • the memory is coupled to the processor and holds program instructions necessary for the apparatus.
  • a computer-readable storage medium where instructions are stored in the computer-readable storage medium, when the computer-readable storage medium runs on a computer, the computer causes the computer to execute the methods in the first aspect and the various embodiments.
  • a computer program product comprising instructions, which, when executed on a computer, cause the computer to perform the methods of the first aspect and the various embodiments above.
  • a chip is provided, and logic in the chip is used to execute the methods in the first aspect and each of the above embodiments.
  • FIG. 1 is a schematic diagram of a system architecture in which an embodiment of the present application is applied to a cloud scenario
  • FIG. 2 is a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application
  • FIG. 3 is a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application
  • FIG. 4 is a schematic diagram of a resource allocation method according to an embodiment of the present application.
  • FIG. 5 is a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application
  • FIG. 6 is a schematic diagram of a NUMA attribute-based resource allocation apparatus provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of another apparatus for resource allocation based on NUMA attributes provided by an embodiment of the present application.
  • Non-uniform memory access NUMA It is a memory architecture designed for multi-processor computers, and the memory access time depends on the location of the memory relative to the processor. Under NUMA, a processor can access its own local memory a bit faster than non-local memory (memory located on another processor, or memory shared between processors).
  • Virtual machine Use virtualization technology to simulate a physical host as multiple logical hosts (called virtual machines).
  • a virtual machine refers to a logical host in a complete computer system that is simulated by software with complete hardware system functions and can run in a completely isolated environment.
  • Computing node In this application, it can be understood as a host or a server.
  • At least one involved in the embodiments of the present application includes one or more; wherein, multiple refers to greater than or equal to two.
  • words such as “first” and “second” are only used for the purpose of distinguishing the description objects, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.
  • FIG. 1 it is a schematic diagram of a system architecture in which an embodiment of the present application is applied to a cloud scenario.
  • the server can be divided into two chips (chips), such as CPU0 and CPU1, wherein each chip can include a NUMA node.
  • the server shown in FIG. 1 may include 4 NUMA nodes, and each NUMA node has multiple processor cores (core0, core1, etc.). Some of these processor cores can be allocated to management resources and some can be allocated to virtual machines.
  • core0 and core1 can be allocated to management resources, and core2, core3...core31 can be allocated to virtual machines.
  • core0, core1...core20 can also be used for management resources, and core21...core31 can be used by virtual machines, etc. This application does not specifically limit this.
  • management resources need to be isolated.
  • NUMA architecture when isolation of management resources is performed, it is necessary to isolate different processor cores on different NUMA nodes for use by management resources. Since the number of processor cores allocated to management resources on different NUMA nodes is uncertain, the number of processor cores allocated to virtual machines is uncertain, which will affect the specifications of virtual machines that can be allocated by the server. and quantity, thus affecting the resource utilization of the server.
  • the system administrator can configure different resource allocation policies for different servers, and the cloud management platform delivers them to different servers.
  • the resource allocation policies can be: Manage resources and allocate server cores to virtual machines to maximize the use of server resources and improve resource utilization.
  • FIG. 2 a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application.
  • the method may include the following steps:
  • S201 Acquire the resource allocation policy issued by the cloud management platform and the NUMA attribute of the management resource.
  • management resource may include multiple management processes, and different management processes may correspond to different NUMA attributes.
  • S202 Allocate the CPU of the computing node for the management resource according to the resource allocation policy and the NUMA attribute of the management resource.
  • the resource allocation strategy may be denoted as “balanced resource allocation strategy” and “centralized resource allocation strategy” in this embodiment of the present application.
  • the balanced resource allocation strategy can be understood as making the management resources on different NUMA nodes as evenly distributed as possible when resource isolation is performed on management resources, so that different NUMA nodes can provide virtual machines with Resources are equal.
  • the centralized resource allocation strategy can be understood as making the management resources centrally allocated to a certain NUMA node when the management resources are isolated.
  • the management resources may include: a first management resource, a second management resource, and a third management resource. It is assumed that the NUMA nodes on the server (computing node) include: a first NUMA node, a second NUMA node, a third NUMA node, and a fourth NUMA node.
  • the attribute requirements of resource isolation may be different.
  • the NUMA attributes of different management resources may correspond to the following:
  • the attribute of the first management resource includes: the CPU of the first NUMA node of the computing node needs to be allocated to the first management resource; the attribute of the second management resource includes: the CPU of any NUMA node of the computing node can be allocated to the second management resource;
  • the attributes of the third management resource include that CPUs can be allocated to the third management resource across NUMA nodes in the computing node.
  • the above management resources can be divided into the following categories:
  • the first category the management resource of a certain NUMA node must be used fixedly, such as resource L.
  • the second category a management resource of a NUMA node must be used, such as resource M.
  • the third category management resources that can be flexibly allocated on each NUMA node, for example, denoted as resource N.
  • the first type of resource namely resource L
  • the second type of resource namely resource M
  • the third type of resource namely resource N
  • the third management resource may correspond to the above-mentioned third management resource.
  • the CPU of the computing node may be allocated for management resources in the following manner:
  • the first management resource, the second management resource and the third management resource are allocated to the first NUMA node, the second NUMA node and the third management resource.
  • the third management resource may occupy more CPU cores
  • the third management resource may not be fully allocated on the third NUMA node allocated above, and at this time, it is necessary to determine the CPU that the third management resource still needs to occupy The number of cores (for example, H CPU cores need to be occupied).
  • the third management resource still needs to occupy H CPU cores
  • the first NUMA node and the second NUMA node with the most remaining CPU cores are allocated H CPU cores to the third management resource. That is, the remaining H CPU cores of the third management resource may be allocated to the NUMA node with the most remaining CPU cores among the first NUMA node and the second NUMA node.
  • H/2 CPU cores may be allocated from the first NUMA node and the second NUMA node to the third management resource. That is, the H CPU cores are equally distributed to the first NUMA node and the second NUMA node.
  • H CPU cores may be allocated from the fourth NUMA node to the third management resource. That is, the remaining H CPU cores of the third management resource can be allocated to other NUMA nodes.
  • FIG. 3 a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application. Referring to FIG. 3 , the method includes the following steps:
  • Q is a positive integer greater than or equal to 1.
  • the CPU and memory on the server when divided into Q NUMA nodes, they can be divided in the form of equal division. In other words, the number of CPUs and memory on the server can be evenly divided among Q NUMA nodes, so that the number of CPUs and memory on each NUMA node are equal.
  • S302 Allocate the resource L to a fixed NUMA node among the Q NUMA nodes.
  • the resource L is a resource using a fixed NUMA node
  • the resource L may be a resource that uses a certain NUMA node on a fixed basis, or a resource that uses a certain two NUMA nodes among the Q NUMA nodes, etc., which is not limited in this application.
  • S303 Allocate the resource M to a NUMA node different from the NUMA node where the resource L is located.
  • Resource M For a resource M that uses one NUMA node fixedly, it can be allocated after fixing the resource L to Q NUMA nodes.
  • Resource M can be allocated to a NUMA node alone, or can be allocated to a NUMA node where resource L is located, as long as it is ensured that resource M is located on the same NUMA node, that is, it is not allocated across NUMA nodes.
  • the resource M may be allocated to a different NUMA node from the resource L, so that different NUMNA nodes will have management resources, and there will be no situation where all management resources are allocated to one NUMA node.
  • S304 Determine the maximum value of the number of CPU cores occupied by the resource L and the resource M.
  • resource L is first allocated to Q NUMA nodes, for example, to NUMA0, and then resource M is allocated, for example, resource M can be allocated to NUMA2, then the management resources in NUMA0 occupy the The number of CPU cores is x1, and the number of CPU cores occupied by management resources in NUMA2 is x2.
  • S305 Allocate the resource N to a NUMA node different from the NUMA node where the resource L and the resource M are located.
  • the resource N may be allocated according to the maximum number of CPU cores occupied by the resource L and the resource M.
  • the maximum number of CPU cores occupied by resource L and resource M can be taken as the maximum number of CPU cores occupied by management resources set in each NUMA node, and then based on the maximum value. Allocate resource N.
  • resource N may be allocated according to the number of CPU cores occupied by resource L or resource M.
  • the resource N can be allocated to NUMA3.
  • the resource N may also be allocated to NUMA1, etc., which is not limited in this application.
  • resource N when resource N is allocated, it may be allocated in the order of NUMA nodes. Assume that the maximum number of CPU cores occupied by resource L and resource M is the number of CPU cores occupied by resource L, that is, x1. For example, if resource L is allocated to NUMA0 and resource M is allocated to NUMA2, then resource N can be allocated to NUMA1 first. When the number of CPU cores occupied by resource N in NUMA1 is x1, then resource N can be allocated to NUMA3. .
  • the resource N may also be randomly allocated to the NUMA nodes that are not resource L and non-resource M, which is not limited in this application.
  • S306 Determine whether there are remaining unallocated resources N. If there is remaining resource N, continue to step S307.
  • resource N when the number of CPU cores occupied by resource N is relatively small (for example, the number of CPU cores occupied by resource N is less than the set threshold), it can be allocated to NUMA nodes that are not resource L and non-resource M middle. That is to say, resource N can be allocated to NUMA nodes other than resource L and non-resource M, and there will be no remaining unallocated resource N.
  • the number of CPU cores occupied by management resources in the NUMA nodes that are not resource L and non-resource M is the maximum number of CPU cores occupied by resource L and resource M. That is to say, when the resource N cannot be allocated to the NUMA nodes other than the resource L and the resource M, it can be allocated to the NUMA node where the resource L and/or the resource M are located. At this point, the number of CPU cores occupied by the management resources in each NUMA node can be calculated.
  • resource L is allocated to NUMA0
  • resource M is allocated to NUMA2
  • the number of CPU cores occupied by resource L is 6,
  • the number of CPU cores occupied by resource M is 4.
  • the resource N can be allocated up to 6 CPU cores on the NUMA1 and NUMA3 that can be allocated, respectively. That is, there are 2 remaining CPU cores left unallocated.
  • S308 Determine the NUMA node with the least number of CPU cores occupied by management resources among the Q NUMA nodes.
  • the remaining resource N can be allocated to the NUMA node with the smallest number of CPU cores occupied by management resources.
  • the relationship between the number of CPU cores occupied by resource L and resource M in the NUMA node is: x1>x2, that is to say, the number of CPU cores occupied by management resources in the NUMA2 node is the least, then the The remaining resource N is allocated to NUMA2 nodes.
  • the 2 CPU cores can be allocated to the NUMA node with more remaining CPU cores among the NUMA nodes, for example, it can be allocated to the NUMA2 node where the resource M is located, so that NUMA0
  • the CPU cores occupied by management resources on , NUMA1, NUMA2 and NUMA3 are balanced.
  • the above allocation method is only an example.
  • the remaining number of CPU cores can also be evenly allocated to NUMA nodes, or a part of them can be allocated to NUMA nodes with more remaining CPU cores, and then The rest is evenly distributed to several NUMA nodes, which is not limited in this application.
  • the number of CPU cores occupied by the management resources in each NUMA node can be the same, which is equal to the maximum number of CPU cores occupied by the resource L and the resource M.
  • step S3010 Continue to allocate the CPU cores occupied by the remaining resources N in step S309 to the Q NUMA nodes until the resource N is allocated and the CPUs occupied by the management resources in the Q NUMA nodes are balanced.
  • the number of CPU cores occupied by the remaining resource N in step S308 may be evenly allocated on the Q NUMA nodes.
  • the remainder can be preferentially allocated to the NUMA nodes where the non-resource L and non-resource M are located , if the allocation still cannot be completed, then allocate to the NUMA node where the resource L and/or resource M are located until the resource N is all allocated.
  • the number of CPU cores allocated to resource N on each NUMA node may be recorded, and then the memory of the server is allocated to the CPU core occupied by resource N.
  • the NUMA node with the largest number to ensure that when accessing memory, there is no need to access across NUMA nodes, shortening the memory access time and improving access efficiency.
  • the host is configured with 96 (pcs) CPUs and 384G of memory, and the CPU and memory are divided into 4 NUMA nodes, such as NUMA0, NUMA1, NUMA2, and NUMA3, the available resources of each NUMA node are 24CPU and 96G of memory.
  • management processes that can be included in this application and the number of CPU cores and memory occupied by each process are as follows:
  • Virtualization management process 2CPU, 12G memory; computing management process: 6CPU, 5G memory; network management process: 4CPU, 8G memory; storage management process: 4CPU, 7G memory.
  • the memory of the virtualization management process can be evenly distributed among the NUMA nodes; the CPU cores of the computing management process can be dynamically allocated, and the memory needs to be assigned a NUMA node; the network management process must be fixed on the NUMA0 node; the storage management process must be on a NUMA node middle.
  • the network management process may correspond to the resource L (ie the first management resource)
  • the storage management process may correspond to the resource M (ie the second management resource)
  • the virtualization management process and the computing management process may correspond to the above-mentioned Resource N (ie the third management resource).
  • Table 1 is used as an example below to illustrate the allocation of management resources by NUMA nodes on the server before applying the allocation strategy of the present application, as shown in Table 1.
  • the CPU of the computing node may be allocated for management resources in the following manner:
  • the NUMA attributes corresponding to the first management resource, the second management resource and the third management resource, the first management resource, the second management resource and the third management resource are sequentially allocated to the first NUMA node. That is to say, three types of management resources with different NUMA attributes are allocated to the same NUMA node, and more specifically, it can be allocated to the NUMA node where the management resources that use a certain NUMA node are located.
  • the remaining CPU cores can be allocated to other NUMA nodes when the allocation cannot be completed on a fixed NUAM node. That is, after the third management resource is allocated to the first NUMA node, if the third management resource still needs to occupy H CPU cores, then H CPU cores are allocated from the second NUMA node or the third NUMA node to the third management resource.
  • FIG. 5 a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application. Referring to FIG. 5 , the method includes the following steps:
  • steps S501 and S502 in the embodiment shown in FIG. 5 are the same as steps S301 and S302 in the embodiment shown in FIG. 3 .
  • steps S501 and S502 in the embodiment shown in FIG. 5 are the same as steps S301 and S302 in the embodiment shown in FIG. 3 .
  • S502 Allocate the resource L to a fixed NUMA node among the Q NUMA nodes.
  • resource M when a centralized resource allocation strategy is used, it is necessary to allocate management resources to a NUMA node as much as possible. Therefore, after resource L is allocated, resource M can be allocated to the same NUMA node as resource L node. Exemplarily, assuming that resource L is allocated to NUMA0 first, when resource M is allocated, resource M may also be allocated to NUMNA0.
  • S504 Allocate the resource N to the same NUMA node as the NUMA node where the resource L and the resource M are located.
  • the resource N can be preferentially allocated to the NUMA nodes occupied by the resource L and the resource M, so as to ensure that the management resources can be centrally allocated to the same NUMA node.
  • S505 Determine whether there are remaining unallocated resources N. If there is remaining resource N, continue to step S506.
  • resource N may be able to be allocated to the NUMA nodes occupied by resource L and resource M.
  • resource N If the number of CPU cores occupied by resource N is greater than the set threshold, that is, when the number of CPU cores is relatively large, resource N cannot be allocated completely, then resource N will be left over, that is, there will be unallocated resource N that needs to be continued. distribute.
  • S506 Allocate the remaining resource N to other NUMA nodes except the fixed NUMA node among the Q NUMA nodes, until the resource N is allocated.
  • the remaining resource N may be allocated to another NUMA node. If another NUMA node can allocate the remaining resource N, it ends; if the other NUMA node still has not allocated the remaining resource N, continue to allocate the remaining resource N to other NUMA nodes until the resource N is allocated.
  • management resources can be centrally allocated to one NUMA node, so that when creating a virtual machine, the number of virtual machines configured on a single NUMA node can be increased.
  • a configuration policy can also be customized, that is, the user can specify the NUMA nodes occupied by the resource M and the resource N as well as the CPU core occupied by the NUMA node according to requirements. number.
  • Table 1 is still used as the allocation form before the centralized resource allocation strategy is applied. From Table 1, according to the resource allocation in Table 1, the maximum specification of a single NUMA virtual machine that a user can create is: 23CPU, that is, the corresponding NUMA2 node. The virtual machine is the maximum size.
  • the allocation of management resources by NUMA nodes on the server can be referred to as shown in Table 3.
  • the present application further provides a resource allocation device based on NUMA attributes.
  • the device 600 may include: an acquisition unit 601 and an allocation unit 602 .
  • the obtaining unit 601 is used for obtaining the resource allocation strategy and the NUMA attribute of the management resource issued by the cloud management platform; the allocation unit 602 is used for obtaining the resource allocation strategy and the management resource according to the obtaining unit 601
  • the NUMA attribute of the central processing unit CPU of the computing node is allocated to the management resource.
  • the management resource includes a first management resource, a second management resource, and a third management resource;
  • the attributes of the first management resource include: the first NUMA node to which the computing node needs to be allocated.
  • attributes of the second management resource include: the CPU of any NUMA node of the computing node can be allocated to the second management resource;
  • attributes of the third management resource include: CPUs may be allocated to the third management resource in the compute nodes across NUMA nodes.
  • the allocation unit 602 is specifically configured to, according to the resource allocation strategy and the NUMA attribute of the management resource, be configured as follows:
  • the management resource is allocated to the central processing unit CPU of the computing node: according to the NUMA attributes corresponding to the first management resource, the second management resource and the third management resource, respectively, the first management resource,
  • the second management resource and the third management resource are allocated to the first NUMA node, the second NUMA node and the third NUMA node.
  • the allocating unit 602 is further configured to: after the third management resource is allocated to the third NUMA node, if the third management resource still needs to occupy H CPU cores, then Allocate H CPU cores from the first NUMA node and the second NUMA node with the most remaining CPU cores to the third management resource, or allocate H/2 CPU cores from each of the first NUMA node and the second NUMA node to all the CPU cores. the third management resource, or allocate H CPU cores from the fourth NUMA node to the third management resource.
  • the allocation unit 602 is specifically configured to, according to the centralized resource allocation strategy and the NUMA attribute of the management resource, as follows: Allocate the CPU of the computing node to the management resource: according to the NUMA attributes corresponding to the first management resource, the second management resource, and the third management resource, sequentially assign the first management resource, all the The second management resource and the third management resource are allocated to the first NUMA node.
  • the allocating unit 602 is further configured to: after the third management resource is allocated to the first NUMA node, if the third management resource still needs to occupy H CPU cores, then The H CPU cores are allocated from the second NUMA node or the third NUMA node to the third management resource.
  • each functional module in each embodiment of this application may be integrated into one processing unit. In the device, it can also exist physically alone, or two or more modules can be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules.
  • FIG. 7 shows a NUMA attribute-based resource allocation apparatus 700 provided in an embodiment of the present application.
  • the apparatus 700 includes at least one processor 702 for implementing or supporting the apparatus 700 in implementing the diagrams provided in the embodiments of the present application.
  • 6 shows the function of the distribution unit.
  • the processor 702 may allocate the central processing unit CPU of the computing node, etc. to the management resource according to the resource allocation policy and the NUMA attribute of the management resource obtained by the obtaining unit 601.
  • the processor 702 may allocate the central processing unit CPU of the computing node, etc. to the management resource according to the resource allocation policy and the NUMA attribute of the management resource obtained by the obtaining unit 601.
  • the detailed description in the method example will not be repeated here.
  • the apparatus 700 may also include at least one memory 701 for storing program instructions.
  • Memory 701 and processor 702 are coupled.
  • the coupling in the embodiments of the present application is an indirect coupling or communication connection between devices, units or modules, which may be in electrical, mechanical or other forms, and is used for information exchange between devices, units or modules.
  • the processor 702 may cooperate with the memory 701 .
  • Processor 702 may execute program instructions and/or data stored in memory 701 . At least one of the at least one memory may be included in the processor.
  • the apparatus 700 may also include a communication interface 703 for communicating with other devices over a transmission medium.
  • the processor 702 may utilize the communication interface 703 to send and receive data.
  • the present application does not limit the specific connection medium between the communication interface 703 , the processor 702 and the memory 701 .
  • the memory 701 , the processor 702 , and the communication interface 703 are connected through a bus 704 , and the bus is represented by a thick line in FIG. 7 .
  • the bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 7, but it does not mean that there is only one bus or one type of bus.
  • the processor 702 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, which can implement Alternatively, each method, step, and logic block diagram disclosed in the embodiments of the present application are executed.
  • a general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the methods disclosed in conjunction with the embodiments of the present application may be directly executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
  • the memory 701 may be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), etc., or a volatile memory (volatile memory), For example RAM.
  • Memory is, but is not limited to, any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
  • the memory in this embodiment of the present application may also be a circuit or any other device capable of implementing a storage function, for storing program instructions.
  • the computer-executed instructions in the embodiment of the present application may also be referred to as application code, which is not specifically limited in the embodiment of the present application.
  • Embodiments of the present application further provide a computer-readable storage medium, including instructions, which, when executed on a computer, cause the computer to execute the method of the foregoing embodiment.
  • Embodiments of the present application also provide a computer program product, including instructions, which, when executed on a computer, cause the computer to execute the methods of the above embodiments.
  • the embodiment of the present application further provides a chip, and the logic in the chip is used to execute the method of the above embodiment.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions
  • the apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

A resource allocation method and apparatus based on a NUMA attribute, which are applied to the field of cloud computing. The method comprises: obtaining resource allocation policies issued by a cloud management platform and NUMA attributes of management resources; and allocating central processing units (CPUs) of a computing node to the management resources according to the resource allocation policies and the NUMA attributes of the management resources. By means of the method of the present application, a computing node can configure different resource allocation policies according to NUMA attributes of management resources, thereby improving the flexibility of resource allocation while also improving the resource utilization rate.

Description

一种基于NUMA属性的资源分配方法及装置A NUMA attribute-based resource allocation method and device 技术领域technical field
本申请涉及云计算技术领域,尤其涉及一种基于NUMA属性的资源分配方法及装置。The present application relates to the field of cloud computing technologies, and in particular, to a method and device for resource allocation based on NUMA attributes.
背景技术Background technique
目前,云管理平台使用的服务器架构为非一致性内存访问(non-uniform memory access,NUMA)架构,基于该NUMA架构可将服务器的中央处理器(central processing unit,CPU)和内存划分为多个NUMA节点。其中,每个NUMA节点中有多个CPU核,有一部分CPU核用于虚拟机运行,另外一部分CPU核用于运行云管理平台的管理进程。At present, the server architecture used by the cloud management platform is a non-uniform memory access (NUMA) architecture. Based on the NUMA architecture, the central processing unit (CPU) and memory of the server can be divided into multiple NUMA nodes. Among them, each NUMA node has multiple CPU cores, some CPU cores are used for running virtual machines, and the other CPU cores are used for running management processes of the cloud management platform.
由于在不同的NUMA节点上,管理进程所占的CPU核数量不同,使得虚拟机的可用资源为不确定的,这样会使得虚拟机发放时,资源碎片过多,导致资源利用率比较低。Since the number of CPU cores occupied by the management process on different NUMA nodes is different, the available resources of the virtual machine are uncertain, which will lead to excessive resource fragmentation when the virtual machine is issued, resulting in low resource utilization.
发明内容SUMMARY OF THE INVENTION
本申请提供一种基于NUMA属性的资源分配方法及装置,用以提高资源利用率。The present application provides a NUMA attribute-based resource allocation method and device to improve resource utilization.
第一方面,本申请提供一种基于NUMA属性的资源分配方法,该方法可应用于计算节点,具体的,该方法包括:获取云管理平台下发的资源分配策略以及管理资源的NUMA属性;根据获取的资源分配策略和管理资源的NUMA属性,为管理资源分配所述计算节点的中央处理器CPU。In a first aspect, the present application provides a resource allocation method based on NUMA attributes, which can be applied to computing nodes. Specifically, the method includes: obtaining a resource allocation policy issued by a cloud management platform and NUMA attributes of management resources; The acquired resource allocation policy and the NUMA attribute of the management resource allocate the central processing unit CPU of the computing node for the management resource.
通过上述技术方案,计算节点可以根据管理资源的NUMA属性,配置不同的资源分配策略,这样能够提高资源分配的灵活性,同时可以减少资源碎片,提高资源利用率。Through the above technical solution, the computing node can configure different resource allocation strategies according to the NUMA attributes of the management resources, which can improve the flexibility of resource allocation, reduce resource fragmentation, and improve resource utilization.
在一种可能的设计中,管理资源包括第一管理资源、第二管理资源以及第三管理资源。其中,第一管理资源的属性包括:需要分配计算节点的第一NUMA节点的CPU至第一管理资源;第二管理资源的属性包括:可以分配计算节点中的任意一个NUMA节点的CPU至第二管理资源;第三管理资源的属性包括:可以在计算节点中跨NUMA节点分配CPU至第三管理资源。In a possible design, the management resources include a first management resource, a second management resource, and a third management resource. The attributes of the first management resource include: the CPU of the first NUMA node of the computing node needs to be allocated to the first management resource; the attributes of the second management resource include: the CPU of any NUMA node in the computing nodes can be allocated to the second management resource. Management resource; the attributes of the third management resource include: CPUs can be allocated to the third management resource across NUMA nodes in the computing node.
在上述技术方案中,不同管理资源的NUMA属性不同,针对不同的管理资源,可分配的NUMA节点可能会相同或不同,这样可按照管理资源的NUMA节点属性将管理资源分配到NUMA节点。In the above technical solution, different management resources have different NUMA attributes, and for different management resources, the assignable NUMA nodes may be the same or different, so that management resources can be allocated to NUMA nodes according to the NUMA node attributes of the management resources.
在一种可能的设计中,资源分配策略包括均衡式资源分配策略,根据所述资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的中央处理器CPU,包括:In a possible design, the resource allocation strategy includes a balanced resource allocation strategy, and according to the resource allocation strategy and the NUMA attribute of the management resource, the central processing unit CPU of the computing node is allocated to the management resource, including :
按照所述第一管理资源、所述第二管理资源以及所述第三管理资源分别对应的 NUMA属性,分别将所述第一管理资源、所述第二管理资源以及所述第三管理资源分配到所述第一NUMA节点、第二NUMA节点以及第三NUMA节点。Allocate the first management resource, the second management resource, and the third management resource according to the NUMA attributes corresponding to the first management resource, the second management resource, and the third management resource, respectively. to the first NUMA node, the second NUMA node, and the third NUMA node.
通过上述技术方案,计算节点可以根据管理资源的NUMA属性将管理资源分配到不同的NUMA节点,并且按照均衡式资源分配策略对管理资源进行分配时,可使得不同的NUMA节点上管理资源所占的CPU核为均衡的,这样能够减少计算节点上的资源碎片,提高资源利用率。并且能够使得每个NUMA节点上虚拟机可用的CPU核为相等的,从而提高虚拟机的创建规格。Through the above technical solution, the computing node can allocate the management resources to different NUMA nodes according to the NUMA attributes of the management resources, and when the management resources are allocated according to the balanced resource allocation strategy, the management resources on different NUMA nodes can be occupied by the management resources. The CPU cores are balanced, which can reduce resource fragmentation on computing nodes and improve resource utilization. In addition, the CPU cores available to the virtual machine on each NUMA node can be equalized, thereby improving the creation specification of the virtual machine.
在一种可能的设计中,所述方法还包括:当所述第三管理资源分配到所述第三NUMA节点之后,若所述第三管理资源还需占用H个CPU核,则从第一NUMA节点和第二NUMA节点中剩余CPU核最多者分配H个CPU核至所述第三管理资源,或从第一NUMA节点和第二NUMA节点各分摊H/2个CPU核至所述第三管理资源,或从第四NUMA节点分配H个CPU核至所述第三管理资源。In a possible design, the method further includes: after the third management resource is allocated to the third NUMA node, if the third management resource still needs to occupy H CPU cores, the first The NUMA node and the second NUMA node, whichever has the most remaining CPU cores, allocates H CPU cores to the third management resource, or allocates H/2 CPU cores from the first NUMA node and the second NUMA node to the third management resource. management resources, or allocating H CPU cores from the fourth NUMA node to the third management resources.
通过上述技术方案,计算节点可根据剩余的第三管理资源所占的CPU核个数,将剩余的第三管理资源分配到CPU核占用比较少的NUMA节点,或者还可以将剩余的第三管理资源平均分配到其它的NUMA节点,这样能够保证不同NUMA节点上管理资源所占的CPU核均衡,提高资源利用率。Through the above technical solution, the computing node can allocate the remaining third management resources to NUMA nodes with relatively few CPU cores according to the number of CPU cores occupied by the remaining third management resources, or can also allocate the remaining third management resources to NUMA nodes that occupy less CPU cores. Resources are evenly distributed to other NUMA nodes, which can ensure that the CPU cores occupied by management resources on different NUMA nodes are balanced and improve resource utilization.
在一种可能的设计中,所述资源分配策略包括集中式资源分配策略,根据所述集中式资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的CPU,包括:按照所述第一管理资源、所述第二管理资源以及所述第三管理资源分别对应的NUMA属性,依次将所述第一管理资源、所述第二管理资源以及所述第三管理资源分配到所述第一NUMA节点。In a possible design, the resource allocation strategy includes a centralized resource allocation strategy, and according to the centralized resource allocation strategy and the NUMA attribute of the management resource, the CPU of the computing node is allocated to the management resource, The method includes: sequentially classifying the first management resource, the second management resource and the third management resource according to the NUMA attributes corresponding to the first management resource, the second management resource and the third management resource respectively Resources are allocated to the first NUMA node.
通过上述技术方案,计算节点可将不同NUMA属性的管理资源集中分配到一个NUMA节点,这样可以提高计算节点的性能,并且在单NUMA上可以创建更大规格的虚拟机。Through the above technical solution, the computing node can centrally allocate management resources of different NUMA attributes to one NUMA node, so that the performance of the computing node can be improved, and a larger size virtual machine can be created on a single NUMA.
在一种可能的设计中,所述方法还包括:当所述第三管理资源分配到所述第一NUMA节点之后,若所述第三管理资源还需占用H个CPU核,则从第二NUMA节点或第三NUMA节点分配H个CPU核至所述第三管理资源。In a possible design, the method further includes: after the third management resource is allocated to the first NUMA node, if the third management resource still needs to occupy H CPU cores, the second The NUMA node or the third NUMA node allocates H CPU cores to the third management resource.
通过上述技术方案,如果第三管理资源没有分配完,则可以将剩余的第三管理资源分配到其它的NUMA节点上,从而避免资源浪费,提高资源利用率。Through the above technical solution, if the third management resources are not allocated, the remaining third management resources can be allocated to other NUMA nodes, thereby avoiding resource waste and improving resource utilization.
第二方面,本申请提供一种基于NUMA属性的资源分配装置,包括:获取单元,所述获取单元用于获取云管理平台下发的资源分配策略以及管理资源的NUMA属性;分配单元,用于根据所述获取单元获取到的所述资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的中央处理器CPU。In a second aspect, the present application provides a resource allocation device based on NUMA attributes, including: an acquisition unit, where the acquisition unit is configured to acquire a resource allocation strategy issued by a cloud management platform and NUMA attributes of management resources; an allocation unit, used for The central processing unit CPU of the computing node is allocated to the management resource according to the resource allocation policy and the NUMA attribute of the management resource obtained by the obtaining unit.
在一种可能的设计中,所述管理资源包括第一管理资源、第二管理资源以及第三管理资源;所述第一管理资源的属性包括:需分配所述计算节点的第一NUMA节点的CPU至所述第一管理资源;所述第二管理资源的属性包括:可分配所述计算节点的任意一个NUMA节点的CPU至所述第二管理资源;所述第三管理资源的属性包括:可在所述计算节点中跨NUMA节点分配CPU至所述第三管理资源。In a possible design, the management resource includes a first management resource, a second management resource, and a third management resource; the attributes of the first management resource include: the first NUMA node to which the computing node needs to be allocated. CPU to the first management resource; attributes of the second management resource include: the CPU of any NUMA node of the computing node can be allocated to the second management resource; attributes of the third management resource include: CPUs may be allocated to the third management resource in the compute nodes across NUMA nodes.
在一种可能的设计中,当所述资源分配策略包括均衡式资源分配策略时,所述分 配单元具体用于按如下方式根据所述资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的中央处理器CPU:按照所述第一管理资源、所述第二管理资源以及所述第三管理资源分别对应的NUMA属性,分别将所述第一管理资源、所述第二管理资源以及所述第三管理资源分配到所述第一NUMA节点、第二NUMA节点以及第三NUMA节点。In a possible design, when the resource allocation strategy includes a balanced resource allocation strategy, the allocation unit is specifically configured to, according to the resource allocation strategy and the NUMA attribute of the management resource, provide the The management resource is allocated to the central processing unit CPU of the computing node: according to the NUMA attributes corresponding to the first management resource, the second management resource, and the third management resource, respectively, the first management resource, all the The second management resource and the third management resource are allocated to the first NUMA node, the second NUMA node and the third NUMA node.
在一种可能的设计中,所述分配单元还用于:当所述第三管理资源分配到所述第三NUMA节点之后,若所述第三管理资源还需占用H个CPU核,则从第一NUMA节点和第二NUMA节点中剩余CPU核最多者分配H个CPU核至所述第三管理资源,或从第一NUMA节点和第二NUMA节点各分摊H/2个CPU核至所述第三管理资源,或从第四NUMA节点分配H个CPU核至所述第三管理资源。In a possible design, the allocating unit is further configured to: after the third management resource is allocated to the third NUMA node, if the third management resource still needs to occupy H CPU cores, then The first NUMA node and the second NUMA node, whichever has the most remaining CPU cores, allocate H CPU cores to the third management resource, or allocate H/2 CPU cores from the first NUMA node and the second NUMA node to the third management resource. The third management resource, or H CPU cores are allocated from the fourth NUMA node to the third management resource.
在一种可能的设计中,当所述资源分配策略包括集中式资源分配策略时,所述分配单元具体用于按如下方式根据所述集中式资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的CPU:按照所述第一管理资源、所述第二管理资源以及所述第三管理资源分别对应的NUMA属性,依次将所述第一管理资源、所述第二管理资源以及所述第三管理资源分配到所述第一NUMA节点。In a possible design, when the resource allocation strategy includes a centralized resource allocation strategy, the allocation unit is specifically configured to, according to the centralized resource allocation strategy and the NUMA attribute of the management resource, be as follows: The management resource is allocated to the CPU of the computing node: according to the NUMA attributes corresponding to the first management resource, the second management resource and the third management resource, the first management resource, the The second management resource and the third management resource are allocated to the first NUMA node.
在一种可能的设计中,所述分配单元还用于:当所述第三管理资源分配到所述第一NUMA节点之后,若所述第三管理资源还需占用H个CPU核,则从第二NUMA节点或第三NUMA节点分配H个CPU核至所述第三管理资源。In a possible design, the allocating unit is further configured to: after the third management resource is allocated to the first NUMA node, if the third management resource still needs to occupy H CPU cores, then The second NUMA node or the third NUMA node allocates H CPU cores to the third management resource.
第三方面,本申请提供一种基于NUMA属性的资源分配装置,该装置具有实现第一方面或第一方面任一种可能实现方式中的资源分配方法的功能。所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。In a third aspect, the present application provides a NUMA attribute-based resource allocation apparatus, which has the function of implementing the resource allocation method in the first aspect or any possible implementation manner of the first aspect. The functions can be implemented by hardware, or can be implemented by hardware executing corresponding software.
所述装置包括通信接口、处理器和存储器,所述通信接口用于接收和发送数据,所述处理器被配置为支持所述装置执行上述第一方面或第一方面任一种可能实现方式中相应的功能。所述存储器与所述处理器耦合,其保存所述装置必要的程序指令。The apparatus includes a communication interface for receiving and sending data, a processor and a memory, the processor being configured to support the apparatus to perform the first aspect or any of the possible implementations of the first aspect corresponding function. The memory is coupled to the processor and holds program instructions necessary for the apparatus.
第四方面,提供一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述第一方面及各实施方式中的方法。In a fourth aspect, a computer-readable storage medium is provided, where instructions are stored in the computer-readable storage medium, when the computer-readable storage medium runs on a computer, the computer causes the computer to execute the methods in the first aspect and the various embodiments.
第五方面,提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面及各实施方式中的方法。In a fifth aspect, there is provided a computer program product comprising instructions, which, when executed on a computer, cause the computer to perform the methods of the first aspect and the various embodiments above.
第六方面,提供一种芯片,所述芯片中的逻辑用于执行上述第一方面及各实施方式中的方法。In a sixth aspect, a chip is provided, and logic in the chip is used to execute the methods in the first aspect and each of the above embodiments.
关于第二方面至第六方面或第二方面至第六方面的各种实施方式所带来的技术效果,可以参考对于第一方面或第一方面的各种实施方式的技术效果的介绍,在此处不作过多赘述。Regarding the technical effects brought about by the various embodiments of the second aspect to the sixth aspect or the second aspect to the sixth aspect, reference may be made to the introduction to the technical effects of the first aspect or the various embodiments of the first aspect. I won't go into details here.
附图说明Description of drawings
图1为本申请实施例应用到云场景下的一种系统架构示意图;1 is a schematic diagram of a system architecture in which an embodiment of the present application is applied to a cloud scenario;
图2为本申请实施例提供的一种基于NUMA属性的资源分配方法流程图;2 is a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application;
图3为本申请实施例提供的一种基于NUMA属性的资源分配方法流程图;3 is a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application;
图4为本申请实施例提供的一种资源分配方法示意图;FIG. 4 is a schematic diagram of a resource allocation method according to an embodiment of the present application;
图5为本申请实施例提供的一种基于NUMA属性的资源分配方法流程图;5 is a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application;
图6为本申请实施例提供的一种基于NUMA属性的资源分配装置示意图;6 is a schematic diagram of a NUMA attribute-based resource allocation apparatus provided by an embodiment of the present application;
图7为本申请实施例提供的另一种基于NUMA属性的资源分配装置示意图。FIG. 7 is a schematic diagram of another apparatus for resource allocation based on NUMA attributes provided by an embodiment of the present application.
具体实施方式detailed description
下面将结合附图对本申请实施例作进一步地详细描述。The embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
为了便于理解,示例性的给出了与本申请相关概念的说明以供参考,如下所示:For ease of understanding, the descriptions of concepts related to the present application are exemplarily given for reference, as follows:
1)非一致性内存访问NUMA:是一种为多处理器的电脑设计的内存架构,内存访问时间取决于内存相对于处理器的位置。在NUMA下,处理器访问它自己的本地内存的速度比非本地内存(内存位于另一个处理器,或者是处理器之间共享的内存)快一些。1) Non-uniform memory access NUMA: It is a memory architecture designed for multi-processor computers, and the memory access time depends on the location of the memory relative to the processor. Under NUMA, a processor can access its own local memory a bit faster than non-local memory (memory located on another processor, or memory shared between processors).
2)虚拟机:利用虚拟化技术将一台物理主机模拟为多台逻辑主机(称为虚拟机)。虚拟机指通过软件模拟的具有完整硬件系统功能的、可以运行在一个完全隔离环境中的完整计算机系统中的逻辑主机。2) Virtual machine: Use virtualization technology to simulate a physical host as multiple logical hosts (called virtual machines). A virtual machine refers to a logical host in a complete computer system that is simulated by software with complete hardware system functions and can run in a completely isolated environment.
3)计算节点:在本申请中可以理解为主机或者服务器。3) Computing node: In this application, it can be understood as a host or a server.
本申请实施例涉及的至少一个,包括一个或者多个;其中,多个是指大于或者等于两个。另外,在本申请的描述中,“第一”、“第二”等词汇,仅用于区分描述对象的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。At least one involved in the embodiments of the present application includes one or more; wherein, multiple refers to greater than or equal to two. In addition, in the description of this application, words such as "first" and "second" are only used for the purpose of distinguishing the description objects, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.
参阅图1所示,为本申请实施例应用到云场景下的一种系统架构示意图。在图1所示的系统架构下,该服务器可被分为两个Chip(芯片),例如为CPU0、CPU1,其中,每个Chip下可包括NUMA节点。示例性的,图1所示的服务器中可包括4个NUMA节点,每个NUMA节点中有多个处理器核(core0、core1等)。这些处理器核中有一部分可分配给管理资源使用,另外一部分可分配给虚拟机使用。Referring to FIG. 1 , it is a schematic diagram of a system architecture in which an embodiment of the present application is applied to a cloud scenario. Under the system architecture shown in FIG. 1 , the server can be divided into two chips (chips), such as CPU0 and CPU1, wherein each chip can include a NUMA node. Exemplarily, the server shown in FIG. 1 may include 4 NUMA nodes, and each NUMA node has multiple processor cores (core0, core1, etc.). Some of these processor cores can be allocated to management resources and some can be allocated to virtual machines.
以NUMA node0为例来说,core0、core1可以分配给管理资源使用,core2、core3…core31可分配给虚拟机使用。当然,可以理解的是,上述示意图仅是一种示意性说明,处理器核的分配情况并不限于此,例如管理资源也可以使用core0、core1…core20,core21…core31可以供虚拟机使用等,本申请对此不作具体限定。Taking NUMA node0 as an example, core0 and core1 can be allocated to management resources, and core2, core3...core31 can be allocated to virtual machines. Of course, it can be understood that the above schematic diagram is only a schematic illustration, and the allocation of processor cores is not limited to this. For example, core0, core1...core20 can also be used for management resources, and core21...core31 can be used by virtual machines, etc. This application does not specifically limit this.
在云场景下,为了避免虚拟机运行和管理资源之间的影响,需要将管理资源进行隔离。基于上述NUMA架构,在进行管理资源隔离时,需要在不同的NUMA节点隔离出不同的处理器核给管理资源使用。而由于在不同的NUMA节点上分配给管理资源的处理器核的数量是不确定的,使得分配给虚拟机的处理器核的数量具有不确定性,这样会影响服务器可以分配的虚拟机的规格和数量,从而影响服务器的资源利用率。In cloud scenarios, in order to avoid the impact between virtual machine operation and management resources, management resources need to be isolated. Based on the above-mentioned NUMA architecture, when isolation of management resources is performed, it is necessary to isolate different processor cores on different NUMA nodes for use by management resources. Since the number of processor cores allocated to management resources on different NUMA nodes is uncertain, the number of processor cores allocated to virtual machines is uncertain, which will affect the specifications of virtual machines that can be allocated by the server. and quantity, thus affecting the resource utilization of the server.
针对上述技术问题,本申请实施例中系统管理员可以针对不同的服务器配置不同的资源分配策略,由云管理平台下发给不同的服务器,服务器接收到资源分配策略之后,可按照资源分配策略为管理资源和虚拟机分配服务器的处理器核,以最大化的利用服务器的资源,提高资源利用率。In view of the above technical problems, in the embodiment of the present application, the system administrator can configure different resource allocation policies for different servers, and the cloud management platform delivers them to different servers. After the server receives the resource allocation policies, the resource allocation policies can be: Manage resources and allocate server cores to virtual machines to maximize the use of server resources and improve resource utilization.
参阅图2所示,为本申请实施例提供的一种基于NUMA属性的资源分配方法流程图,参阅图2所示,该方法可包括如下步骤:Referring to FIG. 2, a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application. Referring to FIG. 2, the method may include the following steps:
S201:获取云管理平台下发的资源分配策略以及管理资源的NUMA属性。S201: Acquire the resource allocation policy issued by the cloud management platform and the NUMA attribute of the management resource.
需要说明的是,管理资源可以包括多个管理进程,并且不同的管理进程可能对应不同的NUMA属性。It should be noted that the management resource may include multiple management processes, and different management processes may correspond to different NUMA attributes.
S202:根据资源分配策略和管理资源的NUMA属性,为管理资源分配计算节点的CPU。S202: Allocate the CPU of the computing node for the management resource according to the resource allocation policy and the NUMA attribute of the management resource.
为了描述方便,本申请实施例中可将资源分配策略记为“均衡式资源分配策略”和“集中式资源分配策略”。For the convenience of description, the resource allocation strategy may be denoted as "balanced resource allocation strategy" and "centralized resource allocation strategy" in this embodiment of the present application.
应理解,均衡式资源分配策略,可以理解为在对管理资源进行资源隔离时,使得在不同NUMA节点上的管理资源尽可能是均分的,进而使得不同的NUMA节点能够提供给虚拟机所用的资源是相等的。集中式资源分配策略,可以理解为在对管理资源进行资源隔离时,使得管理资源集中分配到某个NUMA节点上。It should be understood that the balanced resource allocation strategy can be understood as making the management resources on different NUMA nodes as evenly distributed as possible when resource isolation is performed on management resources, so that different NUMA nodes can provide virtual machines with Resources are equal. The centralized resource allocation strategy can be understood as making the management resources centrally allocated to a certain NUMA node when the management resources are isolated.
在本申请实施例中,管理资源可包括:第一管理资源、第二管理资源和第三管理资源。假设服务器(计算节点)上的NUMA节点包括:第一NUMA节点、第二NUMA节点和第三NUMA节点、第四NUMA节点。In this embodiment of the present application, the management resources may include: a first management resource, a second management resource, and a third management resource. It is assumed that the NUMA nodes on the server (computing node) include: a first NUMA node, a second NUMA node, a third NUMA node, and a fourth NUMA node.
考虑到不同管理资源在进行资源隔离时,资源隔离的属性要求可能不同。在本申请实施例中,不同管理资源的NUMA属性可对应如下:Considering that different management resources are used for resource isolation, the attribute requirements of resource isolation may be different. In this embodiment of the present application, the NUMA attributes of different management resources may correspond to the following:
第一管理资源的属性包括:需分配计算节点的第一NUMA节点的CPU至第一管理资源;第二管理资源的属性包括:可分配计算节点的任意一个NUMA节点的CPU至第二管理资源;第三管理资源的属性包括:可在计算节点中跨NUMA节点分配CPU至第三管理资源。The attribute of the first management resource includes: the CPU of the first NUMA node of the computing node needs to be allocated to the first management resource; the attribute of the second management resource includes: the CPU of any NUMA node of the computing node can be allocated to the second management resource; The attributes of the third management resource include that CPUs can be allocated to the third management resource across NUMA nodes in the computing node.
示例性的,作为一种可能的实现方式,可以将上述管理资源分为如下几类:Exemplarily, as a possible implementation manner, the above management resources can be divided into the following categories:
第一类:必须固定使用某个NUMA节点的管理资源,例如记为资源L。The first category: the management resource of a certain NUMA node must be used fixedly, such as resource L.
第二类:必须使用一个NUMA节点的管理资源,例如记为资源M。The second category: a management resource of a NUMA node must be used, such as resource M.
第三类:可以灵活分配在每个NUMA节点上的管理资源,例如记为资源N。The third category: management resources that can be flexibly allocated on each NUMA node, for example, denoted as resource N.
可以理解的是,第一类资源,即资源L可以对应上述第一管理资源;第二类资源,即资源M可以对应上述第二管理资源;第三类资源,即资源N可以对应上述第三管理资源。It can be understood that the first type of resource, namely resource L, may correspond to the above-mentioned first management resource; the second type of resource, namely resource M, may correspond to the above-mentioned second management resource; the third type of resource, namely resource N, may correspond to the above-mentioned third management resource. Manage resources.
在本申请一些实施例中,当计算节点采用均衡式资源分配策略时,可按照如下方式为管理资源分配计算节点的CPU:In some embodiments of the present application, when a computing node adopts a balanced resource allocation strategy, the CPU of the computing node may be allocated for management resources in the following manner:
按照第一管理资源、第二管理资源以及第三管理资源分别对应的NUMA属性,分别将第一管理资源、第二管理资源以及第三管理资源分配到第一NUMA节点、第二NUMA节点以及第三NUMA节点。也就是说,计算节点可以分别将三类不同NUMA属性的管理资源按照NUMA属性分配到不同的NUMA节点。According to the NUMA attributes corresponding to the first management resource, the second management resource and the third management resource, respectively, the first management resource, the second management resource and the third management resource are allocated to the first NUMA node, the second NUMA node and the third management resource. Three NUMA nodes. That is to say, the computing node can respectively allocate three types of management resources with different NUMA attributes to different NUMA nodes according to the NUMA attributes.
由于考虑到第三管理资源所占的CPU核可能会比较多,这样第三管理资源在上述分配的第三NUMA节点上可能分配不完,则此时需要确定第三管理资源还需占用的CPU核个数(例如,还需占用H个CPU核)。Considering that the third management resource may occupy more CPU cores, the third management resource may not be fully allocated on the third NUMA node allocated above, and at this time, it is necessary to determine the CPU that the third management resource still needs to occupy The number of cores (for example, H CPU cores need to be occupied).
作为一种可能的实现方式,若第三管理资源还需占用H个CPU核,则从第一NUMA节点和第二NUMA节点中剩余CPU核最多者分配H个CPU核至第三管理资源。即可以将第三管理资源剩余的H个CPU核分配到第一NUMA节点和第二NUMA节点中剩余CPU核最多的NUMA节点。As a possible implementation manner, if the third management resource still needs to occupy H CPU cores, the first NUMA node and the second NUMA node with the most remaining CPU cores are allocated H CPU cores to the third management resource. That is, the remaining H CPU cores of the third management resource may be allocated to the NUMA node with the most remaining CPU cores among the first NUMA node and the second NUMA node.
作为另一种可能的实现方式,若第三管理资源还需占用H个CPU核,则可从第一NUMA节点和第二NUMA节点各分摊H/2个CPU核至第三管理资源。也就是说,将H个CPU核平均分配到第一NUMA节点和第二NUMA节点。As another possible implementation manner, if the third management resource still needs to occupy H CPU cores, H/2 CPU cores may be allocated from the first NUMA node and the second NUMA node to the third management resource. That is, the H CPU cores are equally distributed to the first NUMA node and the second NUMA node.
作为又一种可能的实现方式,若第三管理资源还需占用H个CPU核,则可从第四NUMA节点分配H个CPU核至第三管理资源。即可以将第三管理资源剩余的H个CPU核分配到其它的NUMA节点。As another possible implementation manner, if the third management resource still needs to occupy H CPU cores, then H CPU cores may be allocated from the fourth NUMA node to the third management resource. That is, the remaining H CPU cores of the third management resource can be allocated to other NUMA nodes.
以下结合附图对利用均衡式资源分配策略进行资源分配的过程进行详细介绍。如图3所示,为本申请实施例提供的一种基于NUMA属性的资源分配方法流程图,参阅图3所示,该方法包括如下步骤:The following describes the process of resource allocation using the balanced resource allocation strategy in detail with reference to the accompanying drawings. As shown in FIG. 3 , a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application. Referring to FIG. 3 , the method includes the following steps:
S301:将服务器上的CPU和内存划分为Q个NUMA节点。S301: Divide the CPU and memory on the server into Q NUMA nodes.
其中,Q为大于等于1的正整数。在本申请中,在将服务器上的CPU和内存划分为Q个NUMA节点时,可以以均分的形式进行划分。换句话来说,可以将服务器上的CPU个数和内存平均分到Q个NUMA节点上,使得每个NUMA节点上的CPU个数和内存是相等的。Among them, Q is a positive integer greater than or equal to 1. In this application, when the CPU and memory on the server are divided into Q NUMA nodes, they can be divided in the form of equal division. In other words, the number of CPUs and memory on the server can be evenly divided among Q NUMA nodes, so that the number of CPUs and memory on each NUMA node are equal.
S302:将资源L分配到Q个NUMA节点中的固定NUMA节点。S302: Allocate the resource L to a fixed NUMA node among the Q NUMA nodes.
本申请实施例中,由于资源L为使用固定NUMA节点的资源,因此,需要先将资源L分配到NUMA节点中,确定资源L所占的NUMA节点是哪个NUMA节点以及资源L在NUMA节点中所占的处理器核(CPU)个数。In the embodiment of the present application, since the resource L is a resource using a fixed NUMA node, it is necessary to first allocate the resource L to the NUMA nodes, and determine which NUMA node the resource L occupies and which NUMA node the resource L occupies in the NUMA node. The number of processor cores (CPUs) accounted for.
需要说明的是,资源L可以为固定使用某一个NUMA节点的资源,也可以为固定使用Q个NUMA节点中的某两个NUMA节点的资源等,本申请对此不作限定。It should be noted that the resource L may be a resource that uses a certain NUMA node on a fixed basis, or a resource that uses a certain two NUMA nodes among the Q NUMA nodes, etc., which is not limited in this application.
S303:将资源M分配到与资源L所在的NUMA节点不同的NUMA节点。S303: Allocate the resource M to a NUMA node different from the NUMA node where the resource L is located.
对于固定使用一个NUMA节点的资源M,可以在将资源L固定在Q个NUMA节点之后分配。资源M可以单独分配在一个NUMA节点,也可以分配到资源L所在的NUMA节点,只要保证资源M位于同一个NUMA节点,即不跨NUMA节点分配即可。For a resource M that uses one NUMA node fixedly, it can be allocated after fixing the resource L to Q NUMA nodes. Resource M can be allocated to a NUMA node alone, or can be allocated to a NUMA node where resource L is located, as long as it is ensured that resource M is located on the same NUMA node, that is, it is not allocated across NUMA nodes.
作为一种示例,可以将资源M分配到与资源L不同的NUMA节点上,这样可以使得不同的NUMNA节点上都会有管理资源,而不会出现管理资源全部分配在一个NUMA节点的情况。As an example, the resource M may be allocated to a different NUMA node from the resource L, so that different NUMNA nodes will have management resources, and there will be no situation where all management resources are allocated to one NUMA node.
S304:确定资源L和资源M所占的CPU核的个数的最大值。S304: Determine the maximum value of the number of CPU cores occupied by the resource L and the resource M.
假设资源L所占的CPU核个数为x1,资源M所占的CPU核个数为x2。示例性的,参阅图4所示,比如先将资源L分配到Q个NUMA节点中,例如分配到NUMA0,然后分配资源M,例如可将资源M分配到NUMA2,那么NUMA0中管理资源所占的CPU核个数即为x1,NUMA2中管理资源所占的CPU核个数即为x2。Assume that the number of CPU cores occupied by resource L is x1, and the number of CPU cores occupied by resource M is x2. Exemplarily, as shown in FIG. 4, for example, resource L is first allocated to Q NUMA nodes, for example, to NUMA0, and then resource M is allocated, for example, resource M can be allocated to NUMA2, then the management resources in NUMA0 occupy the The number of CPU cores is x1, and the number of CPU cores occupied by management resources in NUMA2 is x2.
S305:将资源N分配到与资源L和资源M所在的NUMA节点不同的NUMA节点。S305: Allocate the resource N to a NUMA node different from the NUMA node where the resource L and the resource M are located.
基于上述步骤S302和步骤S303可知,资源L和资源M在Q个NUMA节点中的位置已经确定,为了使得每个NUMA节点上的管理资源保持均衡,对于资源N的分配,优先考虑分配到非资源L和非资源M所在的NUMA节点。Based on the above steps S302 and S303, it can be known that the positions of resource L and resource M in the Q NUMA nodes have been determined. In order to keep the management resources on each NUMA node balanced, the allocation of resource N is given priority to non-resources. L and the NUMA node where non-resource M is located.
本申请实施例中,可按照资源L和资源M所占的CPU核的个数最大值来分配资 源N。换句话来说,可将资源L和资源M所占的CPU核的个数最大值作为每个NUMA节点中设定的管理资源所占的CPU核个数的最大值,然后基于该最大值对资源N进行分配。In this embodiment of the present application, the resource N may be allocated according to the maximum number of CPU cores occupied by the resource L and the resource M. In other words, the maximum number of CPU cores occupied by resource L and resource M can be taken as the maximum number of CPU cores occupied by management resources set in each NUMA node, and then based on the maximum value. Allocate resource N.
需要说明的是,资源L和资源M所占的CPU核的个数也有可能相同,此时可按照资源L或者资源M所占的CPU核的个数来分配资源N。It should be noted that the number of CPU cores occupied by resource L and resource M may also be the same. In this case, resource N may be allocated according to the number of CPU cores occupied by resource L or resource M.
示例性的,继续参阅图4所示,在将资源L分配到NUMA0,将资源M分配到NUMA2之后,可将资源N分配到NUMA3。当然,也可以将资源N分配到NUMA1等,本申请对此不作限定。Exemplarily, continuing to refer to FIG. 4 , after the resource L is allocated to NUMA0 and the resource M is allocated to NUMA2, the resource N can be allocated to NUMA3. Of course, the resource N may also be allocated to NUMA1, etc., which is not limited in this application.
作为一种可能的实现方式,在分配资源N时,可以按照NUMA节点的顺序来分配。假设资源L和资源M所占的CPU核的个数的最大值为资源L所占的CPU核个数,即x1。比如将资源L分配在NUMA0,资源M分配在NUMA2,则可以先将资源N分配到NUMA1,当NUMA1中的资源N所占的CPU核个数为x1时,然后再将资源N继续分配到NUMA3。当然,也可以在非资源L和非资源M的NUMA节点中随机的分配资源N,本申请对此不作限定。As a possible implementation manner, when resource N is allocated, it may be allocated in the order of NUMA nodes. Assume that the maximum number of CPU cores occupied by resource L and resource M is the number of CPU cores occupied by resource L, that is, x1. For example, if resource L is allocated to NUMA0 and resource M is allocated to NUMA2, then resource N can be allocated to NUMA1 first. When the number of CPU cores occupied by resource N in NUMA1 is x1, then resource N can be allocated to NUMA3. . Of course, the resource N may also be randomly allocated to the NUMA nodes that are not resource L and non-resource M, which is not limited in this application.
S306:判断是否有剩余的未分配的资源N。如果有剩余的资源N,则继续执行步骤S307。S306: Determine whether there are remaining unallocated resources N. If there is remaining resource N, continue to step S307.
本申请实施例中,当资源N所占的CPU核个数比较少(比如,资源N所占的CPU核个数小于设定阈值)时,能够分配在非资源L和非资源M的NUMA节点中。也就是说,资源N在非资源L和非资源M的NUMA节点中可以分配完成,不会存在剩余的未分配的资源N。In this embodiment of the present application, when the number of CPU cores occupied by resource N is relatively small (for example, the number of CPU cores occupied by resource N is less than the set threshold), it can be allocated to NUMA nodes that are not resource L and non-resource M middle. That is to say, resource N can be allocated to NUMA nodes other than resource L and non-resource M, and there will be no remaining unallocated resource N.
当资源N所占的CPU核个数比较多(资源N所占的CPU核个数大于设定阈值)时,在非资源L和非资源M的NUMA节点中分配之后,会有剩余的未分配的资源N。When the number of CPU cores occupied by resource N is relatively large (the number of CPU cores occupied by resource N is greater than the set threshold), after allocating in the NUMA nodes of non-resource L and non-resource M, there will be remaining unallocated the resource N.
S307:计算Q个NUMA节点中每个NUMA节点中管理资源所占的CPU核个数。S307: Calculate the number of CPU cores occupied by management resources in each of the Q NUMA nodes.
当资源N在非资源L和非资源M的NUMA节点中分配有剩余时,需要计算每个NUMA节点中管理资源所占的CPU核的个数。由于资源N有剩余,那么非资源L和非资源M的NUMA节点中管理资源所占的CPU核个数即为资源L和资源M所占的CPU核的个数最大值。也就是说,资源N在非资源L和非资源M的NUMA节点中分配不下时,可以分配到资源L和/或资源M所在的NUMA节点中。此时,可以计算每个NUMA节点中管理资源所占的CPU核个数。When the remaining resource N is allocated in the NUMA nodes that are not resource L and non-resource M, it is necessary to calculate the number of CPU cores occupied by the management resources in each NUMA node. Since there is a surplus of resource N, the number of CPU cores occupied by management resources in the NUMA nodes that are not resource L and non-resource M is the maximum number of CPU cores occupied by resource L and resource M. That is to say, when the resource N cannot be allocated to the NUMA nodes other than the resource L and the resource M, it can be allocated to the NUMA node where the resource L and/or the resource M are located. At this point, the number of CPU cores occupied by the management resources in each NUMA node can be calculated.
示例性的,假设将资源L分配在NUMA0,资源M分配在NUMA2,资源L所占的CPU核个数为6个,资源M所占的CPU核个数为4个,如果资源N所占的CPU核个数为14个时,则为了保证管理资源在每个NUMA节点上所占的CPU核个数均衡,那么资源N在可分配的NUMA1、NUMA3上分别最多可以分配6个CPU核,也就是说,还有2个剩余的CPU核没有分配。Exemplarily, it is assumed that resource L is allocated to NUMA0, resource M is allocated to NUMA2, the number of CPU cores occupied by resource L is 6, and the number of CPU cores occupied by resource M is 4. When the number of CPU cores is 14, in order to ensure that the number of CPU cores occupied by the management resources on each NUMA node is balanced, the resource N can be allocated up to 6 CPU cores on the NUMA1 and NUMA3 that can be allocated, respectively. That is, there are 2 remaining CPU cores left unallocated.
S308:确定Q个NUMA节点中管理资源所占的CPU核个数最少的NUMA节点。S308: Determine the NUMA node with the least number of CPU cores occupied by management resources among the Q NUMA nodes.
S309:将剩余的资源N分配到管理资源所占的CPU核个数最少的NUMA节点。S309: Allocate the remaining resource N to the NUMA node with the smallest number of CPU cores occupied by the management resource.
为了保证每个NUMA节点上管理资源所占的CPU核个数的均衡,可以将剩余的资源N分配到管理资源所占的CPU核个数最少的NUMA节点。示例性的,假设资源L和资源M在NUMA节点中所占的CPU核个数的大小关系为:x1>x2,也就是说 NUMA2节点中管理资源所占的CPU核个数最少,则可以将剩余的资源N分配到NUMA2节点。In order to ensure the balance of the number of CPU cores occupied by management resources on each NUMA node, the remaining resource N can be allocated to the NUMA node with the smallest number of CPU cores occupied by management resources. Exemplarily, assuming that the relationship between the number of CPU cores occupied by resource L and resource M in the NUMA node is: x1>x2, that is to say, the number of CPU cores occupied by management resources in the NUMA2 node is the least, then the The remaining resource N is allocated to NUMA2 nodes.
继续沿用上述举例,如果还剩2个CPU核没有分配,则可以将这个2个CPU核分配到NUMA节点中剩余CPU核比较多的NUMA节点,例如可以分配到资源M所在的NUMA2节点,这样NUMA0、NUMA1、NUMA2和NUMA3上的管理资源所占的CPU核即是均衡的。Continuing to use the above example, if there are 2 CPU cores left unallocated, the 2 CPU cores can be allocated to the NUMA node with more remaining CPU cores among the NUMA nodes, for example, it can be allocated to the NUMA2 node where the resource M is located, so that NUMA0 The CPU cores occupied by management resources on , NUMA1, NUMA2 and NUMA3 are balanced.
当然,上述分配方法也仅是一种示例,在实际应用中,也可以将剩余的CPU核个数平均分配到NUMA节点上,或者也可以一部分分配到剩余CPU核比较多的NUMA节点上,然后其余部分平均分配到几个NUMA节点上,本申请对此不作限定。Of course, the above allocation method is only an example. In practical applications, the remaining number of CPU cores can also be evenly allocated to NUMA nodes, or a part of them can be allocated to NUMA nodes with more remaining CPU cores, and then The rest is evenly distributed to several NUMA nodes, which is not limited in this application.
经过上述步骤,可以使得每个NUMA节点中管理资源所占的CPU核个数相同,均等于资源L和资源M所占的CPU核个数的最大值。Through the above steps, the number of CPU cores occupied by the management resources in each NUMA node can be the same, which is equal to the maximum number of CPU cores occupied by the resource L and the resource M.
S3010:将步骤S309剩余的资源N所占的CPU核继续分配到Q个NUMA节点,直至分配完资源N,且使得Q个NUMA节点中的管理资源所占的CPU均衡。S3010: Continue to allocate the CPU cores occupied by the remaining resources N in step S309 to the Q NUMA nodes until the resource N is allocated and the CPUs occupied by the management resources in the Q NUMA nodes are balanced.
如果在步骤S309执行之后,资源N还是没有分配完,则可将步骤S308剩余的资源N所占的CPU核个数在Q个NUMA节点上平均分配。当然,步骤S308剩余的资源N除以NUMA节点的个数Q得到的结果中,可能会有余数,也就是不能平均分配,那么可将余数优先分配到非资源L和非资源M所在的NUMA节点,如果还是分配不完,然后再分配到资源L和/或资源M所在的NUMA节点,直至将资源N全部分配完。If the resource N is still not allocated after step S309 is executed, the number of CPU cores occupied by the remaining resource N in step S308 may be evenly allocated on the Q NUMA nodes. Of course, in the result obtained by dividing the remaining resource N by the number Q of NUMA nodes in step S308, there may be a remainder, that is, it cannot be distributed evenly, then the remainder can be preferentially allocated to the NUMA nodes where the non-resource L and non-resource M are located , if the allocation still cannot be completed, then allocate to the NUMA node where the resource L and/or resource M are located until the resource N is all allocated.
进一步的,在本申请实施例中,在对资源N分配的过程中,可以记录每个NUMA节点上分配给资源N的CPU核个数,然后将服务器的内存分配到资源N所占的CPU核个数最多的NUMA节点上,以保证在访问内存时,不用跨NUMA节点访问,缩短内存访问的时间,提高访问效率。Further, in the embodiment of the present application, in the process of allocating resource N, the number of CPU cores allocated to resource N on each NUMA node may be recorded, and then the memory of the server is allocated to the CPU core occupied by resource N. On the NUMA node with the largest number, to ensure that when accessing memory, there is no need to access across NUMA nodes, shortening the memory access time and improving access efficiency.
以下结合具体例子对图3所示实施例中的资源分配方法进行介绍。The resource allocation method in the embodiment shown in FIG. 3 will be introduced below with reference to specific examples.
假设主机(服务器)配置为96(个)CPU和384G内存,将CPU和内存划分为4个NUMA节点,比如NUMA0、NUMA1、NUMA2、NUMA3,则每个NUMA节点的可用资源为24CPU和96G内存。Assuming that the host (server) is configured with 96 (pcs) CPUs and 384G of memory, and the CPU and memory are divided into 4 NUMA nodes, such as NUMA0, NUMA1, NUMA2, and NUMA3, the available resources of each NUMA node are 24CPU and 96G of memory.
示例性的,本申请中可包括的管理进程以及每个进程所占用的CPU核个数以及内存举例如下:Exemplarily, the management processes that can be included in this application and the number of CPU cores and memory occupied by each process are as follows:
虚拟化管理进程:2CPU,12G内存;计算管理进程:6CPU,5G内存;网络管理进程:4CPU,8G内存;存储管理进程:4CPU,7G内存。Virtualization management process: 2CPU, 12G memory; computing management process: 6CPU, 5G memory; network management process: 4CPU, 8G memory; storage management process: 4CPU, 7G memory.
其中,虚拟化管理进程的内存可平均分配在NUMA节点中;计算管理进程的CPU核可以动态分配,内存需要指定一个NUMA节点;网络管理进程必须固定在NUMA0节点;存储管理进程必须在一个NUMA节点中。Among them, the memory of the virtualization management process can be evenly distributed among the NUMA nodes; the CPU cores of the computing management process can be dynamically allocated, and the memory needs to be assigned a NUMA node; the network management process must be fixed on the NUMA0 node; the storage management process must be on a NUMA node middle.
应理解,网络管理进程可对应于资源L(即第一管理资源),存储管理进程可对应于资源M(即第二管理资源),虚拟化管理进程和计算管理进程可以对应于上述所介绍的资源N(即第三管理资源)。It should be understood that the network management process may correspond to the resource L (ie the first management resource), the storage management process may correspond to the resource M (ie the second management resource), and the virtualization management process and the computing management process may correspond to the above-mentioned Resource N (ie the third management resource).
为了清楚的体现本申请的分配策略带来的效果,以下以表1为例示例在应用本申请的分配策略之前,服务器上的NUMA节点对于管理资源的分配情况,参阅表1所示。In order to clearly reflect the effect brought by the allocation strategy of the present application, Table 1 is used as an example below to illustrate the allocation of management resources by NUMA nodes on the server before applying the allocation strategy of the present application, as shown in Table 1.
表1Table 1
Figure PCTCN2021120706-appb-000001
Figure PCTCN2021120706-appb-000001
可以理解的是,上述表格仅是一种示意性说明,在实际应用中,管理资源的分配形式并不限于上述举例。It can be understood that the above table is only a schematic illustration, and in practical applications, the allocation form of management resources is not limited to the above examples.
从表1可知,NUMA0上管理资源占用的CPU核最多,则该服务器可以创建的虚拟机的最大规格为4个NUMA0的虚拟机,即75CPU,312G内存。It can be seen from Table 1 that the management resources on NUMA0 occupy the most CPU cores, and the maximum size of virtual machines that can be created by this server is 4 NUMA0 virtual machines, that is, 75CPU and 312G memory.
利用本申请中的均衡式资源分配策略之后,服务器上的NUMA节点对于管理资源的分配情况可参阅表2所示。After utilizing the balanced resource allocation strategy in this application, the allocation of management resources by NUMA nodes on the server can be referred to as shown in Table 2.
表2Table 2
Figure PCTCN2021120706-appb-000002
Figure PCTCN2021120706-appb-000002
通过表2可知,利用均衡式资源分配策略之后,每个NUMA节点上管理资源所占的CPU核的个数为均衡的,因此,虚拟机可用的CPU核的个数也是相等的,这样在跨NUMA节点创建虚拟机时,可以创建更大规格的虚拟机。比如,表2中的服务器可以创建的虚拟机的最大规格为80CPU,340G内存。It can be seen from Table 2 that after using the balanced resource allocation strategy, the number of CPU cores occupied by the management resources on each NUMA node is balanced. Therefore, the number of CPU cores available to the virtual machine is also equal. When a NUMA node creates a virtual machine, a larger size virtual machine can be created. For example, the server in Table 2 can create a virtual machine with a maximum specification of 80CPU and 340G memory.
在本申请另一些实施例中,当计算节点采用集中式资源分配策略时,可按照如下方式为管理资源分配计算节点的CPU:In other embodiments of the present application, when a computing node adopts a centralized resource allocation strategy, the CPU of the computing node may be allocated for management resources in the following manner:
按照第一管理资源、第二管理资源以及第三管理资源分别对应的NUMA属性,依次将第一管理资源、第二管理资源以及第三管理资源分配到第一NUMA节点。也就是说,将三类不同NUMA属性的管理资源分配到同一个NUMA节点上,更为具体的,可以分配到固定使用某个NUMA节点的管理资源所在的NUMA节点。According to the NUMA attributes corresponding to the first management resource, the second management resource and the third management resource, the first management resource, the second management resource and the third management resource are sequentially allocated to the first NUMA node. That is to say, three types of management resources with different NUMA attributes are allocated to the same NUMA node, and more specifically, it can be allocated to the NUMA node where the management resources that use a certain NUMA node are located.
当然,如果管理资源所占的CPU核个数比较多,在固定的一个NUAM节点上分配不完时,可以将剩余的CPU核分配到其它的NUMA节点。即当第三管理资源分配到第一NUMA节点之后,若第三管理资源还需占用H个CPU核,则从第二NUMA 节点或第三NUMA节点分配H个CPU核至第三管理资源。Of course, if the number of CPU cores occupied by the management resources is relatively large, the remaining CPU cores can be allocated to other NUMA nodes when the allocation cannot be completed on a fixed NUAM node. That is, after the third management resource is allocated to the first NUMA node, if the third management resource still needs to occupy H CPU cores, then H CPU cores are allocated from the second NUMA node or the third NUMA node to the third management resource.
以下对利用集中式资源分配策略进行资源分配的过程进行介绍。The following describes the process of resource allocation using the centralized resource allocation strategy.
如图5所示,为本申请实施例提供的一种基于NUMA属性的资源分配方法流程图,参阅图5所示,该方法包括如下步骤:As shown in FIG. 5 , a flowchart of a method for resource allocation based on NUMA attributes provided by an embodiment of the present application. Referring to FIG. 5 , the method includes the following steps:
需要说明的是,图5所示实施例中的步骤S501、S502与图3所示实施例中的步骤S301、S302相同,具体可参阅图3所示实施例中的介绍,此处不再重复赘述。It should be noted that steps S501 and S502 in the embodiment shown in FIG. 5 are the same as steps S301 and S302 in the embodiment shown in FIG. 3 . For details, please refer to the introduction in the embodiment shown in FIG. 3 , which will not be repeated here. Repeat.
S501:将服务器上的CPU和内存划分为Q个NUMA节点。S501: Divide the CPU and memory on the server into Q NUMA nodes.
S502:将资源L分配到Q个NUMA节点中的固定NUMA节点。S502: Allocate the resource L to a fixed NUMA node among the Q NUMA nodes.
S503:将资源M分配到与资源L相同的NUMA节点。S503: Allocate the resource M to the same NUMA node as the resource L.
在本申请实施例中,利用集中式资源分配策略时,需要尽可能的将管理资源分配到一个NUMA节点中,因此,在将资源L分配之后,可将资源M分配到与资源L相同的NUMA节点。示例性的,假设先将资源L分配到NUMA0,在分配资源M时,也可将资源M分配到NUMNA0。In this embodiment of the present application, when a centralized resource allocation strategy is used, it is necessary to allocate management resources to a NUMA node as much as possible. Therefore, after resource L is allocated, resource M can be allocated to the same NUMA node as resource L node. Exemplarily, assuming that resource L is allocated to NUMA0 first, when resource M is allocated, resource M may also be allocated to NUMNA0.
S504:将资源N分配到与资源L、资源M所在的NUMA节点相同的NUMA节点。S504: Allocate the resource N to the same NUMA node as the NUMA node where the resource L and the resource M are located.
对于资源N,可以优先将资源N继续分配到资源L和资源M所占用的NUMA节点,以保证管理资源可以集中分配到同一个NUMA节点中。For the resource N, the resource N can be preferentially allocated to the NUMA nodes occupied by the resource L and the resource M, so as to ensure that the management resources can be centrally allocated to the same NUMA node.
S505:判断是否有剩余的未分配的资源N。如果有剩余的资源N,则继续执行步骤S506。S505: Determine whether there are remaining unallocated resources N. If there is remaining resource N, continue to step S506.
如果资源N所占的CPU核个数小于设定阈值,即CPU核个数比较少时,资源N可能能够分配到资源L和资源M所占用的NUMA节点。If the number of CPU cores occupied by resource N is less than the set threshold, that is, when the number of CPU cores is relatively small, resource N may be able to be allocated to the NUMA nodes occupied by resource L and resource M.
如果资源N所占的CPU核个数大于设定阈值,即CPU核个数比较多时,资源N不能分配完,那么资源N就会有剩余,也就是说,会存在未分配的资源N需要继续分配。If the number of CPU cores occupied by resource N is greater than the set threshold, that is, when the number of CPU cores is relatively large, resource N cannot be allocated completely, then resource N will be left over, that is, there will be unallocated resource N that needs to be continued. distribute.
S506:将剩余的资源N分配到Q个NUMA节点中除固定NUMA节点的其它NUMA节点,直至分配完资源N。S506: Allocate the remaining resource N to other NUMA nodes except the fixed NUMA node among the Q NUMA nodes, until the resource N is allocated.
本申请实施例中,如果资源N分配到资源L和资源M所在的NUMA节点之后,还有剩余未分配的资源N,则可将剩余的资源N分配到另一个NUMA节点。如果另一个NUMA节点可以分配完剩余的资源N,则结束;如果另一个NUMA节点仍然没有分配完剩余的资源N,则继续将剩余的资源N分配给其它的NUMA节点,直至资源N分配完成。In this embodiment of the present application, if there is a remaining unallocated resource N after the resource N is allocated to the NUMA node where the resource L and the resource M are located, the remaining resource N may be allocated to another NUMA node. If another NUMA node can allocate the remaining resource N, it ends; if the other NUMA node still has not allocated the remaining resource N, continue to allocate the remaining resource N to other NUMA nodes until the resource N is allocated.
通过上述步骤,可以将管理资源集中分配到一个NUMA节点,这样可使得在创建虚拟机时,能够提高单NUMA节点的虚拟机的配置个数。Through the above steps, management resources can be centrally allocated to one NUMA node, so that when creating a virtual machine, the number of virtual machines configured on a single NUMA node can be increased.
进一步的,作为一种可能的实现方式,本申请实施例中还可以自定义配置策略,即用户可以根据需求指定资源M和资源N所占的NUMA节点以及在NUMA节点中所占的CPU核的个数。Further, as a possible implementation manner, in this embodiment of the present application, a configuration policy can also be customized, that is, the user can specify the NUMA nodes occupied by the resource M and the resource N as well as the CPU core occupied by the NUMA node according to requirements. number.
以下结合具体例子对图5所示实施例中的资源分配策略进行介绍。The resource allocation strategy in the embodiment shown in FIG. 5 will be introduced below with reference to specific examples.
还是以表1作为应用集中式资源分配策略之前的分配形式,从表1可知,根据表1中的资源分配情况,用户可创建的单NUMA虚拟机的最大规格为:23CPU,即NUMA2节点对应的虚拟机为最大规格。Table 1 is still used as the allocation form before the centralized resource allocation strategy is applied. From Table 1, according to the resource allocation in Table 1, the maximum specification of a single NUMA virtual machine that a user can create is: 23CPU, that is, the corresponding NUMA2 node. The virtual machine is the maximum size.
利用本申请中的集中式资源分配策略之后,服务器上的NUMA节点对于管理资源的分配情况可参阅表3所示。After utilizing the centralized resource allocation strategy in the present application, the allocation of management resources by NUMA nodes on the server can be referred to as shown in Table 3.
表3table 3
Figure PCTCN2021120706-appb-000003
Figure PCTCN2021120706-appb-000003
从表3可知,在使用集中分配策略之后,管理资源所占的CPU核集中在一个NUMA节点中,因此,在创建单NUMA的虚拟机时,可以创建更大规格的虚拟机。比如,表3中的服务器可以创建的虚拟机的最大规格为24CPU。也就是说,CPU核的个数更多了。It can be seen from Table 3 that after the centralized allocation strategy is used, the CPU cores occupied by management resources are concentrated in a NUMA node. Therefore, when a single-NUMA virtual machine is created, a larger-sized virtual machine can be created. For example, the server in Table 3 can create a virtual machine with a maximum specification of 24CPU. In other words, the number of CPU cores is more.
基于上述实施例,本申请还提供一种基于NUMA属性的资源分配装置,参阅图6所示,该装置600可包括:获取单元601、分配单元602。Based on the above embodiments, the present application further provides a resource allocation device based on NUMA attributes. Referring to FIG. 6 , the device 600 may include: an acquisition unit 601 and an allocation unit 602 .
其中,获取单元601,用于获取云管理平台下发的资源分配策略以及管理资源的NUMA属性;分配单元602,用于根据所述获取单元601获取到的所述资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的中央处理器CPU。Wherein, the obtaining unit 601 is used for obtaining the resource allocation strategy and the NUMA attribute of the management resource issued by the cloud management platform; the allocation unit 602 is used for obtaining the resource allocation strategy and the management resource according to the obtaining unit 601 The NUMA attribute of the central processing unit CPU of the computing node is allocated to the management resource.
在一种可能的设计中,所述管理资源包括第一管理资源、第二管理资源以及第三管理资源;所述第一管理资源的属性包括:需分配所述计算节点的第一NUMA节点的CPU至所述第一管理资源;所述第二管理资源的属性包括:可分配所述计算节点的任意一个NUMA节点的CPU至所述第二管理资源;所述第三管理资源的属性包括:可在所述计算节点中跨NUMA节点分配CPU至所述第三管理资源。In a possible design, the management resource includes a first management resource, a second management resource, and a third management resource; the attributes of the first management resource include: the first NUMA node to which the computing node needs to be allocated. CPU to the first management resource; attributes of the second management resource include: the CPU of any NUMA node of the computing node can be allocated to the second management resource; attributes of the third management resource include: CPUs may be allocated to the third management resource in the compute nodes across NUMA nodes.
在一种可能的设计中,当所述资源分配策略包括均衡式资源分配策略时,所述分配单元602具体用于按如下方式根据所述资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的中央处理器CPU:按照所述第一管理资源、所述第二管理资源以及所述第三管理资源分别对应的NUMA属性,分别将所述第一管理资源、所述第二管理资源以及所述第三管理资源分配到所述第一NUMA节点、第二NUMA节点以及第三NUMA节点。In a possible design, when the resource allocation strategy includes a balanced resource allocation strategy, the allocation unit 602 is specifically configured to, according to the resource allocation strategy and the NUMA attribute of the management resource, be configured as follows: The management resource is allocated to the central processing unit CPU of the computing node: according to the NUMA attributes corresponding to the first management resource, the second management resource and the third management resource, respectively, the first management resource, The second management resource and the third management resource are allocated to the first NUMA node, the second NUMA node and the third NUMA node.
在一种可能的设计中,所述分配单元602还用于:当所述第三管理资源分配到所述第三NUMA节点之后,若所述第三管理资源还需占用H个CPU核,则从第一NUMA节点和第二NUMA节点中剩余CPU核最多者分配H个CPU核至所述第三管理资源,或从第一NUMA节点和第二NUMA节点各分摊H/2个CPU核至所述第三管理资源,或从第四NUMA节点分配H个CPU核至所述第三管理资源。In a possible design, the allocating unit 602 is further configured to: after the third management resource is allocated to the third NUMA node, if the third management resource still needs to occupy H CPU cores, then Allocate H CPU cores from the first NUMA node and the second NUMA node with the most remaining CPU cores to the third management resource, or allocate H/2 CPU cores from each of the first NUMA node and the second NUMA node to all the CPU cores. the third management resource, or allocate H CPU cores from the fourth NUMA node to the third management resource.
在一种可能的设计中,当所述资源分配策略包括集中式资源分配策略时,所述分配单元602具体用于按如下方式根据所述集中式资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的CPU:按照所述第一管理资源、所述第二管理资源以及所述第三管理资源分别对应的NUMA属性,依次将所述第一管理资源、所述第二管理资源以及所述第三管理资源分配到所述第一NUMA节点。In a possible design, when the resource allocation strategy includes a centralized resource allocation strategy, the allocation unit 602 is specifically configured to, according to the centralized resource allocation strategy and the NUMA attribute of the management resource, as follows: Allocate the CPU of the computing node to the management resource: according to the NUMA attributes corresponding to the first management resource, the second management resource, and the third management resource, sequentially assign the first management resource, all the The second management resource and the third management resource are allocated to the first NUMA node.
在一种可能的设计中,所述分配单元602还用于:当所述第三管理资源分配到所述第一NUMA节点之后,若所述第三管理资源还需占用H个CPU核,则从第二NUMA节点或第三NUMA节点分配H个CPU核至所述第三管理资源。In a possible design, the allocating unit 602 is further configured to: after the third management resource is allocated to the first NUMA node, if the third management resource still needs to occupy H CPU cores, then The H CPU cores are allocated from the second NUMA node or the third NUMA node to the third management resource.
其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。Wherein, all relevant contents of the steps involved in the above method embodiments can be cited in the functional descriptions of the corresponding functional modules, which will not be repeated here.
本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,另外,在本申请各个实施例中的各功能模块可以集成在一个处理器中,也可以是单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。The division of modules in the embodiments of this application is schematic, and is only a logical function division. In actual implementation, there may be other division methods. In addition, each functional module in each embodiment of this application may be integrated into one processing unit. In the device, it can also exist physically alone, or two or more modules can be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules.
如图7所示为本申请实施例提供的一种基于NUMA属性的资源分配装置700,装置700包括至少一个处理器702,用于实现或用于支持装置700实现如本申请实施例提供的图6所示的分配单元的功能。示例性地,处理器702可以根据所述获取单元601获取到的所述资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的中央处理器CPU等,具体参见方法示例中的详细描述,此处不做赘述。FIG. 7 shows a NUMA attribute-based resource allocation apparatus 700 provided in an embodiment of the present application. The apparatus 700 includes at least one processor 702 for implementing or supporting the apparatus 700 in implementing the diagrams provided in the embodiments of the present application. 6 shows the function of the distribution unit. Exemplarily, the processor 702 may allocate the central processing unit CPU of the computing node, etc. to the management resource according to the resource allocation policy and the NUMA attribute of the management resource obtained by the obtaining unit 601. For details, refer to: The detailed description in the method example will not be repeated here.
装置700还可以包括至少一个存储器701,用于存储程序指令。存储器701和处理器702耦合。本申请实施例中的耦合是装置、单元或模块之间的间接耦合或通信连接,可以是电性,机械或其它的形式,用于装置、单元或模块之间的信息交互。处理器702可能和存储器701协同操作。处理器702可能执行存储器701中存储的程序指令和/或数据。所述至少一个存储器中的至少一个可以包括于处理器中。The apparatus 700 may also include at least one memory 701 for storing program instructions. Memory 701 and processor 702 are coupled. The coupling in the embodiments of the present application is an indirect coupling or communication connection between devices, units or modules, which may be in electrical, mechanical or other forms, and is used for information exchange between devices, units or modules. The processor 702 may cooperate with the memory 701 . Processor 702 may execute program instructions and/or data stored in memory 701 . At least one of the at least one memory may be included in the processor.
装置700还可以包括通信接口703,用于通过传输介质和其它设备进行通信。处理器702可以利用通信接口703收发数据。The apparatus 700 may also include a communication interface 703 for communicating with other devices over a transmission medium. The processor 702 may utilize the communication interface 703 to send and receive data.
本申请不限定上述通信接口703、处理器702以及存储器701之间的具体连接介质。本申请实施例在图7中以存储器701、处理器702以及通信接口703之间通过总线704连接,总线在图7中以粗线表示。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图7中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The present application does not limit the specific connection medium between the communication interface 703 , the processor 702 and the memory 701 . In the embodiment of the present application, in FIG. 7 , the memory 701 , the processor 702 , and the communication interface 703 are connected through a bus 704 , and the bus is represented by a thick line in FIG. 7 . The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 7, but it does not mean that there is only one bus or one type of bus.
在本申请实施例中,处理器702可以是通用处理器、数字信号处理器、专用集成电路、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接由硬件处理器执行完成,或者由处理器中的硬件及软件模块组合执行完成。In this embodiment of the present application, the processor 702 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, which can implement Alternatively, each method, step, and logic block diagram disclosed in the embodiments of the present application are executed. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the methods disclosed in conjunction with the embodiments of the present application may be directly executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
在本申请实施例中,存储器701可以是非易失性存储器,比如硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD)等,还可以是易失性存储器(volatile memory), 例如RAM。存储器是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本申请实施例中的存储器还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令。In this embodiment of the present application, the memory 701 may be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), etc., or a volatile memory (volatile memory), For example RAM. Memory is, but is not limited to, any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory in this embodiment of the present application may also be a circuit or any other device capable of implementing a storage function, for storing program instructions.
可选的,本申请实施例中的计算机执行指令也可以称之为应用程序代码,本申请实施例对此不作具体限定。Optionally, the computer-executed instructions in the embodiment of the present application may also be referred to as application code, which is not specifically limited in the embodiment of the present application.
本申请实施例中还提供一种计算机可读存储介质,包括指令,当其在计算机上运行时,使得计算机执行上述实施例的方法。Embodiments of the present application further provide a computer-readable storage medium, including instructions, which, when executed on a computer, cause the computer to execute the method of the foregoing embodiment.
本申请实施例中还提供一种计算机程序产品,包括指令,当其在计算机上运行时,使得计算机执行上述实施例的方法。Embodiments of the present application also provide a computer program product, including instructions, which, when executed on a computer, cause the computer to execute the methods of the above embodiments.
本申请实施例中还提供一种芯片,所述芯片中的逻辑用于执行上述实施例的方法。The embodiment of the present application further provides a chip, and the logic in the chip is used to execute the method of the above embodiment.
本申请实施例是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The embodiments of the present application are described with reference to flowcharts and/or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It will be understood that each flow and/or block in the flowcharts and/or block diagrams, and combinations of flows and/or blocks in the flowcharts and/or block diagrams, can be implemented by instructions. These instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that execution of the instructions by the processor of the computer or other programmable data processing device produces a A means for the functions specified in a flow or flows of a flowchart and/or a block or blocks of a block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims (14)

  1. 一种基于NUMA属性的资源分配方法,其特征在于,所述方法应用于计算节点,所述方法包括:A NUMA attribute-based resource allocation method, wherein the method is applied to a computing node, and the method includes:
    获取云管理平台下发的资源分配策略以及管理资源的NUMA属性;Obtain the resource allocation policy issued by the cloud management platform and the NUMA attributes of the management resources;
    根据所述资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的中央处理器CPU。The central processing unit CPU of the computing node is allocated to the management resource according to the resource allocation policy and the NUMA attribute of the management resource.
  2. 如权利要求1所述的方法,其特征在于,所述管理资源包括第一管理资源、第二管理资源以及第三管理资源;The method of claim 1, wherein the management resources include a first management resource, a second management resource, and a third management resource;
    所述第一管理资源的NUMA属性包括:The NUMA attributes of the first management resource include:
    需分配所述计算节点的第一NUMA节点的CPU至所述第一管理资源;Need to allocate the CPU of the first NUMA node of the computing node to the first management resource;
    所述第二管理资源的NUMA属性包括:The NUMA attributes of the second management resource include:
    可分配所述计算节点的任意一个NUMA节点的CPU至所述第二管理资源;The CPU of any NUMA node of the computing node can be allocated to the second management resource;
    所述第三管理资源的NUMA属性包括:The NUMA attributes of the third management resource include:
    可在所述计算节点中跨NUMA节点分配CPU至所述第三管理资源。CPUs may be allocated to the third management resource in the compute nodes across NUMA nodes.
  3. 如权利要求2所述的方法,其特征在于,所述资源分配策略包括均衡式资源分配策略,根据所述资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的中央处理器CPU,包括:The method of claim 2, wherein the resource allocation strategy comprises a balanced resource allocation strategy, and the computing node is allocated to the management resource according to the resource allocation strategy and the NUMA attribute of the management resource The central processing unit CPU, including:
    按照所述第一管理资源、所述第二管理资源以及所述第三管理资源分别对应的NUMA属性,分别将所述第一管理资源、所述第二管理资源以及所述第三管理资源分配到所述第一NUMA节点、第二NUMA节点以及第三NUMA节点。Allocate the first management resource, the second management resource, and the third management resource according to the NUMA attributes corresponding to the first management resource, the second management resource, and the third management resource, respectively. to the first NUMA node, the second NUMA node, and the third NUMA node.
  4. 如权利要求3所述的方法,其特征在于,所述方法还包括:The method of claim 3, wherein the method further comprises:
    当所述第三管理资源分配到所述第三NUMA节点之后,若所述第三管理资源还需占用H个CPU核,则从第一NUMA节点和第二NUMA节点中剩余CPU核最多者分配H个CPU核至所述第三管理资源,或从第一NUMA节点和第二NUMA节点各分摊H/2个CPU核至所述第三管理资源,或从第四NUMA节点分配H个CPU核至所述第三管理资源。After the third management resource is allocated to the third NUMA node, if the third management resource still needs to occupy H CPU cores, the first NUMA node and the second NUMA node with the most remaining CPU cores are allocated from the one with the most remaining CPU cores. H CPU cores are allocated to the third management resource, or H/2 CPU cores are allocated from each of the first NUMA node and the second NUMA node to the third management resource, or H CPU cores are allocated from the fourth NUMA node to the third management resource.
  5. 如权利要求2所述的方法,其特征在于,所述资源分配策略包括集中式资源分配策略,根据所述集中式资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的CPU,包括:The method of claim 2, wherein the resource allocation strategy comprises a centralized resource allocation strategy, and the management resource is allocated the management resource according to the centralized resource allocation strategy and a NUMA attribute of the management resource. The CPU of the compute node, including:
    按照所述第一管理资源、所述第二管理资源以及所述第三管理资源分别对应的NUMA属性,依次将所述第一管理资源、所述第二管理资源以及所述第三管理资源分配到所述第一NUMA节点。According to the NUMA attributes corresponding to the first management resource, the second management resource and the third management resource respectively, the first management resource, the second management resource and the third management resource are sequentially allocated to the first NUMA node.
  6. 如权利要求5所述的方法,其特征在于,所述方法还包括:The method of claim 5, wherein the method further comprises:
    当所述第三管理资源分配到所述第一NUMA节点之后,若所述第三管理资源还需占用H个CPU核,则从第二NUMA节点或第三NUMA节点分配H个CPU核至所述第三管理资源。After the third management resource is allocated to the first NUMA node, if the third management resource still needs to occupy H CPU cores, then H CPU cores are allocated from the second NUMA node or the third NUMA node to the third NUMA node. the third management resource.
  7. 一种基于NUMA属性的资源分配装置,其特征在于,包括:A resource allocation device based on NUMA attributes, comprising:
    获取单元,所述获取单元用于获取云管理平台下发的资源分配策略以及管理资源的NUMA属性;an obtaining unit, the obtaining unit is used to obtain the resource allocation strategy issued by the cloud management platform and the NUMA attribute of the management resource;
    分配单元,用于根据所述获取单元获取到的所述资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的中央处理器CPU。an allocation unit, configured to allocate the central processing unit CPU of the computing node to the management resource according to the resource allocation policy and the NUMA attribute of the management resource obtained by the obtaining unit.
  8. 如权利要求7所述的装置,其特征在于,所述管理资源包括第一管理资源、第二管理资源以及第三管理资源;The apparatus of claim 7, wherein the management resources include a first management resource, a second management resource, and a third management resource;
    所述第一管理资源的属性包括:The attributes of the first management resource include:
    需分配所述计算节点的第一NUMA节点的CPU至所述第一管理资源;Need to allocate the CPU of the first NUMA node of the computing node to the first management resource;
    所述第二管理资源的属性包括:The attributes of the second management resource include:
    可分配所述计算节点的任意一个NUMA节点的CPU至所述第二管理资源;The CPU of any NUMA node of the computing node can be allocated to the second management resource;
    所述第三管理资源的属性包括:The attributes of the third management resource include:
    可在所述计算节点中跨NUMA节点分配CPU至所述第三管理资源。CPUs may be allocated to the third management resource in the compute nodes across NUMA nodes.
  9. 如权利要求8所述的装置,其特征在于,当所述资源分配策略包括均衡式资源分配策略时,所述分配单元具体用于按如下方式根据所述资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的中央处理器CPU:The apparatus according to claim 8, wherein when the resource allocation strategy includes a balanced resource allocation strategy, the allocation unit is specifically configured to use the resource allocation strategy and the NUMA of the management resource in the following manner attribute, the central processing unit CPU of the computing node is allocated to the management resource:
    按照所述第一管理资源、所述第二管理资源以及所述第三管理资源分别对应的NUMA属性,分别将所述第一管理资源、所述第二管理资源以及所述第三管理资源分配到所述第一NUMA节点、第二NUMA节点以及第三NUMA节点。Allocate the first management resource, the second management resource, and the third management resource according to the NUMA attributes corresponding to the first management resource, the second management resource, and the third management resource, respectively. to the first NUMA node, the second NUMA node, and the third NUMA node.
  10. 如权利要求9所述的装置,其特征在于,所述分配单元还用于:The apparatus of claim 9, wherein the distribution unit is further used for:
    当所述第三管理资源分配到所述第三NUMA节点之后,若所述第三管理资源还需占用H个CPU核,则从第一NUMA节点和第二NUMA节点中剩余CPU核最多者分配H个CPU核至所述第三管理资源,或从第一NUMA节点和第二NUMA节点各分摊H/2个CPU核至所述第三管理资源,或从第四NUMA节点分配H个CPU核至所述第三管理资源。After the third management resource is allocated to the third NUMA node, if the third management resource still needs to occupy H CPU cores, the first NUMA node and the second NUMA node with the most remaining CPU cores are allocated from the one with the most remaining CPU cores. H CPU cores are allocated to the third management resource, or H/2 CPU cores are allocated from each of the first NUMA node and the second NUMA node to the third management resource, or H CPU cores are allocated from the fourth NUMA node to the third management resource.
  11. 如权利要求8所述的装置,其特征在于,当所述资源分配策略包括集中式资源分配策略时,所述分配单元具体用于按如下方式根据所述集中式资源分配策略和所述管理资源的NUMA属性,为所述管理资源分配所述计算节点的CPU:The apparatus according to claim 8, wherein when the resource allocation strategy includes a centralized resource allocation strategy, the allocation unit is specifically configured to manage resources according to the centralized resource allocation strategy and the management resource in the following manner NUMA attribute to allocate the CPU of the compute node for the management resource:
    按照所述第一管理资源、所述第二管理资源以及所述第三管理资源分别对应的NUMA属性,依次将所述第一管理资源、所述第二管理资源以及所述第三管理资源分配到所述第一NUMA节点。According to the NUMA attributes corresponding to the first management resource, the second management resource and the third management resource respectively, the first management resource, the second management resource and the third management resource are sequentially allocated to the first NUMA node.
  12. 如权利要求11所述的装置,其特征在于,所述分配单元还用于:The apparatus of claim 11, wherein the distribution unit is further configured to:
    当所述第三管理资源分配到所述第一NUMA节点之后,若所述第三管理资源还需占用H个CPU核,则从第二NUMA节点或第三NUMA节点分配H个CPU核至所述第三管理资源。After the third management resource is allocated to the first NUMA node, if the third management resource still needs to occupy H CPU cores, then H CPU cores are allocated from the second NUMA node or the third NUMA node to the third NUMA node. the third management resource.
  13. 一种计算机可读存储介质,其特征在于,所述存储介质存储有计算机指令,当所述计算机指令被计算机执行时,使得所述计算机执行如权利要求1-6中任一项所述的方法。A computer-readable storage medium, characterized in that the storage medium stores computer instructions, which, when executed by a computer, cause the computer to execute the method according to any one of claims 1-6 .
  14. 一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机指令,当所述计算机指令被计算机执行时,使得所述计算机执行如权利要求1-6中任一项所述的方法。A computer program product, characterized in that the computer program product comprises computer instructions, which, when executed by a computer, cause the computer to perform the method according to any one of claims 1-6.
PCT/CN2021/120706 2020-09-27 2021-09-26 Resource allocation method and apparatus based on numa attribute WO2022063273A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011035169.2A CN114281516A (en) 2020-09-27 2020-09-27 Resource allocation method and device based on NUMA attribute
CN202011035169.2 2020-09-27

Publications (1)

Publication Number Publication Date
WO2022063273A1 true WO2022063273A1 (en) 2022-03-31

Family

ID=80844995

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/120706 WO2022063273A1 (en) 2020-09-27 2021-09-26 Resource allocation method and apparatus based on numa attribute

Country Status (2)

Country Link
CN (1) CN114281516A (en)
WO (1) WO2022063273A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116820687A (en) * 2023-08-29 2023-09-29 银河麒麟软件(长沙)有限公司 NUMA architecture resource allocation method and system based on kubelet

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050120160A1 (en) * 2003-08-20 2005-06-02 Jerry Plouffe System and method for managing virtual servers
US20070226449A1 (en) * 2006-03-22 2007-09-27 Nec Corporation Virtual computer system, and physical resource reconfiguration method and program thereof
CN102841815A (en) * 2012-07-12 2012-12-26 北京航空航天大学 Adaptive progress classification binding method for non uniform memory access (NUMA) system architecture
CN104050091A (en) * 2012-12-28 2014-09-17 华耀(中国)科技有限公司 Network equipment based on NUMA (Non Uniform Memory Access) system and setting method thereof
CN109388490A (en) * 2017-08-07 2019-02-26 杭州华为数字技术有限公司 A kind of memory allocation method and server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050120160A1 (en) * 2003-08-20 2005-06-02 Jerry Plouffe System and method for managing virtual servers
US20070226449A1 (en) * 2006-03-22 2007-09-27 Nec Corporation Virtual computer system, and physical resource reconfiguration method and program thereof
CN102841815A (en) * 2012-07-12 2012-12-26 北京航空航天大学 Adaptive progress classification binding method for non uniform memory access (NUMA) system architecture
CN104050091A (en) * 2012-12-28 2014-09-17 华耀(中国)科技有限公司 Network equipment based on NUMA (Non Uniform Memory Access) system and setting method thereof
CN109388490A (en) * 2017-08-07 2019-02-26 杭州华为数字技术有限公司 A kind of memory allocation method and server

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116820687A (en) * 2023-08-29 2023-09-29 银河麒麟软件(长沙)有限公司 NUMA architecture resource allocation method and system based on kubelet
CN116820687B (en) * 2023-08-29 2023-12-05 银河麒麟软件(长沙)有限公司 NUMA architecture resource allocation method and system based on kubelet

Also Published As

Publication number Publication date
CN114281516A (en) 2022-04-05

Similar Documents

Publication Publication Date Title
US11748278B2 (en) Multi-protocol support for transactions
US20210081312A1 (en) Shared memory
CN107690622B (en) Method, equipment and system for realizing hardware acceleration processing
KR102589155B1 (en) Method and apparatus for memory management
WO2015070818A1 (en) Method and apparatus for delivering msi-x interrupts through non-transparent bridges to computing resources in pci-express clusters
US8930507B2 (en) Physical memory shared among logical partitions in a VLAN
US10235047B2 (en) Memory management method, apparatus, and system
CN111880750A (en) Method, device and equipment for distributing read-write resources of disk and storage medium
WO2019148854A1 (en) Method and device for deploying virtualized network element device
WO2019233322A1 (en) Resource pool management method and apparatus, resource pool control unit, and communication device
US11726701B2 (en) Memory expander, heterogeneous computing device using memory expander, and operation method of heterogenous computing
JP7467593B2 (en) Resource allocation method, storage device, and storage system - Patents.com
US20210075745A1 (en) Methods and apparatus for improved polling efficiency in network interface fabrics
US10592285B2 (en) System and method for information handling system input/output resource management
US11741039B2 (en) Peripheral component interconnect express device and method of operating the same
US11012316B2 (en) Methods and apparatus to generate and manage workload domains in virtual server racks
US20230051825A1 (en) System supporting virtualization of sr-iov capable devices
US9792209B2 (en) Method and apparatus for cache memory data processing
US10496565B2 (en) Micro-architectural techniques to minimize companion die firmware loading times in a server platform
US9229891B2 (en) Determining a direct memory access data transfer mode
TWI616759B (en) Apparatus assigning controller and apparatus assigning method
US9218219B2 (en) Managing virtual functions of an input/output adapter
WO2022063273A1 (en) Resource allocation method and apparatus based on numa attribute
Shim et al. Design and implementation of initial OpenSHMEM on PCIe NTB based cloud computing
CN114153549A (en) Virtual machine creation method and related equipment

Legal Events

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

Ref document number: 21871642

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21871642

Country of ref document: EP

Kind code of ref document: A1