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

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

Info

Publication number
CN115964166A
CN115964166A CN202211613089.XA CN202211613089A CN115964166A CN 115964166 A CN115964166 A CN 115964166A CN 202211613089 A CN202211613089 A CN 202211613089A CN 115964166 A CN115964166 A CN 115964166A
Authority
CN
China
Prior art keywords
target
numa
value
numa node
available resource
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
CN202211613089.XA
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.)
Shanghai Pudong Development Bank Co Ltd
Original Assignee
Shanghai Pudong Development Bank 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 Shanghai Pudong Development Bank Co Ltd filed Critical Shanghai Pudong Development Bank Co Ltd
Priority to CN202211613089.XA priority Critical patent/CN115964166A/en
Publication of CN115964166A publication Critical patent/CN115964166A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a container resource allocation method, a device, equipment and a storage medium. The method comprises the following steps: acquiring a resource application request, wherein the resource application request comprises: a target Requests value and a target Limits value; determining the service level of the Pod according to the target Requests value and the target Limits value; determining at least two numa nodes according to the logic CPU topology of the target host machine; and carrying out resource allocation according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value.

Description

Resource allocation method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a resource allocation method, a resource allocation device, resource allocation equipment and a storage medium.
Background
With the recent continuous popularization of container technologies represented by container engines + kubernets and micro-service architectures of container arrangement management technologies and applications, the creation and deployment of applications are as simple as those of heaps, enterprises do not need to consider resources and maintenance cost when creating applications or services, the deployment of applications is extremely simple and rapid, the failure cost is greatly reduced, and the attention of enterprise IT personnel is focused more on the applications and services rather than on complicated system and environment configuration. The container deployment is fast, the resource occupation is small, the resource utilization rate is high, the cross-platform capability is strong, the flexible deployment is combined with the container arrangement and scheduling capability of Kubernets, the functions of automatic expansion, configuration management, resource management, automatic operation and maintenance and the like are realized, and the management of a complete application declaration period is realized by utilizing various application upgrading strategies.
The container is used as a lightweight virtualization technology, is different from the traditional virtualization technology in realizing virtualization based on a hardware layer, is realized based on a shared kernel mode, and has almost no loss in performance compared with the traditional virtualization technology. The container can provide a resource independent operation environment for the application software and the components depending on the application software, the components depending on the application software are packaged into a reusable container mirror image, the deployment of the container is realized, the environment for operating the container mirror image does not share computing resources such as a memory, a CPU and the like with a main operating system, the independent relation between the internal process and the external process of the container is ensured, and the container is essentially the process-level resource isolation.
Currently, the mainstream x86 multiprocessor server adopts a Symmetric Multiprocessor (SMP) architecture, that is, multiple processors adopt CPUs with the same architecture, share the same address memory space, share one operating system instance, and can perform cooperative communication through shared memory. Early x86 multiprocessor systems employed a uniform memory access architecture, i.e., all processors had the same access distance and time to shared memory. With the development and development of CPU architecture, nowadays, most CPUs adopt a Non-Uniform Memory Access (NUMA) architecture, that is, memory Access depends on the relative position between a processor and a Memory, a Memory controller chip is integrated inside the processor, and a plurality of processors are connected to each other through a QPI link. One physical CPU consists of one or more numa nodes, each having its own internal CPU, bus, and memory, and is used for an independent L1 cache. Besides, each physical CPU is composed of a plurality of cores (CPU core), each core realizes a plurality of hardware threads through SMT (synchronous multithreading and hyper-threading technology), and the hardware threads logically form a CPU, share an L1 cache, a logical operation unit and the like.
For the memory, the PCIe peripherals and the local IO resources, the local resources can be accessed directly through the components inside the Uncore, while the resource access across the numa node needs to be accessed to the local CPU through the QPI link, and for the memory, the remote memory access delay is twice as long as the local memory. The operating system and the related virtualization platform should make best use of the characteristics of the access delay of the local memory and the affinity of the CPU numa to allocate the local memory according to the CPU where the task is located, so as to optimize the overall access performance of the application and the system.
In the above architecture, in general, the minimum execution unit is a logical CPU, when a program is started, scheduling and execution of a process are also performed based on the logical CPU, the scheduler needs to exert the best performance of multiple CPUs, so as to avoid scheduling of the process on two different physical CPUs or different numnodes as much as possible, an operating system kernel introduces a solution of a scheduling domain after linux2.6, adds a logical CPU of each CPU core into a scheduling domain to become core _ domain, further includes numa _ domain and phys _ domain from bottom to top, and allocates scheduling and load policies of the CPUs for dimensions. In addition, the operating system supports binding processes to a designated logical CPU through tools such as taskset or numactl.
The multi-core NUMA architecture is more and more widely applied to a commercial server as a support for carrying key services and services of container applications, and with the introduction of an ARM architecture, the number of cores of a CPU and the number of NUMA nodes are both increasing, but the operating performance of a container under the NUMA architecture is reduced due to competition between the container and the container for shared resources and resource access across NUMA nodes, and particularly, for part of high-throughput and high-load application scenarios (sensitive to processor cache loss, sensitive to context switching, and beneficial to sharing processor resources, requiring hyper-threading from the same physical CPU and sensitive application of cross-node memory access), the affinity of the NUMA nodes of the server needs to be utilized to improve the computing performance of the container.
In the topology management scheme provided by Kubernetes, the service level of the pod must be Guaranteed pod (that is, requests and limits of the container must be equal), which means that the container resource and the physical resource have a certain binding relationship, and when the service load is not high, the resource of the node has a certain waste phenomenon, so that the computing resource on the host machine cannot be fully utilized, and the utilization rate of the physical resource is reduced.
Disclosure of Invention
Embodiments of the present invention provide a resource allocation method, an apparatus, a device, and a storage medium, which solve the problem that a certain waste phenomenon may occur to a node resource when a service load is not high due to a certain binding relationship between a container resource and a physical resource, and can improve a resource utilization rate of a container host.
According to an aspect of the present invention, there is provided a resource allocation method, including:
acquiring a resource application request, wherein the resource application request comprises: a target Requests value and a target Limits value;
determining the service level of the Pod according to the target Requests value and the target Limits value;
determining at least two numa nodes according to the logic CPU topology of the target host machine;
and performing resource allocation according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value.
According to another aspect of the present invention, there is provided a resource allocation apparatus, including:
an obtaining module, configured to obtain a resource application request, where the resource application request includes: a target Requests value and a target Limits value;
the first determining module is used for determining the service level of the Pod according to the target Requests value and the target Limits value;
the second determining module is used for determining at least two numa nodes according to the logic CPU topology of the target host machine;
and the resource allocation module is used for allocating resources according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the method of resource allocation according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the resource allocation method according to any one of the embodiments of the present invention when the computer instructions are executed.
The embodiment of the invention obtains the resource application request; determining the service level of the Pod according to the target Requests value and the target Limits value; determining at least two numa nodes according to the logic CPU topology of the target host machine; and performing resource allocation according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value, so that the problem that certain waste of the resources of the nodes occurs due to the fact that the container resources have a certain binding relationship with physical resources and when the service load is not high is solved, and the resource utilization rate of the container can be improved.
It should be understood that the statements in this section are not intended to identify key or critical features of the embodiments of the present invention, nor are they intended to limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
FIG. 1 is a flow chart of a resource allocation method in an embodiment of the present invention;
FIG. 2 is a diagrammatic illustration of a CPU manager CPU set management method in an embodiment of the present invention;
FIG. 3 is a CPU manager static policy flow diagram in an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a resource allocation apparatus in an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device in the embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, 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 invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It is understood that, before the technical solutions disclosed in the embodiments of the present disclosure are used, the user should be informed of the type, the use range, the use scene, etc. of the personal information related to the present disclosure in a proper manner according to the relevant laws and regulations and obtain the authorization of the user.
Example one
Fig. 1 is a flowchart of a resource allocation method provided in an embodiment of the present invention, where this embodiment is applicable to a situation of resource allocation, and the method may be executed by a resource allocation apparatus in an embodiment of the present invention, where the apparatus may be implemented in a software and/or hardware manner, as shown in fig. 1, the method specifically includes the following steps:
s110, acquiring a resource application request.
Wherein, the Pod resource application request includes: a target Requests value and a target Limits value.
The target Requests value is a resource amount corresponding to the basic requirement, namely, a logic CPU number corresponding to the basic requirement, and the target Limits value is an upper limit of the resource amount, namely, an upper limit of the logic CPU number.
And S120, determining the service level of the Pod according to the target Requests value and the target Limits value.
Wherein, the service class of the Pod includes two types, which are respectively: burst and guarded. In another BestEffort mode, the values of Request and Limits are not defined, so this patent does not refer to.
Specifically, the manner of determining the service level of the Pod according to the target Requests values and the target Limits values of all the containers in the Pod may be: if the target Requests value is smaller than the limit value, the service level of the Pod is burst; if the target Requests values of all containers are equal to the Limits value, the service level of the Pod is Guaranteed.
S130, determining at least two numa nodes according to the logic CPU topology of the target host machine.
Specifically, the manner of determining at least two numa nodes according to the logical CPU topology of the target host may be: and acquiring the topological situation of the logical CPU of the target host, wherein generally all the logical CPUs belong to at least two numa nodes.
Specifically, the method for determining at least two numa nodes according to the logical CPU topology of the target host may further be: acquiring the total logic CPU and numa node quantity of a host machine and the incidence relation between the numa node and the logic CPU; and obtaining the topological relation between the logic CPU and the numa node according to the total logic CPU, the numa node and the association relation between the numa node and the logic CPU, and determining at least two numa nodes according to the logical CPU topology of the target host machine. For example, after a host starts the hyper-threading mode, the total CPUset is 0 to 119, and the topology of the logical CPU is as follows: numa node0 (CPUset: 0-7, 64-71), numa node 1 (CPUset: 8-15, 72-79), \ 8230;, numa node7 (CPUset: 56-63, 112-119). And S140, performing resource allocation according to the available resource scores of at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value.
Specifically, the resource allocation manner according to the available resource scores of at least two numa nodes, the service level of the Pod, the target Requests value, and the target Limits value may be: and distributing the computing resources by adopting a new CPU management strategy according to the available resource score of each numa node, the service level of the Pod, the target Requests value and the target Limits value in the CPU manager. The resource allocation mode according to the available resource scores of at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value may further be: and distributing a logic CPU according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value, and further updating each numa node to obtain the updated CPUset of the numa node. For example, as shown in fig. 2, numa node0 (CPUset: 0-7, 64-71) may be used, and the logical CPU in numa node0 includes: system Reserved CPU, kube Reserved CPU, container 1Request CPU, \ 8230, container n Request CPU; numa node 1 (CPUset: 8-15, 72-79), \8230;, numa node7 (CPUset: 56-57,62-63, 112-113, 118-119), and a logical CPU in numa node7 includes: the container n Limit CPU 8. The System Reserved CPU is a preset number of logical CPUs Reserved for System services, and the Kube Reserved CPU is a preset number of logical CPUs Reserved for kubbelet services, it should be noted that the System Reserved CPU and the Kube Reserved CPU can ensure that the CPUset shared pool resource does not become empty, which results in that the related services cannot be served.
Optionally, the resource allocation is performed according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value, and the target Limits value, and includes:
acquiring the available resource score of each numa node;
if the service level of the Pod is burst, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is greater than or equal to the target Requests value, allocating the logic core of the numa node with the highest available resource score to the target container, and recording the Request value of the target container corresponding to the numa node with the highest available resource score;
if the service level of the Pod is a Burstable service, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is smaller than a target Requests value, selecting a target numa node set from a numa node list according to the target Requests value, distributing a logic core to which the target numa node set belongs to a target container, and uniformly distributing the target Requests value to each numa node in the target numa node set, wherein the target numa node set comprises at least two adjacent numa nodes;
if the service level of the Pod is Guaranteed, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is larger than or equal to the target Requests value, allocating the same number of logic CPUs in the numa node with the highest available resource score as the target Limits value or the target Requests value to the target container, and deleting the allocated logic CPUs from the CPU set of the numa node with the highest available resource score;
and if the service level of the Pod is Guaranteed and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is smaller than the target Requests value, allocating the same number of continuous logic CPUs as the target Limits value or the target Requests value to the target container, and deleting the allocated logic CPUs from the CPU set.
Specifically, the manner of obtaining the available resource score of each numa node may be: and recording the resource request value of each container and the condition of the scheduled numa node, and determining the available resource score of each numa node according to the resource request value of each container and the condition of the scheduled numa node.
Specifically, if the service level of the Pod is Burstable, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is greater than or equal to the target Requests value, it is determined that the numa node with the highest available resource score can meet the resource requirement, a logic core to which the numa node with the highest available resource score belongs is allocated to the target container, and the Request value of the target container corresponding to the numa node with the highest available resource score is recorded, for example, as shown in fig. 2, the logic CPU in the numa node0 includes: system Reserved CPU, kube Reserved CPU, container 1Request CPU, \8230, container n Request CPU. Wherein, the container 1Request CPU is the Request value of the container 1, and the container n Request CPU is the Request value of the container n.
Specifically, if the service level of the Pod is burst and the available resource score of the numa node with the highest available resource score in at least two numa nodes is smaller than the target Requests value, determining that the numa node with the highest available resource score cannot meet the resource requirement; creating a numa node list according to available resource scores of the numa nodes, sorting the numa nodes in the numa node list according to the sequence of the available resource scores from high to low, selecting a target numa node set from the numa node list according to a target Requests value, distributing a logic core to which the target numa node set belongs to a target container, and uniformly distributing the target Requests value to each numa node in the target numa node set, wherein the target numa node set comprises at least two adjacent numa nodes.
Specifically, if the service level of the Pod is Guaranteed, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is greater than or equal to the target Requests value, the numa node with the highest available resource score can meet the resource requirement. For example, it may be that, as shown in FIG. 2, numa node7 (CPUset: 56-63, 112-119) is initialized, and if the target Limits value is equal to the target Requests value is equal to 8, 8 logical CPUs in numa node7 are assigned to container n, and the assigned logical CPUs are deleted from CPU sets of numa node7, numa node7 (CPUset: 56-57,62-63, 112-113, 118-119).
Specifically, if the service level of the Pod is Guaranteed, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is smaller than the target Requests value, the numa node with the highest available resource score cannot meet the resource requirement, the same number of continuous logic CPUs are allocated to the target container, and the allocated logic CPUs are deleted from the CPU set.
If the service class of Pod is Guaranteed, the assigned logical CPU needs to be deleted from the CPU set after the logical CPU is assigned. If the service level of the Pod is burst, only the Request value assigned to each container needs to be recorded.
Optionally, obtaining the available resource score of each numa node includes:
acquiring the residual resource of each numa node;
and determining the available resource score of each numa node according to the residual resources of each numa node and the preset Requests value.
Wherein the remaining resources of each numa node is the number of available logical CPUs of each numa node.
Specifically, the method for determining the available resource score of each numa node according to the remaining resources of each numa node and the preset Requests value may be: and determining the difference value of the residual resources of each numa node and the preset Requests value as the available resource score of each numa node.
Optionally, determining the available resource score of each numa node according to the remaining resources of each numa node and the preset Requests value includes:
filtering the at least two numa nodes according to the remaining resources of the numa nodes and the preset Requests value;
and determining the filtered available resource score of each numa node according to the residual resources of each numa node and the preset Requests value.
And the preset Requests value is greater than the target Requests value.
Specifically, the method for determining the filtered available resource score of each numa node according to the remaining resource of each numa node and the preset Requests value may be: and deleting the numa nodes of which the residual resources are smaller than the preset Requests value in the at least two numa nodes.
Optionally, determining the service level of the Pod according to the target Requests value and the target Limits value includes:
if the target Requests value is smaller than the limit value, the service level of the Pod is burst;
if the target Requests value is equal to the Limits value, the service level of the Pod is Guaranteed.
It should be noted that when Pod with QoS level Guaranteed is scheduled on a node, the required logical CPU is taken out from the shared pool and put into the CPUset of the container, so that the container can be exclusively used.
The embodiment of the invention provides a management strategy of a CPU manager in HintProviders, ensures that the same resource is deployed in the same numa node as much as possible on the premise of supporting dispatching of burst Pod, and improves the utilization rate of the whole resource on the premise of ensuring the performance of a container. Specifically, unlike in the conventional static scheme, the container resource request in the pod must be equal to limit. As for the Pod with the service level of Guaranteed, the effect of single core binding can be achieved only by removing the allocated logic CPU from the shared CPU set in the same conventional mode. The whole CPU scheduling scheme. As shown in fig. 3 below, the following description is made:
acquiring the logic CPU condition and the numa node topology condition of the whole node; and distinguishing the total CPUset according to each numa node; acquiring resource use conditions of each numa node (logical CPUs reserved for kubel service and system service need to be subtracted from numa node 0), and removing Burstable Pod in the numa node as an available resource score for Pod service of which the service level is Burstable Pod, as shown in fig. 2, a CPU containing 2 physical CPUs (central processing units) each having 4 numa nodes and 32 cores and starting a CPU manager of the server in HT mode. According to resource requirements set in a container, if the value of a request is equal to the value of limit, determining that the service level of a Pod is Guaranteed to be Guaranteed, executing core binding operation, removing related logic cores from the total CPUset, if the value of the request is smaller than the value of limit, determining that the service level of the Pod is burst, sharing the cores with a conventional container, binding the cores to the numa nodes with the minimum resource utilization rate, and recording the value of the request as the number of the cores used by the numa nodes. For Pod with Guaranteed service class, if a single numodd cannot meet the resource requirement, continuously available logic CPUs are divided from the total CPUset as much as possible for use, and if no available CPUset exists, scheduling fails. Aiming at the Pod with the service level of Burstable, if a single numa node cannot meet new resource requirements, sequentially iterating the resources of a plurality of numa nodes to meet the requirements according to the scoring condition of each numa node, distributing the logic cores to which the numa nodes in the CPUset belong to meet the resource requirements, and distributing the existing nodes to the nodes under other conditions that the existing nodes cannot meet the resource requirements and cannot be dispatched to the nodes.
According to the technical scheme of the embodiment, a resource application request is obtained; determining the service level of the Pod according to the target Requests value and the target Limits value; determining at least two numa nodes according to the logic CPU topology of the target host, and performing resource allocation according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value. The problem that due to the fact that the container resources and the physical resources have a binding relationship to a certain degree, when the service load is not high, the resources of the nodes are wasted to a certain extent is solved, and the resource utilization rate of the container can be improved.
Example two
Fig. 4 is a schematic structural diagram of a resource allocation apparatus according to an embodiment of the present invention. The present embodiment may be applicable to the case of resource allocation, where the apparatus may be implemented in a software and/or hardware manner, and the apparatus may be integrated in any device providing a resource allocation function, as shown in fig. 4, where the resource allocation apparatus specifically includes: an acquisition module 210, a first determination module 220, a second determination module 230, and a resource allocation module 240.
The acquiring module is configured to acquire a resource application request, where the resource application request includes: a target Requests value and a target Limits value;
the first determining module is used for determining the service level of the Pod according to the target Requests value and the target Limits value;
the second determining module is used for determining at least two numa nodes according to the logic CPU topology of the target host machine;
and the resource allocation module is used for allocating resources according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value.
Optionally, the resource allocation module is specifically configured to:
acquiring the available resource score of each numa node;
if the service level of the Pod is burst, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is greater than or equal to the target Requests value, allocating the logic core of the numa node with the highest available resource score to the target container, and recording the Request value of the target container corresponding to the numa node with the highest available resource score;
if the service level of the Pod is a Burstable service, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is smaller than a target Requests value, selecting a target numa node set from a numa node list according to the target Requests value, distributing a logic core to which the target numa node set belongs to a target container, and uniformly distributing the target Requests value to each numa node in the target numa node set, wherein the target numa node set comprises at least two adjacent numa nodes;
if the service level of the Pod is Guaranteed, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is larger than or equal to the target Requests value, allocating the same number of logic CPUs in the numa node with the highest available resource score as the target Limits value or the target Requests value to the target container, and deleting the allocated logic CPUs from the CPU set of the numa node with the highest available resource score;
and if the service level of the Pod is Guaranteed and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is smaller than the target Requests value, allocating the same number of continuous logic CPUs as the target Limits value or the target Requests value to the target container, and deleting the allocated logic CPUs from the CPU sets.
The product can execute the method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
According to the technical scheme of the embodiment, the resource application request is obtained; determining the service level of the Pod according to the target Requests value and the target Limits value; determining at least two numa nodes according to the logic CPU topology of the target host machine; and resource allocation is carried out according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value, so that the problem that certain waste phenomenon of the resources of the nodes can be caused when the service load is not high due to the fact that the container resources and the physical resources have a certain binding relationship is solved, and the resource utilization rate of the container can be improved on the premise of ensuring a high-performance container.
EXAMPLE III
FIG. 5 illustrates a block diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 5, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 may also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to the bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
Processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. The processor 11 performs the various methods and processes described above, such as the resource allocation method.
In some embodiments, the resource allocation method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the resource allocation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the resource allocation method by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user may provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above, reordering, adding or deleting steps, may be used. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired result of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for resource allocation, comprising:
acquiring a resource application request, wherein the resource application request comprises: a target Requests value and a target Limits value;
determining the service level of the Pod according to the target Requests value and the target Limits value;
determining at least two numa nodes according to the logic CPU topology of the target host machine;
and performing resource allocation according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value.
2. The method of claim 1, wherein the resource allocation according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value comprises:
acquiring the available resource score of each numa node;
if the service level of the Pod is burst, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is greater than or equal to the target Requests value, allocating the logic core of the numa node with the highest available resource score to the target container, and recording the Request value of the target container corresponding to the numa node with the highest available resource score;
if the service level of the Pod is a Burstable service, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is smaller than a target Requests value, selecting a target numa node set from a numa node list according to the target Requests value, distributing a logic core to which the target numa node set belongs to a target container, and uniformly distributing the target Requests value to each numa node in the target numa node set, wherein the target numa node set comprises at least two adjacent numa nodes;
if the service level of the Pod is Guaranteed and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is greater than or equal to the target Requests value, allocating the same number of logic CPUs (central processing units) as the target Limits value or the target Requests value in the numa node with the highest available resource score to the target container, and deleting the allocated logic CPUs from the CPU set of the numa node with the highest available resource score;
and if the service level of the Pod is Guaranteed and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is smaller than the target Requests value, allocating the same number of continuous logic CPUs as the target Limits value or the target Requests value to the target container, and deleting the allocated logic CPUs from the CPU set.
3. The method of claim 2, wherein obtaining an available resource score for each numa node comprises:
acquiring the residual resource of each numa node;
and determining the available resource score of each numa node according to the residual resources of each numa node and the preset Requests value.
4. The method of claim 3, wherein determining the available resources score for each numa node based on the remaining resources for each numa node and a predetermined Requests value comprises:
filtering the at least two numa nodes according to the residual resources of the numa nodes and the preset Requests value;
and determining the filtered available resource score of each numa node according to the residual resources of each numa node and the preset Requests value.
5. The method of claim 1, wherein determining the service level of the Pod based on the target Requests value and the target Limits value comprises:
if the target Requests value is smaller than the Limits value, the service level of the Pod is burst;
if the target Requests value is equal to the Limits value, the service level of the Pod is Guaranteed.
6. A resource allocation apparatus, comprising:
an obtaining module, configured to obtain a resource application request, where the resource application request includes: a target Requests value and a target Limits value;
the first determining module is used for determining the service level of the Pod according to the target Requests value and the target Limits value;
the second determining module is used for determining at least two numa nodes according to the logic CPU topology of the target host machine;
and the resource allocation module is used for allocating resources according to the available resource scores of the at least two numa nodes, the service level of the Pod, the target Requests value and the target Limits value.
7. The apparatus of claim 6, wherein the resource allocation module is specifically configured to:
acquiring the available resource score of each numa node;
if the service level of the Pod is burst, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is greater than or equal to the target Requests value, allocating the logic core of the numa node with the highest available resource score to the target container, and recording the Request value of the target container corresponding to the numa node with the highest available resource score;
if the service level of the Pod is a Burstable service, and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is smaller than a target Requests value, selecting a target numa node set from a numa node list according to the target Requests value, distributing a logic core to which the target numa node set belongs to a target container, and uniformly distributing the target Requests value to each numa node in the target numa node set, wherein the target numa node set comprises at least two adjacent numa nodes;
if the service level of the Pod is Guaranteed and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is greater than or equal to the target Requests value, allocating the same number of logic CPUs (central processing units) as the target Limits value or the target Requests value in the numa node with the highest available resource score to the target container, and deleting the allocated logic CPUs from the CPU set of the numa node with the highest available resource score;
and if the service level of the Pod is Guaranteed and the available resource score of the numa node with the highest available resource score in the at least two numa nodes is smaller than the target Requests value, allocating the same number of continuous logic CPUs as the target Limits value or the target Requests value to the target container, and deleting the allocated logic CPUs from the CPU sets.
8. The apparatus of claim 7, wherein the resource allocation module is further configured to:
acquiring the residual resource of each numa node;
and determining the available resource score of each numa node according to the residual resources of each numa node and the preset Requests value.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the method of resource allocation of any one of claims 1-5.
10. A computer-readable storage medium having stored thereon computer instructions for causing a processor to execute the method of allocating resources of any one of claims 1-5.
CN202211613089.XA 2022-12-15 2022-12-15 Resource allocation method, device, equipment and storage medium Pending CN115964166A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211613089.XA CN115964166A (en) 2022-12-15 2022-12-15 Resource allocation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211613089.XA CN115964166A (en) 2022-12-15 2022-12-15 Resource allocation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115964166A true CN115964166A (en) 2023-04-14

Family

ID=87352193

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211613089.XA Pending CN115964166A (en) 2022-12-15 2022-12-15 Resource allocation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115964166A (en)

Cited By (1)

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

Cited By (2)

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

Similar Documents

Publication Publication Date Title
US9229764B2 (en) Estimating migration costs for migrating logical partitions within a virtualized computing environment based on a migration cost history
CN112559182B (en) Resource allocation method, device, equipment and storage medium
CN113641457A (en) Container creation method, device, apparatus, medium, and program product
US10013264B2 (en) Affinity of virtual processor dispatching
CN111796908A (en) System and method for automatic elastic expansion and contraction of resources and cloud platform
CN114936173B (en) Read-write method, device, equipment and storage medium of eMMC device
CN110162396A (en) Method for recovering internal storage, device, system and storage medium
Zhang et al. Workload consolidation in alibaba clusters: the good, the bad, and the ugly
CN115964166A (en) Resource allocation method, device, equipment and storage medium
CN115016894A (en) Thread memory access method, device, equipment and storage medium
CN114579323A (en) Thread processing method, device, equipment and medium
US10846125B2 (en) Memory access optimization in a processor complex
US10976934B2 (en) Prioritizing pages to transfer for memory sharing
CN116680080A (en) Memory management method and device, electronic equipment and storage medium
CN114168294B (en) Method and device for distributing compiling resources, electronic equipment and storage medium
CN111858070A (en) Computing resource allocation method, device, equipment and storage medium
CN118363542B (en) Dynamic storage management method, device, equipment and medium during task running
US11768704B2 (en) Increase assignment effectiveness of kubernetes pods by reducing repetitive pod mis-scheduling
US20240362215A1 (en) Short query prioritization for data processing service
CN116594737A (en) Processor resource allocation method and device, storage medium and electronic equipment
CN116450298A (en) GPU task fine granularity scheduling method and related device
CN117632425A (en) Task allocation method and device, electronic equipment and storage medium
CN116594764A (en) Application program updating method and device, electronic equipment and storage medium
CN117311957A (en) Resource scheduling method, device and system
CN117519940A (en) Process scheduling method and device, electronic equipment and storage medium

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