Resource scheduling method, device, medium and program product
Through the multi-index scheduling strategy integrating hierarchical analysis and packing scheduling ideas, the problem of resource fragmentation and scheduling time in container orchestration is solved, efficient resource utilization and job allocation are achieved, and job waiting time is reduced.
Patent Information
- Application Number
- CN202510876421.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-06-27
AI Technical Summary
The prior art has the problem of resource fragmentation in container orchestration, which is difficult to improve resource utilization and the scheduling algorithm takes a long time.
Using a multi-index scheduling strategy that integrates hierarchical analysis and packing scheduling ideas, we use filtering nodes, creating judgment matrix, and calculating the comprehensive weight values and scores of resource indicators, selecting the node with the highest resource score for container service job allocation, and designing a custom scheduler to optimize resource scoring algorithm.
Minimize resource fragmentation, improve the utilization rate of node resources in K8S clusters, and reduce the overall operation time of the job.
Smart Images

Figure CN120386638B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a resource scheduling method, device, medium, and program product. Background Art
[0002] Currently, the main container orchestration technology solution is a CPU-GPU heterogeneous computing power scheduling strategy based on genetic algorithms. It uses quantified load balancing and priority as two judgment indicators, fine-grained memory allocation, and mounts computing resources to corresponding containers to achieve fine-grained scheduling of computing power resources. It designs a resource weight matrix based on the computing power resources of each node in the cluster, and uses an improved genetic algorithm to obtain the optimal deployment plan for the container Pod, thereby ensuring the execution of multiple tasks.
[0003] However, this solution easily leads to resource fragmentation within the cluster, making it difficult to improve resource utilization, and the scheduling algorithm is time-consuming. Summary of the Invention
[0004] The present application provides a resource scheduling method, device, medium, and program product, the method comprising filtering a number of nodes to obtain a node group to be scored; creating a judgment matrix through a hierarchical analysis method; determining the comprehensive weight value of each resource indicator of any node to be scored based on the judgment matrix; obtaining resource slices of each resource indicator of any node to be scored; determining the resource score of the node to be scored based on the resource slices of each resource indicator of any node to be scored and the comprehensive weight value of each resource indicator; selecting the node with the highest node resource score as the first target scheduling node; and allocating container service jobs through the first target scheduling node. The technology of the present application can minimize resource fragmentation, improve node resource utilization in a K8S cluster, and reduce the overall running time of jobs.
[0005] This application provides a resource scheduling method, which is applied to a containerized management system. The system includes multiple nodes, each of which includes several resource indicators. The method includes:
[0006] Filter several nodes to obtain the node group to be scored;
[0007] Create a judgment matrix through the analytic hierarchy process;
[0008] Determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix;
[0009] Get the resource slices of each resource indicator of any node to be scored;
[0010] Determine the resource score of any node to be scored based on the resource slices of each resource indicator and the comprehensive weight value of each resource indicator;
[0011] The node with the highest node resource score is selected as the first target scheduling node;
[0012] Container service jobs are allocated through the first target scheduling node.
[0013] The present application also provides a resource scheduling device, comprising:
[0014] The filtering module is used to filter several nodes to obtain the node group to be scored;
[0015] Create a module for creating a judgment matrix using the analytic hierarchy process;
[0016] The first determination module is used to determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix;
[0017] The acquisition module is used to obtain the resource slices of each resource indicator of any node to be scored;
[0018] The second determination module is used to determine the resource score of the node to be scored based on the resource slices of each resource indicator and the comprehensive weight value of each resource indicator of any node to be scored;
[0019] A judgment module, configured to select the node to be scored with the highest node resource score as the first target scheduling node;
[0020] The scheduling module is used to allocate container service jobs through the first target scheduling node.
[0021] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of a resource scheduling method when executing the computer program. The method comprises:
[0022] Filter several nodes to obtain the node group to be scored;
[0023] Create a judgment matrix through the analytic hierarchy process;
[0024] Determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix;
[0025] Get the resource slices of each resource indicator of any node to be scored;
[0026] Determine the resource score of any node to be scored based on the resource slices of each resource indicator and the comprehensive weight value of each resource indicator;
[0027] The node with the highest node resource score to be scored is selected as the first target scheduling node;
[0028] Container service jobs are allocated through the first target scheduling node.
[0029] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the resource scheduling method are implemented, and the method includes:
[0030] Filter several nodes to obtain the node group to be scored;
[0031] Create a judgment matrix through the analytic hierarchy process;
[0032] Determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix;
[0033] Get the resource slices of each resource indicator of any node to be scored;
[0034] Determine the resource score of any node to be scored based on the resource slices of each resource indicator and the comprehensive weight value of each resource indicator;
[0035] The node with the highest node resource score to be scored is selected as the first target scheduling node;
[0036] Container service jobs are allocated through the first target scheduling node.
[0037] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the resource scheduling method are implemented. The method includes:
[0038] Filter several nodes to obtain the node group to be scored;
[0039] Create a judgment matrix through the analytic hierarchy process;
[0040] Determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix;
[0041] Get the resource slices of each resource indicator of any node to be scored;
[0042] Determine the resource score of any node to be scored based on the resource slices of each resource indicator and the comprehensive weight value of each resource indicator;
[0043] The node with the highest node resource score to be scored is selected as the first target scheduling node;
[0044] Container service jobs are allocated through the first target scheduling node.
[0045] According to the present application, the method includes filtering a number of nodes to obtain a node group to be scored; creating a judgment matrix through the hierarchical analysis method; determining the comprehensive weight value of each resource indicator of any node to be scored based on the judgment matrix; obtaining the resource slice of each resource indicator of any node to be scored; determining the resource score of the node to be scored based on the resource slice of each resource indicator of any node to be scored and the comprehensive weight value of each resource indicator; taking the node to be scored with the highest node resource score as the first target scheduling node; and allocating container service jobs through the first target scheduling node. Therefore, the technology of the present application can minimize resource fragmentation, improve the node resource utilization rate in the K8S cluster, and reduce the overall running time of the job.
[0046] The technical solution of this application proposes a multi-resource indicator packing scheduling strategy that integrates the hierarchical analysis method. This scheduling strategy abandons the traditional load balancing concept and tends to adopt a more streamlined set of nodes to run jobs; by introducing a resource weight mechanism, it effectively reduces the fragmentation of high-weight resources and improves the utilization of high-weight resources in heterogeneous clusters; in addition, this application designs and implements a custom scheduler based on the scheduling framework (Kubernetes Scheduling Framework), which optimizes the scoring algorithm of resource indicators, achieves good scheduling effects in the application of K8S clusters, and further reduces the waiting time of user jobs. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0048] Figure 1 A first flow chart of the resource scheduling method provided in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of packing scheduling provided in an embodiment of the present application;
[0050] Figure 3 A schematic diagram of load balancing scheduling provided in an embodiment of the present application;
[0051] Figure 4 A second flow chart of the resource scheduling method provided in an embodiment of the present application;
[0052] Figure 5 Node filtering flow chart provided for the embodiment of this application;
[0053] Figure 6 A hierarchical structure model diagram provided for an embodiment of the present application;
[0054] Figure 7 Scheduler expansion flow chart provided in the embodiment of the present application;
[0055] Figure 8 A specific flow chart of the resource scheduling method provided in an embodiment of the present application;
[0056] Figure 9 A structural diagram of a resource scheduling device provided in an embodiment of the present application;
[0057] Figure 10 The exemplary systems provided for the embodiments of the present application can be used to implement the various embodiments described in the present application. DETAILED DESCRIPTION
[0058] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0059] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0060] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0061] In conjunction with the specific application environment architecture or specific hardware architecture on which the execution of the resource scheduling method depends, the specific application environment architecture or specific hardware architecture is described here.
[0062] Kubernetes is an open source system for automating the deployment, scaling, and management of containerized applications;
[0063] As the preferred system in the field of container orchestration, Kubernetes has one of the main functions of scheduling pod service jobs to appropriate nodes. Reasonable scheduling strategies can reduce the generation of resource fragmentation, improve node resource utilization, and reduce job waiting time. In the scenario of heterogeneous cluster resource scheduling, Kubernetes' default processor CPU and memory scheduling algorithms can no longer effectively cope with the multi-dimensional resource job scheduling requirements. Facing this challenge, this application proposes a multi-index scheduling method that integrates hierarchical analysis decision-making algorithm and packing scheduling ideas. It not only considers traditional processor CPU and memory Mem Memory resource indicators, but also incorporates multiple resource indicators such as temporary storage, GPU-like accelerator cards, and container images, achieving a more comprehensive resource evaluation. At the same time, it combines user subjective decisions with the quantitative objective resource constraints of nodes, and decides on the node that best meets the job requirements from multiple nodes for scheduling. A custom scheduler is designed based on the Kubernetes scheduling framework. The custom scheduler using the multi-index scheduling algorithm can more efficiently utilize node resources and reduce job waiting caused by resource fragmentation.
[0064] Among them, Pod is composed of one or more containers (such as Docker containers), and has the ability to share storage / network / UTS / PID, and can run container specifications. In the Kubernetes system, Pod is the smallest atomic unit that can be scheduled.
[0065] The embodiment of the present application provides a resource scheduling method, such as Figure 1 、 Figure 2 As shown, the method is applied to a containerized management system, the system includes multiple nodes, each node includes several resource indicators, and the method includes:
[0066] Filter several nodes to obtain the node group to be scored;
[0067] Create a judgment matrix through the analytic hierarchy process;
[0068] Determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix;
[0069] Get the resource slices of each resource indicator of any node to be scored;
[0070] Determine the resource score of any node to be scored based on the resource slices of each resource indicator and the comprehensive weight value of each resource indicator;
[0071] The node with the highest node resource score is selected as the first target scheduling node;
[0072] Container service jobs are allocated through the first target scheduling node.
[0073] It is understandable that the technical solution of the present application has room for improvement in terms of resource fragmentation and user job waiting time when processing multi-dimensional heterogeneous resources.
[0074] In order to more efficiently manage heterogeneous resources using Kubernetes on large-scale computing platforms, minimize resource fragmentation and reduce user job waiting time, this application deeply analyzes the default scheduling strategy of Kubernetes and makes adjustments and improvements, and proposes a multi-index binning scheduling strategy that integrates hierarchical analysis method. This scheduling strategy abandons the following methods: Figure 3 The load balancing concept shown tends to use a more streamlined set of nodes to run jobs; by introducing a resource weight mechanism, this strategy effectively reduces the fragmentation of high-weight resources and improves the utilization of high-weight resources in heterogeneous clusters; in addition, this application designs and implements a custom scheduler based on the Kubernetes Scheduling Framework, which optimizes the scoring algorithm of resource indicators, achieves good scheduling effects in the application of K8S clusters, and further reduces the waiting time of user jobs.
[0075] The embodiment of the present application provides a resource scheduling method, such as Figure 4 As shown, the method is applied to a containerized management system, the system includes multiple nodes, each node includes several resource indicators, and the method includes:
[0076] This application proposes a multi-index binning scheduling strategy that integrates the idea of hierarchical analysis method. While considering different resource weights, it can minimize resource fragmentation, improve the utilization of node resources in the cluster, and reduce the overall running time of the job.
[0077] Among them, a node is a server, and there are multiple nodes in a cluster. Each node has multiple resources, such as CPU, memory, hard disk, GPU, etc., and the weight of each resource is different.
[0078] Binpack scheduling is a scheduling strategy that focuses on resource utilization and tends to assign scheduled jobs to already occupied nodes. When a new job arrives, the scheduler selects the target scheduling node with the highest resource utilization among the already occupied nodes in the cluster to run the new job, rather than selecting a new idle node. Over time, by compacting the configuration of jobs, the scheduler can pack more jobs into the cluster. Compared with the load balancing scheduling strategy that evenly distributes jobs across nodes, binpack scheduling can minimize resource fragmentation and improve resource utilization.
[0079] Considering the complexity of various scheduling scenarios in real-world environments, the Kubernetes scheduler uses a plug-in approach. This approach allows users to modify scheduling policies to implement user-defined scheduling policies. Kubernetes provides four ways to extend its default scheduler:
[0080] The first method is to modify the Kubernetes scheduler source code at the appropriate location and then recompile the program. This method makes intrusive modifications to the Kubernetes core source code, which can easily lead to security vulnerabilities. It also requires constant adjustments and updates to maintain consistency with the upstream scheduler, and has poor portability.
[0081] The second method is to modify the scheduler configuration file; however, this method can only switch and adjust the weight of the built-in Kubernetes scheduling policy, and cannot implement user-defined scheduling policies.
[0082] The third approach is to implement a scheduler extension. Its core implementation is a configurable webhook with two endpoints: filter and priority, corresponding to the filtering and scoring phases of the scheduling cycle. This approach uses HTTP requests to call the interface, which cannot support high-throughput services. Kubernetes has deprecated this approach since version 1.16.
[0083] The fourth method is to embed it according to the scheduling framework. Kubernetes integrates and splits the traditional scheduling logic, dividing the basic process into three parts: the scheduling queue loop, the scheduling loop, and the binding loop. It also implements the corresponding traditional pre-selection function and optimization function in each part, which greatly enhances the flexibility of the scheduler.
[0084] Based on the comprehensive consideration of the performance and compatibility of the scheduler, this application first chose the fourth way to extend the scheduler, that is, to implement a custom scheduler based on the scheduling framework, and to extend the scheduling framework's scheduling loop at multiple different points (such as Figure 7 as shown) for changes and extensions.
[0085] Specifically, in the filtering stage, a custom pre-selection function was integrated into the scheduler to screen out nodes that meet the hardware requirements; in the scoring stage, not only the weights of the existing scoring functions were adjusted, but also a new scoring function was introduced; this function combines the idea of bin packing scheduling with the hierarchical analysis (AHP) algorithm to achieve a more accurate evaluation of nodes; this series of improvements covers multiple key extension points such as pre-filtering, filtering, pre-scoring, scoring, and score standardization, thereby ensuring that the scheduler maintains high performance while also having a high degree of flexibility and adaptability.
[0086] Step S01: Filter several nodes to obtain a node group to be scored;
[0087] Step S011, as Figure 5 As shown, obtain the common container C, initialize the container IC, and the number of resource indicators of the node m;
[0088] By formula: , calculate the total resource requirements of the container service Pod req ;
[0089] Get the remaining container resources of each node;
[0090] Determine whether the remaining container resources of the node are greater than or equal to the total resource requirements of the container service;
[0091] In response to the remaining container resources of the node being greater than or equal to the total resource demand of the container service, the node belongs to the node to be scored.
[0092] Specifically, the program of the PreFilter extension point is used to preprocess and check the relevant information of the Pod or cluster before filtering. It is an information extension point. The scheduler calculates the total resource requirements of the Pod here, including ordinary containers and initialization containers, to build the environment for subsequent containers.
[0093] The demand is calculated as follows, where Podreq is the total resource requirement of the node Pod service and IC is the resource requirement for starting the container:
[0094] ;
[0095] The scheduler calls the filter extension point programs of different strategies in the configured order to filter out nodes that cannot run Pods (insufficient remaining resources). If a node passes all the filter programs, it means that the resources meet all the resource requirements of the Pod, and the scheduling plug-in returns that the node has passed the filter; if no node passes all the filter extension point programs, the Pod will be marked as unschedulable and returned to the scheduling queue to wait for rescheduling.
[0096] Step S02: Create a judgment matrix through the analytic hierarchy process.
[0097] Faced with the challenge of multi-dimensional resource scheduling in large-scale heterogeneous computing platforms, the Analytic Hierarchy Process (AHP) can effectively handle complex decision-making scenarios with multiple resource levels or multiple indicator factors. This algorithm can effectively combine users' subjective qualitative weights for different resources with objective quantitative indicators of cluster resources. By decomposing the scheduling process into several levels of multiple indicators and using fuzzy quantification of qualitative indicators, the weight ratios of different resource indicators are calculated, which serves as a systematic approach to multi-indicator scheduling strategies. Its calculation process is divided into three steps: ① Establishing the corresponding hierarchical structure model; ② Constructing the judgment matrix; ③ Single sorting and consistency test of the judgment matrix levels.
[0098] Step S021, as Figure 6 As shown, a hierarchical model is created, wherein the hierarchical model includes a target layer, a criterion layer, and a solution layer; the criterion layer includes several resource indicator elements of the node, and the resource indicators include processors, memory, temporary storage, container images, and graphics processing unit accelerator cards;
[0099] Create a judgment matrix , is the ratio of the importance of resource indicator element i and resource indicator element j;
[0100] Verify the consistency of the judgment matrix.
[0101] Specifically, the hierarchical analysis method divides the decision-making problem into three levels: the goal layer Z, the criterion layer C, and the solution layer P. For the study of job scheduling of Kubernetes clusters under large-scale heterogeneous computing platforms, this application uses the CPU, memory, temporary storage, container image status and the number of GPU-like accelerator cards of nodes in the heterogeneous cluster as resource indicators, and constructs a hierarchical structure.
[0102] Among them, the image is a template for starting the container, similar to the ISO image file of the operating system to the actual running operating system.
[0103] Step S022: Obtain judgment matrix , the order of the judgment matrix n ; Degree of judgment matrix n= The number of resource indicators of the node m;
[0104] By formula: , , calculate the relative weight of each resource indicator ;
[0105] The relative weight of each resource indicator Perform normalization to obtain the comprehensive weight of each resource indicator ;
[0106] According to the comprehensive weight of each resource indicator W i Compute the maximum normalized eigenvector W =( W 1 , W 2 ,..., W n ) T , where T is a column vector
[0107] Obtain the maximum normalized eigenvector W of the judgment matrix A;
[0108] By formula: , calculate the maximum eigenvalue of the judgment matrix A ;
[0109] By formula: , calculate the consistency index CI of the judgment matrix;
[0110] Get the average random consistency index RI value of the judgment matrix;
[0111] By formula: , calculate the judgment matrix consistency ratio CR;
[0112] Determining whether the consistency ratio of the judgment matrix is less than a first preset value;
[0113] The consistency of the judgment matrix is verified based on the judgment results.
[0114] Specifically, in the hierarchical analysis method, in order to quantitatively display the importance (weight) of each indicator element in the judgment matrix, the hierarchical analysis method introduces a matrix judgment scale (1-9 scale method), which is divided into 9 scales according to the importance of the indicator, as shown in Table 1; by comparing each indicator with each other to determine its weight for the target decision, that is, constructing the judgment matrix ,in Represents the ratio of the importance of element i to element j.
[0115] Table 1 Matrix judgment scale
[0116]
[0117] Hierarchical single sorting refers to the process of comparing each factor in the current level with a factor in the previous level to perform hierarchical sorting. The specific calculation method is as follows:
[0118] First, for the judgment matrix A, it is necessary to use the judgment factors to calculate the weight (weight coefficient) of each resource indicator on the target layer (determine the target scheduling node), and calculate its eigenvector W and the approximate value of the maximum eigenroot There are many calculation methods, such as geometric mean method, arithmetic mean method, and iterative method. In the hierarchical analysis method, the geometric mean method is used to determine the size of the matrix, the calculation conditions, and the budget accuracy. The calculation process is divided into three steps. The calculation steps and corresponding calculation methods are shown in Table 2:
[0119] Table 2 Weight coefficient calculation steps
[0120]
[0121] The first step (a) is to first multiply the indicator elements of each row of the judgment matrix A and perform 1 / n power operation to obtain the relative weights of different indicators. , where n is the order of the judgment matrix, It represents the i-th row and j-th column element of the judgment matrix A; the second step (b) is to convert the relative weight value obtained in the first step Normalize the data to get the comprehensive weight of each indicator W i ; The third step (c) is to solve the maximum eigenvalue of the judgment matrix A , It can be used to reflect the consistency of the judgment matrix.
[0122] Secondly, after obtaining the weight coefficient, according to the maximum characteristic root The characteristic roots and eigenvectors of A can be obtained by the corresponding maximum normalized eigenvector W, and the calculation method is as follows:
[0123] ;
[0124] Then, when the number of judgment indicators is 1 or 2, since there are not enough comparison relationships to produce logical errors, consistency is automatically satisfied, and there is no need to calculate the CR value at this time; if the number of judgment indicators is greater than or equal to 3, the corresponding judgment matrix is usually inconsistent; in order to use its corresponding eigenvalues and eigenvectors as weight vectors of the compared factors, the inconsistency of the judgment matrix should be controlled within an allowable range; the purpose of the consistency test is to determine whether there are logical problems in the constructed judgment matrix (for example, the logical inconsistency of weights a>b, b>c, but c>a); in order to test the consistency of the judgment matrix, it is necessary to calculate the judgment matrix consistency index CI and consistency ratio CR to avoid logical errors; in the consistency index, is the maximum characteristic root of the judgment matrix A, n is the order of the judgment matrix, and when CI is 0, the higher the consistency of the judgment matrix A, the larger the consistency index CI, and the more serious the inconsistency of the judgment matrix A.
[0125] Find the average random consistency index RI value of the corresponding judgment matrix (a known value can be obtained by looking up Table 3), where n is the order of the judgment matrix.
[0126] Table 3 Random Consistency Index RI Value Table
[0127]
[0128] Step S023: When the consistency ratio of the judgment matrix is less than the first preset value, the consistency degree of the judgment matrix is within the first threshold range, and the judgment matrix is used as the judgment matrix for calculating the comprehensive weight value of each resource indicator of the node;
[0129] When the consistency ratio of the judgment matrix is greater than or equal to the first preset value, a logical error in the element weights of the judgment matrix occurs, and the judgment matrix is corrected.
[0130] Specifically, the consistency ratio CR value of the corresponding judgment matrix is calculated; when CR < 0.1, it indicates that the consistency degree of the judgment matrix A is considered to be within the allowable range (the allowable range means that CR should be less than 0.1, which is used to ensure the validity and reliability of the judgment matrix). At this time, the eigenvector of the judgment matrix A can be used to carry out the calculation of the comprehensive weight vector; if CR ≥ 0.1, the judgment matrix may have an element weight logic error, and the judgment matrix A should be considered for correction.
[0131] Step S03: determining the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix.
[0132] Step S031, obtain the judgment matrix , the number of resource indicators of the node m;
[0133] By formula: , calculate the comprehensive weight value of each resource indicator of the node i .
[0134] Specifically, the pre-scoring extension point is also an informational extension point, which is used to pre-process and obtain some data information that will be used in the scoring stage; the scoring extension point is used to implement the scheduling strategy, and this extension point is the core of the scheduler design; in this extension point, according to the judgment matrix scale in Table 1, according to the indicator order of CPU, memory, temporary storage, GPU-like accelerator card, and container image status, the judgment matrix A is preset and constructed. The element in the i-th row and j-th column of the judgment matrix A represents the importance ratio of the i-th indicator to the j-th indicator; through the judgment matrix, the comprehensive weight value of each resource indicator can be calculated ,in It is the element in the i-th row and j-th column of the judgment matrix A; the standardization extension point follows the standard specifications of Kubernetes and normalizes the resource scores of the nodes in the scoring stage.
[0135] Among them, the judgment matrix:
[0136] ;
[0137] Step S04: Obtain resource slices of each resource indicator of any node to be scored.
[0138] Step S041, obtaining the resources requested by the processor and the available resources of the processor;
[0139] The ratio of the processor's requested resources to the processor's available resources is used as the processor's resource slice;
[0140] Get the memory resources that have been applied for and the memory resources that are available;
[0141] The ratio of memory resources requested to available memory resources is used as the memory resource slice;
[0142] Get the resources that have been applied for temporary storage and the available resources for temporary storage;
[0143] The ratio of temporary storage resources applied for to temporary storage resources available is used as the temporary storage resource slice;
[0144] Get the resources applied for and available for the graphics processing unit accelerator card.
[0145] The ratio of the resources applied for by the graphics processing unit accelerator card to the available resources of the graphics processing unit accelerator card is used as the resource slice of the graphics processing unit accelerator card;
[0146] Calculate resource slices for container images.
[0147] Step S042, obtain the number of node resource indicators m, the number of all nodes in the system TotalNodes, the size of the node container image Image[i].sizes, including the number of nodes in the container image Image[i].nodes;
[0148] By formula: , calculate the initial score of the node container image;
[0149] Get the initial score of the node container image, the first fixed value maxscore, the second fixed value minThreshold, and the third fixed value maxThreshold;
[0150] By formula: , calculate the node container image score ratio Score final ;
[0151] The node container image score ratio is used as the resource slice of the node container image.
[0152] Specifically, first, the scheduling strategy of the extension point will construct resource slices in order by calculating the ratio of applied resources to available resources based on the processor CPU, memory, temporary storage, GPU-like accelerator card, and container image status indicators. The container image status is converted into a quantitative score description using a specific method: this method will score according to the degree of diffusion of the image required by the container (that is, how many nodes already have this image) and the ratio of the image size to the total image size of the node. That is, if a node has many images that are not required by the container, then the node has the "potential" to run other Pods directly. Excessive consumption of the node resources should be avoided, and it should be placed on a node with less "potential", that is, a node with fewer total images; calculate the image score and standardize the score. Among them, score is the initial score of the container image, TotalNodes is the number of nodes in the cluster, Image[i].nodes is the number of nodes with the required image, and Image[i].sizes is the size of the image (in bytes). is the final score. maxscore, minThreshold, and maxThreshold are fixed values. Other resources are described using their corresponding resource calculation methods.
[0153] Step S05, as Figure 7 As shown, the resource score of any node to be scored is determined based on the resource slices of each resource indicator of the node to be scored and the comprehensive weight value of each resource indicator.
[0154] Step S051: Obtain resource slices of each resource indicator of any node to be scored , the comprehensive weight value of each resource indicator , the number of node resource indicators m;
[0155] By formula: , calculate the resource score of the node to be scored node .
[0156] Specifically, a judgment matrix is constructed based on the user's judgment on the importance of different resource indicators, and the corresponding weights of different resource indicators in the evaluation system are calculated through the hierarchical analysis algorithm. The weights of each resource indicator are multiplied by the resource slices of the corresponding elements to obtain the node score; Score node is the resource score of the node, Fraction[i] is the resource slice of each resource indicator, Weight i is the comprehensive weight of each resource indicator, and m is the number of resource indicators;
[0157] ;
[0158] The scoring mechanism increases the node score based on the ratio of requested resources to available resources. This strategy tends to give higher scores to nodes that can just use up all the resources according to the weights of different resource indicators. It aims to achieve the bin-packing scheduling concept of maximizing resource utilization. That is, this scheduling strategy will fill up the node as much as possible before moving on to the next node for scheduling.
[0159] Step S06: The node to be scored with the highest node resource score is selected as the first target scheduling node;
[0160] Container service jobs are allocated through the first target scheduling node.
[0161] Step S061, obtaining the priority order of the container service job according to the importance of the container service job;
[0162] Bind the new container service job task to the first target scheduling node according to the priority order of the container service job;
[0163] Starting the container through the node agent program of the first target scheduling node;
[0164] Starting the container through the node agent program of the first target scheduling node includes:
[0165] Create containers through the container runtime;
[0166] Monitor the health status of containers through node agents;
[0167] When a container fails to start or does not respond to a liveness probe, the container is restarted or configured through the node agent.
[0168] Specifically, the implementation of the scheduling strategy of this application is based on the expansion and adjustment of different extension points within the scheduling framework. It abandons the frequent reallocation of resources in the traditional binning scheduling algorithm and instead implements it by improving the scoring function in the Kubernetes scheduling framework. Compared with the default scheduler, the change in scheduling delay is minimal. This is mainly due to the optimization in the filtering stage and the scheduling scoring stage, and the computational overhead of these stages in the entire scheduling process is relatively small; in addition, since no complex resource reallocation is involved, no additional allocation overhead is generated; at the same time, running jobs will not preempt the allocated scheduler resources, so the change in scheduling delay under high load and low load is also minimal. In summary, the scheduler at the scheduling level has almost no additional scheduling overhead compared to the default scheduler, which improves the efficiency of scheduling.
[0169] It is understandable that after completing the implementation of the scheduling strategy for a specific extension point, this application constructs a corresponding custom scheduler: RFA Scheduler (Resource Fraction-AHP Scheduler), and completes the weight allocation and permission configuration of the scheduling plug-in.
[0170] The judgment matrix judgment scale table builds the judgment matrix in the order of processor CPU, memory, temporary storage, GPU-like accelerator card, and container image status indicators and determines the comprehensive weight of scheduling resources when building the scheduler.
[0171] Step S07: When the node to be scored with the highest node resource score is used as the first target scheduling node, and a failure occurs in the container service job allocation strategy through the first target scheduling node, resources are scheduled using the load balancing scheduling strategy;
[0172] Resources are scheduled using load balancing scheduling policies, including:
[0173] Set the node with the lowest resource utilization or idle node as the second target scheduling node;
[0174] Allocate the container service task to the second target scheduling node;
[0175] The container is started by the node agent of the second target scheduling node.
[0176] Specifically, in a Kubernetes cluster, the scheduler runs in the form of a container Pod; Kubernetes supports two main operating modes: exclusive mode and multi-scheduler coexistence (Multi-Scheduler) mode; in order to fully utilize the flexibility of the scheduling strategy while retaining the core functions of the Kubernetes default scheduler, this application chooses the multi-scheduler coexistence mode. Users can select a specific scheduler by specifying the SchedulerName field in the Pod specification (Spec); if the Pod does not specify a scheduler, the default scheduler built into the cluster will be used for scheduling by default. This retains the original Kubernetes scheduling mechanism, ensures stability and reliability, and also enables flexible expansion and customization of scheduling strategies to meet the needs of diverse application scenarios.
[0177] Step S08: The node to be scored with the highest node resource score is used as the first target scheduling node, and the strategy for allocating container service jobs through the first target scheduling node is set as the packing scheduling strategy;
[0178] Optimize the packing scheduling strategy;
[0179] Optimize the packing scheduling strategy, including:
[0180] When the resource scheduling scenario is complex, the first target scheduling node is determined by a meta-heuristic algorithm, which includes genetic algorithm, simulated annealing algorithm and particle swarm optimization algorithm.
[0181] When resource scheduling requirements change over time, the first target scheduling node is determined through an online algorithm, and the container is started through the node agent program of the first target scheduling node;
[0182] When resource constraints involve multi-dimensional resource indicators, the first target scheduling node is determined through a mixed integer programming model;
[0183] A corresponding packing algorithm is determined according to different resource scheduling constraints, a first target scheduling node is determined according to the packing algorithm, and a container is started through a node agent program of the first target scheduling node.
[0184] Here, as Figure 8 As shown, this application's multi-criteria bin-packing scheduling strategy, which incorporates the Analytic Hierarchy Process (AHP), applies AHP to solve complex decision-making problems, particularly in areas like resource allocation and task scheduling. This approach is particularly suitable for situations where multiple conflicting evaluation metrics need to be considered. By incorporating AHP, the importance of these metrics can be systematically evaluated and weighed, leading to the development of more reasonable and effective scheduling strategies.
[0185] First, define a clear hierarchical model based on the specific application scenario. This model typically includes a goal layer (such as maximizing resource utilization or minimizing costs), a criteria layer (evaluation metrics such as CPU, memory, and container images), and a solution layer (specific options or tasks to be scheduled). This step helps clarify the direction and framework for solving the problem.
[0186] For each criterion layer, we construct a judgment matrix using the AHP method and perform pairwise comparisons to quantify their relative importance. Next, we calculate the maximum eigenvalue of the judgment matrix and its corresponding normalized eigenvector to obtain the weight of each evaluation indicator. This step ensures that the proportion of different indicators in the final decision reflects their true importance.
[0187] Based on the weight information of resource indicators, a comprehensive evaluation of all alternative solutions or tasks to be scheduled is performed. This may involve a multi-objective optimization model, which not only includes traditional packing constraints (such as container capacity restrictions) but also combines various evaluation indicators and their weights for comprehensive consideration. For example, multiple objectives can be converted into a single-objective optimization problem through weighted summation to facilitate solution.
[0188] Since the packing problem is usually an NP-hard problem, it is difficult to solve it directly; therefore, intelligent algorithms such as genetic algorithms, simulated annealing, and particle swarm optimization can be used to find approximate optimal solutions; these algorithms can provide feasible solutions that meet the requirements within a reasonable time and can adapt to the needs of different application scenarios.
[0189] Finally, analyze the results in detail to check whether the expected goals have been achieved. If the results are not ideal, return to the previous steps, re-evaluate the importance of indicators or adjust model parameters until a satisfactory solution is obtained.
[0190] The multi-index packing scheduling strategy, which incorporates AHP principles, provides a systematic solution to complex resource allocation and task scheduling problems. It not only improves the scientificity and rationality of the decision-making process, but also makes the decision more transparent and easier to understand by quantifying the importance of different indicators.
[0191] The technical solution of this application proposes a multi-index scheduling algorithm that integrates the hierarchical analysis decision algorithm and the packing scheduling idea. It not only takes into account the traditional CPU and memory resource indicators, but also incorporates multiple resource indicators such as storage, GPU-like accelerator cards, and container images, achieving a more comprehensive resource evaluation. At the same time, it combines the user's subjective decision with the quantitative objective resource limitations of the node, and decides on the node that best meets the job requirements from multiple nodes for scheduling, and designs a custom scheduler based on the Kubernetes scheduling framework. The custom scheduler using the multi-index scheduling algorithm can more efficiently utilize node resources and reduce job waiting caused by resource fragmentation.
[0192] In addition, creating a judgment matrix also includes:
[0193] Create a judgment matrix using a scoring method, including:
[0194] Determine all resource metrics that need to be compared, including processors, memory, temporary storage, GPU accelerators, and container images.
[0195] Assign a score to each resource indicator based on specific criteria;
[0196] The scores are used to calculate the relative importance between each pair of resource indicators;
[0197] Construct a judgment matrix based on these relative importance values;
[0198] Create a judgment matrix through multi-criteria decision analysis, including:
[0199] Ranking multiple resource indicators based on multiple criteria;
[0200] Generate the weight value of each resource indicator through the preference function;
[0201] A judgment matrix is formed based on the weight values of each resource indicator;
[0202] Create a judgment matrix through the network model, including:
[0203] Estimate the interaction strength between resource indicators based on theoretical or historical data and network models;
[0204] The judgment matrix is indirectly formed according to the interaction intensity between each resource indicator.
[0205] Here, the choice of method to create the judgment matrix depends on the specific application scenario, available data, and the decision maker's preferences; regardless of the method used, the key is to ensure that the resulting judgment matrix can accurately reflect the relative importance of various resource indicators so that effective decisions can be made.
[0206] The resource scheduling method provided in the embodiment of the present application can also be improved and optimized without departing from the technical solution of the present application, and these improvements and optimizations should also be regarded as the scope of protection of the present application.
[0207] The scheduling concept of this technical solution can also be applied to the scheduling of non-Kubernetes clusters, such as high-performance clusters and virtualized clusters.
[0208] The beneficial effects of the technical solution provided by the embodiments of the present application are:
[0209] The technology in this application can minimize resource fragmentation, improve node resource utilization in the K8S cluster, and reduce the overall running time of the job.
[0210] The technical solution of this application proposes a multi-resource indicator packing scheduling strategy that integrates the hierarchical analysis method. This scheduling strategy abandons the traditional load balancing concept and tends to adopt a more streamlined set of nodes to run jobs; by introducing a resource weight mechanism, it effectively reduces the fragmentation of high-weight resources and improves the utilization of high-weight resources in heterogeneous clusters; in addition, this application designs and implements a custom scheduler based on the scheduling framework (Kubernetes Scheduling Framework), which optimizes the scoring algorithm of resource indicators, achieves good scheduling effects in the application of K8S clusters, and further reduces the waiting time of user jobs.
[0211] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0212] The embodiment of the present application also provides a resource scheduling device, such as Figure 9 As shown, the device includes: a filtering module, a creation module, a first determination module, an acquisition module, a second determination module, a judgment module, a scheduling module, and an optimization module.
[0213] In this embodiment, the filtering module is used to filter a number of nodes to obtain a node group to be scored;
[0214] Create a module for creating a judgment matrix using the analytic hierarchy process;
[0215] The first determination module is used to determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix;
[0216] The acquisition module is used to obtain the resource slices of each resource indicator of any node to be scored;
[0217] The second determination module is used to determine the resource score of the node to be scored based on the resource slices of each resource indicator and the comprehensive weight value of each resource indicator of any node to be scored;
[0218] A judgment module, configured to select the node to be scored with the highest node resource score as the first target scheduling node;
[0219] The scheduling module is used to allocate container service jobs through the first target scheduling node.
[0220] In this embodiment, the filtering module is used to obtain a common container C, an initialization container IC, and a resource indicator quantity m;
[0221] By formula: , calculate the total resource requirements of the container service Pod req ;
[0222] Get the remaining container resources of each node;
[0223] Determine whether the remaining container resources of the node are greater than or equal to the total resource requirements of the container service;
[0224] In response to the remaining container resources of the node being greater than or equal to the total resource demand of the container service, the node belongs to the node to be scored.
[0225] In one embodiment, a creation module is configured to create a hierarchical model, wherein the hierarchical model includes a target layer, a criterion layer, and a solution layer; the criterion layer includes several resource indicator elements of a node, and the resource indicators include a processor, memory, temporary storage, container image, and graphics processing unit accelerator card;
[0226] Create a judgment matrix , is the ratio of the importance of resource indicator element i and resource indicator element j;
[0227] Verify the consistency of the judgment matrix.
[0228] In one embodiment, a module is created to obtain a judgment matrix , the order of the judgment matrix n ;
[0229] By formula: , , calculate the relative weight of each resource indicator ;
[0230] The relative weight of each resource indicator Perform normalization to obtain the comprehensive weight of each resource indicator ;
[0231] According to the comprehensive weight of each resource indicator W i Compute the maximum normalized eigenvector W =( W 1 , W 2 ,..., W n ) T , where T is a column vector;
[0232] Obtain the maximum normalized eigenvector W of the judgment matrix A;
[0233] By formula: , calculate the maximum eigenvalue of the judgment matrix A ;
[0234] By formula: , calculate the consistency index CI of the judgment matrix;
[0235] Get the average random consistency index RI value of the judgment matrix;
[0236] By formula: , calculate the judgment matrix consistency ratio CR;
[0237] Determining whether the consistency ratio of the judgment matrix is less than a first preset value;
[0238] The consistency of the judgment matrix is verified based on the judgment results.
[0239] In one embodiment, a module is created for determining that the consistency of the judgment matrix is within a first threshold range when the consistency ratio of the judgment matrix is less than a first preset value, and using the judgment matrix as a judgment matrix for calculating the comprehensive weight value of each resource indicator of the node;
[0240] When the consistency ratio of the judgment matrix is greater than or equal to the first preset value, a logical error in the element weights of the judgment matrix occurs, and the judgment matrix is corrected.
[0241] In one embodiment, the first determination module is used to obtain a judgment matrix , the number of resource indicators of the node m;
[0242] By formula: , calculate the comprehensive weight value of each resource indicator of the node i .
[0243] In one embodiment, the acquisition module is used to obtain the resources requested by the processor and the available resources of the processor;
[0244] The ratio of the processor's requested resources to the processor's available resources is used as the processor's resource slice;
[0245] Get the memory resources that have been applied for and the memory resources that are available;
[0246] The ratio of the memory applied resources to the memory available resources is used as the memory resource slice;
[0247] Acquire the temporarily stored applied resources and temporarily store available resources;
[0248] The ratio of the temporary storage applied resources to the temporary storage available resources is used as a temporary storage resource slice;
[0249] Obtaining resources already applied for and available resources of the graphics processing unit accelerator card;
[0250] The ratio of the resources applied for by the graphics processing unit accelerator card to the available resources of the graphics processing unit accelerator card is used as the resource slice of the graphics processing unit accelerator card;
[0251] Calculate resource slices for container images.
[0252] In one embodiment, the acquisition module is used to obtain the number of node resource indicators m, the number of all nodes in the system TotalNodes, the size of the node container image Image[i].sizes, including the number of nodes in the container image Image[i].nodes;
[0253] By formula: , calculate the initial score of the node container image;
[0254] Get the initial score of the node container image, the first fixed value maxscore, the second fixed value minThreshold, and the third fixed value maxThreshold;
[0255] By formula: , calculate the node container image score ratio Score final ;
[0256] The node container image score ratio is used as the resource slice of the node container image.
[0257] In one embodiment, the second determination module is used to obtain resource slices of each resource indicator of any node to be scored. , the comprehensive weight value of each resource indicator Weight i , the number of node resource indicators m;
[0258] By formula: , calculate the resource score of the node to be scored node .
[0259] In one embodiment, the scheduling module is configured to obtain a priority order of the container service job based on the importance of the container service job;
[0260] Bind the new container service job task to the first target scheduling node according to the priority order of the container service job;
[0261] Starting the container through the node agent program of the first target scheduling node;
[0262] Starting the container through the node agent program of the first target scheduling node includes:
[0263] Create containers through the container runtime;
[0264] Monitor the health status of containers through node agents;
[0265] When a container fails to start or does not respond to a liveness probe, the container is restarted or configured through the node agent.
[0266] In one embodiment, the scheduling module is configured to schedule resources using a load balancing scheduling strategy when a failure occurs in the container service job allocation strategy using the first target scheduling node and the node to be scored with the highest node resource score is used as the first target scheduling node;
[0267] Resources are scheduled using load balancing scheduling policies, including:
[0268] Set the node with the lowest resource utilization or idle node as the second target scheduling node;
[0269] Allocate the container service task to the second target scheduling node;
[0270] The container is started by the node agent of the second target scheduling node.
[0271] In one embodiment, the optimization module is configured to select the node to be scored with the highest node resource score as the first target scheduling node, and set the strategy for allocating container service jobs through the first target scheduling node as a packing scheduling strategy;
[0272] Optimize the packing scheduling strategy;
[0273] Optimize the packing scheduling strategy, including:
[0274] When the resource scheduling scenario is complex, the first target scheduling node is determined by a meta-heuristic algorithm, which includes genetic algorithm, simulated annealing algorithm and particle swarm optimization algorithm.
[0275] When resource scheduling requirements change over time, the first target scheduling node is determined through an online algorithm, and the container is started through the node agent program of the first target scheduling node;
[0276] When resource constraints involve multi-dimensional resource indicators, the first target scheduling node is determined through a mixed integer programming model;
[0277] A corresponding packing algorithm is determined according to different resource scheduling constraints, a first target scheduling node is determined according to the packing algorithm, and a container is started through a node agent program of the first target scheduling node.
[0278] Specifically, the technical key points and protection points of this application are a multi-index scheduling algorithm that integrates the hierarchical analysis decision algorithm and the packing scheduling idea, as well as a custom scheduler algorithm designed based on the Kubernetes scheduling framework.
[0279] Innovation 1: Abandoning the traditional load balancing concept:
[0280] Problem Background: The Kubernetes native scheduler tends to evenly distribute resources among nodes to achieve "load balancing." However, in actual applications, this may lead to resource waste or fragmentation of high-weight resources.
[0281] Improvement direction: Adopt the strategy of "running jobs on a leaner set of nodes", that is, try to aggregate and schedule Pods on a smaller number of nodes, reduce the number of active nodes, and improve overall resource utilization.
[0282] Innovation 2: Introducing a resource weight mechanism:
[0283] Purpose: Different resource types (such as CPU, memory, GPU accelerator card, temporary storage, etc.) have different importance to the business.
[0284] Implementation method: Use the AHP method to assign weights to various resource indicators to make scheduling decisions more in line with business needs.
[0285] Effect: Reduces the fragmentation of high-weight resources and improves their utilization, especially suitable for heterogeneous cluster environments.
[0286] Innovation 3: Implementing a custom scheduler based on the Scheduling Framework:
[0287] Platform foundation: Build a plug-in scheduler based on the Kubernetes Scheduling Framework.
[0288] Functional enhancements:
[0289] The custom Filter plug-in is used to filter nodes that do not meet the resource weight constraints;
[0290] Customize Scoring plug-in to implement AHP weight-based scoring algorithm;
[0291] The optional Bind plugin controls the binding logic and supports advanced features such as delayed binding.
[0292] The beneficial effects of the technical solution provided by the embodiments of the present application are:
[0293] The technology in this application can minimize resource fragmentation, improve node resource utilization in the K8S cluster, and reduce the overall running time of the job.
[0294] The technical solution of this application proposes a multi-resource indicator packing scheduling strategy that integrates the hierarchical analysis method. This scheduling strategy abandons the traditional load balancing concept and tends to adopt a more streamlined set of nodes to run jobs; by introducing a resource weight mechanism, it effectively reduces the fragmentation of high-weight resources and improves the utilization of high-weight resources in heterogeneous clusters; in addition, this application designs and implements a custom scheduler based on the scheduling framework (Kubernetes Scheduling Framework), which optimizes the scoring algorithm of resource indicators, achieves good scheduling effects in the application of K8S clusters, and further reduces the waiting time of user jobs.
[0295] For the description of the features in the embodiment corresponding to the resource scheduling device, please refer to the relevant description of the embodiment corresponding to the resource scheduling method, and no further details will be given here.
[0296] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps of an embodiment of a resource scheduling method, the method comprising:
[0297] Filter several nodes to obtain the node group to be scored;
[0298] Create a judgment matrix through the analytic hierarchy process;
[0299] Determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix;
[0300] Get the resource slices of each resource indicator of any node to be scored;
[0301] Determine the resource score of any node to be scored based on the resource slices of each resource indicator and the comprehensive weight value of each resource indicator;
[0302] The node with the highest node resource score to be scored is selected as the first target scheduling node;
[0303] Container service jobs are allocated through the first target scheduling node.
[0304] like Figure 10 As shown, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the steps of the resource scheduling method embodiment when running, the method comprising:
[0305] Filter several nodes to obtain the node group to be scored;
[0306] Create a judgment matrix through the analytic hierarchy process;
[0307] Determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix;
[0308] Get the resource slices of each resource indicator of any node to be scored;
[0309] Determine the resource score of any node to be scored based on the resource slices of each resource indicator and the comprehensive weight value of each resource indicator;
[0310] The node with the highest node resource score to be scored is selected as the first target scheduling node;
[0311] Container service jobs are allocated through the first target scheduling node.
[0312] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0313] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in the resource scheduling method embodiment are implemented. The method includes:
[0314] Filter several nodes to obtain the node group to be scored;
[0315] Create a judgment matrix through the analytic hierarchy process;
[0316] Determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix;
[0317] Get the resource slices of each resource indicator of any node to be scored;
[0318] Determine the resource score of any node to be scored based on the resource slices of each resource indicator and the comprehensive weight value of each resource indicator;
[0319] The node with the highest node resource score to be scored is selected as the first target scheduling node;
[0320] Container service jobs are allocated through the first target scheduling node.
[0321] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps in the resource scheduling method embodiment are implemented. The method includes:
[0322] Filter several nodes to obtain the node group to be scored;
[0323] Create a judgment matrix through the analytic hierarchy process;
[0324] Determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix;
[0325] Get the resource slices of each resource indicator of any node to be scored;
[0326] Determine the resource score of any node to be scored based on the resource slices of each resource indicator and the comprehensive weight value of each resource indicator;
[0327] The node with the highest node resource score to be scored is selected as the first target scheduling node;
[0328] Container service jobs are allocated through the first target scheduling node.
[0329] The technology in this application can minimize resource fragmentation, improve node resource utilization in the K8S cluster, and reduce the overall running time of the job.
[0330] The technical solution of this application proposes a multi-resource indicator packing scheduling strategy that integrates the hierarchical analysis method. This scheduling strategy abandons the traditional load balancing concept and tends to adopt a more streamlined set of nodes to run jobs; by introducing a resource weight mechanism, it effectively reduces the fragmentation of high-weight resources and improves the utilization of high-weight resources in heterogeneous clusters; in addition, this application designs and implements a custom scheduler based on the scheduling framework (Kubernetes Scheduling Framework), which optimizes the scoring algorithm of resource indicators, achieves good scheduling effects in the application of K8S clusters, and further reduces the waiting time of user jobs.
[0331] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0332] The above is a detailed introduction to the resource scheduling method, device, medium and program product provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the present application.
Claims
1. A resource scheduling method, characterized in that: The method is applied to a containerized management system, the system including multiple nodes, each node including several resource indicators, and the method includes: Filtering the multiple nodes to obtain a node group to be scored; Create a judgment matrix through the analytic hierarchy process; Determine the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix; Get the resource slices of each resource indicator of any node to be scored; Determine the resource score of any node to be scored based on the resource slices of each resource indicator of the node to be scored and the comprehensive weight value of each resource indicator; The node with the highest node resource score is selected as the first target scheduling node; Allocate container service jobs through the first target scheduling node; The resource indicators include processors, memory, temporary storage, container images, and graphics processing unit accelerator cards; The step of obtaining resource slices of each resource indicator of any node to be scored includes: Obtain the resources requested by the processor and the available resources of the processor; The ratio of the resources applied for by the processor to the available resources of the processor is used as the resource slice of the processor; Obtain the memory resources already applied for and the memory resources available; The ratio of the memory applied resources to the memory available resources is used as the memory resource slice; Acquire the temporarily stored applied resources and temporarily store available resources; The ratio of the temporarily stored applied resources to the temporarily stored available resources is used as the resource slice of the temporarily stored resources; Obtaining resources already applied for and available resources of the graphics processing unit accelerator card; taking a ratio of the resources applied for by the graphics processing unit accelerator card to the available resources of the graphics processing unit accelerator card as a resource slice of the graphics processing unit accelerator card; Calculating resource slices of the container image; The calculating of the resource slice of the container image includes: Get the number of resource indicators of the node m, the number of all nodes in the system TotalNodes, the size of the node container image Image[i].sizes, including the number of nodes in the container image Image[i].nodes; By formula: Compute the initial score of the node container image; Get the initial score of the node container image, the first fixed value maxscore, the second fixed value minThreshold, and the third fixed value maxThreshold; By formula: Compute node container image score ratio Score final ; Using the node container image score ratio as a resource slice of the node container image; The determining of the resource score of the node to be scored according to the resource slices of each resource indicator of any node to be scored and the comprehensive weight value of each resource indicator includes: Get the resource slice Fraction[i] of each resource indicator of any node to be scored, and the comprehensive weight value Weight of each resource indicator i , the number of node resource indicators m; By formula: Calculate the resource score of the node to be scored node .
2. The resource scheduling method according to claim 1, characterized in that: Filter the multiple nodes to obtain a node group to be scored, including: Get the common container C, initialize the container IC, and the number of node resource indicators m; By formula: Calculate the total resource requirements of the container service Pod req ; Get the remaining container resources of each node; Determine whether the remaining container resources of the node are greater than or equal to the total resource demand of the container service; In response to the remaining container resources of the node being greater than or equal to the total resource requirement of the container service, the node belongs to the node to be scored.
3. The resource scheduling method according to claim 2, characterized in that: The method of creating a judgment matrix by using the hierarchical analysis method includes: Creating a hierarchical model, wherein the hierarchical model includes a target layer, a criterion layer, and a solution layer; the criterion layer includes a plurality of resource indicator elements of a node; Create a judgment matrix A = (a ij ), a ij is the ratio of the importance of resource indicator element i and resource indicator element j; The consistency of the judgment matrix is verified.
4. The resource scheduling method according to claim 3, characterized in that: The checking of the consistency of the judgment matrix includes: Get the judgment matrix A=a ij , the order of the judgment matrix n, the order of the judgment matrix n = the number of resource indicators of the node m; By formula: Calculate the relative weight of each resource indicator The relative weight of each resource indicator Perform normalization to obtain the comprehensive weight of each resource indicator: According to the comprehensive weight W of each resource indicator i Calculate the maximum normalized eigenvector W = (W1, W2, ..., W n ) T , where T is a column vector; Obtain the maximum normalized eigenvector W of the judgment matrix A; By formula: Calculate the maximum eigenvalue λ of the judgment matrix A max ; Through the formula: Calculating the consistency index CI of the judgment matrix; Obtaining an average random consistency index RI value of the judgment matrix; By formula: Calculating the judgment matrix consistency ratio CR; Determining whether the consistency ratio of the judgment matrix is less than a first preset value; The consistency of the judgment matrix is verified according to the judgment result.
5. The resource scheduling method according to claim 4, characterized in that: Verifying the consistency of the judgment matrix according to the judgment result includes: When the consistency ratio of the judgment matrix is less than a first preset value, the consistency degree of the judgment matrix is within a first threshold range, and the judgment matrix is used as the judgment matrix for calculating the comprehensive weight value of each resource indicator of the node; When the consistency ratio of the judgment matrix is greater than or equal to a first preset value, a logical error in element weights occurs in the judgment matrix, and the judgment matrix is corrected.
6. The resource scheduling method according to claim 1, characterized in that: Determining the comprehensive weight value of each resource indicator of any node to be scored according to the judgment matrix includes: Get the judgment matrix A=a ij , the number of resource indicators of the node m; By formula: Calculate the comprehensive weight of each resource indicator of the node i .
7. The resource scheduling method according to claim 1, characterized in that: The allocating the container service job through the first target scheduling node includes: Get the priority order of container service jobs based on their importance; Binding the new container service job task to the first target scheduling node according to the priority order of the container service job; Start the container through the node agent program of the first target scheduling node; The starting of the container by the node agent program of the first target scheduling node includes: Create containers through the container runtime; Monitoring the health status of the container through the node agent program; When the container fails to start or does not respond to the survival probe, the container is restarted or configured through the node agent.
8. The resource scheduling method according to claim 1, wherein: The method comprises: When the node to be scored with the highest node resource score is used as the first target scheduling node, if a failure occurs in the container service job allocation strategy through the first target scheduling node, resources are scheduled using the load balancing scheduling strategy; Scheduling resources through a load balancing scheduling strategy includes: Set the node with the lowest resource utilization or idle node as the second target scheduling node; Allocating the container service task to the second target scheduling node; The container is started by a node agent program of the second target scheduling node.
9. The resource scheduling method according to claim 1, wherein: After allocating the container service job through the first target scheduling node, the method includes: The node to be scored with the highest node resource score is selected as the first target scheduling node, and the strategy for allocating container service jobs through the first target scheduling node is set as the packing scheduling strategy; Optimizing the packing scheduling strategy; The optimizing the packing scheduling strategy includes: When the resource scheduling scenario is complex, the first target scheduling node is determined by a meta-heuristic algorithm, which includes: a genetic algorithm, a simulated annealing algorithm, and a particle swarm optimization algorithm; When the resource scheduling requirements change over time, a first target scheduling node is determined through an online algorithm, and a container is started through a node agent program of the first target scheduling node; When resource constraints involve multi-dimensional resource indicators, the first target scheduling node is determined through a mixed integer programming model; A corresponding packing algorithm is determined according to different resource scheduling constraints, a first target scheduling node is determined according to the packing algorithm, and a container is started through a node agent program of the first target scheduling node.
10. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the resource scheduling method according to any one of claims 1 to 9 when executing the computer program.
11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the resource scheduling method according to any one of claims 1 to 9.
12. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the resource scheduling method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Cluster resource load balancing method and device, electronic equipment and medium
CN114443284A
Resource scheduling method and device, computer readable storage medium and electronic equipment
CN114598665A