CN115658302A - Resource allocation method, device, equipment and readable storage medium - Google Patents

Resource allocation method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN115658302A
CN115658302A CN202211295786.5A CN202211295786A CN115658302A CN 115658302 A CN115658302 A CN 115658302A CN 202211295786 A CN202211295786 A CN 202211295786A CN 115658302 A CN115658302 A CN 115658302A
Authority
CN
China
Prior art keywords
node
numa
pod
numa node
available resources
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202211295786.5A
Other languages
Chinese (zh)
Inventor
王子豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jinan Inspur Data Technology Co Ltd
Original Assignee
Jinan Inspur Data Technology Co Ltd
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 Jinan Inspur Data Technology Co Ltd filed Critical Jinan Inspur Data Technology Co Ltd
Priority to CN202211295786.5A priority Critical patent/CN115658302A/en
Publication of CN115658302A publication Critical patent/CN115658302A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a resource allocation method, a device, equipment and a readable storage medium, wherein the method comprises the following steps: acquiring the number of resources required by the pod, the level required by the resources, the corresponding node distance standard value and the number of available resources of each numa node; if the number of the available resources of the nodes is less than the number of the resources required by the pod, allocating the node with the largest number of the available resources to the pod when the level is a high level, and selecting a first node from the nodes with the distance from the node with the largest number of the available resources to be less than a standard value to allocate to the pod; and when the level is a low level, the node with the minimum number of available resources is allocated to the pod, and a second node is selected from the nodes with the distance from the node with the minimum number of available resources greater than the standard value of the node and allocated to the pod. According to the technical scheme, numa node allocation is carried out by adopting a suitable resource allocation strategy according to different resource requirements of the pod, so that the resource allocation reasonability is improved, and the optimal resource allocation is realized.

Description

Resource allocation method, device, equipment and readable storage medium
Technical Field
The present application relates to the field of resource allocation technologies, and in particular, to a resource allocation method, apparatus, device, and readable storage medium.
Background
numa (non-uniform memory access) partitions a computer into multiple nodes. On this basis, when the application deployment is carried out, resources of the divided numa nodes need to be allocated to the application. When resources of the numa nodes are allocated to the application, the farther the numa nodes are away, the slower the access speed is, and the closer the numa nodes are, the faster the access speed is.
At present, when numa node resource allocation is performed, the following two strategies are specifically available: the first is to allocate the resources of one numa node as far as possible and then select other numa nodes, and the second is to allocate the resources as far as possible so that the remaining resources of all numa nodes are the same. When the two strategies are used for resource allocation, the situation of the application on the resource requirement is not distinguished, that is, the same allocation strategy is used for allocation for all the applications, and reasonable resource allocation is not realized, so that the performance of the whole system is lower.
In summary, how to improve the rationality of numa resource allocation is a technical problem to be urgently solved by those skilled in the art.
Disclosure of Invention
In view of the above, an object of the present application is to provide a resource allocation method, apparatus, device and readable storage medium, which are used to improve the reasonability of numa resource allocation.
In order to achieve the above object, the present application provides the following technical solutions:
a method of resource allocation, comprising:
acquiring the number of resources required by a pod, the level of the pod required by the resources, a node distance standard value corresponding to the pod and the number of available resources of each numa node;
if the number of available resources of each numa node is smaller than the number of required resources of the pod, when the level is a high level, allocating the numa node with the largest number of available resources to the pod, selecting a first numa node from each numa node, the distance between the numa node with the largest number of available resources and the node distance criterion value of which is smaller than the node distance criterion value, and allocating the first numa node to the pod;
and when the level is a low level, allocating the numa node with the least number of available resources to the pod, selecting a second numa node from the numa nodes with the least number of available resources and the distance between the numa node and the numa node with the least number of available resources is greater than the node distance standard value, and allocating the second numa node to the pod.
Preferably, if there is a number of available resources of the numa node that is greater than or equal to the number of required resources of the pod, the method further includes:
and selecting the numa node with the minimum available resource number from the numa nodes with the available resource number larger than or equal to the required resource number of the pod, and allocating the selected numa node with the minimum available resource number to the pod.
Preferably, if a numa node with the smallest number of available resources is selected from the numa nodes whose number of available resources is greater than or equal to the number of required resources of the pod, the method further includes:
calculating the sum of the distance between each numa node with the least available resources and the rest numa nodes;
allocating the numa node with the least number of available resources to the pod, including:
and allocating a numa node with the largest sum of distances from the remaining numa nodes to the pod, wherein the numa node has the smallest number of available resources.
Preferably, selecting a first numa node from each numa node having the largest number of available resources and having a distance from the numa node smaller than the node distance criterion value, and allocating the first numa node to the pod, includes:
if a numa node with the available resource number greater than or equal to the remaining required resource number of the pod exists in each numa node with the distance from the numa node with the maximum available resource number smaller than the node distance standard value, selecting a numa node with the minimum available resource number from the numa nodes with the available resource number greater than or equal to the remaining required resource number of the pod as the first numa node, and allocating the first numa node to the pod;
if a numa node with the largest number of available resources does not exist in each numa node with the largest number of available resources and the distance to the node distance criterion value, the numa node with the largest number of available resources is selected as the first numa node from each numa node with the largest number of available resources and the distance to the node distance criterion value is smaller than the node distance criterion value, the first numa node is allocated to the pod, the first numa node with the largest number of available resources is removed from each numa node with the largest number of available resources and the distance to the node distance criterion value is smaller than the node distance criterion value, and the step of selecting the numa node with the largest number of available resources as the first numa node from each numa node with the largest number of available resources and the distance to the node distance criterion value is repeatedly executed until the number of remaining required resources of the pod is 0.
Preferably, selecting a second numa node from each numa node having the smallest number of available resources and having a distance from the numa node greater than the node distance criterion value, and allocating the second numa node to the pod, includes:
selecting a numa node with the least number of available resources as the second numa node from the numa nodes with the least number of available resources, the numa nodes having a greater distance from the numa node with the least number of available resources than the node distance criterion value, assigning the second numa node to the pod, and removing the second numa node from the numa nodes with the least number of available resources, the greater distance from the numa node with the least number of available resources than the node distance criterion value;
if the remaining required resource number of the pod is not 0, the step of selecting the numa node with the smallest available resource number as the second numa node from the numa nodes whose distance from the numa node with the smallest available resource number is greater than the node distance criterion value is repeatedly performed until the remaining required resource number of the pod is 0.
Preferably, the obtaining the level of the pod required for the resource and the node distance standard value corresponding to the pod includes:
and acquiring the level of the resource requirement of the pod set by the user and the node distance standard value corresponding to the pod, and writing the node distance standard value corresponding to the pod into a configuration file of the kubelet.
Preferably, the acquiring the number of available resources of each numa node includes:
and calling the kubelet, and acquiring the available resource number of each numa node by using the kubelet.
A resource allocation apparatus, comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring the number of resources required by a pod, the level of the pod required by the resources, a node distance standard value corresponding to the pod and the number of available resources of each numa node;
a first allocation module, configured to, if the number of available resources of each numa node is smaller than the number of required resources of the pod, allocate, when the rank is a high rank, a numa node with the largest number of available resources to the pod, select a first numa node from the numa nodes whose distances from the numa node with the largest number of available resources are smaller than a node distance criterion value, and allocate the first numa node to the pod;
and a second allocating module, configured to, when the level is a low level, allocate a numa node with the smallest number of available resources to the pod, select a second numa node from each numa node whose distance from the numa node with the smallest number of available resources is greater than the node distance criterion value, and allocate the second numa node to the pod.
A resource allocation apparatus, comprising:
a memory for storing a computer program;
a processor adapted to perform the steps of the resource allocation method of any of the above when said computer program is executed.
A readable storage medium, having stored therein a computer program which, when executed by a processor, carries out the steps of the resource allocation method according to any one of the preceding claims.
The application provides a resource allocation method, a device, equipment and a readable storage medium, wherein the method comprises the following steps: acquiring the number of resources required by the pod, the level of the pod required by the resources, a node distance standard value corresponding to the pod and the number of available resources of each numa node; if the number of available resources of each numa node is smaller than the number of required resources of the pod, when the level is high, the numa node with the largest number of available resources is allocated to the pod, a first numa node is selected from each numa node with the largest number of available resources and the distance between the numa node and the numa node with the largest number of available resources is smaller than a node distance standard value, and the first numa node is allocated to the pod; and when the level is a low level, allocating the numa node with the least number of available resources to the pod, selecting a second numa node from the numa nodes with the least number of available resources and the distance between the second numa node and the numa node with the least number of available resources is greater than the node distance standard value, and allocating the second numa node to the pod.
According to the technical scheme disclosed by the application, after the number of resources required by the pod, the level of the pod required by the pod, the node distance standard value corresponding to the pod and the number of available resources of each numa node are obtained, if the number of available resources of each numa node is found to be smaller than the number of the required resources of the pod, when the level of the pod required by the resource is high, the numa node with the largest number of available resources is allocated to the pod, a first numa node is selected from the numa nodes with the largest number of available resources and the numa nodes with the smaller distances from the numa nodes to the node distance standard value, and the first numa node is allocated to the pod, so that the pod with high resource requirement is allocated to the numa node with the largest number of available resources and the numa node with a close distance from the numa node as far as possible under the condition that the resource of a single numa node is insufficient, the access speed and the access efficiency of the pod with high resource requirement to the resource are improved, and the system performance is improved. When the grade of the pod for the resource requirement is low, the numa node with the least available resource number is allocated to the pod, the second numa node is selected from the numa nodes with the least available resource number and the numa nodes with the distance greater than the node standard value, and the second numa node is allocated to the pod, so that the pod with low resource requirement does not occupy the nma node with large available resource and the numa node with close distance as far as possible under the condition that the single numa node resource is insufficient, the numa node with large available resource and the numa node with close distance can be reserved for the pod with high resource requirement, the access speed and the access efficiency of the pod with high resource requirement for the resource can be improved, and the resource allocation mode can realize the fragmented utilization of the numa node resource with far distance, and further realize the full utilization of the numa node resource. According to the method, the numa nodes are allocated by adopting the adaptive resource allocation strategy according to different resource requirements of the pod, so that the reasonability of resource allocation is improved, the optimal resource allocation is realized, the system performance is improved, the resource allocation mode is simple in calculation, and the resources can be fully utilized.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a resource allocation method according to an embodiment of the present application;
fig. 2 is an architecture diagram of a resource allocation method according to an embodiment of the present application;
fig. 3 is a flowchart of another resource allocation method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a resource allocation apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a resource allocation device according to an embodiment of the present application.
Detailed Description
In the prior art, resources of a numa node are allocated with two strategies, wherein the first strategy is to allocate the resources of one numa node as far as possible and then select other numa nodes; the second is to allocate as much as possible so that all numa nodes have the same remaining resources. The two strategies do not distinguish the applications, that is, numa node resource allocation is the same for all applications, so that the system adopts the same resource allocation strategy for applications with different resource requirements under the condition that the resources are insufficient and the allocation needs to span numa, and the resources are not optimally allocated.
Therefore, the application provides a resource allocation method, a device, equipment and a readable storage medium, which are used for improving the reasonability of numa node resource allocation and realizing the optimal allocation of numa node resources.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1 and fig. 2, in which fig. 1 shows a flowchart of a resource allocation method provided in an embodiment of the present application, and fig. 2 shows an architecture diagram of the resource allocation method provided in the embodiment of the present application. The resource allocation method provided by the embodiment of the application may include:
s11: and acquiring the number of resources required by the pod, the level of the pod required by the resources, the node distance standard value corresponding to the pod and the available resource number of each numa node.
After the user has created the pod, kubelet (a proxy component on the k8s worker node, running on each node) can schedule the pod on the designated node. The designated Node mentioned here is specifically a designated Node in the nodes supporting the numa architecture, and the designated Node includes a plurality of numa nodes, and taking fig. 2 as an example, node1, node2, and Node n are all nodes supporting the numa architecture. In k8s (kubernets, an open source for managing containerized applications on multiple hosts in a cloud platform), a pod is the basis for all traffic types, and is also the minimum unit level of k8s management, which is a combination of one or more containers on which the host application and processes closely related to the application run.
Then, the designated node may obtain the required resource number of the pod, the level of the pod required for the resource, and the distance standard value distance of the node corresponding to the pod, where the level of the pod required for the resource may include two levels, i.e., a high level and a low level, the high level means that the performance requirement is high, i.e., the requirement for resource access and scheduling is high, and the low level means that the performance requirement is low, i.e., the requirement for resource access and scheduling is relatively low. In addition, the designated node can also traverse the available resource number of each numa node contained in the designated node, so that the numa node resources can be reasonably distributed according to the acquired information. The resource indicated by the required resource number of the pod and the resource indicated by the available resource number of each numa node are the same resource, and are, for example, cpu (central processing unit) or memory.
Specifically, the designated node may include an information receiver and a resource allocator therein. And the information receiver acquires the level required by the pod for the resource and the node distance standard value corresponding to the pod, and sends the acquired information to the resource distributor. The resource allocator may obtain, in addition to the level of the resource requirement of the pod sent by the information receiver and the node distance standard value corresponding to the pod, the number of resources required by the pod and the number of available resources of each numa node, so as to allocate the numa nodes according to the information. That is, the information receiver in the designated node is mainly responsible for acquiring the information of the pod needing to allocate the resource, and the resource allocator is mainly responsible for allocating the numa node resource.
S12: if the number of available resources of each numa node is smaller than the number of required resources of the pod, when the level is a high level, the numa node with the largest number of available resources is allocated to the pod, a first numa node is selected from each numa node with the largest number of available resources and the distance between the numa node and the numa node with the largest number of available resources is smaller than the node distance standard value, and the first numa node is allocated to the pod.
On the basis of step S11, the designated node may compare the required resource number of the pod with the available resource number of each numa node, and if it is determined that the available resource number of each numa node is less than the required resource number of the pod, that is, if the available resource of a single numa node cannot meet the resource requirement of the pod, when the level of the resource requirement of the pod is a high level, in order to reduce the number of numa nodes across, so as to improve the access speed and the scheduling speed of the resource by the pod having a high performance requirement, reduce the relative delay between the nodes, and improve the access and scheduling efficiency, the numa node having the largest number of available resources (i.e., the numa node having the largest number of available resources) may be determined according to the available resource number of each numa node obtained in step S11 (i.e., the numa node having the largest number of available resources is denoted as numa node a), and the numa node having the largest number of available resources (i.e., the numa node a) may be allocated to the pod, that has the largest number of available resources. The number of numa nodes is reduced by allocating the numa node with the largest number of available resources to the pod with high resource requirement, so that the efficiency of the pod with high resource requirement in resource access is improved, and the performance of the pod is improved.
Since the available resource number of the numa node with the largest available resource number cannot satisfy the required resource number of the pod, after the numa node with the largest available resource number (i.e., numa node a) is allocated to the pod, the distances between the remaining numa nodes and the numa node a may be obtained, and each numa node whose distance from the numa node a is smaller than the node distance criterion value may be determined therefrom, where the distances between the other numa nodes and the numa node a that are smaller than the node distance criterion value indicate that the numa nodes and the numa node a are closer to each other. The distance between numa nodes represents the relative memory delay between numa nodes, e.g., distance 10 represents a delay of 1 times the local node access and distance 20 represents a delay of 2 times the local node access. When the pod is allocated to the node across numa, the farther numa nodes are away, the slower the memory access is, the slower the speed is, and the closer numa nodes are, the faster the memory access is, the faster the speed is.
After each numa node with the distance from the numa node a smaller than the node distance standard value is determined from the remaining numa nodes, a first numa node is selected from the numa nodes with the distance from the numa node a smaller than the node distance standard value, and the first numa node is allocated to the pod, that is, the available resource of the first numa node is allocated to the pod, so that the sum of the available resources of the numa node a and the first numa node satisfies the required resource of the pod, that is, the sum of the available resources of the numa node a and the first numa node is not smaller than the required resource of the pod. Through the process, the numa nodes are selected from the numa nodes which are relatively close to the numa node with the largest number of available resources and are allocated to the pod with high requirement on the resources, so that the pod with high requirement on the resources is allocated to the numa nodes with relatively close distance, the delay of the pod for accessing and scheduling the resources is shortened, the efficiency of accessing and scheduling the resources is improved, and the performance of the pod with high requirement on the resources is greatly improved.
Through the process, the pod with high performance requirement is allocated to the numa node with the largest number of available resources and the resources of the numa nodes close to the numa node as far as possible under the condition that the single numa node has insufficient resources, so that the requirement on the pod with high performance requirement is met, and the performance is improved.
S13: if the number of available resources of each numa node is smaller than the required number of resources of the pod, when the level is low, the numa node with the minimum number of available resources is allocated to the pod, a second numa node is selected from the numa nodes with the minimum number of available resources and the distance between the numa node and the node with the minimum number of available resources is larger than the node distance standard value, and the second numa node is allocated to the pod.
Under the condition that the number of available resources of each numa node is less than the number of resources required by the pod, when the level of the resource requirement of the pod is low, in order to reduce the occupation of the numa resource by the pod with low resource requirement so that the numa node with a large number of available resources can be left as much as possible for the pod with high resource requirement, the numa node with the minimum number of available resources (the numa node with the minimum number of available resources is denoted as numa node b) may be determined according to the number of available resources of each numa node obtained in step S11, and the numa node with the minimum number of available resources (i.e., the numa node b) may be allocated to the pod, that is, the available resource of the numa node with the minimum number of available resources is allocated to the pod. The numa nodes with the least number of available resources are allocated to the pod with the low resource requirement, so that the numa nodes with the low resource requirement and the large number of available resources are occupied, the numa nodes with the large number of available resources can be reserved for the numa nodes with the high resource requirement, the system performance is improved conveniently, and the realization of user functions is met.
Since the number of available resources of the numa node with the smallest number of available resources cannot satisfy the number of required resources of the pod, after the numa node with the smallest number of available resources (i.e., numa node b) is allocated to the pod, distances between the remaining numa nodes and the numa node b may be obtained, and each numa node whose distance from the numa node b is greater than the node distance criterion value may be determined therefrom, where the fact that the distances between other numa nodes and the numa node b are greater than the node distance criterion value indicates that the numa nodes and the numa node b are farther away. After each numa node having a distance from the numa node b greater than the node distance standard value is determined, a second numa node may be selected from the numa nodes having a distance from the numa node b greater than the node distance standard value, and the second numa node may be allocated to the pod, that is, the available resource of the second numa node may be allocated to the pod, so that the sum of the available resources of the numa node b and the second numa node satisfies the required resource of the pod, that is, the sum of the available resources of the numa node b and the second numa node is not less than the required resource of the pod. Through the process, the numa nodes are selected from the numa nodes which are far away from the numa node with the least available resource number and are allocated to the pod with low resource requirement, so that the resource requirement of the pod with low resource requirement is met, and meanwhile, the numa nodes which are far away can be reserved for the pod with high resource requirement.
Through the process, the pod with low performance requirement occupies the numa node with less available resource and the numa node which is far away from the numa node with less available resource as far as possible under the condition that the resource of the single numa node is insufficient, so that the numa node with more available resource and the numa node which is closer to the numa node can reserve more pods with high performance requirement, the user function is realized, and the performance of the whole system is greatly improved. And through the process, the pod with low resource requirement can realize the fragmentation utilization of the numa node resources so as to realize the full utilization of the numa node resources.
According to the technical scheme disclosed by the application, after the number of resources required by the pod, the level of the pod required by the resource, the node distance standard value corresponding to the pod and the number of available resources of each numa node are acquired, if the number of available resources of each numa node is found to be smaller than the number of required resources of the pod, when the level of the pod required by the resource is high, the numa node with the largest number of available resources is allocated to the pod, the first numa node is selected from the numa nodes with the largest number of available resources and the numa nodes with the smaller distances from the numa node to the node distance standard value, and the first numa node is allocated to the pod, so that the pod with high resource requirement is allocated to the numa node with the largest number of available resources and the numa node close to the numa node as far as possible under the condition that the resource of the single numa node is insufficient, the access speed and the access efficiency of the pod with high resource requirement to the resource are improved, and the system performance is improved. When the grade of the pod for the resource requirement is low, the numa node with the least available resource number is allocated to the pod, a second numa node is selected from the numa nodes with the least available resource number and the numa nodes with the distance larger than a node standard value, and the second numa node is allocated to the pod, so that the pod with low resource requirement does not occupy the nma node with large available resource and the numa node with close distance as far as possible under the condition that the single numa node resource is insufficient, the numa node with large available resource and the numa node with close distance can be reserved for the pod with high resource requirement, the access speed and the access efficiency of the pod with high resource requirement for the resource can be improved, the resource allocation mode can realize the fragmented utilization of the numa node resource with far distance, and the full utilization of the numa node resource can be realized. According to the method, the numa nodes are allocated by adopting the adaptive resource allocation strategy according to different resource requirements of the pod, so that the reasonability of resource allocation is improved, the optimal resource allocation is realized, the system performance is improved, the resource allocation mode is simple in calculation, and the resources can be fully utilized.
Referring to fig. 3, a flowchart of another resource allocation method provided in an embodiment of the present application is shown. In the resource allocation method provided in the embodiment of the present application, if there is a number of resources available for a numa node that is greater than or equal to a number of resources required for a pod, the method may further include:
and selecting the numa node with the minimum available resource number from the numa nodes with the available resource number larger than or equal to the required resource number of the pod, and allocating the selected numa node with the minimum available resource number to the pod.
On the basis of step S11, if the numa nodes have the number of available resources greater than or equal to the number of required resources of the pod, a numa node with the minimum number of available resources (the numa node is referred to as a numa node c) may be selected from the numa nodes having the number of available resources greater than or equal to the number of required resources of the pod), and the numa node with the minimum number of available resources (i.e., the numa node c) may be allocated to the pod, so that when a single numa node has sufficient resources, the resources allocated to the pod are all on one numa node, so that the pod performance is greatly improved, and in the above case, the numa node with the minimum number of available resources is selected to be allocated to the pod to reduce the occupation of the numa node with the large number of available resources, so that the numa node with the large number of available resources may be occupied by a pod with a large number of resources requiring high resources and a large number of required resources.
Of course, when there are a plurality of numa nodes whose number of available resources is greater than or equal to the number of required resources of the pod, one numa node may be optionally allocated to the pod from among numa nodes whose number of available resources is greater than or equal to the number of required resources of the pod.
In the resource allocation method provided in the embodiment of the present application, if a numa node with the smallest number of available resources is selected from numa nodes whose number of available resources is greater than or equal to the number of required resources of pod, the method may further include:
calculating the sum of the distances between each numa node with the least available resources and the rest numa nodes;
the step of allocating the numa node with the least number of available resources to the pod may include:
and allocating the numa node with the largest sum of the distances from the numa nodes to the rest to the pod, wherein the numa node with the smallest number of available resources.
In this application, when a numa node (i.e., numa node c) with the smallest number of available resources is selected from numa nodes with the number of available resources being greater than or equal to the number of required resources of pod, if there are a plurality of numa nodes with the smallest number of available resources (i.e., there are a plurality of numa nodes c, which may be referred to as numa nodes c1, numa nodes c2, numa nodes c3 \ 8230; \8230;) whose available resources are not only the same but also the least of the numa nodes with the number of available resources being greater than or equal to the number of required resources of pod for distinction, the sum of distances between each numa node c and the remaining numa nodes (the remaining numa nodes mentioned here are, specifically, numa node other than the current numa node among the numa nodes included in the designated node) may be calculated, that is, the sum of the distances between numa node c1 and the remaining numa nodes is calculated, the sum of the distances between numa node c2 and the remaining numa nodes is calculated, the sum of the distances between numa node c3 and the remaining numa nodes is calculated, 8230is calculated, and then, a numa node having the largest sum of the distances between numa node c1 and the numa node c2 and between numa node c3 and the numa node c 8230, 8230is selected from the numa nodes having the smallest number of available resources and is allocated to the pod, that is, a numa node having the largest sum of the distances between numa node c1 and the remaining numa node is allocated to the pod, that is, a numa node having a larger distance from other numa node is allocated to the pod, so that a numa node having a smaller distance from the numa node having the smallest number of available resources is reserved and is convenient for using the pod having a higher requirement on resources.
Of course, when a number of numa nodes with the smallest number of available resources are selected from numa nodes with the number of available resources greater than or equal to the number of required resources of the pod, one numa node among the numa nodes with the smallest number of available resources may be optionally allocated to the pod.
In the resource allocation method provided in the embodiment of the present application, selecting a first numa node from among numa nodes whose distances from a numa node with the largest number of available resources are smaller than a node distance standard value, and allocating the first numa node to a pod may include:
if the numa nodes with the available resource number larger than or equal to the remaining required resource number of the pod exist in the numa nodes with the distance from the numa node with the maximum available resource number to the node distance standard value, selecting the numa node with the minimum available resource number from the numa nodes with the available resource number larger than or equal to the remaining required resource number of the pod as a first numa node, and allocating the first numa node to the pod;
if the numa nodes with the largest number of available resources are not located in the numa nodes with the largest distance from the numa node with the largest number of available resources being smaller than the node distance standard value, the numa node with the largest number of available resources is selected as a first numa node from the numa nodes with the largest number of available resources being smaller than the node distance standard value, the first numa node is allocated to the pod, the first numa node with the largest number of available resources is removed from the numa nodes with the largest number of available resources being smaller than the node distance standard value, and the step of selecting the numa node with the largest number of available resources as the first numa node from the numa nodes with the largest number of available resources being smaller than the node distance standard value is repeatedly executed until the remaining number of required resources of the pod is 0.
In this application, a first numa node is selected from among numa nodes whose distances from the numa node with the largest number of available resources are smaller than a node distance standard value, and a specific process of assigning the first numa node to a pod may be:
1) If numa nodes with the number of available resources greater than or equal to the number of remaining required resources of pod (the number of remaining required resources referred to herein is equal to the number of required resources of pod minus the number of available resources of numa nodes to which pod has been allocated) exist among numa nodes whose distance from the numa node with the largest number of available resources (numa node a) is smaller than the node distance standard value, the numa node with the smallest number of available resources is preferentially selected as the first numa node from the numa nodes whose distance from the numa node with the largest number of available resources (numa) is smaller than the node distance standard value and whose number of available resources is greater than or equal to the number of remaining required resources of pod, and the first numa node is allocated to the pod so that the pod obtains sufficient resources, that is, the number of remaining required resources of the pod is equal to 0. Through the process, the pod with high resource requirement can be allocated to the resources of the numa nodes with shorter distance and smaller quantity, so that the number of the numa nodes is reduced, and the distance of the numa nodes is shorter, thereby shortening the resource access and scheduling time and improving the performance of the pod with high resource requirement.
2) If there is no numa node having the available resource number greater than or equal to the remaining required resource number of the pod among numa nodes having the largest available resource number (i.e., numa node a) less than the node distance criterion value, that is, if the available resource numbers of numa nodes having the largest available resource number (i.e., numa node a) less than the node criterion value are all less than the remaining required resource number of the pod, the numa node having the largest available resource number may be selected as the first numa node from among the numa nodes having the largest available resource number less than the node criterion value, and the first numa node may be allocated to the pod, and the first numa node may be deleted from the numa nodes having the largest available resource number less than the node criterion value, so as to subsequently continue the selection of the first numa node. After the first numa node is deleted, the step of selecting the numa node with the largest number of available resources from the numa nodes with the largest number of available resources and the distance between the numa nodes and the numa nodes with the largest number of available resources and the number of the numa nodes is smaller than the node standard value can be repeatedly executed until the pod acquires enough resources, namely, until the remaining required resource number of the pod is equal to 0. The numa nodes with the largest number of available resources are selected from the numa nodes with the largest number of available resources and are distributed to the pod with high resource requirement every time, so that the number of numa nodes distributed by the pod is reduced, the number of nodes crossing numa nodes is reduced, and the performance of the pod is improved.
In the resource allocation method provided in the embodiment of the present application, selecting a second numa node from numa nodes whose distance from a numa node with the smallest number of available resources is greater than a node distance standard value, and allocating the second numa node to a pod may include:
selecting the numa node with the least available resource number as a second numa node from the numa nodes with the least available resource number and the numa nodes with the greater distance standard values of the nodes, distributing the second numa node to the pod, and removing the second numa node from the numa nodes with the least available resource number and the greater distance standard values of the nodes;
if the remaining required resource number of the pod is not 0, the step of selecting the numa node with the least available resource number as the second numa node from the numa nodes with the least available resource number and the distance between the numa nodes and the numa node with the least available resource number is larger than the node distance standard value is repeatedly executed until the remaining required resource number of the pod is 0.
In this application, the specific process of allocating the second numa node to the pod may be:
1) And then, deleting the second numa node from the numa nodes of which the distance from the numa node (the numa node b) with the least available resource number is greater than the node distance standard value, so that the second numa node can be continuously selected from the numa nodes of which the distance from the numa node (the numa node b) with the least available resource number is greater than the node distance standard value and can be allocated to the pod when needed subsequently.
2) After the second numa node is allocated to the pod, whether the remaining required resource number of the pod is 0 or not may be determined, and if the remaining required resource number of the pod is 0, the allocation is completed; if the remaining required resource number of the pod is not 0, the step of selecting the numa node with the least available resource number as the second numa node from the numa nodes with the least available resource number and the distance between the numa nodes and the numa node with the least available resource number is larger than the node distance standard value is repeatedly executed until the pod acquires enough resources, namely, until the remaining required resource number of the pod is 0.
The numa node with the least number of available resources is selected from the numa nodes with the least number of available resources and distributed to the pod with low resource requirement every time, so that the pod with low resource requirement can realize fragmented utilization of numa node resources, the numa node resources are fully utilized, more numa nodes with the available resources can be reserved, the pod with the high resource requirement can be conveniently used, and system performance is further improved.
The resource allocation method provided in the embodiment of the present application, acquiring the level of the pod required for the resource and the node distance standard value corresponding to the pod, may include:
and acquiring the level of the pod required by the resource and the node distance standard value corresponding to the pod, which are set by the user, and writing the node distance standard value corresponding to the pod into a configuration file of the kubel.
In the application, when creating the pod, the user may set the level of the resource requirement of the pod on the interface, and specifically, may print a distancevelel tag on the pod (the distancevelel tag is the level of the resource requirement of the pod, and is specifically classified into a high level and a low level). In addition, the user can set a node distance standard value corresponding to the pod on the interface when creating the pod. Correspondingly, the appointed node can acquire the level of the pod required by the resource and the node distance standard value corresponding to the pod, which are set by the user, so that the pod is subjected to resource subsequently according to the level of the pod required by the resource and the node distance standard value corresponding to the pod, and the resource allocation can well meet the user requirement. In addition, the designated node can subsequently receive the node distance standard value modified by the user, and resource allocation can be performed according to the modified node distance standard value during resource allocation, so as to meet the user requirement.
After the information receiver in the designated node acquires the node distance standard value corresponding to the pod, the node distance standard value corresponding to the pod can be written into a configuration file of the kubel, so that the resource allocator can acquire the node distance standard value from the configuration file of the kubel and allocate resources based on the node distance standard value.
According to the resource allocation method, the operation is simple for the user, and the user only needs to set the level of the pod required by the resource and the node distance standard value corresponding to the pod on the interface.
The resource allocation method provided in the embodiment of the present application obtains the number of available resources of each numa node, and may include:
and calling the kubelet, and acquiring the available resource number of each numa node by using the kubelet.
In the application, the designated node can specifically call kubel, and the number of available resources of each numa node in the designated node is obtained by using traversal of the kubel, so that the obtaining efficiency of the number of available resources of each numa node is improved.
An embodiment of the present application further provides a resource allocation apparatus, see fig. 4, which shows a schematic structural diagram of the resource allocation apparatus provided in the embodiment of the present application, and the resource allocation apparatus may include:
an obtaining module 41, configured to obtain a required resource number of the pod, a level of the pod required for the resource, a node distance standard value corresponding to the pod, and an available resource number of each numa node;
a first allocation module 42, configured to, if the number of available resources of each numa node is smaller than the number of required resources of the pod, allocate, when the rank is a high rank, the numa node with the largest number of available resources to the pod, select a first numa node from the numa nodes whose distances from the numa node with the largest number of available resources are smaller than a node distance criterion value, and allocate the first numa node to the pod;
and a second allocating module 43, configured to, when the level is the low level, allocate the numa node with the smallest number of available resources to the pod, select a second numa node from the numa nodes whose distances to the numa node with the smallest number of available resources are greater than a node distance criterion value, and allocate the second numa node to the pod.
The resource allocation apparatus provided in the embodiment of the present application may further include:
and the third allocation module is used for selecting the numa node with the minimum available resource number from the numa nodes with the available resource number larger than or equal to the required resource number of the pod if the numa nodes with the available resource number larger than or equal to the required resource number of the pod exist, and allocating the numa node with the minimum selected available resource number to the pod.
The resource allocation apparatus provided in the embodiment of the present application may further include:
the calculation module is used for calculating the sum of the distances between each numa node with the minimum available resource number and the rest numa nodes if a plurality of numa nodes with the minimum available resource number are selected from the numa nodes with the available resource number larger than or equal to the required resource number of the pod;
the third dispensing module may include:
and the first allocation unit is used for allocating the numa node with the largest sum of the distances from the numa nodes to the rest numa nodes in the numa nodes with the least available resources to the pod.
In an embodiment of the resource allocation apparatus, the first allocation module 42 may include:
a second allocating unit, configured to, if a numa node with the number of available resources greater than or equal to the remaining required number of resources of the pod exists in numa nodes whose distance from the numa node with the maximum number of available resources is smaller than the node distance criterion value, select, as the first numa node, a numa node with the minimum number of available resources from numa nodes with the number of available resources greater than or equal to the remaining required number of resources of the pod, and allocate the first numa node to the pod;
and a third allocating unit, configured to, if there is no numa node having the largest number of available resources and the number of remaining required resources equal to or greater than the pod distance criterion value among the numa nodes having the largest number of available resources and the distance from the numa node having the largest number of available resources is less than the node distance criterion value, select the numa node having the largest number of available resources as the first numa node from among the numa nodes having the largest number of available resources and the distance from the numa node having the largest number of available resources is less than the node distance criterion value, allocate the first numa node to the pod, remove the first numa node from among the numa nodes having the largest number of available resources and the distance from the numa node having the largest number of available resources is less than the node distance criterion value, and repeatedly perform the step of selecting the numa node having the largest number of available resources as the first numa node from among the numa nodes having the largest number of available resources and the distance from the numa node having the largest number of available resources is less than the node distance criterion value until the number of remaining required resources of 0.
In an embodiment of the resource allocation apparatus, the second allocating module 43 may include:
the fourth distribution unit is used for selecting the numa node with the minimum available resource number as a second numa node from the numa nodes with the minimum available resource number and the numa nodes with the larger distance standard values of the nodes, distributing the second numa node to the pod, and removing the second numa node from the numa nodes with the minimum available resource number and the larger distance standard values of the nodes;
and a repeat execution unit, configured to repeat, if the remaining required resource number of the pod is not 0, the step of selecting the numa node with the smallest available resource number as the second numa node from the numa nodes with the smallest available resource number and with a distance from the numa node greater than the node distance criterion value until the remaining required resource number of the pod is 0.
In an embodiment of the resource allocation apparatus, the obtaining module 41 may include:
and the obtaining unit is used for obtaining the level of the pod required by the resource and the node distance standard value corresponding to the pod, and writing the node distance standard value corresponding to the pod into a configuration file of the kubelet.
In an apparatus for allocating resources provided in an embodiment of the present application, the obtaining module 41 may include:
and the calling unit is used for calling the kubel and acquiring the available resource number of each numa node by using the kubel.
An embodiment of the present application further provides a resource allocation device, see fig. 5, which shows a schematic structural diagram of a resource allocation device provided in an embodiment of the present application, and the resource allocation device may include:
a memory 51 for storing a computer program;
the processor 52, when executing the computer program stored in the memory 51, may implement the following steps:
acquiring the number of resources required by the pod, the level of the pod required by the resources, a node distance standard value corresponding to the pod and the number of available resources of each numa node; if the number of available resources of each numa node is smaller than the number of required resources of the pod, when the level is high, the numa node with the largest number of available resources is allocated to the pod, a first numa node is selected from each numa node with the largest number of available resources and the distance between the numa node and the numa node with the largest number of available resources is smaller than a node distance standard value, and the first numa node is allocated to the pod; and when the level is low, allocating the numa node with the least number of available resources to the pod, selecting a second numa node from the numa nodes with the least number of available resources and the distance between the second numa node and the numa node with the least number of available resources is greater than a node distance standard value, and allocating the second numa node to the pod.
An embodiment of the present application further provides a readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the following steps may be implemented:
acquiring the number of resources required by the pod, the level of the pod required by the resources, a node distance standard value corresponding to the pod and the number of available resources of each numa node; if the number of available resources of each numa node is smaller than the number of required resources of the pod, when the level is high, the numa node with the largest number of available resources is allocated to the pod, a first numa node is selected from each numa node, the distance between the numa node with the largest number of available resources and the numa node with the largest number of available resources is smaller than a node distance standard value, and the first numa node is allocated to the pod; and when the level is low, allocating the numa node with the least number of available resources to the pod, selecting a second numa node from the numa nodes with the least number of available resources and the distance between the second numa node and the numa node with the least number of available resources is greater than a node distance standard value, and allocating the second numa node to the pod.
The readable storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
For a description of a relevant part in a resource allocation apparatus, a device, and a readable storage medium provided in the embodiments of the present application, reference may be made to detailed descriptions of the relevant part in a resource allocation method provided in the embodiments of the present application, and details are not described herein again.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include elements inherent in the list. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element. In addition, parts of the above technical solutions provided in the embodiments of the present application, which are consistent with the implementation principles of corresponding technical solutions in the prior art, are not described in detail so as to avoid redundant description.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended 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 (10)

1. A method for resource allocation, comprising:
acquiring the number of resources required by a pod, the level of the pod required by the resources, a node distance standard value corresponding to the pod and the number of available resources of each numa node;
if the number of available resources of each numa node is smaller than the number of required resources of the pod, when the level is a high level, allocating a numa node with the largest number of available resources to the pod, selecting a first numa node from each numa node with the largest number of available resources and a distance from the numa node with the largest number of available resources to be smaller than a node distance standard value, and allocating the first numa node to the pod;
and when the level is a low level, allocating the numa node with the least number of available resources to the pod, selecting a second numa node from each numa node which has a distance from the numa node with the least number of available resources greater than a node distance standard value, and allocating the second numa node to the pod.
2. The method of claim 1, wherein if there is a number of resources available for the numa node that is greater than or equal to the number of resources required for the pod, the method further comprises:
and selecting the numa node with the minimum available resource number from the numa nodes with the available resource number larger than or equal to the required resource number of the pod, and allocating the numa node with the minimum selected available resource number to the pod.
3. The method according to claim 2, wherein if a numa node with the smallest number of available resources is selected from the numa nodes with the number of available resources greater than or equal to the number of required resources for the pod, the method further comprises:
calculating the sum of the distance between each numa node with the least available resources and the rest numa nodes;
allocating the numa node with the least number of available resources to the pod, including:
and allocating a numa node with the largest sum of distances from the remaining numa nodes to the pod, wherein the numa node has the smallest number of available resources.
4. The method according to claim 1, wherein selecting a first numa node from each numa node having a distance from a numa node having the largest number of available resources that is smaller than the node distance criterion value, and allocating the first numa node to the pod comprises:
if a numa node with the available resource number greater than or equal to the remaining required resource number of the pod exists in each numa node with the distance from the numa node with the maximum available resource number smaller than the node distance standard value, selecting a numa node with the minimum available resource number from the numa nodes with the available resource number greater than or equal to the remaining required resource number of the pod as the first numa node, and allocating the first numa node to the pod;
if a numa node with the largest number of available resources does not exist in each numa node with the largest number of available resources and the distance to the node distance criterion value, the numa node with the largest number of available resources is selected as the first numa node from each numa node with the largest number of available resources and the distance to the node distance criterion value is smaller than the node distance criterion value, the first numa node is allocated to the pod, the first numa node with the largest number of available resources is removed from each numa node with the largest number of available resources and the distance to the node distance criterion value is smaller than the node distance criterion value, and the step of selecting the numa node with the largest number of available resources as the first numa node from each numa node with the largest number of available resources and the distance to the node distance criterion value is repeatedly executed until the number of remaining required resources of the pod is 0.
5. The method according to claim 1, wherein selecting a second numa node from each numa node having a distance from the numa node having the least number of available resources greater than the node distance criterion value, and assigning the second numa node to the pod comprises:
selecting a numa node with the least number of available resources as the second numa node from the numa nodes with the least number of available resources, the numa nodes having a greater distance from the numa node with the least number of available resources than the node distance criterion value, assigning the second numa node to the pod, and removing the second numa node from the numa nodes with the least number of available resources, the greater distance from the numa node with the least number of available resources than the node distance criterion value;
if the remaining required resource number of the pod is not 0, the step of selecting the numa node with the smallest available resource number as the second numa node from the numa nodes whose distance from the numa node with the smallest available resource number is greater than the node distance criterion value is repeatedly performed until the remaining required resource number of the pod is 0.
6. The method according to claim 1, wherein obtaining the level of the pod required for the resource and the node distance standard value corresponding to the pod comprises:
and acquiring the level of the resource requirement of the pod set by the user and the node distance standard value corresponding to the pod, and writing the node distance standard value corresponding to the pod into a configuration file of the kubel.
7. The method of claim 1, wherein obtaining the number of available resources for each numa node comprises:
and calling the kubelet, and acquiring the available resource number of each numa node by using the kubelet.
8. A resource allocation apparatus, comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring the number of resources required by a pod, the level of the pod required by the resources, a node distance standard value corresponding to the pod and the number of available resources of each numa node;
a first allocation module, configured to, if the number of available resources of each numa node is less than the number of resources required by the pod, allocate, when the rank is a high rank, a numa node with the largest number of available resources to the pod, select a first numa node from each numa node with the largest number of available resources whose distance from the numa node is less than the node distance criterion value, and allocate the first numa node to the pod;
and a second allocating module, configured to, when the level is a low level, allocate a numa node with the smallest number of available resources to the pod, select a second numa node from each numa node whose distance from the numa node with the smallest number of available resources is greater than the node distance criterion value, and allocate the second numa node to the pod.
9. A resource allocation apparatus, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the resource allocation method according to any one of claims 1 to 7 when executing said computer program.
10. A readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the resource allocation method according to any one of claims 1 to 7.
CN202211295786.5A 2022-10-21 2022-10-21 Resource allocation method, device, equipment and readable storage medium Pending CN115658302A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211295786.5A CN115658302A (en) 2022-10-21 2022-10-21 Resource allocation method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211295786.5A CN115658302A (en) 2022-10-21 2022-10-21 Resource allocation method, device, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN115658302A true CN115658302A (en) 2023-01-31

Family

ID=84989155

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211295786.5A Pending CN115658302A (en) 2022-10-21 2022-10-21 Resource allocation method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN115658302A (en)

Similar Documents

Publication Publication Date Title
CN107491351B (en) Resource allocation method, device and equipment based on priority
CN109471727B (en) Task processing method, device and system
CN110647394B (en) Resource allocation method, device and equipment
CN108268317B (en) Resource allocation method and device
CN112269641B (en) Scheduling method, scheduling device, electronic equipment and storage medium
JP6364880B2 (en) Parallel computer system, control program for job management apparatus, and control method for parallel computer system
CN111290838B (en) Application access request processing method and device based on container cluster
CN113094183B (en) Training task creating method, device, system and medium of AI (Artificial Intelligence) training platform
WO2019170011A1 (en) Task allocation method and device, and distributed storage system
CN111309440B (en) Method and equipment for managing and scheduling multiple types of GPUs
CN111309644B (en) Memory allocation method and device and computer readable storage medium
CN113849260A (en) Instance processing core allocation method and device
CN112214288B (en) Pod scheduling method, device, equipment and medium based on Kubernetes cluster
CN110795234A (en) Resource scheduling method and device
US20170344266A1 (en) Methods for dynamic resource reservation based on classified i/o requests and devices thereof
CN113805816A (en) Disk space management method, device, equipment and storage medium
JP6666553B2 (en) Information processing apparatus, job management method, and job management program
CN115658302A (en) Resource allocation method, device, equipment and readable storage medium
CN111143071A (en) Cache partition management method, system and related components based on MCS system
CN112600765B (en) Method and device for scheduling configuration resources
CN108279982B (en) Method, system and equipment for managing pbs resources and hadoop resources
CN114490083A (en) CPU resource binding method and device, storage medium and electronic device
CN112099728B (en) Method and device for executing write operation and read operation
CN111984382A (en) Resource scheduling method, device, equipment and computer readable storage medium
JP2018010492A (en) Parallel processing device, job management method, and job management program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination