Resource scheduling method and device based on host machine topological structure, and electronic equipment
By collecting and analyzing the topological structure information of the host, determining the resource scheduling target of the container cluster, it solves the problem of resource waste during resource scheduling under the NUMA architecture, and improves resource utilization and the operation efficiency of the container cluster.
Patent Information
- Application Number
- CN202411782599.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-04-01
AI Technical Summary
Currently, Kubernetes does not provide a scheduling strategy based on NUMA architecture, which leads to the problem that individual CPU cores in NUMA nodes cannot be allocated when deploying high-priority containers, resulting in wasted CPU resources.
By collecting the topological structure information of each host, determining the target host in which the container cluster is scheduled and the target memory access area within the target host, ensuring that the main container obtains the best processor core resources, and configuring the resource scheduling information of other containers to optimize the overall resource allocation.
It realizes the reduction of resource waste while meeting high-performance container operation resources, and improves resource utilization and the operation efficiency of container clusters.
Smart Images

Figure CN119739481A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing, and in particular to a resource scheduling method based on a host machine topology structure, a device thereof, and an electronic device. Background Art
[0002] As cloud computing technology continues to mature, resource virtualization technology has developed rapidly. In the field of cloud computing, container technology, as a lightweight virtualization technology, can provide a running environment for containers with lightweight virtualization technology, and support better resource scheduling and isolation for containers. Kubernetes (k8s for short, a system for automated deployment, scaling, and management of containerized applications) can achieve container management and resource scheduling.
[0003] Non-Uniform Memory Access (NUMA) is a computing platform architecture that allows different CPUs (Central Processing Units) to access different memory regions at different speeds. The NUMA architecture allows CPUs with multiple memory controllers to use any available memory across CPU complexes, which allows for increased flexibility at the expense of performance. CPUs that process workloads using memory outside of a NUMA region are slower than workloads processed in a single NUMA region. In addition, for I / O (input / output)-constrained workloads, network interfaces on remote NUMA regions slow down the speed at which information reaches the application. NUMA-aware scheduling can arrange requested cluster computing resources (CPU, memory, devices) in the same NUMA region to efficiently handle latency-sensitive or high-performance workloads. Therefore, for high-performance application containers, Pod (i.e., the basic scheduling unit and deployment unit, representing a collection of one or more containers) workloads need to be processed in a single NUMA region. However, Kubernetes currently does not provide a scheduling strategy based on the NUMA architecture.
[0004] In the related art, the NUMA-aware auxiliary scheduler receives the relevant NUMA area information and schedules the Pod workload to the best node (Node, i.e., the host machine, refers to the actual physical server or virtual machine running the containerized environment). However, the above scheduling scheme will have the problem of resource waste. For example, when a single NUMA-affinity host machine deploys a high-priority container, there will be a problem that individual CPU cores in the NUMA node cannot be allocated. In addition, in the same Pod, since each container needs to exclusively occupy the CPU core, it will also cause a large waste of CPU resources.
[0005] To the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0006] The embodiment of the present invention provides a resource scheduling method based on a host machine topology structure, a device thereof, and an electronic device, so as to at least solve the technical problem of resource waste when performing resource scheduling based on a NUMA architecture in the related art.
[0007] According to one aspect of an embodiment of the present invention, a resource scheduling method based on a host machine topology structure is provided, comprising: collecting topology structure information of each host machine; determining a target host machine to be scheduled for a container cluster and a target memory access area in the target host machine based on the topology structure information, wherein the container cluster comprises: a main container and multiple other containers, and the target memory access area comprises at least: multiple processor cores; based on the container information of the main container of the container cluster, determining a target processor core set from the target memory access area, and binding each target processor core in the target processor core set to the main container to complete resource scheduling of the main container; based on the container information of other containers of the container cluster, configuring resource scheduling information of each other container to complete resource scheduling of the other containers.
[0008] In one embodiment of the present application, the step of collecting topological structure information of each host machine includes: using a policy daemon component deployed in the host machine to collect the operating system hardware description file of the host machine; based on the operating system hardware description file, determining the number of memory access areas in the host machine, the number of processor cores and memory size in each memory access area, the area relationship between the memory access areas, and the layout relationship between the processor cores in each memory access area; based on the number of memory access areas, the number of processor cores and memory size in each memory access area, the area relationship and the layout relationship, determine the topological structure information of the host machine.
[0009] In one embodiment of the present application, based on topology information, the step of determining a target host machine to be scheduled for a container cluster and a target memory access area within the target host machine includes: determining an affinity between the container cluster and each memory access area based on cluster information and topology information of the container cluster; determining a memory access area indicated by a maximum affinity as a target memory access area, and determining a host machine where the target memory access area is located as a target host machine.
[0010] In one implementation of the present application, the step of determining the affinity between the container cluster and each memory access area based on the cluster information and topology information of the container cluster includes: determining the resource requirements of the container cluster based on the cluster information; determining the regional layout of each memory access area based on the topology information; matching the resource requirements with the regional layout to determine the affinity between the container cluster and each memory access area.
[0011] In one embodiment of the present application, after determining the affinity between the container cluster and each memory access area based on the cluster information and topology information of the container cluster, it also includes: when multiple container clusters are created at the same time, determining the container priority of each container cluster; when the affinities between multiple container clusters and the same memory access area are all maximum affinities, determining the memory access area indicated by the maximum affinity as the target memory access area of the container cluster indicated by the highest container priority.
[0012] In one embodiment of the present application, based on the container information of other containers of the container cluster, the step of configuring the resource scheduling information of each other container includes: determining the remaining processor cores of the target memory access area, wherein the remaining processor cores refer to the processor cores other than the target processor core in the target memory access area; based on the topology information, determining the distance relationship between the remaining processor cores and the other processor cores, wherein the other processor cores are the processor cores in other memory access areas; based on the container information of the other containers and the distance relationship between the remaining processor cores and the other processor cores, determining the processing thread of each preset processor core occupied by the other containers, wherein the preset processor core is the remaining processor core or the other processor core; and configuring the resource scheduling information of the other containers based on the processing thread of each preset processor core occupied by the other containers.
[0013] In one implementation of the present application, after completing resource scheduling for other containers, it also includes: when the cluster information of the container cluster changes, determining whether the target host meets the current resource requirements of the container cluster; when the target host does not meet the current resource requirements of the container cluster, deleting each container in the container cluster on the target host, and re-scheduling resources for each container.
[0014] According to another aspect of an embodiment of the present invention, a resource scheduling device based on a host machine topology structure is also provided, including: a collection unit, used to collect topology structure information of each host machine; a first determination unit, used to determine the target host machine to be scheduled by the container cluster and the target memory access area in the target host machine based on the topology structure information, wherein the container cluster includes: a main container and multiple other containers, and the target memory access area includes at least: multiple processor cores; a second determination unit, used to determine the target processor core set from the target memory access area based on the container information of the main container of the container cluster, and bind each target processor core in the target processor core set to the main container to complete resource scheduling of the main container; a configuration unit, used to configure the resource scheduling information of each other container based on the container information of other containers of the container cluster to complete resource scheduling of other containers.
[0015] In one embodiment of the present application, the acquisition unit includes: a first acquisition module, which is used to use a policy daemon component deployed in the host machine to collect the operating system hardware description file of the host machine; a first determination module, which is used to determine the number of memory access areas in the host machine, the number of processor cores and memory size in each memory access area, the area relationship between the memory access areas, and the layout relationship between the processor cores in each memory access area based on the operating system hardware description file; a second determination module, which is used to determine the topological structure information of the host machine based on the number of memory access areas, the number of processor cores and memory size in each memory access area, the area relationship, and the layout relationship.
[0016] In one embodiment of the present application, the first determination unit includes: a third determination module, used to determine the affinity between the container cluster and each memory access area based on cluster information and topology information of the container cluster; a fourth determination module, used to determine the memory access area indicated by the maximum affinity as the target memory access area, and determine the host machine where the target memory access area is located as the target host machine.
[0017] In one embodiment of the present application, the third determination module includes: a first determination submodule, used to determine the resource requirements of the container cluster based on cluster information; a second determination submodule, used to determine the regional layout of each memory access area based on topology information; a third determination submodule, used to match the resource requirements with the regional layout, and determine the affinity between the container cluster and each memory access area.
[0018] In one embodiment of the present application, the resource scheduling device also includes: a fifth determination module, which is used to determine the affinity between the container cluster and each memory access area based on the cluster information and topology structure information of the container cluster, and then determine the container priority of each container cluster when multiple container clusters are created at the same time; a sixth determination module, which is used to determine the memory access area indicated by the maximum affinity as the target memory access area of the container cluster indicated by the highest container priority when the affinities between multiple container clusters and the same memory access area are all maximum affinities.
[0019] In one embodiment of the present application, the configuration unit includes: a seventh determination module, used to determine the remaining processor cores of the target memory access area, wherein the remaining processor cores refer to the processor cores other than the target processor core in the target memory access area; an eighth determination module, used to determine the distance relationship between the remaining processor cores and other processor cores based on topological structure information, wherein the other processor cores are processor cores in other memory access areas; a ninth determination module, used to determine the processing thread of each preset processor core occupied by other containers based on the container information of other containers and the distance relationship between the remaining processor cores and other processor cores, wherein the preset processor core is the remaining processor core or other processor core; a first configuration module, used to configure the resource scheduling information of other containers based on the processing thread of each preset processor core occupied by other containers.
[0020] In one embodiment of the present application, the resource scheduling device also includes: a first judgment module, which is used to judge whether the target host machine meets the current resource requirements of the container cluster after completing the resource scheduling of other containers when the cluster information of the container cluster changes; a first deletion module, which is used to delete each container in the container cluster on the target host machine and re-schedule resources for each container when the target host machine does not meet the current resource requirements of the container cluster.
[0021] According to another aspect of an embodiment of the present invention, a computer program product is also provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements any of the above-mentioned resource scheduling methods based on the host machine topology structure.
[0022] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the above-mentioned resource scheduling methods based on the host machine topology structure.
[0023] In the present invention, by collecting the topological structure information of each host machine, based on the topological structure information, the target host machine to be scheduled by the container cluster and the target memory access area in the target host machine are determined, based on the container information of the main container of the container cluster, the target processor core set is determined from the target memory access area, and each target processor core in the target processor core set is bound to the main container to complete the resource scheduling of the main container, based on the container information of other containers of the container cluster, the resource scheduling information of each other container is configured to complete the resource scheduling of other containers, thereby solving the technical problem of resource waste when performing resource scheduling based on the NUMA architecture in the related technology.
[0024] In the present invention, according to the topological structure information of the host machine (i.e., the architecture information of the NUMA deployed by the host machine), resources can be accurately allocated to each container in the container cluster to ensure that the main container can obtain the best processor core resources, while considering the needs of other containers and optimizing the overall resource allocation. In this way, by accurately matching the container resource requirements with the host machine hardware layout, it is possible to improve resource utilization and improve the operating efficiency of the container cluster, thereby achieving the technical effect of reducing resource waste while meeting the high-performance container operating resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0026] Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a resource scheduling method based on a host machine topology structure is shown;
[0027] Figure 2 is a flow chart of a resource scheduling method based on a host machine topology structure according to Embodiment 1 of the present application;
[0028] Figure 3 is a schematic diagram of the NUMA architecture and local access according to Embodiment 1 of the present application;
[0029] Figure 4 This is a schematic diagram of component access relations in Kubernetes according to Embodiment 1 of the present application;
[0030] Figure 5 is a schematic diagram of an optional resource scheduling device based on a host machine topology structure according to an embodiment of the present application;
[0031] Figure 6 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] To facilitate those skilled in the art to understand the present invention, some terms or nouns involved in the embodiments of the present invention are explained below:
[0035] NUMA (Non-Uniform Memory Access): is a memory architecture designed for multi-processor servers. Each processing unit contains a processor and memory, and the processor gives priority to the memory under the same processor (local memory).
[0036] Affinity: In the computer field, it usually refers to the association between a process, thread or resource and a specific hardware (such as CPU, memory node). By setting affinity, you can optimize application performance, reduce resource competition, and improve the overall efficiency of the system.
[0037] CPU core binding: When a specific process or thread needs to exclusively occupy a CPU core and does not want other programs to use it, you can bind the process or thread to a specified CPU core for execution to avoid program performance issues caused by CPU context switching.
[0038] It should be noted that the resource scheduling method based on the host machine topology structure and the device thereof in the present invention can be used in the field of cloud computing when resource scheduling is performed based on the host machine topology structure, and can also be used in any field other than the field of cloud computing when resource scheduling is performed based on the host machine topology structure. The present invention does not limit the application field of the resource scheduling method based on the host machine topology structure and the device thereof.
[0039] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) collected and involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of the relevant regions, necessary confidentiality measures are taken, and public order and good customs are not violated, and corresponding operation entrances are provided for users to choose to authorize or refuse. For example, an interface is set between the system and the relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0040] In this invention, a resource scheduling method based on the host machine topology structure is proposed, which can intelligently allocate resources to the container cluster according to the hardware topology structure information of the host machine, ensure that the main container can obtain the best processor core resources, and consider the needs of other containers at the same time to optimize the overall resource allocation. It not only improves the operating efficiency of the container cluster, but also enhances the stability and response speed of the system, especially in the scenario where multiple container clusters run in parallel, it can effectively avoid resource competition and improve user experience.
[0041] The present invention is described in detail below in conjunction with various embodiments.
[0042] Example 1
[0043] According to an embodiment of the present application, an embodiment of a resource scheduling method based on a host machine topology structure is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0044] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal (or mobile device) for implementing a resource scheduling method based on a host machine topology structure is shown. Figure 1As shown, the computer terminal 10 (or mobile device) may include one or more ( Figure 1 102a, 102b, ..., 102n are used to illustrate) processor 102 (processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera, wherein the network interface may be connected to a wired and / or wireless network. A person of ordinary skill in the art will understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0045] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0046] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the resource scheduling method based on the host machine topology structure in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the resource scheduling method based on the host machine topology structure is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0047] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0048] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0049] Under the above operating environment, this application provides Figure 2 The resource scheduling method based on the host machine topology structure is shown. Figure 2 is a flowchart of a resource scheduling method based on a host machine topology structure according to Example 1 of the present application, such as Figure 2 As shown, the method comprises the following steps:
[0050] Step S201, collecting topological structure information of each host machine.
[0051] In the embodiment of the present invention, the NUMA architecture solves the restriction of bus and memory bandwidth on the development of CPU computing power under the UMA (Un iform Memory Access, i.e., unified memory access architecture) architecture at the cost of inconsistent memory access.
[0052] Figure 3 is a schematic diagram of the NUMA architecture and local access according to Embodiment 1 of the present application, such as Figure 3 As shown, multiple NUMAs are deployed on each host machine (e.g., Socket0 and Socket1) (e.g., NUMA0, NUMA1, NUMA2, NUMA3 are deployed on Socket0; NUMA4, NUMA5, NUMA6, NUMA7 are deployed on Socket1), each NUMA contains multiple CPU cores, and each NUMA has its own local memory. For example, the local memory of NUMA0 and NUMA2 is memory 1; the local memory of NUMA1 and NUMA3 is memory 2; the local memory of NUMA4 and NUMA6 is memory 3; the local memory of NUMA5 and NUMA7 is memory 4.
[0053] exist Figure 3In the Socket, there are four ways for the CPU core to access memory: local access, same-socket access, cross-socket near-end access, and cross-socket remote-end access. Among them, cross-socket access needs to be transferred through the CPU in the socket to access the memory in the socket. Due to differences in CPU transfer and transmission distance, the latency of threads on the CPU core accessing memory in different locations is different. For example, the time it takes for a CPU core to access the remote end across the socket is 2.56 times that of accessing local memory.
[0054] In an embodiment of the present invention, in order to achieve high-performance operation of containers, a NUMA architecture can be combined to deploy multiple NUMA regions (i.e., memory access regions) in the host machine to schedule high-performance containers to run on the same NUMA region.
[0055] In an embodiment of the present invention, the topology information of each host machine can be collected first. The topology information includes the number of NUMAs deployed on the host machine, the positional relationship between the NUMAs, and the number of CPU cores in each NUMA, the memory size, and the positional relationship between the CPU cores.
[0056] Step S202: determining a target host machine where the container cluster is scheduled and a target memory access area in the target host machine based on the topology information, wherein the container cluster includes: a main container and multiple other containers, and the target memory access area includes: multiple processor cores.
[0057] In the embodiment of the present invention, the container cluster (i.e., Pod) is the smallest unit of scheduling, and the container cluster includes: a main container and multiple other containers, and the main container is a container with higher performance requirements. The best target host machine to be scheduled for the container cluster and the best target memory access area in the best target host machine can be determined based on the topological structure information of each host machine.
[0058] In the embodiment of the present invention, the memory access area is a NUMA area, which includes multiple processor cores (ie, CPU cores) and a local memory.
[0059] Step S203, based on the container information of the main container of the container cluster, determine the target processor core set from the target memory access area, and bind each target processor core in the target processor core set to the main container to complete resource scheduling for the main container.
[0060] In an embodiment of the present invention, a preset number (equal to the number of CPU cores required when the main container is running) of target processor cores can be selected from the target memory access area according to the container information of the main container of the container cluster (including the number of CPU cores required when the main container is running) (for example, processor cores with adjacent positions can be preferentially selected as the complex for running the main container) to obtain a target processor core set.
[0061] In the embodiment of the present invention, since the main container has high requirements for operation performance, the main container needs to monopolize these target processor cores to achieve high-performance operation of the main container. Therefore, each target processor core in the target processor core set can be bound to the main container to achieve the main container's exclusive use of these resources, thereby completing the resource scheduling of the main container.
[0062] Step S204: Based on the container information of other containers in the container cluster, configure the resource scheduling information of each other container to complete the resource scheduling of other containers.
[0063] In an embodiment of the present invention, since other containers in the container cluster do not have high requirements for operating performance and do not need to monopolize CPU resources, other containers can share other CPU cores (i.e., processor cores other than the target processor core bound to the main container). Therefore, resource scheduling information can be configured for each other container based on the positional relationship of other CPU cores and container information of other containers to complete resource scheduling for other containers. For example, each other container can be configured to use the processing cycle of other CPU cores according to the preset configuration ratio (such as 1 / 2) of the number of CPU cores required by other containers when running (such as a CPU core required by other containers when running, half of the threads of two CPU cores can be configured for it as its processing cycle using the CPU core).
[0064] In summary, according to the topological structure information of the host machine (i.e., the architecture information of the NUMA deployed by the host machine), resources can be accurately allocated to each container in the container cluster to ensure that the main container can obtain the best processor core resources, while considering the needs of other containers and optimizing the overall resource allocation. In this way, by accurately matching the container resource requirements with the host machine hardware layout, it is possible to improve resource utilization and improve the operating efficiency of the container cluster, thereby achieving the technical effect of reducing resource waste while meeting the high-performance container operating resources, and thus solving the technical problem of resource waste in related technologies when performing resource scheduling based on the NUMA architecture.
[0065] In order to accurately collect the topological structure information of each host machine, in the resource scheduling method based on the host machine topological structure provided in Example 1 of the present application, a policy daemon component deployed in the host machine is used to collect the operating system hardware description file of the host machine; based on the operating system hardware description file, the number of memory access areas in the host machine, the number of processor cores and memory size in each memory access area, the area relationship between the memory access areas, and the layout relationship between the processor cores in each memory access area are determined; based on the number of memory access areas, the number of processor cores and memory size in each memory access area, the area relationship and the layout relationship, the topological structure information of the host machine is determined.
[0066] In an embodiment of the present invention, on a host machine that deploys a NUMA architecture, a policy daemon component (such as Node Feature Discovery, NFD) deployed in the host machine can be used to collect the hardware description information of the host machine's operating system. This information mainly comes from the host machine's operating system's identification and description of the hardware, including: the layout and characteristics of the CPU, memory, and other hardware resources. By analyzing this information, the policy daemon can determine the number of NUMA memory access areas in the host machine, the number of processor cores (CPU cores) and the size of the memory in each area, as well as the regional relationship (i.e., physical relative position) between these memory access areas, and the layout relationship between the processor cores in the area, i.e., the physical relative position of the processor cores.
[0067] In an embodiment of the present invention, after determining the topological structure information of the host machine, this information is reported to the control plane of the Kubernetes cluster. For example, the NUMA-related description information can be injected into the metadata of the node (Node, i.e., the host machine) as an extensible field through the CRD (Custom Resource Definitions) mechanism and stored in a preset database (e.g., a key-value storage database) to store the topological structure of the node.
[0068] In order to improve the accuracy of determining the target host machine to be scheduled by the container cluster and the target memory access area in the target host machine, in the resource scheduling method based on the host machine topology structure provided in Example 1 of the present application, the affinity between the container cluster and each memory access area is determined based on the cluster information and topology structure information of the container cluster; the memory access area indicated by the maximum affinity is determined as the target memory access area, and the host machine where the target memory access area is located is determined as the target host machine.
[0069] In an embodiment of the present invention, in a Kubernetes (K8s) cluster, a scheduler determines the deployment location of a container based on the resource requirements of the container cluster and the topological structure information of the host machine.
[0070] In an embodiment of the present invention, the cluster information of the container cluster (including the resource requirements of the container cluster, such as memory requirements, CPU requirements, etc.) and the topology information can be used to determine the affinity between the container cluster and each memory access area, that is, to evaluate the degree of match between the workload characteristics of the Pod (such as whether it is sensitive to memory access latency) and the resource status and access characteristics of each NUMA area (i.e., memory access area) on the host machine, so as to determine the affinity between the container cluster and each memory access area.
[0071] In an embodiment of the present invention, the affinity evaluation may be based on multiple factors, including but not limited to: whether the CPU cores and memory resources required by the Pod can be met within a single NUMA region; the sensitivity of the Pod's workload to memory access latency; and resource usage within the NUMA region, such as CPU and memory utilization.
[0072] In an embodiment of the present invention, if the memory access region with the highest affinity (i.e., the best match) to the container cluster is determined, this region becomes the target memory access region corresponding to the container cluster. Correspondingly, the host machine that owns this target memory access region is also determined as the target host machine. This means that the container cluster will be preferentially scheduled to the host machine that can provide the best performance and resource utilization. Specifically in the NUMA architecture, these are the NUMA regions whose resource layout and access characteristics best match the container workload requirements.
[0073] In this embodiment, through the scheduling strategy based on the affinity between the container cluster and the memory access area, Kubernetes can manage cluster resources more intelligently, which not only improves the performance and resource utilization efficiency of the application, but also enhances the stability of the system and the convenience of operation and maintenance.
[0074] In order to improve the accuracy of determining the affinity between the container cluster and each memory access area, in the resource scheduling method based on the host machine topology structure provided in Example 1 of the present application, the resource requirements of the container cluster are determined based on the cluster information; the regional layout of each memory access area is determined based on the topology structure information; the resource requirements are matched with the regional layout to determine the affinity between the container cluster and each memory access area.
[0075] In an embodiment of the present invention, in a Kubernetes (K8s) cluster, the scheduling and resource allocation of the container cluster is a key process to ensure that each Pod can run efficiently and stably. Specifically, the scheduler calculates the overall resource requirements of the container cluster based on the Pod's request (such as CPU and memory usage) and the characteristics of the containers in the Pod (such as whether there are special requirements for CPU or memory access). In addition, the scheduler can understand the resource distribution of each NUMA area on the host machine based on the NUMA topology, including the number of CPU cores, memory size, and the physical location of these resources. Under the NUMA architecture, the latency and performance of resource access depend on whether they are located in the same physical location. The scheduler then matches the container cluster resource requirements with the resource layout of each NUMA area on the host machine, and evaluates the performance and resource efficiency of the container cluster when running in these areas to obtain the corresponding affinity.
[0076] In an embodiment of the present invention, the affinity may be calculated based on multiple factors, such as resource utilization, resource access latency, resource distribution, and container cluster requirements. Generally, the closer the resource requirements of a container cluster are to the resource layout of a certain NUMA region, the higher the affinity with the NUMA region.
[0077] In order to achieve accurate resource scheduling when performing resource scheduling on multiple container clusters at the same time, in the resource scheduling method based on the host machine topology structure provided in Example 1 of the present application, after determining the affinity between the container cluster and each memory access area based on the cluster information and topology structure information of the container cluster, when multiple container clusters are created at the same time, the container priority of each container cluster is determined; when the affinities between multiple container clusters and the same memory access area are all maximum affinities, the memory access area indicated by the maximum affinity is determined as the target memory access area of the container cluster indicated by the highest container priority.
[0078] In an embodiment of the present invention, in a Kubernetes cluster, when multiple container clusters (Pods collections) are created at the same time, the system needs to handle resource competition between them. At this time, the scheduler can assign a priority to each container cluster according to predefined rules or policies. This priority usually reflects the business importance of the containers in the cluster, the urgency of resource requirements, etc.
[0079] In an embodiment of the present invention, if the workload characteristics of multiple container clusters are highly matched with the same NUMA region (i.e., memory access region) on the host machine, it means that these container clusters can obtain the best performance and resource utilization efficiency when running in the NUMA region. However, when resources are limited, all container clusters may not be deployed to the region with the highest affinity at the same time. At this time, the scheduler will give priority to the container cluster with the highest priority and schedule the container cluster with the highest priority to the memory access region with the highest affinity. In this way, it is ensured that critical business or high-priority container clusters can obtain the best hardware resources first to meet their performance requirements.
[0080] In this embodiment, by considering the priority of the container cluster and the affinity between the container cluster and the host NUMA area, fairer and more efficient resource allocation can be achieved, ensuring high-performance operation of key businesses, while improving system stability and operation and maintenance management efficiency.
[0081] In order to improve the accuracy of configuring resource scheduling information for each other container, in the resource scheduling method based on the host machine topology structure provided in Example 1 of the present application, the remaining processor cores of the target memory access area are determined, wherein the remaining processor cores refer to the processor cores other than the target processor core in the target memory access area; based on the topology information, the distance relationship between the remaining processor cores and the other processor cores is determined, wherein the other processor cores are the processor cores in other memory access areas; based on the container information of other containers and the distance relationship between the remaining processor cores and the other processor cores, the processing thread of each preset processor core occupied by other containers is determined, wherein the preset processor core is the remaining processor core or other processor core; based on the processing thread of each preset processor core occupied by other containers, the resource scheduling information of other containers is configured.
[0082] In an embodiment of the present invention, in a Kubernetes cluster, after the target memory access area (i.e., NUMA area) of the container cluster is determined, the processor cores that have not been monopolized by other containers in the NUMA area (i.e., the remaining processor cores, which refer to the processor cores other than the target processor core in the target memory access area) can be identified. Then, the scheduler uses the topological information of the NUMA architecture to quantify and understand the physical distance and access delay (i.e., distance relationship) between the remaining processor cores and the processor cores in other NUMA areas. The determination of this distance relationship is crucial for optimizing the resource allocation of the container cluster because it directly affects the efficiency and performance of communication between containers.
[0083] Afterwards, the processing threads of each preset processor core (which may be the remaining processor core or other processor core) occupied by other containers can be determined based on the container information of other containers (i.e., the number of CPU cores required for operation) and the distance relationship between the remaining processor cores and other processor cores. For example, when the idle threads of the remaining processor cores cannot meet the operation requirements of other containers (i.e., the number of CPU cores required for the operation of other containers is insufficient), the threads of other processor cores can be selected based on the distance (i.e., local access is given priority, then access with the same socket, then access across the near end of the socket, and finally access across the far end of the socket), thereby determining the processing threads of each preset processor core occupied by other containers. Afterwards, according to the processing threads of each preset processor core occupied by other containers, the resource scheduling information of other containers is configured, that is, the processing threads of these preset processor cores are associated with other containers, so that other containers can directly schedule the processing threads of these preset processor cores when in use.
[0084] In order to ensure that the container cluster is scheduled to a host machine that meets its topology requirements, in the resource scheduling method based on the host machine topology structure provided in Example 1 of the present application, after completing the resource scheduling of other containers, if the cluster information of the container cluster changes, it is determined whether the target host machine meets the current resource requirements of the container cluster; if the target host machine does not meet the current resource requirements of the container cluster, each container in the container cluster on the target host machine is deleted, and resources are re-scheduled for each container.
[0085] In an embodiment of the present invention, in a Kubernetes (K8s) cluster, the resource requirements of a container cluster (Pods collection) may change over time. For example, due to an increase in business volume, containers may require more CPU and memory resources. Therefore, the Kubernetes scheduler or node agent (kube let) will check whether the current resource requirements of the container cluster (i.e., CPU and memory usage) match the resource capabilities of the host machine (Node) where it is located, either regularly or when resource requests change. If it is detected that the resources of the host machine (such as the number of CPU cores and memory capacity) are insufficient to support the updated resource consumption of the container cluster. At this point, Kubernetes will delete each container in the container cluster on the host machine and re-schedule resources for each container. For example, the container cluster can be uninstalled from the current host machine, and then, based on the updated resource requirements, a host machine that can meet these requirements is re-searched, and the container cluster is scheduled to run on the new host machine.
[0086] In this embodiment, by dynamically checking the match between resource requirements and host resource capabilities, and adopting a rescheduling strategy when there is a mismatch, it is possible to ensure that container applications continue to run under optimal resource conditions, which not only improves the performance and stability of the container cluster, but also improves resource utilization efficiency and the convenience of operation and maintenance management.
[0087] Figure 4 is a schematic diagram of the component access relationship in Kubernetes according to Example 1 of the present application, such as Figure 4 As shown, it includes: Kubernetes Pod (the most basic workload unit in Kubernetes, which can contain one or more containers), Server (the server is the core component of the control plane in Kubernetes, used to receive requests such as Pod creation, deletion and modification), Scheduler (the scheduling component, responsible for deciding which node to assign the unbound Pod to run on), Node (the node is the working machine in Kubernetes, which can be a physical server or a virtual machine, and there can be multiple), among which each Node includes: kube let (the agent component, responsible for communicating with the Server, executing the start, stop and maintenance of Pods), NFD (Node Feature Discovery, that is, the node feature discovery component, which collects detailed feature information of the node by querying the operating system and hardware, including the NUMA topology structure). In addition, the components within the Node can communicate through Kube let Socket (i.e., kube let socket, a socket used for communication between kube let and other components (such as NFD) so that they can pass information and control commands to each other) and Unix Socket (i.e., Unix socket, an inter-process communication mechanism used to send data between processes on the same host. In the Kubernetes scenario, Unix sockets are used for communication between components within the node).
[0088] exist Figure 4In the process, you can first initiate a Pod creation request, which is received and processed by the Server. The Server stores the Pod information in a preset database. The Scheduler component obtains the unbound Pod information as well as the resource information and NUMA topology of all nodes by communicating with the Server. The Scheduler component makes scheduling decisions based on the resource information and NUMA topology of all nodes, as well as the Pod information, to determine which node the Pod should be bound to. After receiving the scheduling decision of the Pod, the Kube let component matches the Pod resource requirements with the node's resource information and allocates resources to the Pod's main container. Once the Pod is scheduled and resources are allocated, the NFD component updates the node's resource information and NUMA topology to the Server to reflect the current usage of resources.
[0089] The resource scheduling method based on the host machine topology structure provided in the embodiment of the present application can accurately allocate resources to each container in the container cluster according to the host machine topology structure information (i.e., the architecture information of the NUMA deployed by the host machine), ensuring that the main container can obtain the best processor core resources, while considering the needs of other containers and optimizing the overall resource allocation. In this way, by accurately matching the container resource requirements with the host machine hardware layout, it is possible to improve resource utilization and improve the operating efficiency of the container cluster, thereby achieving the technical effect of reducing resource waste while meeting the high-performance container operation resources, thereby solving the technical problem of resource waste in the related technology when performing resource scheduling based on the NUMA architecture.
[0090] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0091] Example 2
[0092] The embodiment of the present application also provides a resource scheduling device based on the host machine topology structure. It should be noted that the resource scheduling device based on the host machine topology structure of the embodiment of the present application can be used to execute the resource scheduling method based on the host machine topology structure provided by the embodiment of the present application. The resource scheduling device based on the host machine topology structure provided by the embodiment of the present application is introduced below.
[0093] According to an embodiment of the present application, a device for implementing the above-mentioned resource scheduling method based on the host machine topology structure is also provided. Figure 5 is a schematic diagram of an optional resource scheduling device based on a host machine topology structure according to an embodiment of the present application, such as Figure 5As shown, the resource scheduling device may include: a collection unit 50, a first determination unit 51, a second determination unit 52, and a configuration unit 53.
[0094] Wherein, the collection unit 50 is used to collect topological structure information of each host machine;
[0095] A first determining unit 51 is used to determine a target host machine to be scheduled for the container cluster and a target memory access area in the target host machine based on the topology information, wherein the container cluster includes: a main container and multiple other containers, and the target memory access area includes at least: multiple processor cores;
[0096] A second determining unit 52 is used to determine a target processor core set from a target memory access area based on the container information of the main container of the container cluster, and bind each target processor core in the target processor core set to the main container to complete resource scheduling for the main container;
[0097] The configuration unit 53 is used to configure resource scheduling information of each other container based on the container information of other containers in the container cluster, and complete resource scheduling for other containers.
[0098] The resource scheduling device based on the host machine topology structure provided in the embodiment of the present application can accurately allocate resources to each container in the container cluster according to the topology structure information of the host machine (i.e., the architecture information of the NUMA deployed by the host machine), ensuring that the main container can obtain the best processor core resources, while considering the needs of other containers and optimizing the overall resource allocation. In this way, by accurately matching the container resource requirements with the host machine hardware layout, it is possible to improve resource utilization and improve the operating efficiency of the container cluster, thereby achieving the technical effect of reducing resource waste while meeting the high-performance container operation resources, thereby solving the technical problem of resource waste in the related technology when performing resource scheduling based on the NUMA architecture.
[0099] Optionally, the collection unit includes: a first collection module, which is used to use a policy daemon component deployed in the host machine to collect the operating system hardware description file of the host machine; a first determination module, which is used to determine the number of memory access areas in the host machine, the number of processor cores and memory size in each memory access area, the area relationship between the memory access areas, and the layout relationship between the processor cores in each memory access area based on the operating system hardware description file; a second determination module, which is used to determine the topological structure information of the host machine based on the number of memory access areas, the number of processor cores and memory size in each memory access area, the area relationship and the layout relationship.
[0100] Optionally, the first determination unit includes: a third determination module, used to determine the affinity between the container cluster and each memory access area based on cluster information and topology information of the container cluster; a fourth determination module, used to determine the memory access area indicated by the maximum affinity as the target memory access area, and determine the host machine where the target memory access area is located as the target host machine.
[0101] Optionally, the third determination module includes: a first determination submodule, used to determine the resource requirements of the container cluster based on cluster information; a second determination submodule, used to determine the regional layout of each memory access area based on topology information; and a third determination submodule, used to match the resource requirements with the regional layout and determine the affinity between the container cluster and each memory access area.
[0102] Optionally, the resource scheduling device also includes: a fifth determination module, which is used to determine the affinity between the container cluster and each memory access area based on the cluster information and topology structure information of the container cluster, and then determine the container priority of each container cluster when multiple container clusters are created at the same time; a sixth determination module, which is used to determine the memory access area indicated by the maximum affinity as the target memory access area of the container cluster indicated by the highest container priority when the affinities between multiple container clusters and the same memory access area are all maximum affinities.
[0103] Optionally, the configuration unit includes: a seventh determination module, used to determine the remaining processor cores of the target memory access area, wherein the remaining processor cores refer to the processor cores other than the target processor core in the target memory access area; an eighth determination module, used to determine the distance relationship between the remaining processor cores and other processor cores based on topological structure information, wherein the other processor cores are processor cores in other memory access areas; a ninth determination module, used to determine the processing thread of each preset processor core occupied by other containers based on the container information of other containers and the distance relationship between the remaining processor cores and other processor cores, wherein the preset processor core is the remaining processor core or other processor core; a first configuration module, used to configure resource scheduling information of other containers based on the processing thread of each preset processor core occupied by other containers.
[0104] Optionally, the resource scheduling device also includes: a first judgment module, which is used to judge whether the target host machine meets the current resource requirements of the container cluster after completing the resource scheduling of other containers when the cluster information of the container cluster changes; a first deletion module, which is used to delete each container in the container cluster on the target host machine and re-schedule resources for each container when the target host machine does not meet the current resource requirements of the container cluster.
[0105] The resource scheduling device may also include a processor and a memory. The acquisition unit 50, the first determination unit 51, the second determination unit 52, the configuration unit 53, etc. are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
[0106] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and resource scheduling information of each other container is configured based on container information of other containers in the container cluster by adjusting kernel parameters to complete resource scheduling of other containers.
[0107] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (fl ash RAM), and the memory includes at least one storage chip.
[0108] It should be noted that the above-mentioned acquisition unit 50, first determination unit 51, second determination unit 52, and configuration unit 53 correspond to steps S201 to S204 in Embodiment 1, and the above-mentioned units and corresponding steps implement the same instances and application scenarios, but are not limited to the contents disclosed in the above-mentioned Embodiment 1. It should be noted that the above-mentioned units may be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above-mentioned units may also be part of the device and may be run in the computer terminal 10 provided in Embodiment 1.
[0109] Example 3
[0110] An embodiment of the present application may provide an electronic device, Figure 6 is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 6 As shown, the electronic device may include: one or more ( Figure 6 (only one is shown) processor 602, memory 604, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0111] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the resource scheduling method and device based on the host machine topology structure in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned resource scheduling method based on the host machine topology structure. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0112] The processor can call the information and application programs stored in the memory through the transmission device to perform the following steps: collect the topological structure information of each host machine; based on the topological structure information, determine the target host machine where the container cluster is scheduled and the target memory access area in the target host machine, wherein the container cluster includes: a main container and multiple other containers, and the target memory access area includes at least: multiple processor cores; based on the container information of the main container of the container cluster, determine the target processor core set from the target memory access area, and bind each target processor core in the target processor core set to the main container to complete resource scheduling of the main container; based on the container information of other containers of the container cluster, configure the resource scheduling information of each other container to complete resource scheduling of other containers.
[0113] The processor can also call the information and applications stored in the memory through the transmission device to perform the following steps: use the policy daemon component deployed in the host machine to collect the host machine's operating system hardware description file; based on the operating system hardware description file, determine the number of memory access areas in the host machine, the number of processor cores and memory size in each memory access area, the area relationship between the memory access areas, and the layout relationship between the processor cores in each memory access area; based on the number of memory access areas, the number of processor cores and memory size in each memory access area, the area relationship and the layout relationship, determine the host machine's topological structure information.
[0114] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: determine the affinity between the container cluster and each memory access area based on the cluster information and topology information of the container cluster; determine the memory access area indicated by the maximum affinity as the target memory access area, and determine the host machine where the target memory access area is located as the target host machine.
[0115] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: determine the resource requirements of the container cluster based on the cluster information; determine the regional layout of each memory access area based on the topology information; match the resource requirements with the regional layout to determine the affinity between the container cluster and each memory access area.
[0116] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: when multiple container clusters are created at the same time, determine the container priority of each container cluster; when the affinities between multiple container clusters and the same memory access area are all maximum affinity, determine the memory access area indicated by the maximum affinity as the target memory access area of the container cluster indicated by the highest container priority.
[0117] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: determine the remaining processor cores in the target memory access area, wherein the remaining processor cores refer to the processor cores other than the target processor core in the target memory access area; based on the topological structure information, determine the distance relationship between the remaining processor cores and other processor cores, wherein the other processor cores are processor cores in other memory access areas; based on the container information of other containers and the distance relationship between the remaining processor cores and other processor cores, determine the processing thread of each preset processor core occupied by other containers, wherein the preset processor core is the remaining processor core or other processor core; based on the processing thread of each preset processor core occupied by other containers, configure the resource scheduling information of other containers.
[0118] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: when the cluster information of the container cluster changes, determine whether the target host machine meets the current resource requirements of the container cluster; when the target host machine does not meet the current resource requirements of the container cluster, delete each container in the container cluster on the target host machine, and re-schedule resources for each container.
[0119] By adopting the embodiment of the present application, a solution for resource scheduling based on the host machine topology structure is provided. By allocating resources accurately to each container in the container cluster according to the topology structure information of the host machine (i.e., the architecture information of the NUMA deployed by the host machine), it is possible to ensure that the main container can obtain the best processor core resources, while considering the needs of other containers and optimizing the overall resource allocation. In this way, by accurately matching the container resource requirements with the host machine hardware layout, it is possible to improve resource utilization and improve the operating efficiency of the container cluster, thereby achieving the technical effect of reducing resource waste while meeting the high-performance container operation resources, thereby solving the technical problem of resource waste when performing resource scheduling based on the NUMA architecture in the related technology.
[0120] It can be understood by those skilled in the art that Figure 6 The structure shown is for illustration only, and the electronic device may also be a terminal device such as a smart phone, a tablet computer, a PDA, and a Mobile Internet Device (MID). Figure 6 The structure of the electronic device is not limited. Figure 6 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 6 Different configurations are shown.
[0121] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0122] Example 4
[0123] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the resource scheduling method based on the host machine topology structure provided in the first embodiment.
[0124] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0125] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing the program steps of the resource scheduling method based on the host machine topology structure.
[0126] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0127] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0128] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0129] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0130] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0131] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.
[0132] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A resource scheduling method based on a host machine topology structure, characterized in that: include: Collect topological information of each host; Based on the topology information, determine a target host machine where the container cluster is scheduled and a target memory access area in the target host machine, wherein the container cluster includes: a main container and multiple other containers, and the target memory access area includes at least: multiple processor cores; Based on the container information of the main container of the container cluster, determine a target processor core set from the target memory access area, and bind each target processor core in the target processor core set to the main container to complete resource scheduling for the main container; Based on the container information of the other containers in the container cluster, resource scheduling information of each of the other containers is configured to complete resource scheduling of the other containers.
2. The resource scheduling method according to claim 1, characterized in that: The steps of collecting topology information of each host include: Using a policy daemon component deployed in the host machine, collecting an operating system hardware description file of the host machine; Based on the operating system hardware description file, determine the number of memory access areas in the host machine, the number of processor cores and memory size in each of the memory access areas, the area relationship between the memory access areas, and the layout relationship between the processor cores in each of the memory access areas; The topology information of the host machine is determined based on the number of the memory access regions, the number of the processor cores and the memory size in each of the memory access regions, the region relationship, and the layout relationship.
3. The resource scheduling method according to claim 1, characterized in that: The step of determining a target host machine to be scheduled by the container cluster and a target memory access area in the target host machine based on the topology information includes: Determine, based on the cluster information of the container cluster and the topology information, an affinity between the container cluster and each memory access area; The memory access region indicated by the maximum affinity is determined as the target memory access region, and the host machine where the target memory access region is located is determined as the target host machine.
4. The resource scheduling method according to claim 3, characterized in that: The step of determining the affinity between the container cluster and each memory access area based on the cluster information of the container cluster and the topology structure information includes: Determining resource requirements of the container cluster based on the cluster information; Based on the topological structure information, determining the regional layout of each of the memory access regions; The resource requirement is matched with the area layout to determine the affinity between the container cluster and each of the memory access areas.
5. The resource scheduling method according to claim 3, characterized in that: After determining the affinity between the container cluster and each memory access area based on the cluster information of the container cluster and the topology information, the method further includes: When multiple container clusters are created at the same time, determining a container priority of each container cluster; When the affinities between the plurality of container clusters and the same memory access region are all the maximum affinity, the memory access region indicated by the maximum affinity is determined as the target memory access region of the container cluster indicated by the highest container priority.
6. The resource scheduling method according to claim 1, characterized in that: The step of configuring resource scheduling information of each of the other containers based on the container information of the other containers of the container cluster includes: Determine remaining processor cores in the target memory access region, wherein the remaining processor cores refer to processor cores in the target memory access region except the target processor core; Based on the topology information, determining a distance relationship between the remaining processor cores and other processor cores, wherein the other processor cores are processor cores in other memory access areas; Determine, based on the container information of the other containers and the distance relationship between the remaining processor cores and the other processor cores, a processing thread of each preset processor core occupied by the other containers, wherein the preset processor core is the remaining processor core or the other processor core; The resource scheduling information of the other containers is configured based on the processing thread of each of the preset processor cores occupied by the other containers.
7. The resource scheduling method according to claim 1, characterized in that: After completing the resource scheduling of the other containers, the method further includes: When cluster information of the container cluster changes, determining whether the target host meets current resource requirements of the container cluster; When the target host does not meet the current resource demand of the container cluster, each container in the container cluster on the target host is deleted, and resources are rescheduled for each container.
8. A resource scheduling device based on a host machine topology structure, characterized in that: include: A collection unit, used to collect topological structure information of each host machine; A first determining unit is configured to determine, based on the topology information, a target host machine where the container cluster is scheduled and a target memory access area in the target host machine, wherein the container cluster includes: a main container and multiple other containers, and the target memory access area includes at least: multiple processor cores; A second determining unit is used to determine a target processor core set from the target memory access area based on the container information of the main container of the container cluster, and bind each target processor core in the target processor core set to the main container to complete resource scheduling for the main container; A configuration unit is used to configure resource scheduling information of each of the other containers based on the container information of the other containers in the container cluster, so as to complete resource scheduling of the other containers.
9. A computer program product, characterized in that It includes a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the resource scheduling method based on the host machine topology structure as described in any one of claims 1 to 7.
10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the resource scheduling method based on the host machine topology structure as described in any one of claims 1 to 7.