Resource scheduling method and device, equipment, storage medium and program product
By improving artificial bee colony and ant colony algorithms, combined with node load data filtering and resource weight calculation, the problem of uneven resource sharding in Kubernetes resource scheduling is solved, achieving more efficient resource utilization and load balancing.
Patent Information
- Application Number
- CN202511350219.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-22
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2045-09-22
AI Technical Summary
Existing Kubernetes resource scheduling algorithms do not fully consider the actual proportion of CPU, memory, bandwidth, and disk capacity used on nodes, resulting in uneven resource sharding and affecting resource utilization and load balancing.
By introducing an improved artificial bee colony algorithm, combining historical and predicted load data of nodes, suitable candidate nodes are selected, and performance scores are calculated based on the resource type and weight of the Pod. An improved ant colony algorithm is then used for global optimization to determine the target node of the Pod.
This achieves balanced resource deployment, improves cluster resource utilization and load balancing, and avoids the problem of uneven node load.
Smart Images

Figure CN120849063A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of resource scheduling technology, and in particular to a resource scheduling method, apparatus, equipment, storage medium, and program product. Background Technology
[0002] Kubernetes is a container orchestration tool for deploying and managing containerized applications. It primarily utilizes Pod-based resource scheduling (the smallest unit of deployment, containing one or more containers). Specifically, it first selects nodes that meet the resource requirements of the Pod application, then scores the nodes based on their remaining CPU and memory utilization, and selects the node with the highest score to deploy the Pod application.
[0003] However, Pod-based resource scheduling algorithms rely primarily on CPU and memory resources for decision-making when dealing with Pods. They do not fully consider the impact of the actual occupancy ratio of CPU, memory, bandwidth, and disk capacity on node performance. Furthermore, they ignore the dynamic changes in actual node resources, making Pod-based resource scheduling algorithms inadequate when dealing with diverse applications and resulting in uneven resource sharding. Summary of the Invention
[0004] To address the problems existing in the prior art, embodiments of the present invention provide a resource scheduling method, apparatus, device, storage medium, and program product, which can achieve balanced deployment of resources and improve the resource utilization and load balancing of the entire cluster.
[0005] In a first aspect, embodiments of the present invention provide a resource scheduling method, including: By intercepting Pods created in the Kubernetes cluster, multiple Pods are obtained that are to be scheduled. Based on the resource types and resource requirements of the multiple Pods to be scheduled, and the resource information of the nodes in the Kubernetes cluster, multiple nodes to be deployed are selected from the Kubernetes cluster. According to the resource scheduling strategy based on the improved artificial bee colony algorithm, the target node of each Pod to be scheduled is determined from the multiple nodes to be deployed, and the multiple Pods to be scheduled are deployed to the corresponding target nodes.
[0006] As an improvement to the above solution, the Pods created in the Kubernetes cluster are intercepted to obtain multiple Pods to be scheduled, including: Within a preset retention period, Pods created in the Kubernetes cluster are retained; wherein, the retention period is determined based on the Pod request rate and the Pod latency tolerance. If the number of pods that are withheld reaches a preset threshold, the withheld pods will be designated as pods to be scheduled.
[0007] As an improvement to the above solution, the step of selecting multiple nodes to be deployed from the Kubernetes cluster based on the resource types and resource requirements of the multiple Pods to be scheduled and the resource information of the nodes in the Kubernetes cluster includes: Based on the resource requirements of each Pod to be scheduled, the Pods to be scheduled are classified into different types to determine the resource type of each Pod to be scheduled. Based on the historical load data of each node in the Kubernetes cluster, the predicted load data of each node for multiple time units within a set future time period is obtained, and based on the predicted load data of the nodes, multiple candidate nodes are selected from the nodes of the Kubernetes cluster. Based on the resource types of the multiple Pods to be scheduled and the resource information of the multiple candidate nodes, multiple nodes to be deployed are selected from the multiple candidate nodes.
[0008] As an improvement to the above solution, the step involves obtaining predicted load data for each node over a set period of time based on historical load data of each node in the Kubernetes cluster, and then selecting multiple candidate nodes from the nodes of the Kubernetes cluster based on the predicted load data of the nodes, including: Determine whether the CPU resource utilization of each node exceeds a preset utilization threshold; If not, the corresponding node will be considered a candidate node; If so, obtain the CPU load data collected within the specified time period of the corresponding node as historical load data; Based on the historical load data of the corresponding node, CPU load is predicted using a preset load prediction model to obtain the predicted load data of the corresponding node for multiple time units within a set future time period. Determine whether the predicted load data of the corresponding node in multiple time units within a future set time period meets the preset load conditions; the load conditions include: there exists at least a first set number of predicted load data exceeding the preset load threshold; When the load conditions are met, the corresponding node is considered a candidate node.
[0009] As an improvement to the above solution, the step of selecting multiple deployment nodes from multiple candidate nodes based on the resource types of multiple Pods to be scheduled and the resource information of multiple candidate nodes includes: Based on the resource type of each Pod to be scheduled, determine the weight of each Pod to be scheduled in terms of CPU, memory, network bandwidth, and disk space; Based on the resource information of each candidate node, determine the total resource amount and used resource amount of each candidate node in CPU, memory, network bandwidth, and disk space, and the requested resource amount of the Pod to be scheduled in CPU, memory, network bandwidth, and disk space. Based on the total resource amount, the used resource amount, and the requested resource amount, determine the resource usage and remaining resource amount of each candidate node in CPU, memory, network bandwidth, and disk space after scheduling the Pod. Based on the weights of each Pod to be scheduled in terms of CPU, memory, network bandwidth, and disk space, and the resource usage, remaining resources, and disk read / write speed of each candidate node in terms of CPU, memory, network bandwidth, and disk space, calculate the performance score of each candidate node. Based on the performance scores of each candidate node, a plurality of nodes to be deployed are selected from the plurality of candidate nodes.
[0010] As an improvement to the above scheme, the step of determining the target node for each scheduled Pod from among multiple nodes to be deployed, based on a resource scheduling strategy using an improved artificial bee colony algorithm, includes: Initialize the bee colony based on the multiple Pods to be scheduled, and initialize the search space based on the multiple nodes to be deployed; During the hired bee search phase, an improved ant colony algorithm is used to globally optimize the search space and determine the first search area; During the bee selection phase, a preset adaptive random rule distribution is used to update the position of the first search area to determine the second search area; During the scout bee search phase, the fitness value of each location in the second search area is calculated, and the optimal location of the bee colony is determined based on the fitness value of each location in the second search area; wherein, each location corresponds to one node to be deployed; The optimal position of the bee colony is iteratively updated to determine the most suitable position for the bee colony. Based on the node to be deployed indicated by the most suitable location and its mapping relationship with the multiple Pods to be scheduled indicated by the bee colony, the target nodes corresponding to the multiple Pods to be scheduled are determined.
[0011] As an improvement to the above scheme, the step of using an improved ant colony algorithm to globally optimize the search space and determine the first search region includes: Initialize the ant colony parameters and initialize the path pheromone concentration to the preset concentration value; Based on the path pheromone concentration and a preset heuristic function, calculate the probability value of each scheduled Pod in each population being scheduled to any node to be deployed in the search space. Based on the probability value of each Pod to be scheduled being scheduled to any node to be deployed in the search space, the target scheduling node of each Pod to be scheduled is determined. Update the path pheromone concentration based on the load balancing degree of the currently determined target scheduling node; The target scheduling node for each Pod to be scheduled is re-determined based on the updated path pheromone concentration until the preset iteration termination condition is met, and the final target scheduling node for each Pod to be scheduled is determined as the first search area.
[0012] As an improvement to the above scheme, the step of calculating the probability value of each scheduled Pod in each population being scheduled to any node to be deployed in the search space based on the path pheromone concentration and a preset heuristic function includes: Based on the utilization of CPU, memory, network bandwidth, and disk space of the corresponding node when each scheduled Pod is scheduled to any node to be deployed, and the average utilization of CPU, memory, network bandwidth, and disk space of all nodes to be deployed in the search space, the expected degree of scheduling each scheduled Pod to be deployed to any node to be deployed is calculated through the heuristic function. Based on the expected degree of each scheduled Pod being scheduled to any deployment node and the path pheromone concentration, calculate the probability value of each scheduled Pod being scheduled to any deployment node.
[0013] As an improvement to the above scheme, updating the path pheromone concentration based on the currently determined load balancing degree of the target scheduling node includes: Based on the utilization of CPU, memory, network bandwidth, and disk space of the corresponding target scheduling node when each Pod to be scheduled is scheduled to the corresponding target scheduling node, and the average utilization of CPU, memory, network bandwidth, and disk space of all the target scheduling nodes, the load balancing degree of each Pod to be scheduled to the corresponding target scheduling node is calculated, and it is used as the load balancing degree of the ants that schedule each Pod to be scheduled. The ants are sorted according to their respective load balancing degrees to determine the ranking of each ant; The increment of the path pheromone concentration is calculated based on the load balancing degree and ranking of each ant. The path pheromone concentration is updated based on the path pheromone concentration and its increment.
[0014] As an improvement to the above scheme, the step of updating the position of the first search region using a preset adaptive random rule distribution to determine the second search region includes: By taking the standard Gaussian distribution and the Cauchy distribution as the limiting distributions of continuous probability distributions under a given degree of freedom, an adaptive random regular distribution is obtained; The adaptive random rule distribution is used to update the position of the first search region to determine the second search region.
[0015] Secondly, embodiments of the present invention provide a resource scheduling apparatus, comprising: The Pod interception module is used to intercept Pods created in a Kubernetes cluster, resulting in multiple Pods to be scheduled. The node filtering module is used to filter out multiple nodes to be deployed from the Kubernetes cluster based on the resource types and resource requirements of the multiple Pods to be scheduled and the resource information of the nodes in the Kubernetes cluster. The Pod scheduling module is used to determine the target node for each Pod to be scheduled from multiple nodes to be deployed according to a resource scheduling strategy based on an improved artificial bee colony algorithm, and to deploy the multiple Pods to be scheduled to the corresponding target nodes.
[0016] Thirdly, embodiments of the present invention provide a resource scheduling device, including: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the resource scheduling method as described in any one of the first aspects.
[0017] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, wherein the computer program, when running, controls the device where the computer-readable storage medium is located to perform the resource scheduling method as described in any one of the first aspects.
[0018] Fifthly, embodiments of the present invention provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the resource scheduling method as described in any one of the first aspects.
[0019] Compared to existing technologies, the resource scheduling method, apparatus, device, storage medium, and program product provided in this invention intercepts Pods created in a Kubernetes cluster to obtain multiple Pods to be scheduled; then, based on the resource types and resource requirements of the multiple Pods to be scheduled and the resource information of the nodes in the Kubernetes cluster, multiple nodes to be deployed are selected from the Kubernetes cluster; finally, based on a resource scheduling strategy based on an improved artificial bee colony algorithm, a target node is determined for each of the multiple nodes to be deployed, and the multiple Pods to be scheduled are deployed to the corresponding target nodes, thereby achieving balanced resource deployment and improving the resource utilization and load balancing of the entire cluster. Attached Figure Description
[0020] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart of a resource scheduling method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the node search process for Pod scheduling provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the system framework for Pod scheduling provided in an embodiment of the present invention; Figure 4 This is a structural block diagram of a resource scheduling device provided in an embodiment of the present invention; Figure 5 This is a structural block diagram of a resource scheduling device provided in an embodiment of the present invention. Detailed Implementation
[0022] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0023] It is understood that the various numerical designations used in the embodiments of this invention are merely for descriptive convenience and are not intended to limit the scope of this application. The order of the process numbers does not imply the order of execution; the execution order of each process should be determined by its function and internal logic.
[0024] In embodiments of the invention, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, without necessarily requiring or implying any such actual relationship or order between these entities or operations. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0025] See Figure 1 , Figure 1 This is a flowchart of a resource scheduling method provided in an embodiment of the present invention. The resource scheduling method specifically includes: S11: Intercept Pods created in the Kubernetes cluster to obtain multiple Pods to be scheduled; Specifically, S11: Pods created in the Kubernetes cluster are intercepted, resulting in multiple Pods to be scheduled, including: Within a preset retention period, Pods created in the Kubernetes cluster are retained; wherein the retention period is determined based on the Pod request rate and the Pod latency tolerance. If the number of pods that are withheld reaches a preset threshold, the withheld pods will be designated as pods to be scheduled.
[0026] In this embodiment of the invention, a brief Pod request interception mechanism is introduced. The interception period (also described as the interception time period) can be determined based on specific business characteristics, such as Pod request rate, Pod latency tolerance (i.e., the Pod's tolerance for creation time delay), etc. This embodiment of the invention does not specifically limit the calculation of the interception period; for example, interception period = (maximum number of concurrent requests)... Pod latency tolerance / Pod request rate (Unit time for a single Pod).
[0027] When the number of Pods intercepted within the interception period reaches a certain threshold, resource scheduling is triggered to perform unified scheduling processing on the Pods intercepted within the current interception period.
[0028] Compared to the default initial resource scheduling mechanism in Kubernetes, where the system determines the best Node based on the creation order of Pod requests using pre-selection and optimization strategies, resulting in uneven load distribution among nodes (also described as Nodes) and some nodes having fewer Pods, thus failing to fully utilize cluster resources, this embodiment of the invention performs batch and unified resource scheduling on Pods that are reserved within a specific time period, so as to schedule the reserved Pods to multiple Nodes simultaneously, thereby maximizing resource utilization and load balancing.
[0029] S12: Based on the resource types and resource requirements of the multiple Pods to be scheduled and the resource information of the nodes in the Kubernetes cluster, select multiple nodes to be deployed from the Kubernetes cluster; For example, based on the resource types and resource requirements of multiple Pods to be scheduled intercepted in step S11, and combined with the resource information of nodes in the Kubernetes cluster, multiple nodes in normal load state are selected from the Kubernetes cluster for subsequent Pod deployment.
[0030] S13: Based on the resource scheduling strategy based on the improved artificial bee colony algorithm, determine the target node for each Pod to be scheduled from the multiple nodes to be deployed, and deploy the multiple Pods to be scheduled to the corresponding target nodes.
[0031] The resource scheduling strategy based on the improved artificial bee colony algorithm of this invention allocates a node to be deployed to each intercepted Pod as the target node of the Pod, and then deploys multiple intercepted Pods to the corresponding target nodes at the same time, which can achieve balanced deployment of resources and improve the resource utilization and load balancing of the entire cluster.
[0032] In an optional embodiment, S12: Based on the resource types and resource requirements of the multiple Pods to be scheduled and the resource information of the nodes in the Kubernetes cluster, select multiple nodes to be deployed from the Kubernetes cluster, including: Based on the resource requirements of each Pod to be scheduled, the Pods to be scheduled are classified into different types to determine the resource type of each Pod to be scheduled. In this embodiment of the invention, it is considered that the different resource requirements of applications within a Pod in a cluster environment have a significant impact on node performance. For example, some tenants have high CPU resource requirements, which may lead to increased CPU load on the node; while other tenants focus more on memory resources, thus increasing memory load. Simultaneously, considering that the system can use soft limits to avoid overuse of CPU and bandwidth resources when quotas are exceeded, but memory and disk capacity exceeding quotas may trigger an "Out-of-memory" error in the kernel, causing the Pod to be forcibly terminated and rescheduled, this embodiment of the invention introduces a Pod type classification mechanism, dividing the Pods to be scheduled into different resource types, including CPU-type load Pod nodes, memory-type load Pod nodes, and network bandwidth-type load Pod nodes, to characterize the application's preference for resources such as CPU, memory, bandwidth, and disk capacity in the Pod to be scheduled. Specifically, a CPU-type load Pod node indicates that the application in the corresponding Pod has a higher demand for CPU resources than other resources, a memory-type load Pod node indicates that the application in the corresponding Pod has a higher demand for memory resources than other resources, and a network bandwidth-type load Pod node indicates that the application in the corresponding Pod has a higher demand for network bandwidth resources than other resources. By classifying the pods to be scheduled, data support can be provided for load balancing of subsequent Node scheduling.
[0033] Based on the historical load data of each node in the Kubernetes cluster, the predicted load data of each node for multiple time units within a set future time period is obtained, and based on the predicted load data of the nodes, multiple candidate nodes are selected from the nodes of the Kubernetes cluster. Specifically, based on the historical load data of each node in the Kubernetes cluster, predicted load data for each node over a set period of time is obtained, and based on the predicted load data of the nodes, multiple candidate nodes are selected from the nodes of the Kubernetes cluster, including: Determine whether the CPU resource utilization of each node exceeds a preset utilization threshold; If not, the corresponding node will be considered a candidate node; If so, obtain the CPU load data collected within the specified time period of the corresponding node as historical load data; Based on the historical load data of the corresponding node, CPU load is predicted using a preset load prediction model to obtain the predicted load data of the corresponding node for multiple time units within a set future time period. Determine whether the predicted load data of the corresponding node in multiple time units within a future set time period meets the preset load conditions; the load conditions include: there exists at least a first set number of predicted load data exceeding the preset load threshold; When the load conditions are met, the corresponding node is considered a candidate node.
[0034] The load prediction model is constructed based on a triple exponential smoothing algorithm.
[0035] In this embodiment of the invention, the predicted load data of a node at a predetermined future time is estimated using historical load data of nodes in the cluster. This estimation is used to assess the load status of the node and determine whether it is suitable for deploying Pods. Specifically, historical load data of a node is collected at a preset collection interval (10 seconds). Since the collected historical load data is a time series with non-linear characteristics, in order to more accurately reflect the actual load status of the node and avoid erroneous operations caused by instantaneous high load values, this embodiment of the invention uses a triple exponential smoothing method to construct a load prediction model. This model is used to calculate the short-term predicted load data of the node over a predetermined future time period, thereby effectively improving the accuracy and stability of load prediction and ensuring the stable operation of Pods in the cluster.
[0036] The prediction result of triple exponential smoothing resembles a curve, showing both long-term trends and seasonal fluctuations. Triple exponential smoothing derives its prediction by combining historical data, previous forecasts, and a smoothing coefficient. The calculation process for triple exponential smoothing is as follows: (1); (2); (3); in, This represents the exponentially smoothed value in period t. This represents the quadratic exponential smoothed value for period t. This represents the triple exponentially smoothed value for period t. This represents the smoothing coefficient, with a value between 0 and 1. This represents the actual observed value in period t.
[0037] The calculation process for the prediction results in the future period T is as follows: (4); in, This represents a prediction for the next period (t+T) based on data from period t, where t represents time t and T represents the data collection interval. , , These represent the forecast parameters for period t, which are used to characterize the level, trend slope, and trend curvature of the time series in period t.
[0038] (5).
[0039] In a Kubernetes cluster, tenants write their resource requirements for CPU, memory, network bandwidth, and disk space in the Pod's YAML file. Based on the resource requirements recorded in the YAML file, the resource consumption on the corresponding node after the Pod is deployed can be calculated.
[0040] Taking CPU resource utilization as an example, the specific process for predicting node load data is as follows: (1) When the CPU resource utilization of a node exceeds the preset utilization threshold, the prediction mechanism for the future CPU utilization of the node is activated.
[0041] (2) Retrieve the CPU load data collected most recently q times from the database as historical load data, and use the above triple exponential smoothing algorithm to predict the CPU load data for the next p time units as predicted load data.
[0042] (3) Analyze the CPU load data obtained from the p predictions. If a first set number (e.g., Nk or more) of the predicted CPU load data exceeds the set load threshold, then the node will be judged as a high load state; otherwise, the node will be regarded as a normal load state.
[0043] Nodes that are determined to be in a normal load state will be selected as candidate nodes for Pod deployment.
[0044] Based on the resource types of the multiple Pods to be scheduled and the resource information of the multiple candidate nodes, multiple nodes to be deployed are selected from the multiple candidate nodes.
[0045] Specifically, the step of selecting multiple deployment nodes from multiple candidate nodes based on the resource types of multiple Pods to be scheduled and the resource information of multiple candidate nodes includes: Based on the resource type of each Pod to be scheduled, determine the weight of each Pod in terms of CPU, memory, network bandwidth, and disk space. Based on the resource information of each candidate node, determine the total resource amount and used resource amount of each candidate node in CPU, memory, network bandwidth, and disk space, and the requested resource amount of the Pod to be scheduled in CPU, memory, network bandwidth, and disk space. Based on the total resource amount, the used resource amount, and the requested resource amount, determine the resource usage and remaining resource amount of each candidate node in CPU, memory, network bandwidth, and disk space after scheduling the Pod. Based on the weights of each Pod to be scheduled in terms of CPU, memory, network bandwidth, and disk space, and the resource usage, remaining resources, and disk read / write speed of each candidate node in terms of CPU, memory, network bandwidth, and disk space, calculate the performance score of each candidate node. Based on the performance scores of each candidate node, a plurality of nodes to be deployed are selected from the plurality of candidate nodes.
[0046] In this embodiment of the invention, node N is obtained. i The total resources of CPU, memory, disk space, and network bandwidth are respectively , , , Disk read / write speed includes disk read I / O speed. disk write I / O rate The amount of resources used are respectively , , , The specific details are recorded in the resource information of the candidate nodes.
[0047] The requested resource amounts for CPU, memory, disk space, and network bandwidth of the currently scheduled Pod are as follows: , , , The weights of the Pods to be scheduled in terms of CPU, memory, network bandwidth, and disk space are as follows: , , , The weights are allocated based on the resource type of the Pod to be scheduled. For example... + + + =1, if the resource type of the Pod to be scheduled is a CPU-based load Pod node, then set The value is the largest; if it is a memory-intensive load Pod node, then set it to [value]. The value of the largest value is 4, and so on. The specific weighting ratios are not specifically limited in this embodiment of the invention; for example, the largest weight might be 4, and the other weights might each be 2.
[0048] When the pod to be scheduled is scheduled to the current candidate node i, the resource usage of the current candidate node i in terms of CPU, memory, disk space, and network bandwidth are respectively , , , The specific calculation formula is as follows: = + (6); = + (7); = + (8); = + (9); When the pod to be scheduled is scheduled to the current candidate node i, the remaining resources of the current candidate node i in terms of CPU, memory, disk space, and network bandwidth are respectively , , , The specific calculation formula is as follows: = - (10); = - (11); = - (12); = - (13); The performance score S of the current candidate node i i The details are as follows: (14); When evaluating node performance, this embodiment of the invention considers four resources: CPU, memory, disk space, and network bandwidth. First, it calculates the percentage of each resource remaining in a candidate node relative to its total capacity, and also considers the importance (weight) of each resource. The value obtained by dividing these percentages by their weights is related to the node's performance score; the higher the value, the higher the performance score. Subsequently, candidate nodes whose performance scores exceed a set threshold can be selected as nodes to be deployed. Compared to traditional single-dimensional evaluations (such as looking only at CPU utilization), which may lead to misjudgments (e.g., nodes with idle CPU but exhausted memory being mistakenly selected), this embodiment of the invention considers four types of core resources simultaneously, providing a more complete picture of the node's actual load capacity. The introduction of a resource weighting mechanism allows for adjusting the importance of different resources according to business characteristics, avoiding unreasonable "one-size-fits-all" scheduling and adapting to diverse deployment scenarios.
[0049] Furthermore, the balance of these four resources can be considered. If the usage of these four resources is similar across nodes in the scheduling cluster, it indicates that the node is in good condition and working healthily. For example, for candidate nodes whose performance scores exceed a set threshold, the percentage of CPU, memory, disk space, and network bandwidth usage of the candidate node relative to its total resource usage can be calculated after the pod to be scheduled is scheduled to the candidate node. By comparing the percentages corresponding to CPU, memory, disk space, and network bandwidth, candidate nodes whose deviations are within a certain range are selected as nodes to be deployed.
[0050] In an optional embodiment, S13: determining the target node for each Pod to be scheduled from among the multiple nodes to be deployed according to a resource scheduling strategy based on an improved artificial bee colony algorithm, including: Initialize the bee colony based on the multiple Pods to be scheduled, and initialize the search space based on the multiple nodes to be deployed; During the hired bee search phase, an improved ant colony algorithm is used to globally optimize the search space and determine the first search area; During the bee selection phase, a preset adaptive random rule distribution is used to update the position of the first search area to determine the second search area; During the scout bee search phase, the fitness value of each location in the second search area is calculated, and the optimal location of the bee colony is determined based on the fitness value of each location in the second search area; wherein, each location corresponds to one node to be deployed; The optimal position of the bee colony is iteratively updated to determine the most suitable position for the bee colony. Based on the node to be deployed indicated by the most suitable location and its mapping relationship with the multiple Pods to be scheduled indicated by the bee colony, the target nodes corresponding to the multiple Pods to be scheduled are determined.
[0051] For example, suppose there are n Pods currently waiting to be scheduled in the Kubernetes cluster, and m nodes have been selected for deployment. Figure 2 The node search process of the resource scheduling strategy based on the improved artificial bee colony algorithm (referred to as the AABCK strategy) is described below: Step 1: Bee Colony Parameter Initialization: Initialize the population size: n bee colonies, initialize an m-dimensional search space, where each position in the m-dimensional search space indicates a node to be deployed; the bee colonies search for the optimal solution in the m-dimensional search space, and the optimal solution is the optimal location (i.e., the optimal node to be deployed) for the Pod; number of iterations. , maximum number of searches limit, initial boundary conditions.
[0052] Based on the resource requirements of the Pods to be scheduled, they are classified into three groups: hired bees, observation peaks, and scout bees, and each group forms a corresponding bee colony. For example, Pods with high resource requirements are classified as hired bees, those with medium resource requirements as observation peaks, and those with low resource requirements as scout bees. Assuming the initial number of hired bees, observation peaks, and scout bees in each colony is x, m feasible solutions are randomly generated, and the fitness function value fit is calculated for each. The solutions with the highest fitness function values are taken as the initial feasible solutions. The feasible solution for the k-th colony is denoted as Pos. k =(Pos k1 Pos k2 , ..., Pos kj , ..., Pos km ); k [1, x], x Pos kj Let k represent the node where the j-th pod to be scheduled is deployed, and its value range is [1, m].
[0053] Step 2: In the bee-hired search phase, the AABCK strategy selects the globally optimal location from the m-dimensional search space (m nodes to be deployed) based on the improved ant colony algorithm, forming the best search region (i.e., the first search region mentioned above) for Pod scheduling. The specific formula is as follows: P kj,new =P best + (P) mean -Pos kj (15); P tkj,new =P kj,new +P kj,new (n)(16); Among them, P kj,new For the new node where the j-th Pod to be scheduled resides in the k-th bee colony, P best To calculate the optimal location on a node for the j-th Pod to be scheduled in the previous iteration using the fitness function, This is a parameter used to control position changes (also known as the search step size), and its value ranges from 1 to 2; It is a random number, ranging from 0 to 1; P mean P represents the average position across k bee colonies, indicating that these colonies have exhausted all information from previous points, such as the "average state" of the resources and performance characteristics of all nodes to be deployed, reflecting the overall average level of the cluster nodes; t kj,new This refers to the new node where the Pod to be deployed will be located after undergoing adaptive random rule distribution. (n) represents an adaptive random regular distribution.
[0054] Step 3: In the observation bee search phase, the AABCK strategy selects to follow the hired bees and uses an adaptive random distribution for position updates. This allows the AABCK strategy to choose a suitable node to deploy the Pod to be scheduled within the selected optimal search area (i.e., the first search area mentioned above). The Pod then continuously moves to different locations within the optimal search area (i.e., the first search area mentioned above). The specific formula is as follows: P t kj,news =P t kj,new +x(j) (P) t kj,new -P mean )+y(j) (P) t kj,new - (P) t kj+1,new -P mean (17); Among them, P t kj,news Indicates that the observed bee selected P t kj,new Let P be the new node to be scheduled for the j-th Pod after the starting search, and let x(j) and y(j) represent the random numbers of the observed bee positions in polar coordinates, both taking values of (-1, 1); t kj+1,new This indicates the new node where the (j+1)th Pod to be scheduled resides after the bee search.
[0055] Among them, the observation bee selects and follows the hired bee based on relevant probability values, and the probability calculation method is as follows: ;in, Let be the fitness value of the new node where the j-th Pod to be scheduled resides.
[0056] Step 4: In the scout bee search phase, if the number of times a certain position is repeatedly searched (e.g., the cumulative number of searches by hired bees and observer bees) exceeds the preset maximum search limit, the scout bee searches for a better position across regions from the best position in the best search region (i.e., the position updated in the observer bee search phase above, forming the second search region) through random perturbation. This prevents the algorithm from getting trapped in local optima and obtains the most suitable node for the Pod to be scheduled. The specific formula is as follows: P t kj,newss =rand P t kj,news + (18); Among them, P t kj,newss This indicates the most suitable node (i.e., the most suitable position) for scheduling the j-th Pod to be scheduled after the scout bee searches. This represents the random disturbance term in polar coordinates, with values of (-1, 1).
[0057] Step 5: Through manual bee colony selection and iteration, continuously update the optimal position of the bee colony until the set maximum number of iterations is reached. If precision is required, the optimal position is output, the target node for each Pod to be scheduled is selected, and the scheduler schedules each Pod to be scheduled to the corresponding target node simultaneously. Figure 3 As shown.
[0058] For example, the Pod to be scheduled is { , , … }, where n represents the total number of Pods, and the target nodes to be filtered are { , , … The mapping relationship between Pods and Nodes is represented by matrix X, as follows: (19); Where m represents the total number of Nodes and n represents the total number of Pods; the elements in matrix X indicate whether a Pod to be scheduled is scheduled to a specific Node. When an element in matrix X = 1, it means that the corresponding Pod to be scheduled will be scheduled to run on the corresponding Node (based on the target node determined above), and when an element in matrix X = 0, it means that the corresponding Pod to be scheduled will not be scheduled to run on the corresponding Node. For example, when X12 = 1, it means that Pod1 to be scheduled will be scheduled to run on Node2.
[0059] Understandably, based on the target nodes corresponding to each Pod to be scheduled obtained above, a matrix representing the mapping relationship between the Pod to be scheduled and the Node nodes in the cluster can be established. For example, the element value corresponding to the target node of the Pod to be scheduled can be set to 1, and the element value corresponding to other nodes that the Pod to be scheduled does not need to be scheduled can be set to 1.
[0060] Specifically, the step of using an improved ant colony algorithm to globally optimize the search space and determine the first search region includes: Initialize the ant colony parameters and initialize the path pheromone concentration to the preset concentration value; Based on the path pheromone concentration and a preset heuristic function, calculate the probability value of each scheduled Pod in each population being scheduled to any node to be deployed in the search space. Specifically, calculating the probability value of each scheduled Pod in each population being scheduled to any node to be deployed in the search space based on the path pheromone concentration and a preset heuristic function includes: Based on the utilization of CPU, memory, network bandwidth, and disk space of the corresponding node when each scheduled Pod is scheduled to any node to be deployed, and the average utilization of CPU, memory, network bandwidth, and disk space of all nodes to be deployed in the search space, the expected degree of scheduling each scheduled Pod to be deployed to any node to be deployed is calculated through the heuristic function. Based on the expected degree of each scheduled Pod being scheduled to any deployment node and the path pheromone concentration, calculate the probability value of each scheduled Pod being scheduled to any deployment node.
[0061] Based on the probability value of each Pod to be scheduled being scheduled to any node to be deployed in the search space, the target scheduling node of each Pod to be scheduled is determined. Update the path pheromone concentration based on the load balancing degree of the currently determined target scheduling node; Specifically, updating the path pheromone concentration based on the currently determined load balancing degree of the target scheduling node includes: Based on the utilization of CPU, memory, network bandwidth, and disk space of the corresponding target scheduling node when each Pod to be scheduled is scheduled to the corresponding target scheduling node, and the average utilization of CPU, memory, network bandwidth, and disk space of all the target scheduling nodes, the load balancing degree of each Pod to be scheduled to the corresponding target scheduling node is calculated, and it is used as the load balancing degree of the ants that schedule each Pod to be scheduled. The ants are sorted according to their respective load balancing degrees to determine the ranking of each ant; The increment of the path pheromone concentration is calculated based on the load balancing degree and ranking of each ant. The path pheromone concentration is updated based on the path pheromone concentration and its increment.
[0062] The target scheduling node for each Pod to be scheduled is re-determined based on the updated path pheromone concentration until the preset iteration termination condition is met, and the final target scheduling node for each Pod to be scheduled is determined as the first search area.
[0063] In this embodiment of the invention, the specific process of using the improved ant colony algorithm to perform global optimization of the search space is as follows: Step 1: Ant colony parameter initialization, including setting the path pheromone concentration and the importance weight of the heuristic function in scheduling decisions. Determine the constant Q in the heuristic function calculation and set the pheromone volatility coefficient. Determine the coefficients for calculating pheromone release. Initialize the number of ants w and the maximum number of iterations max for the ant colony algorithm.
[0064] Step 2: Initialize path pheromone concentration: Assign the same path pheromone concentration, such as 1, to all possible paths or nodes.
[0065] To prevent the ant colony algorithm from prematurely converging to a local optimum during the search process and to ensure that the algorithm can more fairly explore various possible optimal resource scheduling methods in the initial stage, the initial path pheromone concentration is set to a uniform value, so that each node has an equal attraction to the Pod when the ants begin searching. The initial path pheromone concentration... .
[0066] Step 3: Node Selection: The probability of each Pod being scheduled to a specific node is calculated using path pheromone concentration and a heuristic function. A roulette wheel selection method (also known as proportional selection) is employed, using the probabilities calculated above to determine the scheduling target for each Pod.
[0067] Specifically, the path explored by each ant constitutes a potential solution for resource scheduling. In each iteration, the ant selects the most suitable node for each Pod to be scheduled. When the scheduling tasks for all Pods to be scheduled are completed by the same ant, it means that this resource scheduling attempt has ended. When selecting a suitable node to allocate to a Pod to be scheduled, the ant uses a roulette wheel strategy based on the probability calculated by the path pheromone concentration and a heuristic function. Specifically, in iteration t, the probability that the h-th ant selects the i-th node for the j-th Pod to be scheduled is... The calculation formula is as follows: (20); in, This represents the path pheromone concentration at which the j-th Pod to be scheduled selects the i-th node to be deployed in the t-th iteration. It reflects the frequency at which a certain node is selected, thus affecting the ants' tendency to select that node in the future. This represents the expected degree of the j-th Pod to be scheduled in the t-th iteration to choose the i-th node to be deployed on, and is usually calculated based on a heuristic function. These are the importance parameters of path pheromone concentration and expectation level, which determine the degree to which ants rely on these two factors when selecting nodes. This represents the set of Pods that Ant h has not yet scheduled, i.e., the list of Pods for which Ant k has not yet allocated nodes. When the list contains all Pods to be scheduled, it means that Ant k has completed all resource scheduling tasks in this iteration. At this point, the most suitable combination of nodes found by Ant k for each Pod to be scheduled constitutes a potential optimal solution discovered by Ant k in this iteration.
[0068] The heuristic function is an indicator that measures the expected effect of ants scheduling a pod to a certain node, and it is directly related to the optimization efficiency of the ant colony algorithm. The heuristic function not only determines the algorithm's ability to search for the optimal solution, but also reflects the degree of emphasis the ant colony algorithm places on different optimization objectives. This invention focuses on improving the load balancing effect in the cluster; that is, when ant h decides to select the i-th node to be deployed for the j-th pod, if this action can significantly improve the load balancing of the cluster, then the value of the corresponding heuristic function should also be higher. Based on this, this invention proposes an improved heuristic function to calculate the expected degree of selection of the i-th node for the j-th pod to be deployed, as follows: (twenty one); (twenty two); (twenty three); (twenty four); (25); Among them, CPU m This represents the CPU utilization on node m when a Pod to be scheduled is scheduled to that node; and This represents the average CPU utilization of all nodes in the cluster after the scheduled Pod is scheduled; cpuStd represents the standard deviation of CPU utilization across all nodes in the cluster after resource scheduling. mem m This represents the memory utilization on node m when a Pod to be scheduled is scheduled to that node; and This represents the average memory utilization of all nodes in the cluster after the scheduled Pod is scheduled; memStd represents the standard deviation of the network utilization of all nodes in the entire cluster after resource scheduling. m This represents the network bandwidth utilization on node m when a Pod to be scheduled is scheduled to that node; while This represents the average network bandwidth utilization of all nodes in the cluster after the scheduled Pod is scheduled; netStd represents the standard deviation of the network bandwidth utilization of all nodes in the entire cluster after resource scheduling. m This represents the disk utilization on node m when a Pod to be scheduled is scheduled to that node; while This represents the average disk utilization of all nodes in the cluster after the scheduled Pod is scheduled; diskStd represents the standard deviation of disk utilization of all nodes in the cluster after resource scheduling. As a heuristic function, it integrates the above performance metrics and adjusts the weights appropriately using a constant Q to ensure that resource scheduling decisions comprehensively consider the overall performance and load balancing of the cluster.
[0069] Step 4: Path pheromone concentration update: Based on the load balance calculated after each ant completes scheduling and its ranking among all ants, determine the increment of the path pheromone concentration for that ant.
[0070] In ant colony optimization algorithms, once an ant completes the resource scheduling task for all Pods, it leaves a certain amount of pheromone as a marker along its path. However, pheromone is not permanent; it gradually dissipates over time. In subsequent iterations, the ant comprehensively considers the path pheromone concentration and heuristic function information to replan its movement path. In this embodiment of the invention, the increment of pheromone generated by an ant after completing the Pod scheduling task is not fixed, but closely related to the overall load balance of the cluster resources. If the ant can achieve a higher load balance during the scheduling process, the concentration of pheromone it releases will increase accordingly. This mechanism encourages ants to choose scheduling strategies that can achieve a higher load balance.
[0071] Based on this, this invention introduces a reward and punishment mechanism to guide the ant colony's search process. After each iteration, the load balancing degree calculated based on the scheduling strategies of all ants is sorted. Ants with higher load balancing degrees receive higher pheromone concentration rewards, while ants with lower load balancing degrees receive lower pheromone concentrations, thereby accelerating the algorithm's convergence speed. By assigning higher path pheromone concentrations to better scheduling strategies (i.e., the strategies by which Pods are scheduled to nodes), the probability of subsequent ants choosing these scheduling strategies can be increased, thus finding the optimal resource scheduling scheme faster. The specific calculation method for the load balancing degree (lb) is as follows: (26); This invention employs a load balancing-based reward and penalty strategy to calculate the release amount (i.e., increment) of path pheromone concentration. The load balancing-based reward and penalty strategy uses a linear decreasing approach to ensure that ants with higher load balancing rankings receive higher pheromone concentration rewards. Specifically, the ant with the highest load balancing ranking releases its full pheromone concentration as recognition of its efficient scheduling strategy; the ant with the lowest ranking does not release any pheromone concentration because it failed to achieve ideal load balancing during resource scheduling; ants with a middle ranking release a value between the full pheromone concentration and zero, for example, half of the full pheromone concentration, depending on their position in the load balancing ranking. This pheromone concentration reward and penalty strategy and the specific pheromone concentration update method are detailed below: (27); (28); Among them, variables This indicates the load balancing ranking of the h-th ant after one iteration. name, The value range is from 1 to w; w is the total number of ants; a fixed coefficient is set. A coefficient representing the concentration of released pheromones; This represents the coefficient used to calculate pheromone evaporation. Through the aforementioned reward and punishment strategy, the ant colony can be guided towards a better resource scheduling scheme, and the speed at which the algorithm converges to the optimal solution can be accelerated.
[0072] Step 5: Iteration count: Increment the number of iterations by 1.
[0073] Step 6: Termination Condition Check: Check if the termination condition is met (such as reaching the maximum number of iterations or finding the optimal solution that meets the accuracy requirements). If the condition is met, stop the iteration and output the optimal resource scheduling scheme, i.e., the best search region mentioned above (the first search region); otherwise, return to Step 3 to continue the iterative search.
[0074] Understandably, during the hired bee search phase, the bee colony is equivalent to an ant colony, and the hired bees in the bee colony are equivalent to ants in the ant colony. The bee colony executes the improved ant colony algorithm to perform a global optimization search on the nodes to be deployed, which can improve search efficiency and obtain a better optimal solution.
[0075] Specifically, the step of updating the position of the first search region using a preset adaptive random rule distribution to determine the second search region includes: By taking the standard Gaussian distribution and the Cauchy distribution as the limiting distributions of continuous probability distributions under a given degree of freedom, an adaptive random regular distribution is obtained; The adaptive random rule distribution is used to update the position of the first search region to determine the second search region.
[0076] The t-distribution is a probability distribution characterized by symmetry and a unimodal nature, with its peak at 0. The specific shape of the t-distribution is determined by its degrees of freedom. The decision, when When the value of decreases, the curve of the t-distribution becomes flatter and broader; conversely, when , the curve of the t-distribution becomes flatter and broader. As the value of gradually increases, the t-distribution curve will gradually approach the standard normal distribution curve, that is, when ... As the t-distribution approaches infinity, it becomes extremely close to the standard Gaussian distribution N(0, 1). Specifically, when the degrees of freedom... When the degree of freedom is exactly 1, the shape of the t-distribution is completely identical to the Cauchy distribution C(0,1). Based on this unique property, this embodiment of the invention treats the standard Gaussian distribution and the Cauchy distribution as limiting distributions of the t-distribution under specific degrees of freedom conditions, and constructs an adaptive random regular distribution, that is, when the degree of freedom is exactly 1... As the number of degrees of freedom approaches infinity, the adaptive random regular distribution follows a standard Gaussian distribution N(0,1). When the degree of freedom is 1, the adaptive random regular distribution is a Cauchy distribution C(0,1). For other values, the adaptive random regular distribution follows a t-distribution. In the artificial bee colony algorithm, the adaptive random regular distribution is used to determine the position P obtained after the peak search. t kj,news Perform a location update.
[0077] P t kj,news(更新后) =rand P t kj,news(更新前) +P t kj,news(更新前) (29); Where rand is a random number, and P is a random number whose value is in the range (0, 1]. t kj,news(更新后) It is the position after the adaptive random regular distribution has mutated, P t kj,news(更新前) It is the position before the adaptive random regular distribution mutates. Describing the degrees of freedom as Adaptive random regular distribution, It is the number of iterations. , These represent the minimum and maximum values of an adaptive random regular distribution.
[0078] The subsequent adaptive random regular distribution mutation position P will be used. t kj,news(更新后) The final location obtained from the observation peak search constitutes the final second search area for subsequent reconnaissance bee searches.
[0079] This invention introduces a random regular distribution perturbation P. t kj,news(更新前) This enhances the flexibility of bees in choosing their search space. When the search process gets stuck in a local optimum, this perturbation mechanism can guide the search out of local limitations, effectively improving the accuracy and efficiency of the search and accelerating the convergence speed. Adaptive random regular distribution mutation cleverly utilizes the number of iterations as a degree of freedom parameter to dynamically adjust the t-distribution. In the initial stage, due to the small number of iterations, the t-distribution mutation exhibits Cauchy distribution characteristics, which can improve global search capabilities. As the number of iterations increases, the t-distribution mutation gradually approaches a Gaussian distribution, exhibiting more refined development capabilities in local regions. This allows for effective exploration globally and in-depth development in local regions, combining global and local advantages. The mutation operator of the adaptive random regular distribution combines Gaussian and Cauchy operators, further enhancing the robustness and comprehensiveness of the search.
[0080] See Figure 4 , Figure 4This is a structural block diagram of a resource scheduling device provided in an embodiment of the present invention. The resource scheduling device includes: Pod interception module 11 is used to intercept Pods created in the Kubernetes cluster, resulting in multiple Pods to be scheduled; The node filtering module 12 is used to filter out multiple nodes to be deployed from the Kubernetes cluster based on the resource types and resource requirements of the multiple Pods to be scheduled and the resource information of the nodes in the Kubernetes cluster. The Pod scheduling module 13 is used to determine the target node for each Pod to be scheduled from multiple nodes to be deployed according to a resource scheduling strategy based on an improved artificial bee colony algorithm, and to deploy the multiple Pods to be scheduled to the corresponding target nodes.
[0081] In one alternative embodiment, the Pod interception module 11 includes: The interception unit is used to intercept Pods created in the Kubernetes cluster within a preset interception period; wherein the interception period is determined based on the Pod request rate and the Pod latency tolerance. The Pod to be scheduled determination unit is used to identify the pods to be scheduled when the number of pods that have been intercepted reaches a preset threshold.
[0082] In one optional embodiment, the node filtering module 12 includes: The type classification unit is used to classify each of the scheduled Pods according to their resource requirements and determine the resource type of each scheduled Pod. The load prediction unit is used to obtain the predicted load data of each node in the future for multiple time units within a set time period based on the historical load data of each node in the Kubernetes cluster, and to select multiple candidate nodes from the nodes in the Kubernetes cluster based on the predicted load data of the nodes. The node filtering unit is used to filter out multiple nodes to be deployed from multiple candidate nodes based on the resource types of multiple Pods to be scheduled and the resource information of multiple candidate nodes.
[0083] In one optional embodiment, the load prediction unit includes: The first judgment subunit is used to determine whether the CPU resource utilization of each node exceeds a preset utilization threshold. The first candidate node confirmation sub-unit is used to treat the corresponding node as a candidate node if the condition is not met. The load data acquisition subunit is used to acquire CPU load data collected within a set time period for the corresponding node, and use it as historical load data. The load data prediction subunit is used to predict the CPU load based on the historical load data of the corresponding node and through a preset load prediction model, so as to obtain the predicted load data of the corresponding node for multiple time units in the future within a set time period. The second judgment subunit is used to determine whether the predicted load data of the corresponding node in multiple time units within a future set time period meets the preset load conditions; the load conditions include: there is at least a first set number of predicted load data exceeding the preset load threshold. The second candidate node confirmation subunit is used to regard the corresponding node as a candidate node when the load condition is met.
[0084] In one optional embodiment, the node filtering unit includes: The sub-unit is used to determine the weight of each scheduled Pod in terms of CPU, memory, network bandwidth, and disk space based on the resource type of each Pod to be scheduled. The resource determination subunit is used to determine the total and used resources of each candidate node in CPU, memory, network bandwidth, and disk space, and the requested resources of the Pod to be scheduled in CPU, memory, network bandwidth, and disk space, based on the resource information of each candidate node. Based on the total resources, the used resources, and the requested resources, the unit determines the resource usage and remaining resources of each candidate node in CPU, memory, network bandwidth, and disk space after scheduling the Pod. The performance evaluation subunit is used to calculate the performance score of each candidate node based on the weights of each Pod to be scheduled in CPU, memory, network bandwidth, and disk space, and the resource usage, remaining resources, and disk read / write speed of each candidate node in CPU, memory, network bandwidth, and disk space. The node to be deployed subunit is used to select multiple nodes to be deployed from multiple candidate nodes based on the performance scores of each candidate node.
[0085] In an optional embodiment, the Pod scheduling module 13 includes: An initialization unit is used to initialize a bee colony based on the multiple Pods to be scheduled, and to initialize a search space based on the multiple nodes to be deployed. The first search unit is used to perform global optimization of the search space using an improved ant colony algorithm during the hired bee search phase, and to determine the first search area. The second search unit is used to update the position of the first search area using a preset adaptive random rule distribution during the observation bee selection phase, and to determine the second search area. The third search unit is used to calculate the fitness value of each position in the second search area during the scout bee search phase, and determine the optimal position of the bee colony based on the fitness value of each position in the second search area; wherein each position corresponds to one node to be deployed; An iterative update unit is used to iteratively update the optimal position of the bee colony to determine the most suitable position for the bee colony. The target node determination unit is used to determine the target nodes corresponding to the multiple Pods to be scheduled based on the node to be deployed indicated by the most suitable location and its mapping relationship with the multiple Pods to be scheduled indicated by the bee colony.
[0086] In one optional embodiment, the first search unit includes: The parameter initialization subunit is used to initialize the ant colony parameters and initialize the path pheromone concentration to a preset concentration value. The probability calculation subunit is used to calculate the probability value of each scheduled Pod in each population being scheduled to any node to be deployed in the search space based on the path pheromone concentration and a preset heuristic function. The first node determination subunit is used to determine the target scheduling node for each of the scheduled Pods based on the probability value of each Pod being scheduled to be deployed to any node in the search space. The pheromone concentration update subunit is used to update the path pheromone concentration based on the load balancing degree of the currently determined target scheduling node. The second node determination subunit is used to redetermine the target scheduling node of each of the Pods to be scheduled based on the updated path pheromone concentration, until the preset iteration termination condition is met, and to determine the final target scheduling node of each of the Pods to be scheduled as the first search area.
[0087] In one optional embodiment, the probability calculation subunit includes: The expectation degree calculation subunit is used to calculate the expectation degree of each scheduled Pod being scheduled to any deployment node based on the utilization rate of the corresponding deployment node in terms of CPU, memory, network bandwidth, and disk space when each scheduled Pod is scheduled to any deployment node, and the average utilization rate of all deployment nodes in terms of CPU, memory, network bandwidth, and disk space in the search space, through the heuristic function. The node probability calculation subunit is used to calculate the probability value of each scheduled Pod being scheduled to any node to be deployed based on the expected degree of each scheduled Pod being scheduled to any node to be deployed and the path pheromone concentration.
[0088] In one optional embodiment, the pheromone concentration update subunit includes: The load balancing calculation subunit is used to calculate the load balancing degree of each Pod to be scheduled to the corresponding target scheduling node based on the utilization rate of the corresponding target scheduling node in terms of CPU, memory, network bandwidth, and disk space when each Pod to be scheduled is scheduled to the corresponding target scheduling node, and the average utilization rate of all the target scheduling nodes in terms of CPU, memory, network bandwidth, and disk space, and use it as the load balancing degree of the ants that schedule each Pod to be scheduled. The ranking subunit is used to sort the ants according to their respective load balancing degrees and determine the ranking of each ant. The concentration increment calculation subunit is used to calculate the increment of the path pheromone concentration based on the load balance and ranking of each ant. The path pheromone concentration update subunit is used to update the path pheromone concentration based on the path pheromone concentration and its increment.
[0089] In one optional embodiment, the second search unit includes: The random regular distribution construction sub-unit is used to take the standard Gaussian distribution and Cauchy distribution as the limiting distributions of continuous probability distributions under a set degree of freedom, and obtain the adaptive random regular distribution; The position update subunit is used to update the position of the first search region using the adaptive random rule distribution to determine the second search region.
[0090] It should be noted that the working process of each module in the resource scheduling device described in the embodiments of the present invention can refer to the working process of the resource scheduling method described in the above embodiments, and the technical effect achieved is the same as that of the resource scheduling method described in the above embodiments, so it will not be repeated here.
[0091] See Figure 5 , Figure 5 This is a structural block diagram of a resource scheduling device provided in an embodiment of the present invention. The resource scheduling device includes a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, it implements the steps in the above-described resource scheduling method embodiments, such as steps S11 to S13.
[0092] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 22 and executed by the processor 21 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the resource scheduling device.
[0093] The resource scheduling device may include, but is not limited to, processor 21 and memory 22. Those skilled in the art will understand that the schematic diagram is merely an example of a resource scheduling device and does not constitute a limitation on the resource scheduling device. It may include more or fewer components than illustrated, or combine certain components, or different components. For example, the resource scheduling device may also include input / output devices, network access devices, buses, etc.
[0094] The processor 21 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor 21 is the control center of the resource scheduling equipment, connecting all parts of the entire resource scheduling equipment via various interfaces and lines.
[0095] The memory 22 can be used to store the computer programs and / or modules. The processor 21 implements various functions of the resource scheduling device by running or executing the computer programs and / or modules stored in the memory 22 and calling the data stored in the memory 22. The memory 22 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0096] If the modules / units integrated into the resource scheduling device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by the processor 21, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0097] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0098] The above description represents the preferred embodiments of the present invention. It should be noted that, for those skilled in the art, various improvements and modifications can be made without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A resource scheduling method, characterized in that, include: By intercepting Pods created in the Kubernetes cluster, multiple Pods are obtained that are to be scheduled. Based on the resource types and resource requirements of the multiple Pods to be scheduled, and the resource information of the nodes in the Kubernetes cluster, multiple nodes to be deployed are selected from the Kubernetes cluster. According to the resource scheduling strategy based on the improved artificial bee colony algorithm, the target node of each Pod to be scheduled is determined from the multiple nodes to be deployed, and the multiple Pods to be scheduled are deployed to the corresponding target nodes.
2. The resource scheduling method as described in claim 1, characterized in that, The process of intercepting Pods created in the Kubernetes cluster results in multiple Pods awaiting scheduling, including: Within a preset retention period, Pods created in the Kubernetes cluster are retained; wherein, the retention period is determined based on the Pod request rate and the Pod latency tolerance. If the number of pods that are withheld reaches a preset threshold, the withheld pods will be designated as pods to be scheduled.
3. The resource scheduling method as described in claim 1, characterized in that, The step of selecting multiple nodes to be deployed from the Kubernetes cluster based on the resource types and resource requirements of the multiple Pods to be scheduled and the resource information of the nodes in the Kubernetes cluster includes: Based on the resource requirements of each Pod to be scheduled, the Pods to be scheduled are classified into different types to determine the resource type of each Pod to be scheduled. Based on the historical load data of each node in the Kubernetes cluster, the predicted load data of each node for multiple time units within a set future time period is obtained, and based on the predicted load data of the nodes, multiple candidate nodes are selected from the nodes of the Kubernetes cluster. Based on the resource types of the multiple Pods to be scheduled and the resource information of the multiple candidate nodes, multiple nodes to be deployed are selected from the multiple candidate nodes.
4. The resource scheduling method as described in claim 3, characterized in that, The process involves obtaining predicted load data for each node over a predetermined period of time based on historical load data of each node in the Kubernetes cluster, and then selecting multiple candidate nodes from the nodes of the Kubernetes cluster based on the predicted load data of the nodes, including: Determine whether the CPU resource utilization of each node exceeds a preset utilization threshold; If not, the corresponding node will be considered a candidate node; If so, obtain the CPU load data collected within the specified time period of the corresponding node as historical load data; Based on the historical load data of the corresponding node, CPU load is predicted using a preset load prediction model to obtain the predicted load data of the corresponding node for multiple time units within a set future time period. Determine whether the predicted load data of the corresponding node in multiple time units within a future set time period meets the preset load conditions; the load conditions include: there exists at least a first set number of predicted load data exceeding the preset load threshold; When the load conditions are met, the corresponding node is considered a candidate node.
5. The resource scheduling method as described in claim 3, characterized in that, The step of selecting multiple deployment nodes from multiple candidate nodes based on the resource types of multiple Pods to be scheduled and the resource information of multiple candidate nodes includes: Based on the resource type of each Pod to be scheduled, determine the weight of each Pod to be scheduled in terms of CPU, memory, network bandwidth, and disk space; Based on the resource information of each candidate node, determine the total resource amount and used resource amount of each candidate node in CPU, memory, network bandwidth, and disk space, and the requested resource amount of the Pod to be scheduled in CPU, memory, network bandwidth, and disk space. Based on the total resource amount, the used resource amount, and the requested resource amount, determine the resource usage and remaining resource amount of each candidate node in CPU, memory, network bandwidth, and disk space after scheduling the Pod. Based on the weights of each Pod to be scheduled in terms of CPU, memory, network bandwidth, and disk space, and the resource usage, remaining resources, and disk read / write speed of each candidate node in terms of CPU, memory, network bandwidth, and disk space, calculate the performance score of each candidate node. Based on the performance scores of each candidate node, a plurality of nodes to be deployed are selected from the plurality of candidate nodes.
6. The resource scheduling method as described in claim 1, characterized in that, The step of determining the target node for each Pod to be scheduled from a plurality of nodes to be deployed, based on a resource scheduling strategy using an improved artificial bee colony algorithm, includes: Initialize the bee colony based on the multiple Pods to be scheduled, and initialize the search space based on the multiple nodes to be deployed; During the hired bee search phase, an improved ant colony algorithm is used to globally optimize the search space and determine the first search area; During the bee selection phase, a preset adaptive random rule distribution is used to update the position of the first search area to determine the second search area; During the scout bee search phase, the fitness value of each location in the second search area is calculated, and the optimal location of the bee colony is determined based on the fitness value of each location in the second search area; wherein, each location corresponds to one node to be deployed; The optimal position of the bee colony is iteratively updated to determine the most suitable position for the bee colony. Based on the node to be deployed indicated by the most suitable location and its mapping relationship with the multiple Pods to be scheduled indicated by the bee colony, the target nodes corresponding to the multiple Pods to be scheduled are determined.
7. The resource scheduling method as described in claim 6, characterized in that, The step of using an improved ant colony algorithm to globally optimize the search space and determine the first search region includes: Initialize the ant colony parameters and initialize the path pheromone concentration to the preset concentration value; Based on the path pheromone concentration and a preset heuristic function, calculate the probability value of each scheduled Pod in each population being scheduled to any node to be deployed in the search space. Based on the probability value of each Pod to be scheduled being scheduled to any node to be deployed in the search space, the target scheduling node of each Pod to be scheduled is determined. Update the path pheromone concentration based on the load balancing degree of the currently determined target scheduling node; The target scheduling node for each Pod to be scheduled is re-determined based on the updated path pheromone concentration until the preset iteration termination condition is met, and the final target scheduling node for each Pod to be scheduled is determined as the first search area.
8. The resource scheduling method as described in claim 7, characterized in that, The step of calculating the probability value of each scheduled Pod in each population being scheduled to any node to be deployed in the search space based on the path pheromone concentration and a preset heuristic function includes: Based on the utilization of CPU, memory, network bandwidth, and disk space of the corresponding node when each scheduled Pod is scheduled to any node to be deployed, and the average utilization of CPU, memory, network bandwidth, and disk space of all nodes to be deployed in the search space, the expected degree of scheduling each scheduled Pod to be deployed to any node to be deployed is calculated through the heuristic function. Based on the expected degree of each scheduled Pod being scheduled to any deployment node and the path pheromone concentration, calculate the probability value of each scheduled Pod being scheduled to any deployment node.
9. The resource scheduling method as described in claim 7, characterized in that, The step of updating the path pheromone concentration based on the currently determined load balancing degree of the target scheduling node includes: Based on the utilization of CPU, memory, network bandwidth, and disk space of the corresponding target scheduling node when each Pod to be scheduled is scheduled to the corresponding target scheduling node, and the average utilization of CPU, memory, network bandwidth, and disk space of all the target scheduling nodes, the load balancing degree of each Pod to be scheduled to the corresponding target scheduling node is calculated, and it is used as the load balancing degree of the ants that schedule each Pod to be scheduled. The ants are sorted according to their respective load balancing degrees to determine the ranking of each ant; The increment of the path pheromone concentration is calculated based on the load balancing degree and ranking of each ant. The path pheromone concentration is updated based on the path pheromone concentration and its increment.
10. The resource scheduling method as described in claim 6, characterized in that, The step of updating the position of the first search region using a preset adaptive random rule distribution to determine the second search region includes: By taking the standard Gaussian distribution and the Cauchy distribution as the limiting distributions of continuous probability distributions under a given degree of freedom, an adaptive random regular distribution is obtained; The adaptive random rule distribution is used to update the position of the first search region to determine the second search region.
11. A resource scheduling device, characterized in that, include: The Pod interception module is used to intercept Pods created in a Kubernetes cluster, resulting in multiple Pods to be scheduled. The node filtering module is used to filter out multiple nodes to be deployed from the Kubernetes cluster based on the resource types and resource requirements of the multiple Pods to be scheduled and the resource information of the nodes in the Kubernetes cluster. The Pod scheduling module is used to determine the target node for each Pod to be scheduled from multiple nodes to be deployed according to a resource scheduling strategy based on an improved artificial bee colony algorithm, and to deploy the multiple Pods to be scheduled to the corresponding target nodes.
12. A resource scheduling device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the resource scheduling method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the resource scheduling method as described in any one of claims 1 to 10.
14. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the resource scheduling method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Resource load capacity prediction method, analysis prediction system and service operation monitoring system
CN103778474A
A resource scheduling optimization method based on cross-global artificial bee colony algorithm
CN109272137A
K8s-based pod intelligent balanced scheduling method, equipment, equipment and storage medium
CN117349022A
Dam termite monitoring node deployment method based on artificial bee colony algorithm
CN119539174A
Improved quantum ant colony algorithm-based spark platform task scheduling method
WO2021179462A1
Cited By
Cloud native database kubernetes dynamic scheduling method and equipment based on tensor structure
CN121509358A