Scheduling method and device, electronic equipment, chip and storage medium

By filtering and matching the active state and resource saturation of candidate nodes in the Kubernetes scheduling method, the target node is determined, and the problems of unbalanced resource utilization and fragmentation in the existing technology are solved, and efficient resource utilization and waste reduction are achieved .

CN118939371APending Publication Date: 2024-11-12CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410989373.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

The existing Kubernetes scheduling algorithm fails to effectively balance the utilization rate of various resources of nodes, resulting in resource waste and fragmentation of single resources, and fails to constrain scheduling requirements for specific factors such as system kernel and network based on container applications.

Method used

A scheduling method is proposed to determine the resources required for the Pod to be scheduled, filter the candidate target nodes according to the active state and resource saturation of the candidate nodes, and determine the target nodes based on the matching degree of the available resources of the node and the required resources of the Pod to avoid nodes. Overload to achieve balanced utilization of resources.

Benefits of technology

It effectively avoids node overload, balances the utilization rate of various resources of nodes, reduces resource waste, and solves the fragmentation of single resource in cluster nodes caused by applications with relatively high single resource use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939371A_ABST
    Figure CN118939371A_ABST
Patent Text Reader

Abstract

The invention provides a scheduling method and device, electronic equipment, a chip and a medium, and the method comprises the steps: determining a first resource needed by a to-be-scheduled Pod; a candidate target node list is determined according to the active state and the resource saturation of the candidate nodes, and the candidate target node list comprises a plurality of candidate target nodes; determining the matching degree between the available resource of each candidate target node and the first resource, and determining a target node from the candidate target node list according to the matching degree; and scheduling the Pod to be scheduled to the target node. The utilization rate of various resources of nodes can be balanced, and resource waste is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of cloud computing, and in particular to a scheduling method, device, electronic device, chip and storage medium. Background Art

[0002] With the rise of container technology and cloud-native architecture, Kubernetes has become the de facto standard for container technology, and more and more servers are providing computing power to applications in the form of Kubernetes nodes. Summary of the invention

[0003] The present disclosure provides a scheduling method, device, electronic device, chip and storage medium, which can balance the utilization rate of various resources of nodes and reduce resource waste.

[0004] The first aspect of the present disclosure provides a scheduling method, which includes determining a first resource required for a Pod to be scheduled; determining a candidate target node list according to an active state and resource saturation of the candidate node, wherein the candidate target node list includes multiple candidate target nodes; determining a matching degree between available resources of each candidate target node and the first resource, and determining a target node from the candidate target node list according to the matching degree; and scheduling the Pod to be scheduled to the target node.

[0005] In some embodiments of the present disclosure, before determining a list of candidate target nodes based on the active status and resource saturation of the candidate nodes, the method also includes: determining nodes that meet preset constraints as candidate nodes; collecting real-time data of the candidate nodes; and determining the active status and resource saturation of the candidate nodes based on the real-time data.

[0006] In some embodiments of the present disclosure, determining a list of candidate target nodes based on the active state and resource saturation of the candidate node includes: when the resource saturation of the candidate node is less than or equal to a lower threshold, determining the candidate node as a candidate target node; when the resource saturation of the candidate node is greater than the lower threshold and less than or equal to an upper threshold, determining the active state of the candidate node; when the active state of the candidate node is inactive, determining the candidate node as a candidate target node.

[0007] In some embodiments of the present disclosure, determining the degree of match between the available resources of each candidate target node and the first resource includes: determining the types of resources contained in the candidate target node and the number of available resources; determining the type and number of the first resource; determining a resource matching function based on the types of resources contained in the candidate target node and the number of available resources, and the type and number of the first resource; using the resource matching function, determining the degree of match between the available resources of the candidate target node and the first resource.

[0008] In some embodiments of the present disclosure, scheduling the Pod to be scheduled to the target node includes: creating a scheduling object, the name and identifier of the scheduling object match the Pod to be scheduled, and the object reference field of the scheduling object includes the name of the target node; sending scheduling information to the interaction center.

[0009] A second aspect embodiment of the present disclosure proposes a scheduling device, including a first processing unit, used to determine a first resource required for a Pod to be scheduled; a second processing unit, used to determine a candidate target node list according to the active state and resource saturation of the candidate node, the candidate target node list including multiple candidate target nodes; a third processing unit, used to determine the matching degree between the available resources of each candidate target node and the first resource, and determine the target node from the candidate target node list according to the matching degree; and a fourth processing unit, used to schedule the Pod to be scheduled to the target node.

[0010] The third aspect embodiment of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the first aspect embodiment of the present disclosure.

[0011] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment of the present disclosure.

[0012] A fifth aspect embodiment of the present disclosure provides a computer program product, including a computer program, which executes the method described in the first aspect embodiment of the present disclosure when a processor is used to execute the computer program.

[0013] The sixth aspect embodiment of the present disclosure proposes a chip, which includes one or more interfaces and one or more processors; the interface is used to receive signals from a memory of an electronic device and send signals to the processor, the signals include computer instructions stored in the memory, and when the processor executes the computer instructions, the electronic device executes the method described in the first aspect embodiment of the present disclosure.

[0014] In summary, the scheduling method, device, electronic device, chip and storage medium proposed in the present invention can screen nodes according to the active status and resource saturation of the nodes, which can avoid causing node overload. By determining the target node according to the matching degree between the available resources of the node and the resources required by the Pod, and scheduling the Pod to the target node, the utilization rate of various resources of the node can be balanced and resource waste can be reduced.

[0015] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0017] Figure 1 A flowchart of a scheduling method provided by an embodiment of the present disclosure;

[0018] Figure 2 A flowchart of a scheduling method provided by an embodiment of the present disclosure;

[0019] Figure 3 A flowchart of a scheduling method provided by an embodiment of the present disclosure;

[0020] Figure 4 A flowchart of a method for scheduling computing power in a container-based cluster management system provided in an embodiment of the present disclosure;

[0021] Figure 5 A schematic diagram of a node filtering process based on activity and saturation provided in an embodiment of the present disclosure;

[0022] Figure 6 A schematic diagram of the structure of a scheduling device provided in an embodiment of the present disclosure;

[0023] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure;

[0024] Figure 8 A schematic diagram of the chip structure provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0025] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.

[0026] With the rise of container technology and cloud-native architecture, Kubernetes has become the de facto standard for container technology, and more and more servers provide computing power to applications in the form of Kubernetes nodes. Among them, Scheduler is the scheduler of Kubernetes. Its main function is to discover newly created Pods in the cluster that have not yet been scheduled to nodes through the monitoring (Watch) mechanism of Kubernetes. The scheduler will schedule each unscheduled Pod found to a suitable node to run. The Scheduler scheduling method includes two steps when making a scheduling selection for a Pod: filtering and scoring. The filtering stage selects all nodes that meet the Pod scheduling requirements. For example, the PodFitsResources filter function checks whether the available resources of the candidate node can meet the resource request of the Pod. After filtering, a node list is obtained, which contains all schedulable nodes; usually, this node list contains more than one node. If this list is empty, it means that the Pod is not schedulable. In the scoring stage, the scheduler selects the most suitable node for the Pod from all schedulable nodes. According to the currently enabled scoring rules, the scheduler will score each schedulable node. Finally, the scheduler will schedule the Pod to the node with the highest score. If there are multiple nodes with the highest scores, the scheduler will randomly select one of them.

[0027] It can be seen from the default scheduling mechanism of Kubernetes that in terms of constraint scheduling algorithm, in the filtering stage, Kubernetes mainly schedules the application Pod based on the statically configured CPU core number, memory size and other indicators of the cluster nodes. Because the cluster is based on Docker containers, the underlying application containers and the host share the network, disk, and system kernel with the host. Therefore, the cluster is insufficient in resource filtering and cannot meet the scheduling of specific tasks that require network, disk, and system kernel. In the prior art, there are improved scheduling algorithms that add indicators such as network bandwidth indicators, GPU, disk IO, and other highly relevant indicators for specific scenarios into the scoring formula. However, if it is a simple static indicator, there will often be a situation where the node Pod has occupied most of the resources, but the Pod is still allocated. This directly leads to the problem of slow response time of hot application services and poor user experience. In a cluster with hot application services deployed, resources such as network bandwidth and disk IO should take into account the actual usage of Pods on nodes.

[0028] The existing scheduling algorithm still does not consider the difference in the demand for various resources by application services. For example, storage-type application services occupy a relatively high amount of disk IO, while computing-type application services occupy a relatively high amount of CPU (or GPU). If only storage-type application services are deployed on cluster nodes, other resources of the node will be seriously wasted, which is easy to cause the problem of single resource fragmentation. It is necessary to consider the balanced utilization rate of various resources on each node.

[0029] Related technology discloses a method and device for scheduling tasks and machine constraints based on Kubernetes clusters, wherein the method includes: traversing all available machine nodes and obtaining resource information of each available machine node; calculating the average network storage transmission rate score of each available Node; calculating the constraint weight score of each available machine node according to the resource information of the machine node and the average network storage transmission rate score of each available Node; calculating the priority of scheduling the constraint task to the corresponding node according to the constraint weight score, and creating and running the task Pod on the Node with the highest priority. The method and device for scheduling tasks and machine constraints of Kubernetes clusters provided by the embodiments of the present invention solve the problem that the Kubernetes cluster cannot realize the scheduling of containers to machine nodes in the cluster according to the constraint scheduling requirements of specific factors such as the system kernel and the network in the container application.

[0030] This method traverses all available nodes in the cluster and obtains the resource information of each available node; calculates the average network storage transmission rate score of each available node; calculates the constraint weight score of each available node based on the node resource information and the average network storage transmission rate score; calculates the priority of scheduling the constrained task to the corresponding node based on the constraint weight score, and creates and runs the task Pod on the node with the highest priority. This solves the problem that the Kubernetes cluster cannot schedule containers to machine nodes based on the constraints of specific factors such as the system kernel and network in the container application. However, this method only considers the ratio of available resources to total resources, and does not consider the serious fragmentation of a single resource; and the weight factor of a single resource in the total resources is relatively empirical, and the workload of parameter adjustment is high.

[0031] Related technology proposes a Kubernetes scheduling method based on a genetic algorithm improved by real-time Pod traffic data. The method uses the real inbound and outbound traffic data of the Pod on the cluster nodes and introduces a genetic algorithm to make the scheduling more load-balanced. The method includes the following steps: (1) Capturing the real-time Pod inbound and outbound traffic of the cluster nodes based on Istio, and capturing the CPU and memory utilization indicator data obtained based on Prometheus; (2) Calculating the node type weighted mean of the three data to obtain the real comprehensive resource utilization rate of the node; (3) Introducing a genetic algorithm, binary encoding the allocation scheme of the Pod and the node, and calculating the absolute difference between the obtained real comprehensive resource utilization rate and its standard deviation as the fitness formula of the population individual; (4) When the cluster tends to load balance or the algorithm reaches the maximum number of iterations, the iteration stops, and the final node fitness is used as the node score.

[0032] This method is based on the statistics of real-time Pod in-and-out traffic, CPU and memory utilization index data on cluster nodes; the node type weighted mean is calculated to obtain the real comprehensive resource utilization rate of the node; and a genetic algorithm is introduced to calculate the absolute difference between the obtained real comprehensive resource utilization rate and its standard deviation as the fitness formula of the population individual; finally, the cluster tends to load balance or the algorithm stops iteration when the maximum number of iterations is reached, and the final node fitness is used as the node score to improve Pod scheduling. Patent 2 only considers the comprehensive utilization rate of three indicators: Pod traffic, CPU and memory, and its applicability to application services is relatively narrow; and the comprehensive utilization rate calculation factor comprehensively considers the three indicators, indicating the comprehensive utilization rate, and does not consider the single resource fragmentation of the introduced cluster node due to the high utilization of single resources.

[0033] Related technology discloses a Kubernetes optimization scheduling method and system based on running virtual machines in containers, which relates to the field of container orchestration technology. The request for applying to create a virtual machine object is intercepted by Admission Webhook in Kubernetes, and the KubeVirt resource allocation is analyzed by Admission Webhook according to the resource usage of the existing virtual machine Pod. Under the condition that the virtual machine resources remain unchanged, the oversold ratio of KubeVirt configuration is modified by Admission Webhook, and the number of resource requests for the virtual machine object is calculated according to the modified oversold ratio, the configuration of the virtual object is modified, and the number of resources requested by the virtual machine Pod is reset. The request to create the virtual machine object is released and the virtual machine object is created, and the corresponding virtual machine Pod is created according to the virtual machine object. The cluster scheduler Scheduler uses the pre-selection algorithm and the optimization algorithm to select cluster nodes in turn, and the virtual machine Pod is scheduled to run on the selected cluster nodes. The single resource fragmentation of cluster nodes introduced by applications with high single resource usage is not considered.

[0034] Therefore, in order to solve the above technical problems, the present invention proposes a scheduling method, which can improve the filtering (Filter) and scoring (Score) stages of the native Kubernetes scheduler.

[0035] The specific contents of this method are as follows.

[0036] Figure 1 A flow chart of a target frequency determination method provided by an embodiment of the present disclosure. Figure 1 As shown, the method may include the following steps.

[0037] Step 101: determine the first resource required by the Pod to be scheduled.

[0038] In some embodiments, the first resource required by the Pod to be scheduled can be determined. By way of example, the first resource is related to the application service included in the Pod to be scheduled. For example, when the application service included in the Pod is a data computing application service, the first resource required by the Pod can be CPU resources, memory resources, etc.; when the application service included in the Pod is an image computing application service, the first resource required by the Pod can be GPU resources, memory resources, etc.

[0039] Step 102: Determine a list of candidate target nodes according to the activity status and resource saturation of the candidate nodes.

[0040] In some embodiments, the candidate target node list includes multiple candidate target nodes.

[0041] In some embodiments, for example, the activity state and resource saturation of the node can be determined based on the real-time data of the node. The activity state of the node can include: active, normal, and indifferent, and the inactive state can include a normal state and an indifferent state.

[0042] In some embodiments, a candidate node can be determined as a candidate target node when the resource saturation of the candidate node is less than or equal to a lower threshold, wherein the lower threshold can be specified according to the actual application scenario, for example, the lower threshold of the resource saturation can be specified as 50%, and the present disclosure does not limit this.

[0043] Specifically, when the resource saturation of a node is less than or equal to a lower threshold, it indicates that the node has a large amount of resource margin, and at this time, the node can be determined as a candidate target node.

[0044] In some embodiments, the active state of the candidate node can be determined when the resource saturation of the candidate node is greater than a lower threshold and less than or equal to an upper threshold, and when the active state of the candidate node is inactive, the candidate node is determined to be a candidate target node.

[0045] In some embodiments, when the resource saturation of a candidate node is greater than an upper threshold, it indicates that the resource usage of the candidate node has been saturated. At this time, scheduling a Pod to the node may cause node overload. Therefore, the node can be removed and other candidate nodes can be screened in a cycle.

[0046] In some embodiments, a list of candidate target nodes may be determined based on the candidate target nodes determined above.

[0047] Step 103: determine the matching degree between the available resources of each candidate target node and the first resource, and determine the target node from the candidate target node list according to the matching degree.

[0048] In some embodiments, the types of resources contained in the candidate target node and the number of available resources can be determined, where the resource types include CPU resources, memory resources, disk resources, etc. For example, the types of resources contained in the candidate target node and the number of available resources can be obtained through metrics server, Istio and Prometheus services.

[0049] In some embodiments, the type and quantity of the first resource may be determined, that is, the type and quantity of the resource required for the Pod to be scheduled may be determined.

[0050] In some embodiments, a resource matching function may be determined according to the resource types and available resource quantities of the candidate target nodes, and the types and quantities of the first resources. Specifically, the resource matching function may be expressed as follows:

[0051]

[0052] Among them, ρ i is the matching degree between the available resources of the candidate target node and the first resource, J represents the total number of computing power resource categories (CPU, memory, disk, bandwidth, etc.) owned by the candidate target node; X ij P represents the variable of available computing resources of type j for candidate target node i; j Indicates the number of j-type computing resources required by the Pod to be scheduled. ρ is calculated based on each candidate node. i , select the candidate target node with the best matching rate as the target node.

[0053] In some embodiments, a resource matching function can be used to determine the matching degree between the available resources of the candidate target node and the first resource. Specifically, the resource matching function can determine the matching degree between the resources required by the Pod to be scheduled and the available resources of multiple candidate target nodes. For example, the resources required by the Pod to be scheduled are memory resources and CPU resources, and the resource types owned by the candidate target node A are CPU resources, memory resources, and disk resources, of which the CPU resource available margin is 80%, the memory resource available margin is 70%, and the disk resource is available 30%. The resource types owned by the candidate target node B are CPU resources, memory resources, and GPU resources, of which the CPU resource available margin is 40%, the memory resource available margin is 40%, and the GPU resource is available 30%. It can be determined through the resource matching function that the resource matching degree between the Pod to be scheduled and the candidate target node A is higher at this time.

[0054] In some embodiments, for example, the candidate target node in the candidate target node list with the highest resource matching degree with the resources required by the Pod to be scheduled can be determined as the target node. For example, when there are multiple candidate target nodes with the highest resource matching degree, one of the candidate target nodes with the highest resource matching degree can be selected as the target node. The specific selection method can be set according to the actual situation, for example, it can be specified or randomly determined, and this disclosure is not limited to this.

[0055] Step 104: Schedule the Pod to be scheduled to the target node.

[0056] In some embodiments, after the target node is determined, the Pod to be scheduled can be scheduled to the target node, so that the target node can process the application included in the Pod to be scheduled.

[0057] In summary, the above embodiments of the present application can screen nodes according to the active status and resource saturation of the nodes, thereby avoiding causing node overload. By determining the target node based on the matching degree between the available resources of the node and the resources required by the Pod, and scheduling the Pod to the target node, the utilization rate of various resources of the node can be balanced and resource waste can be reduced.

[0058] Figure 2 A flow chart of a target frequency determination method provided by an embodiment of the present disclosure. Figure 2 As shown, the method may include the following steps.

[0059] Step 201: determine nodes that meet preset constraints as candidate nodes.

[0060] In some embodiments, before determining a list of candidate target nodes based on the activity status and resource saturation of the candidate nodes, nodes that meet preset constraints may also be determined as candidate nodes.

[0061] In some embodiments, the preset constraints may be Kubernetes' own constraints, such as node selector nodeSelector, port availability, volume conflicts, etc. Specifically, the preset constraints may be set based on actual scenarios, which is not limited by the present disclosure.

[0062] Step 202: Collect real-time data of candidate nodes.

[0063] In some embodiments, the metrics-controller service can be used to collect real-time data of candidate nodes in real time. The real-time data can be, for example, the real-time memory utilization, real-time inbound and outbound traffic, etc. of the candidate nodes. That is, the metrics-controller service is based on the metrics server, Istio and Prometheus to capture the real-time inbound and outbound traffic on the candidate nodes as well as CPU and memory utilization, disk IO and other indicators.

[0064] Step 203: Determine the activity status and resource saturation of the candidate nodes according to the real-time data.

[0065] In some embodiments, optionally, the metrics-controller service may determine the activity status and resource saturation of the candidate nodes based on real-time data.

[0066] Specifically, the steps for determining the active status of a candidate node are as follows:

[0067] 1. Determine the data set X based on the collected data of the candidate nodes. For example, the real-time memory utilization of the candidate nodes can be collected, and a data set is generated based on the real-time collected memory utilization and the previously collected memory utilization. For example, one day's memory utilization data can be collected to generate a data set.

[0068] Specifically, the data set can be expressed as X = {x1, x2, x3, ..., x n}.

[0069] Optionally, different types of real-time data may be collected for the same candidate node and combined with historical data to generate a data set, which is not limited in the present disclosure.

[0070] 2. Determine the average value of all data in the data set. The formula can be expressed as

[0071] 3. Determine the active status of the candidate node based on the average value of the above data set.

[0072] When the average value is less than the activity threshold, the candidate node is determined to be a cold node, that is, an inactive node. Preferably, the activity threshold can be determined to be 0, or the activity threshold can be determined to be 0.01% of the resource value required for the Pod to be scheduled, that is, 0.01% of the first resource amount. The activity threshold can be set according to actual needs, which is not limited in the present disclosure.

[0073] When the average value is not less than the activity threshold, we can take the i-th data and the i+c-th data in the data set to form a pair of data, that is, take x i and x i+c Composed of a pair of data (x i ,x i+c ∈X), expressed as (x1,x 1+c ),(x2,x 2+c ),(x3,x 3+c )……

[0074] in,

[0075]

[0076] When n is an even number, there are c pairs of data; when n is an odd number, there are c-1 pairs of data.

[0077] 4. Take the difference between the two numbers of each pair of data and record it as D i =(x i+v -x i ).

[0078] Use S + Record D i is a positive quantity; S - Record D i is a negative quantity. When there are more positive signs, S + The number will be larger, S - The number will be relatively small, and the activity tends to increase. Otherwise, the activity tends to decrease.

[0079] Under the null hypothesis that there is no trend, they should follow the binomial distribution b(nn,0.5), where nn is the number of pairs (excluding the number of pairs with a difference of 0).

[0080] 5. Use the sign test method to test. Take the test statistic K = min (S + ,S - ), then

[0081] p K =2*cdf(K,nn,0.5)

[0082] Where cdf(K,nn,0.5) is the probability (cumulative) distribution function, p KIt can represent the confidence level, that is, S + The probability of the minimum value or S - The probability of being the minimum value.

[0083] 6. Based on p K The results can be judged as follows:

[0084] If S + >S - &&p K <0.05 The activity has an increasing trend and can be regarded as becoming active. At this time, the candidate node is in active state;

[0085] If S + - &&p K <0.05 indicates that the activity is decreasing, which can be regarded as becoming cold. At this time, the candidate node is in a cold state;

[0086] Otherwise, there is no change trend and the candidate node can be regarded as being in a normal state, that is, inactive.

[0087] In some embodiments, the resource saturation of the candidate node may be determined based on the collected real-time data of the candidate node. For example, the resource saturation is the comprehensive saturation of the resources owned by the candidate node. The resource saturation of the candidate node may be determined based on the following formula:

[0088]

[0089] Among them, R i is the resource saturation of the candidate node, k ij Indicates the weight coefficient of resource type j in node i, the default is k ij =1, but it can also be In other words, when a candidate node has multiple resources, different weights can be set for different resource types. Optionally, the weights of all types of resources on the same node are added together to 1. ij represents the total number of resources of type j available in node i; n ij Indicates the number of used resources of type j in node i.

[0090] In summary, the above embodiments of the present application can determine the activity and resource saturation of the candidate nodes based on the real-time data of the candidate nodes. The real-time status of the candidate nodes can be determined through the real-time data, thereby avoiding the situation where the node is still assigned a Pod when it is already saturated due to untimely node status updates, and avoiding node overload.

[0091] Figure 3 A flowchart of a scheduling method provided by an embodiment of the present disclosure is shown in FIG. Figure 3 ​As shown, the method may include the following steps.

[0092] Step 301, create a scheduling object.

[0093] In some embodiments, when scheduling a Pod, a scheduling object may be created, wherein the name and identifier of the scheduling object match the Pod to be scheduled, and the object reference (ObjectReference) field of the scheduling object includes the name of the target node.

[0094] Specifically, the scheduling object may be a Binding object, which may be used to bind the scheduled Pod and the target node together to complete the scheduling. The name (Name) and identifier (Uid) of the Binding object match the Pod to be scheduled.

[0095] Step 302: Send scheduling information to the interaction center.

[0096] In some embodiments, specifically, the scheduling information may be a POST request, and the interaction center may be a kube-apiserver. In other words, resource scheduling may be completed by sending a POST request to the kube-apiserver.

[0097] In some embodiments, a POST request is sent to the kube-apiserver, and the scheduling object binding information can be stored in the etcd database, so that the node can complete subsequent operations based on the relevant information.

[0098] In summary, the above embodiments of the present application can implement the scheduling of the Pod by creating a scheduling object to bind the Pod to be scheduled with the target node, and sending the scheduling information to the interaction center.

[0099] For the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present disclosure is not limited by the described order of actions, because according to the present disclosure, certain steps can be performed in other orders or simultaneously.

[0100] Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.

[0101] The technical solution of the present disclosure is further described in detail below in conjunction with specific application examples.

[0102] The present disclosure provides a method for scheduling computing power in a container-based cluster management system.

[0103] This example proposes improvements to the filtering and scoring stages of the native Kubernetes scheduler. The overall technical solution process of the present invention is as follows: Figure 4 As shown,

[0104] When the Kubernetes cluster receives a request from the client to create an instance, it will go through a series of controllers related to resource instances in the Kubernetes cluster for parsing, and finally obtain the dependent resource topology structure and store it in etcd. The next stage is the Scheduler stage. In order to find a suitable cluster node, the Scheduler will obtain the cluster node resource information and filter out the suitable scheduling node in combination with a specific algorithm; then, the Scheduler will create a binding object whose name (Name) and identifier (Uid) match the Pod, and its object reference (ObjectReference) field contains the name of the selected scheduling node, and then send a POST request to the kube-apiserver to complete the resource scheduling.

[0105] The present invention adds a metrics-controller service that regularly summarizes cluster information to assist the Scheduler filtering stage. The metrics-controller service captures real-time inbound and outbound traffic on cluster nodes, as well as CPU and memory utilization, disk IO and other indicators based on metrics server, Istio and Prometheus. The metrics-controller service determines whether the status of cluster nodes tends to be active based on the time series trend, and labels the status - active, normal, indifferent.

[0106] The specific activity determination method is as follows:

[0107] According to the collected indicator data, take n data (usually the amount of data in one day) to form a data set X, X = {x1, x2, x3, ..., x n}.

[0108] Calculate the average

[0109] if If it is less than the threshold (usually 0, usually recommended to be 0.01% of the Pod request resource value), it can be considered a cold node.

[0110] Otherwise, take x i and x i+c Composed of a pair of data (x i ,x i+c∈X), a total of c pairs of data are generated. (x1,x 1+c ),(x2,x 2+c ),(x3,x 3+c )……

[0111]

[0112] When n is an even number, there are c pairs; when n is an odd number, there are c-1 pairs.

[0113] Take the difference between the two numbers in each pair and record it as D i =(x i+c -x i ).

[0114] Another S + Record D i is a positive quantity; S - Record D i is a negative quantity. Obviously, when there are more positive signs, S + The number will be larger, S - The number will be relatively small, and the activity has an upward trend. Conversely, it has a downward trend.

[0115] Under the null hypothesis of no trend, they should follow the binomial distribution b(nn,0.5). Here nn is the number of pairs (excluding the number of pairs with a difference of 0)

[0116] Use the sign test method to test. Take the test statistic K = min (S + ,S - ), then

[0117] p K =2*cdf(K,nn,0.5)

[0118] where cdf(K,nn,0.5) is the probability (cumulative) distribution function.

[0119] Based on p K The results can be judged as follows:

[0120] If S + >S - &&p K <0.05 The activity level has an increasing trend and can be regarded as becoming more active;

[0121] If S + - &&p K <0.05 indicates a decreasing trend in activity, which can be considered as becoming apathetic;

[0122] Otherwise, there is no trend of change and it can be considered normal.

[0123] ​The metrics-controller service also obtains the actual usage of various computing resources (CPU, memory, disk, etc.) of the existing Kubernetes cluster nodes based on the metrics server, Istio, and Prometheus services. The comprehensive resource saturation of each node is calculated based on the following formula:

[0124]

[0125] Among them, k ij Indicates the weight coefficient of resource type j in node i, the default is k ij =1, but it can also be In this case, the weight is adjusted according to the importance of resource category. ij represents the total number of resources of type j available in node i; n ij Indicates the number of used resources of type j in node i.

[0126] (I) Optimization of the filtering stage: Node filtering and screening based on activity and saturation

[0127] Optimization in the filtering stage: After filtering based on Kubernetes' own constraints (node ​​selector, port availability, volume conflicts, etc.), a new filtering based on the comprehensive consideration of node computing resource saturation and activity is added to avoid the situation where a single static indicator of computing resource causes an overloaded node and a Pod is still assigned. Figure 5 As shown:

[0128] For the candidate node list, if the node saturation is greater than the upper threshold (specifiable, 95% is recommended), the node computing resources are considered to be saturated, the candidate node is removed, and other candidate nodes are screened in a loop; otherwise, if the node saturation is greater than the lower threshold (specifiable, 50% is recommended), the node computing resources are at a normal usage level, considering the current node activity, if there is an active label, it means that the current node activity has an upward trend, the candidate node is removed, and other candidate nodes are screened in a loop; otherwise, it can be used as a candidate node in other cases.

[0129] (II) Scoring stage optimization: Based on the new scoring algorithm, the matching degree between the Pod required resources and the available resources of the cluster nodes is calculated.

[0130] In order to avoid the problem of cluster node computing resource fragmentation caused by applications that use a single computing resource too much, this solution introduces a new scoring algorithm to obtain the usage of various computing resources (CPU, memory, disk, etc.) of existing Kubernetes cluster nodes through metrics server, Istio and Prometheus services.

[0131] According to the current node computing resource usage, the matching degree between the Pod required resources and the cluster node available resources is calculated according to the following formula:

[0132]

[0133] Where J represents the total number of computing resource categories (CPU, memory, disk, bandwidth, etc.) owned by the cluster nodes; X ij P represents the number of available computing resources of type j at cluster node i; j Indicates the number of j-type computing resources required by the Pod. ρ is calculated based on each candidate node. i , select the cluster node with the best matching rate.

[0134] In summary, the above examples of the present disclosure introduce an algorithm based on the matching degree of available computing resources of nodes to select the best matching node in the scoring stage of the Scheduler, so as to avoid the problem of fragmentation of computing resources of cluster nodes introduced by applications with high usage of single computing resources. In the filtering stage of the Scheduler, a new filter is added based on comprehensive consideration of the saturation and activity of node resource computing resources to avoid the situation where overloaded nodes are still assigned Pods due to simple static indicators of computing resources. A metrics-controller service is introduced to regularly summarize cluster indicator information, add specific indicator labels to cluster nodes, and improve the efficiency of summarizing effective indicator information.

[0135] Figure 6 600 is a block diagram of a scheduling device 600 provided in an embodiment of the present disclosure. Figure 6 As shown, the device 600 includes: a first processing unit 610, used to determine the first resource required for the Pod to be scheduled; a second processing unit 620, used to determine a candidate target node list according to the active state and resource saturation of the candidate node, the candidate target node list including multiple candidate target nodes; a third processing unit 630, used to determine the matching degree between the available resources of each candidate target node and the first resource, and determine the target node from the candidate target node list according to the matching degree; a fourth processing unit 640, used to schedule the Pod to be scheduled to the target node.

[0136] In summary, the above-mentioned device disclosed in the present invention can screen nodes according to the active status and resource saturation of the nodes, which can avoid causing node overload. By determining the target node according to the matching degree between the available resources of the node and the resources required by the Pod, and scheduling the Pod to the target node, the utilization rate of various resources of the node can be balanced and resource waste can be reduced.

[0137] In some embodiments, the scheduling device also includes a fifth processing unit, which is used to determine nodes that meet preset constraints as candidate nodes; collect real-time data of the candidate nodes; and determine the activity status and resource saturation of the candidate nodes based on the real-time data.

[0138] In some embodiments, the second processing unit can also be used to determine that the candidate node is a candidate target node when the resource saturation of the candidate node is less than or equal to a lower threshold value; determine the active state of the candidate node when the resource saturation of the candidate node is greater than the lower threshold value and less than or equal to the upper threshold value; and when the active state of the candidate node is inactive, determine the candidate node as a candidate target node.

[0139] In some embodiments, the third processing unit can also be used to determine the types of resources contained in the candidate target node and the number of available resources; determine the type and quantity of the first resource; determine the resource matching function based on the types of resources contained in the candidate target node and the number of available resources, and the type and quantity of the first resource; use the resource matching function to determine the matching degree between the available resources of the candidate target node and the first resource.

[0140] In some embodiments, the fourth processing unit can also be used to create a scheduling object, the name and identifier of the scheduling object match the Pod to be scheduled, and the object reference field of the scheduling object includes the name of the target node; and send scheduling information to the interaction center.

[0141] Figure 7 A block diagram of an electronic device 700 for implementing the above method is provided in an embodiment of the present disclosure.

[0142] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiment of the present disclosure, the embodiment of the present disclosure also provides an electronic device, such as Figure 7 As shown, the electronic device 700 includes:

[0143] Communication interface 701, capable of exchanging information with other devices;

[0144] The processor 702 is connected to the communication interface 701 to implement information interaction with other devices, and is used to execute the method provided by one or more of the above technical solutions when running the computer program;

[0145] The computer program is stored in the memory 703 .

[0146] It should be noted that the specific processing process of the processor 702 can be understood by referring to the above method.

[0147] Of course, in actual application, the various components in the electronic device 700 are coupled together through the bus system 704. It can be understood that the bus system 704 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 704 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 7 Various buses are labeled as bus system 704 .

[0148] The memory 703 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device 700. Examples of such data include: any computer program used to operate on the electronic device 700.

[0149] The method disclosed in the above embodiment of the present application can be applied to the processor 702, or implemented by the processor 702. The processor 702 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 702. The above-mentioned first processor 702 may be a general-purpose processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 702 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 703, and the processor 702 reads the information in the memory 703 and completes the steps of the above method in combination with its hardware.

[0150] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0151] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by a processor 720 of an electronic device 700 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0152] The embodiments of the present disclosure further provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the above embodiments of the present disclosure.

[0153] The embodiments of the present disclosure further provide a computer program product, including a computer program, which implements the method described in the above embodiments of the present disclosure when executed by a processor.

[0154] The embodiment of the present disclosure also provides a chip, such as Figure 8 As shown, the chip includes a processor 810 and an interface 820. The number of the processor 810 may be one or more, the number of the interface 820 may be multiple, and the interface circuit is used to receive a signal from the memory of the electronic device and send a signal to the processor, the signal includes a computer instruction stored in the memory, and when the processor executes the computer instruction, the electronic device executes the method described in the above embodiment of the present disclosure.

[0155] It should be noted that, for the convenience of description, only the parts related to the relevant invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other.

[0156] It should be understood that the "system", "device", "unit" and / or "module" used in this application is a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the word can be replaced by other expressions.

[0157] As shown in this application and claims, unless the context clearly indicates an exception, the words "a", "an", "a kind" and / or "the" do not refer to the singular, but also include the plural. Generally speaking, the terms "include" and "comprise" only indicate the inclusion of clearly identified steps and elements, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements. The elements defined by the sentence "includes a..." do not exclude the existence of other identical elements in the process, method, commodity or device that includes the elements.

[0158] In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0159] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.

[0160] Flowcharts are used in the present application to illustrate the operations performed by the system according to the embodiments of the present application. It should be understood that the preceding or following operations are not necessarily performed accurately in order. On the contrary, the various steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes, or one or more operations may be removed from these processes.

[0161] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0162] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.

[0163] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including an acquisition module, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (control method), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.

[0164] It should be understood that the various parts of the embodiments of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0165] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0166] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent commodity, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0167] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A scheduling method, characterized in that: The method comprises: Determine the first resource required for the Pod to be scheduled; Determine a candidate target node list according to the active state and resource saturation of the candidate node, wherein the candidate target node list includes multiple candidate target nodes; Determine a matching degree between available resources of each candidate target node and the first resource, and determine a target node from the candidate target node list according to the matching degree; Schedule the Pod to be scheduled to the target node.

2. The method according to claim 1, characterized in that Before determining the candidate target node list according to the active state and resource saturation of the candidate nodes, the method further includes: Determine a node that meets a preset constraint condition as the candidate node; Collecting real-time data of the candidate nodes; The active state and the resource saturation of the candidate node are determined according to the real-time data.

3. The method according to claim 1, characterized in that: Determining the candidate target node list according to the active state and resource saturation of the candidate nodes includes: When the resource saturation of the candidate node is less than or equal to a lower threshold, determining the candidate node as the candidate target node; When the resource saturation of the candidate node is greater than the lower threshold and less than or equal to the upper threshold, the active state of the candidate node is determined; when the active state of the candidate node is inactive, the candidate node is determined to be the candidate target node.

4. The method according to claim 1, characterized in that: Determining the matching degree between the available resources of each candidate target node and the first resource includes: Determine the resource types and available resource quantities included in the candidate target node; Determining the type and quantity of the first resource; Determine a resource matching function according to the resource types included in the candidate target node and the quantity of the available resources, and the type and quantity of the first resource; The resource matching function is used to determine the matching degree between the available resources of the candidate target node and the first resource.

5. The method according to claim 1, characterized in that Scheduling the Pod to be scheduled to the target node includes: Create a scheduling object, the name and identifier of the scheduling object match the Pod to be scheduled, and the object reference field of the scheduling object includes the name of the target node; Send scheduling information to the interaction center.

6. A scheduling device, characterized in that: The device includes: A first processing unit, configured to determine a first resource required by the Pod to be scheduled; A second processing unit is used to determine a candidate target node list according to the active state and resource saturation of the candidate node, wherein the candidate target node list includes multiple candidate target nodes; a third processing unit, configured to determine a matching degree between the available resources of each candidate target node and the first resource, and determine a target node from the candidate target node list according to the matching degree; The fourth processing unit is configured to schedule the Pod to be scheduled to the target node.

7. An electronic device, characterized in that: include: one or more processors; A storage device communicatively connected to the one or more processors, on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-5.

9. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 5.

10. A chip, characterized in that: It comprises one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory of an electronic device and send the signal to the processor, the signal includes a computer instruction stored in the memory, and when the processor executes the computer instruction, the electronic device executes the method described in any one of claims 1 to 5.