A resource allocation method, device, apparatus and readable storage medium

CN115658302BActive Publication Date: 2026-10-27JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211295786.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-21
Publication Date
2026-10-27
Estimated Expiration
2042-10-21

AI Technical Summary

Technical Problem

这两种策略在进行资源分配时并不区分应用对于资源要求情况,也即对于所有应用都是采用相同的分配策略进行分配,而这并没有实现合理化的资源分配,导致整个系统的性能比较低

Benefits of technology

[0035]本申请提供了一种资源分配方法、装置、设备及可读存储介质,其中,该方法包括:获取pod的所需资源数、pod对资源要求的级别、pod对应的节点距离标准值及各numa节点的可用资源数;若各numa节点的可用资源数均小于pod的所需资源数,则当级别为高级别时,则将可用资源数最多的numa节点分配给pod,并从与可用资源数最多的numa节点的距离小于节点距离标准值的各numa节点中选择第一numa节点,将第一numa节点分配给pod;当级别为低级别时,则将可用资源数最少的numa节点分配给pod,并从与可用资源数最少的numa节点的距离大于节点距离标准值的各numa节点中选择第二numa节点,将第二numa节点分配给pod。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115658302B_ABST
    Figure CN115658302B_ABST
Patent Text Reader

Abstract

The application discloses a resource allocation method, device and equipment and a readable storage medium. The method comprises the following steps: acquiring the required resource number of a pod, the level of resource requirement, the corresponding node distance standard value and the available resource number of each NUMA node; if the available resource number of the node is less than the required resource number of the pod, when the level is a high level, the node with the largest available resource number is allocated to the pod, and a first node is selected from each node with a node distance from the node with the largest available resource number less than the standard value and allocated to the pod; when the level is a low level, the node with the smallest available resource number is allocated to the pod, and a second node is selected from each node with a distance from the node with the smallest available resource number greater than the node standard value and allocated to the pod. According to the application, the corresponding resource allocation strategy is adopted for the NUMA node allocation according to the different resource requirements of the pod, so that the resource allocation rationality is improved, and the optimal resource allocation is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of resource allocation technology, and more specifically, to a resource allocation method, apparatus, device, and readable storage medium. Background Technology

[0002] NUMA (Uniform Memory Access) divides a computer into multiple nodes. When deploying applications, the resources of these NUMA nodes need to be allocated to the applications. In allocating NUMA node resources to applications, the farther apart the NUMA nodes are, the slower the access speed; the closer the NUMA nodes are, the faster the access speed.

[0003] Currently, there are two main strategies for allocating resources to NUMA nodes: the first is to allocate as much resource as possible to a single NUMA node before selecting other NUMA nodes; the second is to allocate resources so that all NUMA nodes have roughly the same amount of remaining resources. Neither strategy differentiates between application resource requirements, meaning all applications are allocated resources using the same strategy. This fails to achieve rational resource allocation, resulting in low overall system performance.

[0004] In conclusion, how to improve the rationality of NUMA resource allocation is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] In view of this, the purpose of this application is to provide a resource allocation method, apparatus, device and readable storage medium for improving the rationality of numa resource allocation.

[0006] To achieve the above objectives, this application provides the following technical solution:

[0007] A resource allocation method, comprising:

[0008] Obtain the required resources for a pod, the resource requirement level of the pod, the distance from the node corresponding to the pod to the standard value, and the available resources of each NUMA node;

[0009] If the number of available resources of each of the numa nodes is less than the number of resources required by the pod, then when the level is high, the numa node with the most available resources is assigned to the pod, and a first numa node is selected from the numa nodes whose distance from the numa node with the most available resources is less than the node distance standard value, and the first numa node is assigned to the pod.

[0010] When the level is low, the numa node with the fewest available resources is assigned to the pod, and a second numa node is selected from the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, and the second numa node is assigned to the pod.

[0011] Preferably, if there exists a number of available resources for the numa node that is greater than or equal to the number of resources required by the pod, then the method further includes:

[0012] Select the numa node with the fewest available resources from among the numa nodes whose available resources are greater than or equal to the required resources of the pod, and assign the selected numa node with the fewest available resources to the pod.

[0013] Preferably, if multiple numa nodes with the fewest available resources are selected from the numa nodes whose available resources are greater than or equal to the required resources of the pod, the method further includes:

[0014] Calculate the sum of distances between each of the numa nodes with the fewest available resources and the remaining numa nodes;

[0015] Assign the NUMA node with the fewest available resources to the pod, including:

[0016] Assign the pod to the numa node with the largest sum of distances to the remaining numa nodes from among the numa nodes with the fewest available resources.

[0017] Preferably, selecting a first numa node from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, and assigning the first numa node to the pod, includes:

[0018] If, among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, there is a numa node whose available resources are greater than or equal to the remaining required resources of the pod, then the numa node with the fewest available resources among the numa nodes whose available resources are greater than or equal to the remaining required resources of the pod is selected as the first numa node, and the first numa node is assigned to the pod.

[0019] If, among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, there is no numa node whose available resources are greater than or equal to the remaining required resources of the pod, then the numa node with the most available resources is selected from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value as the first numa node, and the first numa node is assigned to the pod. The first numa node is then removed from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, and the step of selecting the numa node with the most available resources from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value as the first numa node is repeated until the remaining required resources of the pod are 0.

[0020] Preferably, selecting a second numa node from among the numa nodes whose distance to the numa node with the fewest available resources is greater than the node distance standard value, and assigning the second numa node to the pod, includes:

[0021] From all the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, select the numa node with the fewest available resources as the second numa node, assign the second numa node to the pod, and remove the second numa node from all the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value.

[0022] If the remaining required resources of the pod are not 0, the step of selecting the numa node with the fewest available resources from among the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value is repeated until the remaining required resources of the pod are 0.

[0023] Preferably, obtaining the resource requirement level of the pod and the standard distance value of the node corresponding to the pod includes:

[0024] Obtain the resource requirement level of the pod set by the user and the standard distance value of the node corresponding to the pod, and write the standard distance value of the node corresponding to the pod into the kubelet configuration file.

[0025] Preferably, the number of available resources for each numa node is obtained, including:

[0026] Call kubelet to obtain the number of available resources for each of the numa nodes.

[0027] A resource allocation device, comprising:

[0028] The acquisition module is used to acquire the number of resources required by a pod, the level of resource requirements of the pod, the distance from the node corresponding to the pod to the standard value, and the number of available resources of each NUMA node;

[0029] The first allocation module is configured to, if the number of available resources of each of the numa nodes is less than the number of resources required by the pod, then when the level is high, allocate the numa node with the most available resources to the pod, and select a first numa node from among the numa nodes whose distance from the numa node with the most available resources is less than the node distance standard value, and allocate the first numa node to the pod.

[0030] The second allocation module is used to allocate the numa node with the fewest available resources to the pod when the level is low, and to select a second numa node from the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, and allocate the second numa node to the pod.

[0031] A resource allocation device, comprising:

[0032] Memory, used to store computer programs;

[0033] A processor for implementing the resource allocation method as described in any of the preceding claims when executing the computer program.

[0034] A readable storage medium storing a computer program that, when executed by a processor, implements the steps of the resource allocation method as described in any of the preceding claims.

[0035] This application provides a resource allocation method, apparatus, device, and readable storage medium. The method includes: obtaining the required number of resources for a pod, the resource requirement level of the pod, the node distance standard value corresponding to the pod, and the available resources of each numa node; if the available resources of each numa node are less than the required number of resources for the pod, then when the level is high, the numa node with the most available resources is allocated to the pod, and a first numa node is selected from among the numa nodes whose distance from the numa node with the most available resources is less than the node distance standard value, and the first numa node is allocated to the pod; when the level is low, the numa node with the fewest available resources is allocated to the pod, and a second numa node is selected from among the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, and the second numa node is allocated to the pod.

[0036] The technical solution disclosed in this application, after obtaining the required number of resources for a pod, the level of resource requirements for the pod, the standard distance value between the pod and its corresponding node, and the number of available resources for each numa node, if it is found that the number of available resources for each numa node is less than the required number of resources for the pod, then when the pod's resource requirement level is high, the numa node with the most available resources is assigned to the pod. Furthermore, a first numa node is selected from among the numa nodes whose distance from the numa node with the most available resources is less than the standard distance value, and this first numa node is assigned to the pod. This ensures that pods with high resource requirements are allocated to the numa node with the most available resources and the numa node closest to that numa node when the resources of a single numa node are insufficient, thereby improving the access speed and efficiency of pods with high resource requirements and enhancing system performance. When a pod has a low resource requirement level, the NUMA node with the fewest available resources is allocated to the pod. Then, a second NUMA node is selected from among all NUMA nodes whose distance from the NUMA node with the fewest available resources is greater than the node's standard value, and this second NUMA node is also allocated to the pod. This ensures that pods with low resource requirements do not occupy NUMA nodes with large available resources or nearby NUMA nodes when single NUMA node resources are insufficient. This allows pods with large available resources and nearby NUMA nodes to be reserved for pods with high resource requirements, thereby improving the access speed and efficiency of resources for pods with high resource requirements. Furthermore, this resource allocation method can achieve fragmented utilization of NUMA node resources that are relatively far away, thus achieving full utilization of NUMA node resources. As can be seen from the above, this application adopts an appropriate resource allocation strategy for NUMA node allocation based on the different resource requirements of pods, thereby improving the rationality of resource allocation, achieving optimal resource allocation, improving system performance, and the calculation method is simple, ensuring full utilization of resources. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0038] Figure 1 A flowchart illustrating a resource allocation method provided in an embodiment of this application;

[0039] Figure 2 An architecture diagram of the resource allocation method provided in the embodiments of this application;

[0040] Figure 3 A flowchart illustrating another resource allocation method provided in this application embodiment;

[0041] Figure 4 This is a schematic diagram of the structure of a resource allocation device provided in an embodiment of this application;

[0042] Figure 5 This is a schematic diagram of the structure of a resource allocation device provided in an embodiment of this application. Detailed Implementation

[0043] In existing technologies, there are two strategies for allocating resources to NUMA nodes. The first is to allocate as much of the resources of a NUMA node as possible before selecting other NUMA nodes; the second is to allocate resources so that all NUMA nodes have roughly the same remaining resources. Neither strategy differentiates between applications, meaning that NUMA node resource allocation is the same for all applications. This leads to a situation where resources are insufficient or allocation involves multiple NUMA nodes, causing the system to use the same resource allocation strategy for applications with different resource requirements, resulting in suboptimal resource allocation.

[0044] Therefore, this application provides a resource allocation method, apparatus, device, and readable storage medium to improve the rationality of numa node resource allocation and achieve optimal allocation of numa node resources.

[0045] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0046] See Figure 1 and Figure 2 ,in, Figure 1 A flowchart of a resource allocation method provided in an embodiment of this application is shown. Figure 2 An architecture diagram of a resource allocation method provided in an embodiment of this application is shown. A resource allocation method provided in an embodiment of this application may include:

[0047] S11: Obtain the number of resources required by the pod, the level of resource requirements of the pod, the distance of the node corresponding to the pod from the standard value, and the number of available resources of each NUMA node.

[0048] After a user creates a pod, kubelet (a proxy component on each Kubernetes worker node) can schedule the pod to a specified node. This specified node specifically refers to a node within a node that supports the NUMA architecture, and this specified node contains multiple NUMA nodes. Figure 2 For example, Node1, Node2, and Noden are all nodes that support the NUMA architecture. In Kubernetes (an open-source platform for managing containerized applications across multiple hosts in a cloud platform), the pod is the foundation of all business types and the smallest unit managed by Kubernetes. It is a combination of one or more containers, on which the main application and processes closely related to that application run.

[0049] Then, the specified node can obtain the required resources of a pod, the resource requirement level of the pod, and the distance from the node corresponding to the pod to the standard value. The resource requirement level of a pod can be either high-level or low-level. A high-level requirement indicates high performance requirements, meaning high demands on resource access and scheduling, while a low-level requirement indicates low performance requirements, meaning relatively low demands on resource access and scheduling. Additionally, the specified node can iterate through the available resources of each NUMA node it contains to rationally allocate NUMA node resources based on the aforementioned information. The resources referred to in the pod's required resources and the resources referred to in the available resources of each NUMA node are of the same type, such as CPU (central processing unit) or memory.

[0050] Specifically, a designated node can contain an information receiver and a resource allocator. The information receiver obtains the resource requirement level of a pod and the standard distance value to the node corresponding to the pod, and then sends this information to the resource allocator. The resource allocator, in addition to obtaining the resource requirement level and the standard distance value to the node corresponding to the pod from the information receiver, can also obtain the number of resources required by the pod and the number of available resources on each NUMA node, so as to allocate NUMA nodes based on this information. In other words, the information receiver in the designated node is mainly responsible for obtaining information about the pods that need resource allocation, while the resource allocator is mainly responsible for allocating NUMA node resources.

[0051] S12: If the number of available resources on each numa node is less than the number of resources required by the pod, then when the level is high, the numa node with the most available resources will be assigned to the pod, and the first numa node will be selected from among the numa nodes whose distance from the numa node with the most available resources is less than the node distance standard value, and the first numa node will be assigned to the pod.

[0052] Based on step S11, the specified node can compare the required resources of the pod with the available resources of each numa node. If it is determined that the available resources of each numa node are less than the required resources of the pod, that is, if the available resources of a single numa node cannot meet the resource requirements of the pod, then when the pod's resource requirement level is high, in order to reduce the number of numa nodes involved and improve the access and scheduling speed of resources for pods with high performance requirements, reduce the relative latency between nodes, and improve access and scheduling efficiency, the numa node with the most available resources (denoted as numa node a) can be determined based on the available resources of each numa node obtained in step S11. This numa node with the most available resources (i.e., numa node a) is then allocated to the pod, meaning its available resources are allocated to the pod. By allocating the numa node with the most available resources to the pod with high resource requirements, the number of numa nodes involved is reduced, thereby improving the efficiency of resource access for pods with high resource requirements and thus improving pod performance.

[0053] Since the available resources of the numa node with the most available resources are insufficient to meet the resource requirements of the pod, after assigning the numa node with the most available resources (i.e., numa node a) to the pod, the distances between the remaining numa nodes and numa node a can be obtained. From this, numa nodes whose distances to numa node a are determined to be less than a standard distance value. These numa nodes are considered relatively close to numa node a. The distance between numa nodes represents the relative memory latency between them; for example, a distance of 10 indicates a latency of 1 times that of a local node, and a distance of 20 indicates a latency of 2 times that of a local node. When a pod is assigned across multiple numa nodes, the farther apart the numa nodes are, the slower the memory access and the faster the pod's speed; conversely, the closer the numa nodes are, the faster the memory access and the faster the pod's speed.

[0054] After identifying the remaining numa nodes whose distance to numa node a is less than the standard distance value, a first numa node is selected from these nodes and assigned to the pod. This means allocating the available resources of the first numa node to the pod, ensuring that the total available resources of numa node a and the first numa node meet the pod's resource requirements. In other words, the total available resources of numa node a and the first numa node are not less than the pod's required resources. This process selects numa nodes from those closest to the numa node with the most available resources and assigns them to pods with high resource requirements. This ensures that resource-intensive pods are assigned to nearby numa nodes, reducing latency in resource access and scheduling, improving resource access and scheduling efficiency, and significantly enhancing the performance of resource-intensive pods.

[0055] The above process ensures that pods with high performance requirements are allocated resources from the numa node with the most available resources and the numa node closest to the numa node when the resources of a single numa node are insufficient. This satisfies the needs of pods with high performance requirements and improves their performance.

[0056] S13: If the number of available resources on each numa node is less than the number of resources required by the pod, then when the level is low, the numa node with the fewest available resources will be assigned to the pod, and the second numa node will be selected from the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, and the second numa node will be assigned to the pod.

[0057] When the available resources on each NUMA node are less than the resources required by the pod, and the pod's resource requirement level is low, in order to reduce the NUMA resource consumption by pods with low resource requirements and to allow NUMA nodes with more available resources to be reserved for pods with higher resource requirements, the NUMA node with the fewest available resources (denoted as NUMA node b) can be determined based on the available resources of each NUMA node obtained in step S11. This NUMA node with the fewest available resources (i.e., NUMA node b) can then be allocated to the pod, meaning its available resources are allocated to the pod. By allocating the NUMA node with the fewest available resources to pods with low resource requirements, the consumption of NUMA nodes with more available resources by pods with low resource requirements is reduced. This allows NUMA nodes with more available resources to be reserved for pods with higher resource requirements, thereby improving system performance and meeting user function requirements.

[0058] Since the available resources of the numa node with the fewest available resources are insufficient to meet the pod's resource requirements, after assigning the numa node with the fewest available resources (i.e., numa node b) to the pod, we can obtain the distances between the remaining numa nodes and numa node b. From these, we can identify the numa nodes whose distances from numa node b are greater than a standard distance value. These other numa nodes are relatively far from numa node b. After identifying the numa nodes whose distances from numa node b are greater than the standard distance value, we can select a second numa node from these and assign it to the pod. This means allocating the available resources of the second numa node to the pod, ensuring that the total available resources of numa node b and the second numa node meet the pod's resource requirements. In other words, the total available resources of numa node b and the second numa node are not less than the pod's resource requirements. The aforementioned process allows for the selection of numa nodes from those numa nodes that are relatively far from the numa nodes with the fewest available resources, and their allocation to pods with low resource requirements. This satisfies the resource needs of pods with low resource requirements, while reserving numa nodes that are relatively close to the pods for use by pods with high resource requirements.

[0059] The above process allows pods with low performance requirements to utilize NUMA nodes with fewer available resources, as well as those farther away, when the resources of a single NUMA node are insufficient. This ensures that more NUMA nodes with abundant resources, or those closer to the pod, are reserved for pods with higher performance requirements, thus fulfilling user functionality needs and significantly improving overall system performance. Furthermore, this process enables pods with low resource requirements to utilize NUMA node resources in a fragmented manner, achieving full utilization of NUMA node resources.

[0060] The technical solution disclosed in this application, after obtaining the required number of resources for a pod, the level of resource requirements for the pod, the standard distance value between the pod and its corresponding node, and the number of available resources for each numa node, if it is found that the number of available resources for each numa node is less than the required number of resources for the pod, then when the pod's resource requirement level is high, the numa node with the most available resources is assigned to the pod. Furthermore, a first numa node is selected from among the numa nodes whose distance from the numa node with the most available resources is less than the standard distance value, and this first numa node is assigned to the pod. This ensures that pods with high resource requirements are allocated to the numa node with the most available resources and the numa node closest to that numa node when the resources of a single numa node are insufficient, thereby improving the access speed and efficiency of pods with high resource requirements and enhancing system performance. When a pod has a low resource requirement level, the NUMA node with the fewest available resources is allocated to the pod. Then, a second NUMA node is selected from among all NUMA nodes whose distance from the NUMA node with the fewest available resources is greater than the node's standard value, and this second NUMA node is also allocated to the pod. This ensures that pods with low resource requirements do not occupy NUMA nodes with large available resources or nearby NUMA nodes when single NUMA node resources are insufficient. This allows pods with large available resources and nearby NUMA nodes to be reserved for pods with high resource requirements, thereby improving the access speed and efficiency of resources for pods with high resource requirements. Furthermore, this resource allocation method can achieve fragmented utilization of NUMA node resources that are relatively far away, thus achieving full utilization of NUMA node resources. As can be seen from the above, this application adopts an appropriate resource allocation strategy for NUMA node allocation based on the different resource requirements of pods, thereby improving the rationality of resource allocation, achieving optimal resource allocation, improving system performance, and the calculation method is simple, ensuring full utilization of resources.

[0061] See Figure 3The diagram illustrates a flowchart of another resource allocation method provided in an embodiment of this application. If the number of available resources for a numa node is greater than or equal to the number of resources required by the pod, the resource allocation method provided in this embodiment may further include:

[0062] Select the numa node with the fewest available resources from among the numa nodes whose available resources are greater than or equal to the pod's required resources, and assign the selected numa node with the fewest available resources to the pod.

[0063] Based on step S11, if there is a numa node among the numa nodes whose available resources are greater than or equal to the number of resources required by the pod, then the numa node with the fewest available resources (named numa node c) can be selected from the numa nodes whose available resources are greater than or equal to the number of resources required by the pod. The selected numa node with the fewest available resources (i.e., numa node c) is then assigned to the pod. This ensures that when the resources of a single numa node are sufficient, the resources allocated to the pod are all on one numa node, which greatly improves the performance of the pod. Furthermore, in the above case, selecting the numa node with the fewest available resources to assign to the pod reduces the occupation of numa nodes with more available resources, so that numa nodes with more available resources can be occupied by pods with high resource requirements and a large number of resources.

[0064] Of course, if there are multiple numa nodes with available resources greater than or equal to the number of resources required by the pod, one of these numa nodes can be randomly selected and assigned to the pod.

[0065] The resource allocation method provided in this application embodiment, if selecting from multiple numa nodes with the fewest available resources among numa nodes whose available resources are greater than or equal to the required resources of the pod, may further include:

[0066] Calculate the sum of distances between each numa node with the fewest available resources and the remaining numa nodes;

[0067] Assigning the NUMA node with the fewest available resources to the pod can include:

[0068] Assign the pod to the numa node with the largest sum of distances to the remaining numa nodes from among the numa nodes with the fewest available resources.

[0069] In this application, when selecting the numa node with the fewest available resources (i.e., numa node c) from numa nodes whose available resources are greater than or equal to the required resources of the pod, if there are multiple numa nodes with the fewest available resources (i.e., multiple numa nodes c, which can be denoted as numa node c1, numa node c2, numa node c3, etc. for distinction), and these numa nodes not only have the same number of available resources but are also the fewest among the numa nodes whose available resources are greater than or equal to the required resources of the pod, then the sum of the distances between each numa node c and the remaining numa nodes (specifically, the remaining numa nodes mentioned here refer to the numa nodes included in the specified node excluding the current numa node) can be calculated, i.e., the sum of the distances between each numa node c and the remaining numa nodes (the remaining numa nodes mentioned here specifically refer to the numa nodes excluding the current numa node contained in the specified node) can be calculated. Calculate the total distance between numa node c1 and the remaining numa nodes, calculate the total distance between numa node c2 and the remaining numa nodes, calculate the total distance between numa node c3 and the remaining numa nodes, and so on. Then, select the numa node with the largest total distance to the remaining numa nodes from among the numa nodes with the fewest available resources (i.e., from numa node c1, numa node c2, numa node c3, etc.), and assign this numa node to the pod. In other words, assign the numa node with the largest total distance to the remaining numa nodes from among the numa nodes with the fewest available resources to the pod, or assign the numa node that is relatively far away from other numa nodes to the pod, so as to reserve the numa nodes that are relatively close to the pod for use by pods with high resource requirements.

[0070] Of course, when selecting multiple numa nodes with the fewest available resources from numa nodes with available resources greater than or equal to the number of resources required by the pod, you can also randomly select one numa node from these multiple numa nodes with the fewest available resources to assign to the pod.

[0071] This application provides a resource allocation method that selects a first numa node from among all numa nodes whose distance to the numa node with the most available resources is less than a standard node distance value, and allocates the first numa node to a pod. This method may include:

[0072] If, among the numa nodes whose distance to the numa node with the most available resources is less than the standard distance value, there exists a numa node whose available resources are greater than or equal to the remaining required resources of the pod, then the numa node with the fewest available resources among the numa nodes whose available resources are greater than or equal to the remaining required resources of the pod is selected as the first numa node, and the first numa node is assigned to the pod.

[0073] If, among all the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, there is no numa node whose available resources are greater than or equal to the remaining required resources of the pod, then select the numa node with the most available resources from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value as the first numa node, assign the first numa node to the pod, and remove the first numa node from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value. Repeat the step of selecting the numa node with the most available resources from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value as the first numa node until the remaining required resources of the pod are 0.

[0074] In this application, the process of selecting the first numa node from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, and assigning the first numa node to the pod, can be as follows:

[0075] 1) If, among the numa nodes whose distance to the numa node with the most available resources (i.e., numa node a) is less than the node distance standard, there exists a numa node whose available resources are greater than or equal to the pod's remaining required resources (here, remaining required resources equals the pod's required resources minus the available resources of the numa nodes already allocated to the pod), then the numa node with the fewest available resources among these nodes (numa node a) whose distance to the numa node with the most available resources is less than the node distance standard and whose available resources are greater than or equal to the pod's remaining required resources is selected as the first numa node. This first numa node is then assigned to the pod, ensuring that the pod receives sufficient resources, thus making the pod's remaining required resources equal to 0. This process allows resource-intensive pods to be allocated resources from a smaller number of numa nodes that are closer together, reducing the number of numa nodes involved and shortening resource access and scheduling time, thereby improving the performance of resource-intensive pods.

[0076] 2) If, among the numa nodes whose distance to the numa node with the most available resources (i.e., numa node a) is less than the node distance standard value, there is no numa node whose available resources are greater than or equal to the remaining required resources of the pod, that is, if the available resources of all numa nodes whose distance to the numa node with the most available resources (i.e., numa node a) is less than the remaining required resources of the pod, then the numa node with the most available resources among those whose distance to the numa node with the most available resources is less than the node distance standard value can be selected as the first numa node. This first numa node is then assigned to the pod, and the first numa node is removed from the list of numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value. This process is repeated to allow for subsequent selection of the first numa node. After removing the first numa node, the process of selecting the numa node with the most available resources from those numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value can be repeated until the pod acquires sufficient resources, that is, until the remaining required resources of the pod equal to 0. By selecting the numa node with the most available resources from among all numa nodes whose distance to the numa node with the most available resources is less than the node standard value, and assigning it to the pod with high resource requirements, the number of numa nodes assigned to the pod is reduced, thereby reducing the number of numa nodes to be crossed, and thus improving the performance of the pod.

[0077] This application provides a resource allocation method that selects a second numa node from among all numa nodes whose distance to the numa node with the fewest available resources is greater than a node distance standard value, and allocates the second numa node to the pod. This method may include:

[0078] From all the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, select the numa node with the fewest available resources as the second numa node, assign the second numa node to the pod, and remove the second numa node from all the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value.

[0079] If the remaining required resources of the pod are not 0, repeat the step of selecting the numa node with the fewest available resources from all numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, until the remaining required resources of the pod are 0.

[0080] In this application, the process of selecting a second numa node from among the numa nodes whose distance to the numa node with the fewest available resources is greater than the node distance standard value, and allocating the second numa node to the pod, can be as follows:

[0081] 1) Select the numa node with the fewest available resources (i.e., numa node b) from all numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, and assign the second numa node to the pod. Then, delete the aforementioned second numa node from all numa nodes whose distance from the numa node with the fewest available resources (i.e., numa node b) is greater than the node distance standard value, so that when needed later, a second numa node can be selected from all numa nodes whose distance from the numa node with the fewest available resources (i.e., numa node b) is greater than the node distance standard value and assigned to the pod.

[0082] 2) After assigning the second numa node to the pod, it can be determined whether the remaining required resources of the pod are 0. If the remaining required resources of the pod are 0, the allocation is complete; if the remaining required resources of the pod are not 0, the step of selecting the numa node with the fewest available resources from all numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value is repeated until the pod obtains enough resources, that is, until the remaining required resources of the pod are 0.

[0083] By selecting the numa node with the fewest available resources from among all numa nodes whose distance to the numa node with the fewest available resources is greater than the node distance standard, and assigning it to a pod with low resource requirements, the pod with low resource requirements can achieve fragmented utilization of numa node resources, thereby making full use of numa node resources. At the same time, more numa nodes with available resources can be reserved for pods with high resource requirements, thus improving system performance.

[0084] This application provides a resource allocation method that obtains the resource requirement level of a pod and the standard distance value between the pod and its corresponding node, which may include:

[0085] Get the resource requirement level of the pod set by the user and the standard distance value of the node corresponding to the pod, and write the standard distance value of the node corresponding to the pod into the kubelet configuration file.

[0086] In this application, when creating a pod, users can set the resource requirement level of the pod on the interface. Specifically, they can add a `distancelevel` tag to the pod (this `distancelevel` tag represents the pod's resource requirement level, which is either high or low). Additionally, users can set the node distance standard value corresponding to the pod on the interface. Correspondingly, the designated node can obtain the user-set pod resource requirement level and the corresponding node distance standard value, and then allocate resources to the pod based on these settings, ensuring that resource allocation effectively meets user needs. Furthermore, the designated node can subsequently receive modified node distance standard values ​​from the user and allocate resources based on these modified values ​​during resource allocation to meet user requirements.

[0087] After obtaining the standard distance value of the node corresponding to the pod, the information receiver in the specified node can also write the standard distance value of the node corresponding to the pod to the kubelet configuration file, so that the resource allocator can subsequently obtain the standard distance value of the node from the kubelet configuration file and perform resource allocation based on it.

[0088] As can be seen from the above, the resource allocation method of this application is simple for users to operate. Users only need to set the resource requirement level of the pod and the standard distance value of the node corresponding to the pod on the interface.

[0089] This application provides a resource allocation method for obtaining the number of available resources for each numa node, which may include:

[0090] Call kubelet to obtain the number of available resources for each numa node.

[0091] In this application, a specific node can call kubelet to traverse and obtain the number of available resources of each numa node in the specified node, so as to improve the efficiency of obtaining the number of available resources of each numa node.

[0092] This application also provides a resource allocation device, see [link to relevant documentation] Figure 4 It shows a schematic diagram of the structure of a resource allocation device provided in an embodiment of this application, which may include:

[0093] The acquisition module 41 is used to obtain the number of resources required by the pod, the level of resource requirements of the pod, the distance of the node corresponding to the pod from the standard value, and the number of available resources of each numa node;

[0094] The first allocation module 42 is used to allocate the numa node with the most available resources to the pod when the level is high, if the number of available resources of each numa node is less than the number of resources required by the pod. Then, the first numa node is selected from the numa nodes whose distance from the numa node with the most available resources is less than the node distance standard value and the first numa node is allocated to the pod.

[0095] The second allocation module 43 is used to allocate the numa node with the fewest available resources to the pod when the level is low, and to select a second numa node from among the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, and allocate the second numa node to the pod.

[0096] The resource allocation device provided in this application embodiment may further include:

[0097] The third allocation module is used to select the numa node with the fewest available resources from the numa nodes whose available resources are greater than or equal to the pod's required resources, and then allocate the selected numa node with the fewest available resources to the pod.

[0098] The resource allocation device provided in this application embodiment may further include:

[0099] The calculation module is used to calculate the sum of the distances between each of the numa nodes with the fewest available resources and the remaining numa nodes if multiple numa nodes with the fewest available resources are selected from the numa nodes with the fewest available resources that are greater than or equal to the number of resources required by the pod.

[0100] The third allocation module may include:

[0101] The first allocation unit is used to allocate the pod to the pod from among the numa nodes with the fewest available resources and the numa node with the largest sum of distances to the remaining numa nodes.

[0102] This application provides a resource allocation device, wherein the first allocation module 42 may include:

[0103] The second allocation unit is used to select the numa node with the fewest available resources from among the numa nodes whose distance to the numa node with the most available resources is less than the standard value of node distance, and to allocate the first numa node to the pod if there is a numa node whose available resources are greater than or equal to the remaining required resources of the pod.

[0104] The third allocation unit is used to select the numa node with the most available resources from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, if there is no numa node whose available resources are greater than or equal to the remaining required resources of the pod. The first numa node is then selected from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, and the first numa node is allocated to the pod. The first numa node is then removed from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, and the step of selecting the numa node with the most available resources from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value is repeated until the remaining required resources of the pod are 0.

[0105] This application provides a resource allocation device, wherein the second allocation module 43 may include:

[0106] The fourth allocation unit is used to select the numa node with the fewest available resources from all numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, as the second numa node, allocate the second numa node to the pod, and remove the second numa node from all numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value.

[0107] The repetitive execution unit is used to repeatedly execute the step of selecting the numa node with the fewest available resources from all numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, if the remaining required resources of the pod are not 0, until the remaining required resources of the pod are 0.

[0108] This application provides a resource allocation device, wherein the acquisition module 41 may include:

[0109] The acquisition unit is used to obtain the resource requirement level of the pod set by the user and the standard distance value of the node corresponding to the pod, and write the standard distance value of the node corresponding to the pod into the kubelet configuration file.

[0110] This application provides a resource allocation device, wherein the acquisition module 41 may include:

[0111] The calling unit is used to call kubelet and use kubelet to obtain the number of available resources for each numa node.

[0112] This application also provides a resource allocation device, see [link to relevant documentation] Figure 5 It shows a schematic diagram of the structure of a resource allocation device provided in an embodiment of this application, which may include:

[0113] Memory 51 is used to store computer programs;

[0114] When processor 52 executes a computer program stored in memory 51, it can perform the following steps:

[0115] Obtain the required resources for the pod, the resource requirement level of the pod, the distance to the standard value of the node corresponding to the pod, and the available resources of each numa node. If the available resources of each numa node are less than the required resources for the pod, then when the level is high, the numa node with the most available resources is assigned to the pod, and the first numa node is selected from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance to the standard value, and the first numa node is assigned to the pod. When the level is low, the numa node with the fewest available resources is assigned to the pod, and the second numa node is selected from among the numa nodes whose distance to the numa node with the fewest available resources is greater than the node distance to the standard value, and the second numa node is assigned to the pod.

[0116] This application embodiment also provides a readable storage medium storing a computer program, which, when executed by a processor, can perform the following steps:

[0117] Obtain the required resources for the pod, the resource requirement level of the pod, the distance to the standard value of the node corresponding to the pod, and the available resources of each numa node. If the available resources of each numa node are less than the required resources for the pod, then when the level is high, the numa node with the most available resources is assigned to the pod, and the first numa node is selected from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance to the standard value, and the first numa node is assigned to the pod. When the level is low, the numa node with the fewest available resources is assigned to the pod, and the second numa node is selected from among the numa nodes whose distance to the numa node with the fewest available resources is greater than the node distance to the standard value, and the second numa node is assigned to the pod.

[0118] The readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0119] For a description of the relevant parts of the resource allocation device, equipment and readable storage medium provided in the embodiments of this application, please refer to the detailed description of the relevant parts of the resource allocation method provided in the embodiments of this application, and will not be repeated here.

[0120] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that the elements inherent in a process, method, article, or apparatus that includes a list of elements are included. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. Additionally, portions of the technical solutions provided in the embodiments of this application that are consistent with the implementation principles of corresponding technical solutions in the prior art have not been described in detail to avoid excessive elaboration.

[0121] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A resource allocation method, characterized in that, include: Obtain the required resources for a pod, the resource requirement level of the pod, the distance from the node corresponding to the pod to the standard value, and the available resources of each NUMA node; If the number of available resources of each of the numa nodes is less than the number of resources required by the pod, then when the level is high, the numa node with the most available resources is assigned to the pod, and a first numa node is selected from the numa nodes whose distance from the numa node with the most available resources is less than the node distance standard value, and the first numa node is assigned to the pod. If, among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, there is no numa node whose available resources are greater than or equal to the remaining required resources of the pod, then the numa node with the most available resources is selected from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value as the first numa node, and the first numa node is assigned to the pod. The first numa node is then removed from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, and the step of selecting the numa node with the most available resources from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value as the first numa node is repeated until the remaining required resources of the pod are 0. When the level is low, the numa node with the fewest available resources is assigned to the pod, and a second numa node is selected from the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, and the second numa node is assigned to the pod. Remove the second numa node from all numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value; If the remaining required resources of the pod are not 0, then repeat the step of selecting the numa node with the fewest available resources from all numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value as the second numa node, until the remaining required resources of the pod are 0. The process of obtaining the resource requirement level of the pod and the standard distance value of the node corresponding to the pod includes: Obtain the resource requirement level of the pod set by the user and the standard distance value of the node corresponding to the pod, and write the standard distance value of the node corresponding to the pod into the kubelet configuration file.

2. The resource allocation method according to claim 1, characterized in that, If there exists a numa node with available resources greater than or equal to the pod's required resources, then the following is also included: Select the numa node with the fewest available resources from among the numa nodes whose available resources are greater than or equal to the required resources of the pod, and assign the selected numa node with the fewest available resources to the pod.

3. The resource allocation method according to claim 2, characterized in that, If, from among the numa nodes whose available resources are greater than or equal to the required resources of the pod, the numa node with the fewest available resources is selected, then the selection also includes: Calculate the sum of distances between each of the numa nodes with the fewest available resources and the remaining numa nodes; Assign the NUMA node with the fewest available resources to the pod, including: Assign the pod to the numa node with the largest sum of distances to the remaining numa nodes from among the numa nodes with the fewest available resources.

4. The resource allocation method according to claim 1, characterized in that, If, among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, there exists a numa node whose available resources are greater than or equal to the remaining required resources of the pod, then the numa node with the fewest available resources among the numa nodes whose available resources are greater than or equal to the remaining required resources of the pod is selected as the first numa node, and the first numa node is assigned to the pod.

5. The resource allocation method according to claim 1, characterized in that, From all the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, select the numa node with the fewest available resources as the second numa node, and assign the second numa node to the pod.

6. The resource allocation method according to claim 1, characterized in that, Get the number of available resources for each numa node, including: Call kubelet to obtain the number of available resources for each of the numa nodes.

7. A resource allocation device, characterized in that, include: The acquisition module is used to acquire the number of resources required by a pod, the level of resource requirements of the pod, the distance from the node corresponding to the pod to the standard value, and the number of available resources of each NUMA node; The first allocation module is configured to, if the number of available resources of each of the numa nodes is less than the number of resources required by the pod, then when the level is high, allocate the numa node with the most available resources to the pod, and select a first numa node from among the numa nodes whose distance from the numa node with the most available resources is less than the node distance standard value, and allocate the first numa node to the pod. If, among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, there is no numa node whose available resources are greater than or equal to the remaining required resources of the pod, then the numa node with the most available resources is selected from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value as the first numa node, and the first numa node is assigned to the pod. The first numa node is then removed from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value, and the step of selecting the numa node with the most available resources from among the numa nodes whose distance to the numa node with the most available resources is less than the node distance standard value as the first numa node is repeated until the remaining required resources of the pod are 0. The second allocation module is used to allocate the numa node with the fewest available resources to the pod when the level is low, and to select a second numa node from the numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value, and allocate the second numa node to the pod. Remove the second numa node from all numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value; If the remaining required resources of the pod are not 0, then repeat the step of selecting the numa node with the fewest available resources from all numa nodes whose distance from the numa node with the fewest available resources is greater than the node distance standard value as the second numa node, until the remaining required resources of the pod are 0. The acquisition module includes: The acquisition unit is used to acquire the resource requirement level of the pod set by the user and the standard value of the node distance corresponding to the pod, and write the standard value of the node distance corresponding to the pod into the kubelet configuration file.

8. A resource allocation device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the resource allocation method as described in any one of claims 1 to 6 when executing the computer program.

9. A readable storage medium, characterized in that, The readable storage medium stores a computer program that, when executed by a processor, implements the steps of the resource allocation method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Resource secondary scheduling method and device based on kubernetes container arrangement system

    CN110515730A

  • Pod deployment method and device

    CN113760549A