A method and system for edge-cloud collaborative multi-task scheduling to ensure edge-cloud load ratio
By calculating the score matrix and pheromone matrix in edge-cloud collaborative multitasking, combining the ant colony algorithm optimization, and adding edge-cloud load ratio as the objective function parameter, the problem of edge-cloud load ratio uncontrollable in the existing technology is solved, and more reasonable edge-cloud load allocation and cluster performance improvement are achieved.
Patent Information
- Application Number
- CN202210036283.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-13
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2042-01-13
AI Technical Summary
The existing scheduling platforms lack consideration for edge cloud load ratio in collaborative scheduling of edge computing and cloud computing, resulting in greater load pressure on edge or cloud, affecting cluster performance and disaster recovery.
By calculating the scores of each task scheduled to any node, a score matrix is established, and the scheduling strategy optimization of the ant colony algorithm is performed based on the pheromone matrix, and the edge-cloud load ratio is added as the objective function parameter to ensure that the edge-cloud load ratio of the scheduling result is reasonable.
It ensures the load ratio of edge and cloud in edge and cloud collaborative multi-task scheduling, avoids the problem of excessive load pressure on the edge or cloud, and improves the performance and disaster recovery of the cluster.
Smart Images

Figure CN114371925B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of edge computing technology, and in particular to an edge-cloud collaborative multi-task scheduling method and system for ensuring edge-cloud load ratio. Background Art
[0002] Faced with the connection of massive user devices, explosive growth of data traffic and users' increasing demand for service quality, more and more companies are beginning to pay attention to edge computing. The rise of edge computing models does not mean the decline of cloud computing models. The two are not in a state of choosing one or the other. Edge computing can actually be seen as a supplement to centralized cloud computing, providing users with better service quality. Compared with edge clouds, central clouds can store more data, which is convenient for global query comparison and analysis. Edge computing can better realize the analysis and intelligent processing of real-time data. Both have their own advantages and are complementary and mutually combined. The combination of the two can reduce latency, improve scalability and increase access to information. Kubernetes (often referred to as k8s) is an open source system for automatically deploying, expanding and managing "containerized applications". Using kubernetes to manage each node in the edge cloud collaborative cluster is convenient for monitoring the real-time status of cloud and edge computing nodes, and scheduling pods that execute computing tasks to specific cloud nodes or edge nodes. The Kubernetes scheduler is part of the many components of Kubernetes and is used to schedule containers in the cluster. The scheduler takes one container from all containers to be scheduled each time, executes the filtering function and scoring function configured in the scheduling algorithm in turn, scores each node that can be scheduled, and uses the node ranked first as the deployment node for the container.
[0003] The built-in scheduling strategy of kubernetes is relatively simple. Each time it is scheduled, only one container is selected from all containers to be scheduled for scheduling. Therefore, it only implements the scheduling of a single task, and cannot globally optimize the scheduling of multiple tasks. The edge-cloud load ratio of the scheduling result is uncontrollable. At present, mainstream scheduling platforms such as SchedulerX and ElasticJob mainly focus on the real-time and reliability of scheduling, and lack consideration of the edge-cloud load ratio. The scheduling object of the built-in scheduling strategy in kubernetes is a single task. Even if a series of tasks arrive at the same time, they are screened, scored and scheduled one by one. This can only achieve local optimality, which is not ideal from a global perspective. Among the various existing scheduling strategies, there are relatively few that perform global optimization when a large number of tasks arrive. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides an edge-cloud collaborative multi-task scheduling method that guarantees the edge-cloud load ratio, so as to eliminate or improve one or more defects existing in the prior art.
[0005] One aspect of the present invention provides an edge-cloud collaborative multi-task scheduling method for ensuring edge-cloud load ratio, the method comprising:
[0006] Based on the remaining available amount of CPU resources and memory resources of each node, as well as the CPU resource request amount and memory resource request amount of each task, the score of each task scheduled to any node is calculated, and a score matrix is established;
[0007] Initializing a pheromone matrix according to the score matrix;
[0008] Obtaining all element values based on each task from the pheromone matrix, and calculating a random factor for each task based on the element values;
[0009] Based on the random factor, a scheduling strategy dividing line is established, so that some ants in the ant colony adopt the pheromone concentration scheduling strategy, and other ants adopt the random scheduling strategy;
[0010] Obtain the scheduling strategy of each ant for each task, and obtain the scheduling plan of each ant for all tasks based on the scheduling strategy of each ant for each task;
[0011] Calculate an edge-cloud load ratio based on the scheduling scheme, and calculate a target score of the scheduling scheme based on the edge-cloud load ratio;
[0012] Obtain the size of the random factor of all current tasks. If the size of the random factor of each task is greater than a preset first threshold, compare the target score of each ant and take the scheduling plan of the ant with the largest target score as the optimal strategy.
[0013] Obtain the size of the random factor of all current tasks. If the size of the random factor of any task is less than or equal to a preset first threshold, calculate the pheromone concentration increase ratio according to the remaining available amount of CPU resources and the remaining available amount of memory resources of each node, and update the pheromone matrix based on the pheromone concentration increase ratio.
[0014] The edge-cloud collaborative multi-task scheduling method for ensuring the edge-cloud load ratio of the present invention, first of all, the solution of the present application can complete the simultaneous scheduling of multiple tasks at the same time, and further, in the edge-cloud collaborative task scheduling, if the task load balance between the edge and the cloud is poor, it may cause the edge or cloud load pressure to be larger, affecting the performance of the task program running in the cluster, increasing the communication delay between each node, and the overall disaster recovery of the cluster will also be affected due to the aggregation of tasks. The current mainstream scheduling platforms mainly focus on the real-time and reliability of scheduling, and lack consideration of the edge-cloud load ratio. In the patent of the present invention, the edge-cloud load ratio is added as a parameter to the objective function, which directly affects the judgment of the quality of the scheduling results, and can ensure the edge-cloud load ratio of the scheduling results.
[0015] In some embodiments of the present invention, based on the remaining available amount of CPU resources and memory resources of each node, as well as the CPU resource request amount and memory resource request amount of each task, the score of each task scheduled to any node is calculated, and a score matrix is established, according to the following formula:
[0016]
[0017] LScore[j]=cpuScore[j]+memScore[j];
[0018]
[0019]
[0020] Bscore[j]=10-|cpuScore[j]–memScore[j]|;
[0021] CPUUsable[j] represents the remaining available amount of CPU resources of node j, e represents any one of 1-n nodes, CPUUsable[e] represents the remaining available amount of CPU resources of node e, cpuScore[j] represents the CPU score of node j, memScore[j] represents the memory score of node j, MEMUsable[j] represents the remaining available amount of memory resources of node j, MEMUsable[e] represents the remaining available amount of memory resources of node e, Bscore[j] represents the memory balance score of node j, LScore[j] represents the comprehensive resource score of node j, score[i][j] represents the score for scheduling task i to node j, CPUNeed[i] is the CPU resource request amount of task i, and MEMNeed[i] is the memory resource request amount of task i.
[0022] In some embodiments of the present invention, the step of initializing the pheromone matrix according to the score matrix is: the score of each task in the score matrix scheduled to each node is equivalent to the element in the pheromone matrix, and the score parameters in the score matrix are used as the element values in the pheromone matrix.
[0023] In some embodiments of the present invention, the random factor of each task is calculated based on the element value according to the following formula:
[0024]
[0025] randomFactor[i] represents the random factor of task i, maxPheromone[i] represents the subscript corresponding to the maximum element value of the row corresponding to task i in the pheromone matrix. If the maximum element value in the row corresponding to task i, pheromoneMatrix[i][1], pheromoneMatrix[i][2], …, pheromoneMatrix[i][n] is pheromoneMatrix[i][j], then maxPheromone[i] = j; pheromoneMatrix[i][j] represents the element value corresponding to task i and node j in the corresponding pheromone matrix, pheromoneMatrix[i][e] represents the element value corresponding to task i and node e in the corresponding pheromone matrix, and e represents any one of 1-n nodes.
[0026] In some embodiments of the present invention, the step of establishing a scheduling strategy dividing line based on the random factor so that some ants in the ant colony adopt the pheromone concentration scheduling strategy and another part of the ants adopt the random scheduling strategy includes:
[0027] All ants are numbered in sequence, and the dividing line ant number is calculated based on a random factor. The dividing line ant number is used as the scheduling strategy dividing line;
[0028] Among all the ants, the ants whose numbers are less than or equal to the dividing line adopt the pheromone concentration scheduling strategy, and the ants whose numbers are greater than the dividing line adopt the random scheduling strategy.
[0029] In some embodiments of the present invention, the step of sequentially numbering all ants includes:
[0030] The total number of ants is calculated based on the total number of nodes and the total number of tasks according to the following formula:
[0031]
[0032] antNum represents the total number of ants, n represents the total number of nodes, m represents the total number of tasks, and [] represents rounding.
[0033] In some embodiments of the present invention, the demarcation line ant number is calculated based on a random factor according to the following formula:
[0034] antp[i]=randomFactor[i]*antNum+1;
[0035] antp[i] represents the boundary ant number of task i, antNum represents the total number of ants, and randomFactor[i] represents the random factor of task i.
[0036] In some embodiments of the present invention, the target score of the scheduling scheme is calculated based on the edge-cloud load ratio according to the following formula:
[0037]
[0038] goal[k] represents the target score of ant k's scheduling plan, m represents the total number of tasks, task i is any one of the m tasks, intermediate[k][i] represents the node to which ant k schedules task i, if [intermediate[k][i]=j, then score[i][intermediate[k][i]]=score[i][j], score[i][j] represents the score of scheduling task i to node j, f(loadRatio) represents the function of edge-cloud load ratio, and loadRatio represents the edge-cloud load ratio.
[0039] In some embodiments of the present invention, the function of the edge-cloud load ratio is calculated according to any one of the following formulas:
[0040]
[0041]
[0042] [lr1,lr2] represents the control interval, lr1 represents the lower limit of the control interval, lr2 represents the upper limit of the control interval, and loadRatio represents the edge-cloud load ratio.
[0043] In some embodiments of the present invention, in the step of calculating the pheromone concentration increase ratio according to the remaining available amount of CPU resources and the remaining available amount of memory resources of each node, the pheromone concentration increase ratio is calculated according to the following formula: increaseRate indicates the increase rate of pheromone concentration.
[0044] In some embodiments of the present invention, the step of updating the pheromone matrix based on the pheromone concentration increase ratio is:
[0045] Multiply the value of pheromoneMatrix[i][intermediate[antMax][i]] by the pheromone concentration increase ratio to complete the pheromone update for task i. antMax is the number of the ant with the highest target score in the scheduling scheme, intermediate[antMax][i] indicates the node assigned to task i by ant antMax, and if intermediate[antMax][i] is j, pheromoneMatrix[i][j] indicates the corresponding element value of task i and node j in the corresponding pheromone matrix.
[0046] The pheromone is updated for all tasks to complete the updating of the pheromone matrix.
[0047] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention can be specifically pointed out and obtained in the specification and the accompanying drawings.
[0048] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention.
[0050] Figure 1 A schematic diagram of an implementation of the edge-cloud collaborative multi-task scheduling method for ensuring edge-cloud load ratio of the present invention;
[0051] Figure 2 This is a schematic diagram of the scheduling architecture;
[0052] Figure 3 This is a schematic diagram of the task scheduling module;
[0053] Figure 4 A schematic diagram of another implementation of the edge-cloud collaborative multi-task scheduling method for ensuring edge-cloud load ratio of the present invention. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0055] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.
[0056] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.
[0057] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.
[0058] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0059] Containerization: Containerization refers to packaging your software code and all the components it requires (such as libraries, frameworks, and other dependencies) together and keeping them isolated in their own "container."
[0060] Cluster: A cluster is a group of computer nodes used to run containerized applications.
[0061] Container scheduling: Through certain algorithms, containerized programs are started on appropriate nodes in the cluster.
[0062] The main ideas of the proposed edge-cloud collaborative multi-task scheduling method to ensure the edge-cloud load ratio are introduced as follows. First, the basic information of the tasks to be scheduled and the basic information of each edge cloud computing node in the cluster used for scheduling are obtained from all mobile devices and all container resources, and the number of ants in the ant colony that need to participate in the scheduling is calculated. The pheromone is initialized according to the task request resources and the remaining resources of the node. The initial random factor is calculated based on the pheromone aggregation. The random factor will change with the update of the pheromone concentration in each subsequent iteration. In each iteration, each ant gives its own scheduling plan separately. After a round of iteration is completed, the edge-cloud load ratio of the scheduling results given by each ant in the iteration is calculated. The objective function value of each ant scheduling result is calculated based on the edge-cloud load ratio. The more ideal the edge-cloud load ratio is, the larger the objective function value is, and the better the scheduling effect is. The ant that gives the best scheduling result is selected according to the objective function value, and the pheromone and random factor are updated according to its scheduling result. The random factor will change with the aggregation of pheromone concentration. The more aggregated the pheromone is, the lower the randomness of the scheduling is. After the iteration is completed, the best scheduling result in the last round of iteration is output as the final scheduling result of the entire algorithm, and each task is deployed to the corresponding edge or cloud node according to the final result.
[0063] like Figure 1 , 4 As shown, one aspect of the present invention provides an edge-cloud collaborative multi-task scheduling method for ensuring edge-cloud load ratio, and the steps of the method include:
[0064] Step S100, based on the remaining available amount of CPU resources and memory resources of each node, as well as the CPU resource request amount and memory resource request amount of each task, calculate the score of each task scheduled to any node, and establish a score matrix;
[0065] Step S200, initializing the pheromone matrix according to the score matrix;
[0066] In some embodiments of the present invention, the score matrix is used as an initialized pheromone matrix, the scores in the score matrix are used as the values of each element in the pheromone matrix, and each line in the pheromone matrix is the element value of each node corresponding to a certain task.
[0067] Step S300, obtaining all element values based on each task from the pheromone matrix, and calculating the random factor of each task based on the element values;
[0068] In some embodiments of the present invention, the size of the random factor is calculated based on the element value. During the iteration process of this solution, the value of each element may change, which is more flexible than the fixed random factor of the traditional ant colony algorithm.
[0069] Step S400: establishing a scheduling strategy dividing line based on the random factor, so that some ants in the ant colony adopt the pheromone concentration scheduling strategy, and the other part of the ants adopt the random scheduling strategy;
[0070] In some embodiments of the present invention, if a pheromone concentration scheduling strategy is adopted, task i is scheduled to the node corresponding to the largest element value in the row corresponding to i; if a random scheduling strategy is adopted, task i is scheduled to the node corresponding to any non-zero element value in the row corresponding to i.
[0071] The scheduling strategy adopted by pheromone concentration scheduling is to schedule task numbered i to the node with the largest element value, that is, to schedule each task to the node with the largest pheromone concentration in its corresponding row; the scheduling strategy adopted by random scheduling is to select non-zero element values in the pheromone matrix with equal probability for task numbered i. Assuming that the selected element value is the element with coordinates (i, j) in the matrix, task i is scheduled to node j.
[0072] Step S500: Obtain the scheduling strategy of each ant for each task, and obtain the scheduling scheme of each ant for all tasks according to the scheduling strategy of each ant for each task;
[0073] In some implementations of the present invention, the same ant may adopt different scheduling strategies for different tasks, and different ants may adopt the same scheduling strategy for the same task.
[0074] Step S600: Calculate the edge-cloud load ratio based on the scheduling scheme, and calculate the target score of the scheduling scheme based on the edge-cloud load ratio;
[0075] In some embodiments of the present invention, the nodes include edge nodes and cloud nodes, and the scheduling scheme is the scheduling scheme of a certain ant in this round of iteration, including the scheduling results of the ant for all tasks, such as scheduling task i to node j, and the edge-cloud load ratio is the ratio of the number of tasks scheduled to the edge node to the number of tasks scheduled to the cloud node.
[0076] Step S710: Obtain the size of the random factor of each current task. If the size of the random factor of each task is greater than a preset first threshold, compare the target score of each ant and take the scheduling plan of the ant with the largest target score as the optimal strategy.
[0077] Step S720, obtaining the size of the random factor of all current tasks. If there is any task whose random factor size is less than or equal to a preset first threshold, the pheromone concentration increase ratio is calculated according to the remaining available amount of CPU resources and the remaining available amount of memory resources of each node, and the pheromone matrix is updated based on the pheromone concentration increase ratio.
[0078] In some embodiments of the present invention, the size of the random factor of all tasks in the current iteration is obtained. If they are all greater than a preset first threshold, the iteration is exited. If the size of the random factor of any task is less than or equal to the preset first threshold, the iteration is continued to update the pheromone matrix.
[0079] The first threshold may be 0.85, 0.9 or 0.95, etc., preferably 0.9;
[0080] Figure 4 The iterative convergence value is the first threshold.
[0081] The edge-cloud collaborative multi-task scheduling method for ensuring the edge-cloud load ratio of the present invention, first of all, the solution of the present application can complete the simultaneous scheduling of multiple tasks at the same time, and further, in the edge-cloud collaborative task scheduling, if the task load balance between the edge and the cloud is poor, it may cause the edge or cloud load pressure to be larger, affecting the performance of the task program running in the cluster, increasing the communication delay between each node, and the overall disaster recovery of the cluster will also be affected due to the aggregation of tasks. The current mainstream scheduling platforms mainly focus on the real-time and reliability of scheduling, and lack consideration of the edge-cloud load ratio. In the patent of the present invention, the edge-cloud load ratio is added as a parameter to the objective function, which directly affects the judgment of the quality of the scheduling results, and can ensure the edge-cloud load ratio of the scheduling results.
[0082] In some embodiments of the present invention, based on the remaining available amount of CPU resources and memory resources of each node, as well as the CPU resource request amount and memory resource request amount of each task, the score of each task scheduled to any node is calculated, and a score matrix is established, according to the following formula:
[0083]
[0084] LScore[j]=cpuScore[j]+memScore[j];
[0085]
[0086]
[0087] Bscore[j]=10-|cpuScore[j]–memScore[j]|;
[0088] CPUUsable[j] represents the remaining available amount of CPU resources of node j, e represents any one of 1-n nodes, CPUUsable[e] represents the remaining available amount of CPU resources of node e, cpuScore[j] represents the CPU score of node j, memScore[j] represents the memory score of node j, MEMUsable[j] represents the remaining available amount of memory resources of node j, MEMUsable[e] represents the remaining available amount of memory resources of node e, Bscore[j] represents the memory balance score of node j, LScore[j] represents the comprehensive resource score of node j, score[i][j] represents the score for scheduling task i to node j, CPUNeed[i] is the CPU resource request amount of task i, and MEMNeed[i] is the memory resource request amount of task i.
[0089] When the traditional ant colony algorithm uses the above scheme to initialize the pheromone matrix, since the ant colony is completely unknown to the environment, all elements in the matrix are generally initialized to 1. In the multi-task scheduling discussed in this patent, the resource conditions of each node and the amount of resources required by each task are known. Therefore, when initializing the pheromone matrix, each element in the matrix is assigned a value separately according to the specific conditions of the node and the task. On the one hand, it can make the scheduling result more reasonable, and on the other hand, it can speed up the convergence of the iteration.
[0090] According to the edge cloud container resource information and task requirement information, a pheromone matrix model that meets the edge cloud resource coordination requirements is constructed. In the traditional ant colony algorithm, the environmental conditions cannot be perceived under the initial conditions, so the pheromone of each point in the environment is initially set to the same value, and the pheromone concentration is synchronously updated through the perception of the environment during the iteration process. In the patent of this invention, cluster resources and task conditions are used as algorithm inputs, and the initial pheromone concentration in the ant colony algorithm is calculated using the available resources of the cluster and the resources requested by the task, so as to optimize the execution process of the ant colony algorithm and accelerate the convergence speed of the algorithm iteration.
[0091] In addition, the Bscore[j] of the present application takes into account the balance of the remaining CPU and memory resources of node j to prevent the overload of one of the CPU and memory from affecting the other.
[0092] In some embodiments of the present invention, the step of initializing the pheromone matrix according to the score matrix is: the score of each task in the score matrix scheduled to each node is equivalent to the element in the pheromone matrix, and the score parameters in the score matrix are used as the element values in the pheromone matrix.
[0093] In some embodiments of the present invention, the random factor of each task is calculated based on the element value according to the following formula:
[0094]
[0095] randomFactor[i] represents the random factor of task i, maxPheromone[i] represents the subscript corresponding to the maximum element value of the row corresponding to task i in the pheromone matrix. If the maximum element value in the row corresponding to task i in pheromoneMatrix[i][1], pheromoneMatrix[i][2], …, pheromoneMatrix[i][n] is pheromoneMatrix[i][j], then maxPheromone[i] = j; pheromoneMatrix[i][j] represents the element value corresponding to task i and node j in the corresponding pheromone matrix, pheromoneMatrix[i][e] represents the element value corresponding to task i and node e in the corresponding pheromone matrix, and e represents any one of 1-n nodes.
[0096] Using the above scheme, randomFactor[i] is the ratio of the maximum element value in the i-th row of the pheromone matrix to the sum of all element values in that row;
[0097] During the execution of the ant colony algorithm, in order to prevent the scheduling results from converging to the local optimal solution, it is necessary to introduce random factors in the scheduling process to make the scheduling process random. In ordinary ant colony algorithms, the random factor is usually preset to a fixed value. In the problem solved by this patent, it is not appropriate to set the random factor to a fixed value: on the one hand, a larger randomness is required in the early stage of scheduling, so as to find a schedule close to the optimal solution among all possible solutions; on the other hand, a smaller randomness is required in the later stage of scheduling to prevent the results from converging for a long time, resulting in low scheduling timeliness. Therefore, in the patent of this invention, the random factor is dynamically determined by the pheromone situation in each round of iteration, so as to achieve the characteristics of strong randomness in the early stage of scheduling and weak randomness in the later stage of scheduling.
[0098] This solution proposes a dynamic random factor to improve the ant colony algorithm. In order to prevent the execution results from converging to the local optimal solution, the traditional ant colony algorithm will introduce a random factor to enhance the randomness of the intermediate results of the algorithm execution, thereby avoiding falling into the local optimal solution. However, the traditional ant colony algorithm generally sets the random factor to a fixed empirical value. If such a random factor determination method is applied to the problem solved by the patent of this invention, it will lead to two problems: first, the algorithm is not random enough in the early stage of execution, and it cannot widely reach various areas of the solution space, and the algorithm is executed in the later stage; second, the randomness is too large in the later stage of the algorithm execution, which makes the scheduling results converge too slowly.
[0099] In some embodiments of the present invention, the step of establishing a scheduling strategy dividing line based on the random factor so that some ants in the ant colony adopt the pheromone concentration scheduling strategy and another part of the ants adopt the random scheduling strategy includes:
[0100] All ants are numbered in sequence, and the dividing line ant number is calculated based on a random factor. The dividing line ant number is used as the scheduling strategy dividing line;
[0101] In some embodiments of the present invention, if there are z ants in total, they may be numbered 1, 2, ..., z.
[0102] Among all the ants, the ants whose numbers are less than or equal to the dividing line adopt the pheromone concentration scheduling strategy, and the ants whose numbers are greater than the dividing line adopt the random scheduling strategy.
[0103] If the boundary ant for task i is numbered δ, then the ants numbered 1, 2, …, δ adopt the pheromone concentration scheduling strategy for task i, while the ants numbered δ+1, …, z adopt the random scheduling strategy for task i.
[0104] In the early stage of scheduling, the ratio of the maximum element value in each row of the pheromone matrix to the sum of all element values in this row is small, so the randomness of scheduling is small. In the later stage of scheduling, the maximum element in each row is amplified in the iterative process, and the difference with other elements in the row gradually increases, and the ratio also gradually increases, so the randomness of scheduling gradually decreases.
[0105] In some embodiments of the present invention, the step of sequentially numbering all ants includes:
[0106] The total number of ants is calculated based on the total number of nodes and the total number of tasks according to the following formula:
[0107]
[0108] antNum represents the total number of ants, n represents the total number of nodes, m represents the total number of tasks, and [] represents rounding.
[0109] By adopting the above scheme, the total number of ants is calculated according to the total number of nodes and the total number of tasks, so as to avoid too many or too few ants and improve resource utilization.
[0110] In some embodiments of the present invention, the demarcation line ant number is calculated based on a random factor according to the following formula:
[0111] antp[i]=randomFactor[i]*antNum+1;
[0112] antp[i] represents the boundary ant number of task i, antNum represents the total number of ants, and randomFactor[i] represents the random factor of task i.
[0113] With the above solution, as the number of iterations increases, the value of randomFactor[i] increases, antp[i] increases, and the number of ants using random scheduling strategies gradually decreases, making it easier to find the optimal solution;
[0114] From the calculation formula of the random factor, it can be seen that the value of the random factor is in the interval of (0,1). The smaller the random factor, the higher the randomness of the scheduling. The actual meaning of randomFactor[i] is the proportion of ants that use the pheromone concentration strategy to schedule task i instead of the random strategy. To be precise, in the process of scheduling task i, ants numbered 1, 2, …, randomFactor[i]*antNum+1 perform pheromone concentration scheduling for task i, while ants numbered randomFactor[i]*antNum+1, …, antNum perform random scheduling for task i.
[0115] In some embodiments of the present invention, the target score of the scheduling scheme is calculated based on the edge-cloud load ratio according to the following formula:
[0116]
[0117] goal[k] represents the target score of ant k's scheduling plan, m represents the total number of tasks, task i is any one of the m tasks, intermediate[k][i] represents the node to which ant k schedules task i, if [intermediate[k][i]=j, then score[i][intermediate[k][i]]=score[i][j], score[i][j] represents the score of scheduling task i to node j, f(loadRatio) represents the function of edge-cloud load ratio, and loadRatio represents the edge-cloud load ratio.
[0118] goal[k] is the objective function.
[0119] Using the above scheme, the score assigned by ant k to each task is calculated, and the sum is calculated to obtain the target score of ant k's scheduling scheme in this iteration.
[0120] In some embodiments of the present invention, the function of the edge-cloud load ratio is calculated according to any one of the following formulas:
[0121] Using the above solution, in edge-cloud collaborative task scheduling, if the task load balance between the edge and the cloud is poor, it may cause greater load pressure on the edge or cloud, affecting the performance of the task program in the cluster, increasing the communication delay between each node, and the overall disaster recovery of the cluster will also be affected due to the aggregation of tasks. The current mainstream scheduling platforms mainly focus on the real-time and reliability of scheduling, and lack consideration of the edge-cloud load ratio. In the patent of this invention, the edge-cloud load ratio is added as a parameter to the objective function, which directly affects the judgment of the quality of the scheduling results and can ensure the edge-cloud load ratio of the scheduling results.
[0122] The edge-cloud load ratio is used as the scheduling target to meet the task scheduling requirements. In the existing edge-cloud collaborative scheduling solutions, more attention is paid to the load of each scheduling machine and the real-time and reliability of scheduling, and the edge-cloud load ratio is not taken into consideration. This patent adds the edge-cloud load ratio as a parameter to the calculation of the objective function, thereby ensuring that the edge-cloud load ratio of the scheduling result is within the ideal range.
[0123] If we need to control the scheduled edge-cloud load ratio within the interval [lr1, lr2] in actual production applications, and if we only need to control the edge-cloud load ratio within the interval [lr1, lr2], and the specific value of the edge-cloud load ratio in this interval does not affect the quality of the scheduling result, then f(loadRatio) can be set to a piecewise function with a value of 0 or 1. The function is as follows:
[0124]
[0125] However, in more practical situations, not only does the edge-cloud load ratio need to be controlled within the interval [lr1,lr2], but the closer it is to the geometric mean of the two boundary values, the better. For an edge-cloud load ratio x greater than and an edge-cloud load ratio y less than , if x*y=lr1*lr2, then the edge-cloud load ratio x is considered to be equivalent to y. Based on this consideration, f(loadRatio) is set to a relevant piecewise function, which is as follows:
[0126]
[0127] [lr1,lr2] represents the control interval, lr1 represents the lower limit of the control interval, lr2 represents the upper limit of the control interval, and loadRatio represents the edge-cloud load ratio.
[0128] When performing edge-cloud collaborative task scheduling, we hope that the load on the edge server and the cloud server is as balanced as possible. If the task load balance between the edge and the cloud is poor, it may cause greater load pressure on the edge or cloud, affecting the performance of the program, increasing communication delays, and affecting disaster recovery.
[0129] The edge-cloud resource collaborative multi-task scheduling can effectively utilize the computing resources of edge cloud and central cloud. For the edge-cloud collaborative multi-task scheduling, a global task scheduling module and an edge-cloud collaborative multi-task scheduling algorithm that guarantees the edge-cloud load ratio are proposed.
[0130] In some embodiments of the present invention, in the step of calculating the pheromone concentration increase ratio according to the remaining available amount of CPU resources and the remaining available amount of memory resources of each node, the pheromone concentration increase ratio is calculated according to the following formula: increaseRate indicates the increase rate of pheromone concentration.
[0131] Using the above scheme, the number of nodes is used to determine the increase ratio of pheromone concentration.
[0132] In some embodiments of the present invention, the step of updating the pheromone matrix based on the pheromone concentration increase ratio is:
[0133] Multiply the value of pheromoneMatrix[i][intermediate[antMax][i]] by the pheromone concentration increase ratio to complete the pheromone update for task i. antMax is the number of the ant with the highest target score in the scheduling scheme, intermediate[antMax][i] indicates the node assigned to task i by ant antMax, and if intermediate[antMax][i] is j, pheromoneMatrix[i][j] indicates the corresponding element value of task i and node j in the corresponding pheromone matrix.
[0134] The pheromone is updated for all tasks to complete the updating of the pheromone matrix.
[0135] An embodiment of the present invention also provides an edge-cloud collaborative multi-task scheduling system that ensures the edge-cloud load ratio. The system includes a computer device, the computer device includes a processor and a memory, the memory stores computer instructions, and the processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the system implements the steps of the method described above.
[0136] The proposed global task scheduling module is deployed in the cloud node, receives task scheduling requests, and uses the task scheduling algorithm to assign tasks to different containers for execution. The system architecture is as follows: Figure 2 As shown in Figure 1, cloud nodes, edge nodes, and all mobile devices are connected to each other through the network. Mobile devices can offload their tasks to edge nodes or cloud nodes to reduce runtime latency and task execution energy consumption.
[0137] The entire task scheduling process includes three stages: scheduling request reporting, resource perception, and task scheduling. In the scheduling request reporting stage, each mobile device reports its own task scheduling request to the edge node of the edge computing network where it is located, and then each edge node reports the received request to the task scheduling module in the cloud node. In the resource perception stage, the task scheduling module collects the resource status of each container in the associated edge and cloud. At the task scheduling node, the task scheduling module uses the proposed edge-cloud collaborative multi-task scheduling algorithm to obtain the scheduling results, and then offloads the tasks of the mobile device to the corresponding container for execution based on the scheduling results. The proposed task scheduling module includes three sub-modules: task acquisition, resource perception, and task scheduling. Figure 3 The functions of the three sub-modules correspond to the three stages of the task scheduling process.
[0138] The embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the edge-cloud collaborative multi-task scheduling method for ensuring the edge-cloud load ratio are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0139] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.
[0140] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.
[0141] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or replace features of other embodiments.
[0142] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An edge-cloud collaborative multi-task scheduling method to ensure edge-cloud load ratio, It is characterized in that The steps of the method include: Based on the remaining available amount of CPU resources and memory resources of each node, as well as the CPU resource request amount and memory resource request amount of each task, the score of each task scheduled to any node is calculated, and a score matrix is established; Initializing a pheromone matrix according to the score matrix; Obtaining all element values based on each task from the pheromone matrix, and calculating a random factor for each task based on the element values; Based on the random factor, a scheduling strategy dividing line is established, so that some ants in the ant colony adopt the pheromone concentration scheduling strategy, and other ants adopt the random scheduling strategy; Obtain the scheduling strategy of each ant for each task, and obtain the scheduling plan of each ant for all tasks based on the scheduling strategy of each ant for each task; Calculate an edge-cloud load ratio based on the scheduling scheme, and calculate a target score of the scheduling scheme based on the edge-cloud load ratio; Obtain the size of the random factor of all current tasks. If the size of the random factor of each task is greater than a preset first threshold, compare the target score of each ant and take the scheduling plan of the ant with the largest target score as the optimal strategy. Obtain the size of the random factor of all current tasks. If the size of the random factor of any task is less than or equal to a preset first threshold, calculate the pheromone concentration increase ratio according to the remaining available amount of CPU resources and the remaining available amount of memory resources of each node, and update the pheromone matrix based on the pheromone concentration increase ratio.
2. The method according to claim 1, It is characterized in that Based on the remaining available CPU resources and memory resources of each node, as well as the CPU resource requests and memory resource requests of each task, the score of each task scheduled to any node is calculated, and a score matrix is established according to the following formula: LScore[j]=cpuScore[j]+memScore[j]; Bscore[j]=10-|cpuScore[j]–memScore[j]|; CPUUsable[j] represents the remaining available amount of CPU resources of node j, e represents any one of 1-n nodes, CPUUsable[e] represents the remaining available amount of CPU resources of node e, cpuScore[j] represents the CPU score of node j, memScore[j] represents the memory score of node j, MEMUsable[j] represents the remaining available amount of memory resources of node j, MEMUsable[e] represents the remaining available amount of memory resources of node e, Bscore[j] represents the memory balance score of node j, LScore[j] represents the comprehensive resource score of node j, score[i][j] represents the score for scheduling task i to node j, CPUNeed[i] is the CPU resource request amount of task i, and MEMNeed[i] is the memory resource request amount of task i.
3. The method according to claim 1, It is characterized in that The random factor for each task is calculated based on the element value according to the following formula: randomFactor[i] represents the random factor of task i, maxPheromone[i] represents the subscript corresponding to the maximum element value of the row corresponding to task i in the pheromone matrix. If the maximum element value in the row corresponding to task i, pheromoneMatrix[i][1], pheromoneMatrix[i][2], …, pheromoneMatrix[i][n] is pheromoneMatrix[i][j], then maxPheromone[i] = j; pheromoneMatrix[i][j] represents the element value corresponding to task i and node j in the corresponding pheromone matrix, pheromoneMatrix[i][e] represents the element value corresponding to task i and node e in the corresponding pheromone matrix, and e represents any one of 1-n nodes.
4. The method according to claim 1, It is characterized in that The steps of establishing a scheduling strategy dividing line based on the random factor so that some ants in the ant colony adopt the pheromone concentration scheduling strategy and the other ants adopt the random scheduling strategy include: All ants are numbered sequentially, and the dividing line ant number is calculated based on a random factor. The dividing line ant number is used as the scheduling strategy dividing line; Among all the ants, the ants whose numbers are less than or equal to the dividing line adopt the pheromone concentration scheduling strategy, and the ants whose numbers are greater than the dividing line adopt the random scheduling strategy.
5. The method according to claim 4, It is characterized in that The steps to number all ants sequentially include: The total number of ants is calculated based on the total number of nodes and the total number of tasks according to the following formula: antNum represents the total number of ants, n represents the total number of nodes, m represents the total number of tasks, and [] represents rounding.
6. The method according to claim 4, It is characterized in that The dividing line ant number is calculated based on the random factor according to the following formula: antp[i]=randomFactor[i]*antNum+1; antp[i] represents the boundary ant number of task i, antNum represents the total number of ants, and randomFactor[i] represents the random factor of task i.
7. The method according to claim 1, It is characterized in that The target score of the scheduling solution is calculated based on the edge-cloud load ratio according to the following formula: goal[k] represents the target score of ant k's scheduling plan, m represents the total number of tasks, task i is any one of the m tasks, intermediate[k][i] represents the node to which ant k schedules task i, if [intermediate[k][i]=j, then score[i][intermediate[k][i]]=score[i][j], score[i][j] represents the score of scheduling task i to node j, f(loadRatio) represents the function of edge-cloud load ratio, and loadRatio represents the edge-cloud load ratio.
8. The method according to claim 7, It is characterized in that The function of edge-cloud load ratio is calculated according to any of the following formulas: [lr1,lr2] represents the control interval, lr1 represents the lower limit of the control interval, lr2 represents the upper limit of the control interval, and loadRatio represents the edge-cloud load ratio.
9. The method according to claim 3, It is characterized in that The steps of updating the pheromone matrix based on the pheromone concentration increase ratio are: Multiply the value of pheromoneMatrix[i][intermediate[antMax][i]] by the pheromone concentration increase ratio to complete the pheromone update for task i. antMax is the number of the ant with the highest target score in the scheduling scheme, intermediate[antMax][i] indicates the node assigned to task i by ant antMax, and if intermediate[antMax][i] is j, pheromoneMatrix[i][j] indicates the corresponding element value of task i and node j in the corresponding pheromone matrix. The pheromone is updated for all tasks to complete the updating of the pheromone matrix.
10. An edge-cloud collaborative multi-task scheduling system that guarantees edge-cloud load ratio, It is characterized in that The system includes a computer device, which includes a processor and a memory. The memory stores computer instructions. The processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the system implements the steps of the method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
A cloud computing center-oriented high-efficient load balancing optimization scheduling method.
CN109542619A
Collaborative scheduling method, system and device for dynamic edge computing
CN111722925A