Container task scheduling method and device in computing power network
By combining improved genetic algorithms and convex optimization algorithms with dynamic programming algorithms, the task and resource allocation in the computing power network is optimized, solving the problem of fragmented task allocation, achieving global latency optimization for container tasks, and improving the execution efficiency of the computing power network.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-01
- Publication Date
- 2026-04-10
AI Technical Summary
In computing networks, the optimization of task allocation, resource quotas, and container replicas in existing technologies is fragmented, resulting in container scheduling schemes that are not globally latency-optimal, thus affecting the execution efficiency of computing networks.
An improved genetic algorithm is used to generate an initial matching scheme between tasks and computing nodes. A convex optimization algorithm is used to calculate the amount of computing resources allocated and a dynamic programming algorithm is used to determine the number of replicas. Through iterative optimization using the fitness function, the optimal container task scheduling scheme is finally output.
This minimizes the average processing latency of container tasks in the computing network, thereby improving the execution efficiency of the computing network.
Smart Images

Figure CN121833157A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cloud computing technology, and in particular to a container task scheduling method and apparatus in a computing power network. Background Technology
[0002] With the rapid development of cloud computing, the Internet of Things, artificial intelligence, and 5G / 6G technologies, the traditional centralized cloud computing model is gradually showing its limitations in handling massive, low-latency services. Various emerging applications, such as autonomous driving, the industrial internet, and the metaverse, are placing new demands on computing power, requiring low latency, high bandwidth, and high security. Meanwhile, the rise of edge computing has led to a shift in computing resources from centralized to decentralized, forming a three-tiered "cloud-edge-device" architecture. How to effectively integrate these dispersed and heterogeneous computing resources to achieve globally optimized utilization has become a key issue that the industry urgently needs to address, leading to the emergence of the concept of computing power networks.
[0003] The computing power network deeply integrates and coordinates heterogeneous computing resources such as cloud computing centers, edge computing nodes, and terminal devices distributed in different geographical locations through networking, constructing a unified and globally aware "computing power resource pool." Its core lies in achieving deep coupling between computing power and the network. By sensing the computing power status through the network and optimizing network resource allocation through computing power, it ultimately provides users with intelligent computing power services that offer "one-point access and network-wide service."
[0004] For heterogeneous computing network scenarios, container technology is an important means to solve the problem of heterogeneous computing power scheduling. Container technology can package programs and their runtime dependencies into standardized, highly portable images, and provide a process-isolated and resource-limitable runtime environment through a container engine. It allows for one-time packaging and execution anywhere. Furthermore, multiple container services can be quickly deployed on the same computing node.
[0005] In a computing network environment oriented towards containerized services, the key issues for improving the execution efficiency of the computing network and reducing the average processing latency of tasks are to rationally schedule different types of tasks, decide the number of containers to be launched on computing nodes under resource constraints, and decide how to allocate computing resources to different containers. Summary of the Invention
[0006] This invention provides a container task scheduling method and apparatus in a computing network to address the shortcomings of existing technologies that optimize task allocation, resource quotas, and container replicas separately, resulting in a non-globally optimal container scheduling scheme. This invention minimizes the average processing latency of container tasks in the computing network and improves the execution efficiency of the computing network.
[0007] This invention provides a container task scheduling method in a computing power network, comprising: Obtain the task set, the computing node set, and the container type set within the task scheduling period; Based on the task set, computing node set, and container type set, an improved genetic algorithm is used to generate an initial matching scheme between tasks and computing nodes. The initial matching scheme assigns a target computing node to each task. Based on the initial matching scheme, the optimal computing resource allocation for each type of container on each computing node is calculated using the convex optimization algorithm, so that all replicas of each type of container equally share the computing resources allocated to the corresponding type of container. Based on the initial matching scheme, the optimal number of replicas of each type of container on each computing node is calculated using a dynamic programming algorithm; Based on the initial matching scheme, the optimal amount of computing resources allocated, and the optimal number of replicas, the average processing latency of all tasks is calculated, and the negative value of the average processing latency is used as the fitness function of the improved genetic algorithm. The initial matching scheme is iteratively optimized based on the fitness function until the termination condition is met, and the optimal container task scheduling scheme is output. Container task scheduling is performed based on the optimal container task scheduling scheme.
[0008] In one possible implementation, the method further includes: Obtain different types of tasks uploaded by the client to the computing power network system to obtain a task set, where each task includes the input data size; Based on the task types in the task set, the required container type is determined to obtain a container type set, wherein each task type corresponds to one container type; Tasks of the same type are sorted in ascending order of input data size and stored in a cache queue; The number of computing nodes is determined based on the number of cache queues, thus obtaining the set of computing nodes.
[0009] In one possible implementation, the method further includes: Based on the task set, the first computing resource amount and the first memory resource amount of each computing node in the computing node set, the second computing resource amount and the second memory resource amount required for each container type to process a unit of data, and the startup latency, an improved genetic algorithm is used to generate an initial matching scheme between tasks and computing nodes.
[0010] In one possible implementation, the method further includes: For each computing node, the corresponding set of tasks assigned to each computing node is obtained according to the initial matching scheme, and the total amount of data to be processed by each type of container is calculated. With the goal of minimizing the cumulative processing latency of all tasks on each computing node, a convex optimization model is established for the allocation of computing resources for each type of container. By using a convex optimization algorithm to solve the convex optimization model through the construction of a Lagrangian function, the optimal allocation of computing resources for each type of container on each computing node is obtained.
[0011] In one possible implementation, the method further includes: The problem of the number of replicas of each type of container is transformed into a knapsack problem with limited item selection by taking the first memory resource of the corresponding computing node as the knapsack capacity, the memory usage of a single replica as the item weight, and the value objective of reducing task processing latency. The knapsack problem is solved using a dynamic programming algorithm to obtain the optimal number of replicas of each type of container on each computing node.
[0012] In one possible implementation, the method further includes: Based on the fitness function, an improved genetic algorithm is used to maintain and evolve the population of task-computing node matching schemes. For each matching scheme, the convex optimization algorithm and the dynamic programming algorithm are called in turn to calculate the optimal resource allocation and the number of replicas, and the average processing latency is returned as the fitness. When the maximum number of iterations is reached or the fitness converges, the historically optimal task and computing node matching scheme, resource allocation scheme, and replica configuration scheme are output to obtain the optimal container task scheduling scheme.
[0013] The present invention also provides a container task scheduling device in a computing power network, comprising the following modules: The acquisition module is used to acquire the task set, the computing power node set in the computing power network, and the container type set within the task scheduling period; The generation module is used to generate an initial matching scheme between tasks and computing nodes based on the task set, computing node set, and container type set using an improved genetic algorithm. The initial matching scheme assigns a target computing node to each task. The computing module is used to calculate the optimal computing resource allocation for each type of container on each computing node based on the initial matching scheme using a convex optimization algorithm, so that all replicas of each type of container equally share the computing resources allocated to the corresponding type of container. The calculation module is used to calculate the optimal number of replicas of each type of container on each computing node based on the initial matching scheme using a dynamic programming algorithm. The calculation module is used to calculate the average processing latency of all tasks based on the initial matching scheme, the optimal computing resource allocation, and the optimal number of replicas, and to use the negative value of the average processing latency as the fitness function of the improved genetic algorithm. The optimization module is used to iteratively optimize the initial matching scheme based on the fitness function until the termination condition is met, and output the optimal container task scheduling scheme. The scheduling module is used to schedule container tasks based on the optimal container task scheduling scheme.
[0014] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the container task scheduling method in the computing power network as described above.
[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the container task scheduling method in a computing power network as described above.
[0016] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the container task scheduling method in a computing power network as described above.
[0017] The present invention provides a container task scheduling method and apparatus in a computing power network, which involves: acquiring a task set, a set of computing power nodes, and a set of container types within a task scheduling period; generating an initial matching scheme between tasks and computing power nodes using an improved genetic algorithm based on the task set, the set of computing power nodes, and the set of container types, wherein the initial matching scheme assigns a target computing power node to each task; calculating the optimal computing resource allocation for each type of container on each computing power node using a convex optimization algorithm based on the initial matching scheme, such that all replicas of each type of container equally share the computing resources allocated to the corresponding type of container; calculating the optimal number of replicas for each type of container on each computing power node using a dynamic programming algorithm based on the initial matching scheme; calculating the average processing latency of all tasks according to the initial matching scheme, the optimal computing resource allocation, and the optimal number of replicas, and using the negative value of the average processing latency as the fitness function of the improved genetic algorithm; iteratively optimizing the initial matching scheme based on the fitness function until a termination condition is met, and outputting an optimal container task scheduling scheme; and performing container task scheduling based on the optimal container task scheduling scheme. Compared to existing technologies that optimize task allocation, resource quotas, and container replicas separately, resulting in container scheduling schemes that are not globally latency-optimal, this solution minimizes the average processing latency of container tasks in the computing network, thereby improving the execution efficiency of the computing network. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0019] Figure 1 This is one of the flowcharts illustrating the container task scheduling method in the computing power network provided by the present invention.
[0020] Figure 2 This is the second flowchart illustrating the container task scheduling method in the computing power network provided by this invention.
[0021] Figure 3 This is a schematic diagram of a computing power network container task scheduling scenario provided by the present invention.
[0022] Figure 4 This is a flowchart of the computing power network container task scheduling solution algorithm provided by the present invention.
[0023] Figure 5 This is a schematic diagram comparing the average processing latency for different numbers of tasks provided by the present invention.
[0024] Figure 6 This is a schematic diagram comparing the average processing latency for different numbers of nodes provided by the present invention.
[0025] Figure 7 This is a schematic diagram of the container task scheduling device in the computing power network provided by the present invention.
[0026] Figure 8 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0028] To facilitate understanding of the embodiments of the present invention, further explanations and descriptions will be provided below with reference to the accompanying drawings and specific embodiments. These embodiments do not constitute a limitation on the embodiments of the present invention.
[0029] Figure 1This is one of the flowcharts illustrating the container task scheduling method in the computing power network provided by the present invention, such as... Figure 1 As shown, the method includes the following: S11. Obtain the task set within the task scheduling period, the set of computing nodes in the computing power network, and the set of container types.
[0030] Obtain different types of tasks uploaded by the client to the computing power network system to obtain a task set, where each task contains the input data size; determine the required container type based on the task type in the task set to obtain a container type set, where each task type corresponds to one container type; sort the tasks of the same type in ascending order according to the input data size and store them in a cache queue; determine the number of computing power nodes based on the number of cache queues to obtain a computing power node set.
[0031] S12. Based on the task set, computing node set, and container type set, an improved genetic algorithm is used to generate an initial matching scheme between tasks and computing nodes. The initial matching scheme assigns a target computing node to each task.
[0032] Based on the task set, the first computing resource amount and the first memory resource amount of each computing node in the computing node set, the second computing resource amount and the second memory resource amount required for each container type to process a unit of data, and the startup latency, an improved genetic algorithm is used to generate an initial matching scheme between tasks and computing nodes.
[0033] S13. Based on the initial matching scheme, use the convex optimization algorithm to calculate the optimal computing resource allocation for each type of container on each computing node, so that all replicas of each type of container equally share the computing resources allocated to the corresponding type of container.
[0034] For each computing node, the set of tasks of the corresponding type is obtained according to the initial matching scheme, and the total amount of data to be processed by each type of container is calculated. With the goal of minimizing the cumulative processing latency of all tasks on each computing node, a convex optimization model for the allocation of computing resources for each type of container is established. The optimal allocation of computing resources for each type of container on each computing node is obtained by solving the convex optimization model by constructing a Lagrangian function using a convex optimization algorithm.
[0035] S14. Based on the initial matching scheme, use a dynamic programming algorithm to calculate the optimal number of replicas of each type of container on each computing node.
[0036] The problem of determining the number of replicas of each type of container is transformed into a knapsack problem with limited item selection times. The problem is solved by using the number of replicas of each type of container on the computing node as the decision variable, the first memory resource of the corresponding computing node as the knapsack capacity, the memory usage of a single replica as the item weight, and the goal of reducing task processing latency. A dynamic programming algorithm is used to solve the knapsack problem to obtain the optimal number of replicas of each type of container on each computing node.
[0037] S15. Based on the initial matching scheme, the optimal computing resource allocation, and the optimal number of replicas, calculate the average processing latency of all tasks, and use the negative value of the average processing latency as the fitness function of the improved genetic algorithm.
[0038] S16. Iteratively optimize the initial matching scheme based on the fitness function until the termination condition is met, and output the optimal container task scheduling scheme.
[0039] Based on the fitness function, an improved genetic algorithm is used to maintain and evolve a population of task-to-computing node matching schemes. For each matching scheme, a convex optimization algorithm and a dynamic programming algorithm are called in sequence to calculate the optimal resource allocation and the number of replicas, and the average processing latency is returned as the fitness. When the maximum number of iterations is reached or the fitness converges, the historically optimal task-to-computing node matching scheme, resource allocation scheme, and replica configuration scheme are output to obtain the optimal container task scheduling scheme.
[0040] S17. Perform container task scheduling based on the optimal container task scheduling scheme.
[0041] Each computing node establishes a short job priority cache queue locally according to the optimal container task scheduling scheme; newly arrived tasks first enter the queue corresponding to their target node and are arranged in ascending order of input data volume.
[0042] When any container instance is idle, the task with the smallest amount of data is immediately taken from the head of the queue and executed; the CPU cycles required for execution have been evenly distributed to each replica by the quota matrix, so the processing rate can be accurately predicted and the queuing latency is compressed to the theoretical minimum.
[0043] If all replicas of a certain type of container are busy, subsequent tasks will still be waiting in the queue, and will not consume memory or trigger node-level memory exhaustion due to blindly creating new instances; the memory limit has been locked by the knapsack algorithm in the replica planning stage, and the system is always in a state of zero resource conflict.
[0044] The container task scheduling method in a computing power network provided by this invention involves: acquiring a task set, a set of computing power nodes, and a set of container types within a task scheduling period; generating an initial matching scheme between tasks and computing power nodes using an improved genetic algorithm based on the task set, computing power node set, and container type set, wherein the initial matching scheme assigns a target computing power node to each task; calculating the optimal computing resource allocation for each type of container on each computing power node using a convex optimization algorithm based on the initial matching scheme, such that all replicas of each type of container equally share the computing resources allocated to the corresponding type of container; calculating the optimal number of replicas for each type of container on each computing power node using a dynamic programming algorithm based on the initial matching scheme; calculating the average processing latency of all tasks according to the initial matching scheme, the optimal computing resource allocation, and the optimal number of replicas, and using the negative value of the average processing latency as the fitness function of the improved genetic algorithm; iteratively optimizing the initial matching scheme based on the fitness function until a termination condition is met, outputting an optimal container task scheduling scheme; and performing container task scheduling based on the optimal container task scheduling scheme. Compared to existing technologies that optimize task allocation, resource quotas, and container replicas separately, resulting in container scheduling schemes that are not globally latency-optimal, this method minimizes the average processing latency of container tasks in the computing network, thereby improving the execution efficiency of the computing network.
[0045] Figure 2 This is the second flowchart illustrating the container task scheduling method in the computing power network provided by this invention, as shown below. Figure 2 As shown, the method includes the following: S21. Obtain client upload data. Different types of tasks in a force network system yield a task set.
[0046] S22. Determine the required container type based on the task types in the task set to obtain a container type set. Each task type corresponds to one container type. S23. Sort tasks of the same type in ascending order according to the size of the input data and store them in a cache queue.
[0047] S24. Determine the number of computing nodes based on the number of cache queues to obtain the computing node set.
[0048] The following provides a unified explanation of S21-S24: The purpose of this invention is to model the task processing mode of caching before execution in a computing network container task scheduling scenario, and propose a task scheduling algorithm with the optimization objective of minimizing the average execution latency of tasks. Container task scheduling is divided into three sub-problems: task computing node allocation, container computing resource allocation, and container replica number configuration. A joint optimization algorithm is proposed to solve these three sub-problems, with the objective of minimizing the average execution latency of container tasks.
[0049] Specifically, in computing power network container task scheduling scenarios such as Figure 3 As shown, within a task scheduling cycle, the client uploads a set of different types of tasks to the computing power network system. The task scheduling service is responsible for scheduling the tasks to a specific computing power node for caching and processing. Each type of task has a cache queue on the computing power node, and the system uses a priority queue, with shorter tasks given priority. Under resource constraints, computing power nodes can start containers to process the cached tasks scheduled to that node. Different types of tasks require different types of containers for processing, and multiple replicas of the same type of container can be started. Containers consume node resources, so resource constraints need to be considered. The goal is to minimize the average task execution latency.
[0050] The specific modeling and workflow of the system are as follows: the computing power network consists of a set of computing power nodes. ,in This represents the number of computing nodes. Computing nodes possess heterogeneous resources; this scenario primarily considers computing (CPU only) and memory resources. Representing computing power nodes The system requires sufficient computing and memory resources. It supports processing M different types of tasks, each type requiring processing within a corresponding type of container, meaning it contains M types of containers. ,container It has two attributes ,in This indicates the amount of computing resources required to process a unit of data. This indicates the amount of memory resources required by the container. Computing resources can be dynamically allocated, while memory resources are determined by configuration. Under resource constraints, a computing node can launch multiple containers, and multiple replicas of the same type of container can be launched. The maximum number of replicas a container can launch is specified. It is determined by the system configuration.
[0051] The task model is as follows: a task scheduling cycle receives a set of tasks. It contains S tasks. Contains two properties , Enter the data size for the task. This indicates the type of container required for the task. The task scheduling service schedules tasks to the node's task cache queue for caching. Containers are created to process the cached tasks in the task queue. Tasks in the cache queue are sorted in ascending order of input data size, with priority given to tasks with smaller input data (shortest jobs first). When a container is idle, it retrieves a task from the task cache queue for processing.
[0052] The latency model is as follows, for scheduling to computing nodes Task The required container type is The processing latency of this task can be divided into three parts: container startup latency, queuing latency, and execution latency.
[0053] Container startup latency is a constant, determined by the container type: Formula 1 in, For container startup latency, It is a container type.
[0054] Execution latency is related to the computing resources allocated to the container and the size of the task's input data. It is calculated by multiplying the input data size by the execution latency per unit of data. The unit latency is determined by the ratio of the computing resources required to process a unit of data to the computing resources allocated to the container. This represents the computational resources allocated to a container of type m, by Divide into equal containers The number of copies of the container of type m: Formula 2 in, Due to execution delay.
[0055] Queuing delay for tasks The sum of the execution latencies of tasks previously scheduled to the same container instance; only after these tasks are completed can the container process its own task. Prerequisite quests under fixed instance configuration : Formula 3 Therefore, the processing latency for container task i is: Formula 4 node The processing latency of all tasks is the time required to schedule to the node. The sum of processing latency for all types of tasks. To schedule to the node The container type is The task set is given by the following formula: Formula 5 The optimization objective is to optimize the average processing latency of all tasks, where S is the number of tasks. Formula Six S25. Based on the task set, the first computing resource amount and the first memory resource amount of each computing node in the computing node set, the second computing resource amount and the second memory resource amount required for each container type to process a unit of data amount, and the startup latency, an improved genetic algorithm is used to generate an initial matching scheme between tasks and computing nodes.
[0056] S26. For each computing power node, obtain the corresponding set of tasks assigned to each computing power node according to the initial matching scheme, and calculate the total amount of data to be processed by each type of container.
[0057] S27. With the goal of minimizing the cumulative processing latency of all tasks on each computing node, establish a convex optimization model for the allocation of computing resources for each type of container.
[0058] S28. Using a convex optimization algorithm, the optimal computing resource allocation for each type of container on each computing node is obtained by constructing a Lagrangian function to solve the convex optimization model.
[0059] The following provides a unified explanation of S25-S28: To solve the above optimization model, this embodiment of the invention divides container task scheduling into three sub-problems. Considering that the matching of tasks and nodes affects the allocation of node container computing resources and the configuration of container replicas, and the latter in turn affects the evaluation of the former's performance, a two-layer algorithm is used for mutual feedback to solve the problem. The solution method is as follows: Figure 4 As shown, an improved genetic algorithm is used externally to determine the matching of tasks and computing nodes. Internally, based on the task node matching scheme generated by the genetic algorithm, a convex optimization algorithm is used to allocate container computing resources, and a dynamic programming algorithm is used to configure the number of container replicas. The internal algorithm is used to evaluate the fitness of the matching scheme generated by the genetic algorithm and to assist the evolution of the genetic algorithm.
[0060] A container computing resource allocation algorithm based on convex optimization is proposed: a node needs to allocate its computing resources to each type of container, and all replicas of each type of container are equally distributed among the computing resources of the current type of container. This section proposes an optimal container computing resource allocation method for a single node given task node matching.
[0061] The objective of allocating computing resources is to minimize the average processing latency of node tasks. Based on Formulas 4 and 5, the optimization objective can be obtained as follows: Formula 7 Once the task and node match is determined, it is assigned to the node. The type is task set It is certain that the amount of input data for task i is... ,container Startup time Since it is also a constant, the optimization objective is rewritten as follows, where For about The polynomial, where b is a constant: Formula 8 The constraint is that the computing resources allocated to a node for all types of containers shall not exceed the node's total computing resources. Formula Nine Clearly, the constraint (Equation 9) is a convex function. We will now prove that the objective function is also a convex function, expressed as follows: The Hessian matrix is calculated using the following formula.
[0062] Formula 10 Formula Eleven We can see that the objective function's Hessian matrix is positive definite, and G is a convex function. Therefore, the Lagrange method can be used to find the optimal container for resource allocation. The Lagrange function is defined as follows: Formula 12 in These are Lagrange multipliers. The optimal resource allocation can be solved using the KKT conditions: Formula Thirteen Substituting the optimal allocation into the objective function G, we can obtain the objective function under optimal resource allocation as follows: Formula Fourteen In summary, given a task node matching scheme, the allocation of container resources for a single node is a convex optimization problem. The KKT conditions can be applied to find the optimal allocation of computing resources, thus obtaining the node task processing latency under optimal computing resources. The algorithm pseudocode is as follows: S29. Using the number of replicas of each type of container as the decision variable, the first memory resource of the corresponding computing node as the knapsack capacity, the memory usage of a single replica as the item weight, and shortening the task processing latency as the value objective, the problem of the number of replicas of each type of container on the computing node is transformed into a knapsack problem with limited item selection times.
[0063] S210. The knapsack problem is solved using a dynamic programming algorithm to obtain the optimal number of replicas of each type of container on each computing node.
[0064] Dynamic programming-based container replica configuration algorithm: A container computing resource allocation algorithm based on convex optimization can obtain the optimal task processing delay function for nodes. According to (Formula Fourteen), this function is a function concerning the number of replicas configured for each type of container, denoted as... This section proposes a method for optimizing container replica configuration to minimize node task processing latency under optimal resource allocation.
[0065] The container replica configuration problem involves deciding how many replicas to start for each type of container, given the limitations of node memory resources. In form, we can define the value function Setting the number of replicas per container is the inverse of the contribution to node task processing latency: Formula Fifteen Obviously and Therefore, the container replica configuration optimization target is transformed into the following formula: Formula Sixteen The objective function generates a value summation form for different types of containers. The replica configuration is limited by the memory resources of the container nodes, and each container can create a maximum of [number missing] replicas. Each node has multiple replicas, and if a node needs to handle a certain type of task, the number of containers cannot be zero. This problem can be transformed into a knapsack problem with a limited number of item selections, where the knapsack capacity is equal to the node's memory size. The value of each item is a function of its value. Each item can be selected up to a maximum of One, to use memory Discretize to a unit size, each item occupies a central area of size. The goal is to find the maximum value that can be obtained. This type of knapsack problem can be solved using dynamic programming. The pseudocode for the algorithm is as follows: S211. Based on the initial matching scheme, the optimal amount of computing resources allocated, and the optimal number of replicas, calculate the average processing latency of all tasks, and use the negative value of the average processing latency as the fitness function of the improved genetic algorithm.
[0066] S212. Based on the fitness function, maintain and evolve the population of task and computing node matching schemes using an improved genetic algorithm.
[0067] S213. For each matching scheme, call the convex optimization algorithm and the dynamic programming algorithm in sequence to calculate the optimal resource allocation and the optimal number of replicas, and return the average processing latency as the fitness.
[0068] S214. When the maximum number of iterations is reached or the fitness converges, output the historically optimal task and computing node matching scheme, resource allocation scheme and replica configuration scheme to obtain the optimal container task scheduling scheme.
[0069] The following provides a unified explanation of S211-S214: Task node matching algorithm based on improved genetic algorithm: After generating the task node matching scheme based on the container computing resource allocation algorithm and the container replica configuration algorithm, the processing latency of all node tasks can be calculated using the above algorithm, and then the average processing latency of the task can be obtained.
[0070] Furthermore, the average processing latency of tasks is optimized by solving the task node matching problem using an improved genetic algorithm.
[0071] Genetic algorithms include the following steps: Step 1, Initialize the population: Randomly generate an initial population containing multiple individuals (solutions), each represented by a set of decision variables.
[0072] Step 2, Fitness Evaluation: Define a fitness function based on the optimization objective. Decode each individual into its corresponding solution, substitute it into the fitness function for calculation, and output a fitness score. This score is the sole criterion for evaluating the quality of the individual.
[0073] Step 3, Selection Operation: Based on fitness scores, select parent individuals from the current population for reproduction. The core principle is to increase the probability of selecting individuals with high fitness, thus guiding the search direction.
[0074] Step 4, Cross: Use the cross operation to generate one or more child solutions from two parent solutions.
[0075] Step 5, Mutation: Use the mutation operation to randomly change the decision variables of individuals to increase the diversity of the population.
[0076] Step 6, Generate a new population: Replace some or all of the individuals in the old population with the newly generated offspring individuals to complete the population update and iteration.
[0077] Step 7, Termination Condition Check: Check if the preset termination condition is met (reaching the maximum number of generations or finding a solution that meets the accuracy requirements). If the condition is met, output the historical best solution. Otherwise, the algorithm returns to Step 2 to continue execution.
[0078] In this scenario, individuals are encoded using integers, and each individual is an S-dimensional vector. Each bit represents the task scheduling node number. The fitness is set to the negative of the average task processing latency, indicating that the smaller the average task processing latency of the task node matching scheme, the better the matching scheme. Based on (Equation 6) and (Equation 14), we obtain: Formula 17 This patent introduces a probabilistic mutation operator during the mutation phase, increasing the probability that tasks will mutate to computing nodes with lighter loads and fewer queues of similar tasks, thus assisting population evolution and the search for better solutions. The formula for the probabilistic mutation operator is as follows: Formula 18 in, This indicates that a task scheduling node of type m has mutated to a node. The probability, the computing resources required for task i are determined by the size of the task input data. Computing resources required per unit of data The product determines the outcome. Represents a node The ratio of computing resources required for the tasks carried by the node to the computing resources of the node. Represents a node The computing resources required for all tasks of type m.
[0079] The pseudocode for the Probabilistic Mutation Operator Improved Genetic Algorithm (PM-GA) is as follows: This invention also uses Python to conduct simulation experiments, and the comparison algorithms include: Container node matching and comparison algorithm: Genetic Algorithm (GA): Basic Genetic Algorithm Greedy algorithm: Tasks are preferentially scheduled to nodes where the ratio of the computing resources required to carry the task to the node's computing resources is smaller.
[0080] Container replica configuration comparison algorithm: Random Container Replica Configuration (RANDOM) algorithm: randomly creates container replicas.
[0081] The final comparison algorithms are as follows: 1. The PM-GA task node matching algorithm and DP container replica configuration proposed in this invention 2. GA task node matching algorithm + DP container replica configuration algorithm 3. Greendy task node matching algorithm + DP container replica configuration algorithm 4. PM-GA task node matching algorithm + RANDOM replica configuration algorithm To compare the above algorithms, we used Python simulation, running each algorithm ten times and taking the average.
[0082] In scenarios with different numbers of tasks on a fixed task node, the PM-GA+DP algorithm shows an improvement of approximately 6.6% in average task processing latency compared to the GA+DP algorithm, approximately 12.2% compared to the GREEDY+DP algorithm, and approximately 15.3% compared to the PM-GA+RANDOM algorithm.
[0083] In scenarios with a fixed number of tasks but different task nodes, the PM-GA+DP algorithm shows an improvement of approximately 7.1% in average task processing latency compared to the GA+DP algorithm, approximately 13.2% compared to the GREEDY+DP algorithm, and approximately 15%-20% compared to the PM-GA+RANDOM algorithm.
[0084] 1) Evaluation indicators: Average processing time of tasks 2) Environment: Hardware configuration: AMD R7 7745HX CPU, Intel(R) Core(TM) i5-8300H CPU Operating System: Windows 11 Python version: 3.11.
[0085] The experimental parameters are fixed as shown in Table 1: Table 1 3) Experiment In scenarios with a fixed number of task nodes and varying task quantities (with a fixed number of computing nodes of 10 and task quantities ranging from 200 to 450 in 50 increments), the experimental results are as follows: Figure 5 The diagram shows a comparison of average processing latency for different numbers of tasks.
[0086] In scenarios with a fixed number of nodes and varying numbers of tasks, where the fixed number of tasks is 400 and the number of nodes ranges from 8 to 12 with an interval of 1, the latency results are as follows. Figure 6 The diagram showing the average processing latency comparison for different numbers of nodes demonstrates a more significant improvement when the number of nodes is smaller.
[0087] This invention primarily considers container task scheduling in computing power networks, specifically a task processing mode of caching before execution. This scenario involves three main sub-problems: which node to schedule the task to, container computing resource allocation, and the number of container replicas. Firstly, current research lacks modeling for the caching-before-execution task processing mode. Secondly, current research lacks a comprehensive consideration of these three problems, simultaneously optimizing task and node matching, efficient allocation of container computing resources, and reasonable configuration of the number of container replicas. A joint solution algorithm is proposed to optimize the average latency of container tasks. Therefore, the average processing latency of container tasks in computing power networks is minimized, improving the execution efficiency of computing power networks.
[0088] The container task scheduling device in the computing power network provided by the present invention is described below. The container task scheduling device in the computing power network described below can be referred to in correspondence with the container task scheduling method in the computing power network described above.
[0089] Figure 7 This is a schematic diagram of the structure of the container task scheduling device in the computing power network provided by the present invention, specifically including: The acquisition module 701 is used to acquire the task set, the computing node set in the computing power network, and the container type set within the task scheduling period. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0090] The generation module 702 is used to generate an initial matching scheme between tasks and computing nodes based on the task set, computing node set, and container type set using an improved genetic algorithm. The initial matching scheme assigns a target computing node to each task. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0091] The calculation module 703 is used to calculate the optimal allocation of computing resources for each type of container on each computing node based on the initial matching scheme and using a convex optimization algorithm, so that all replicas of each type of container equally share the computing resources allocated to the corresponding type of container. For detailed explanations, please refer to the relevant descriptions in the above method embodiments, which will not be repeated here.
[0092] The calculation module 703 is used to calculate the optimal number of replicas of each type of container on each computing node based on the initial matching scheme using a dynamic programming algorithm. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0093] The calculation module 703 is used to calculate the average processing latency of all tasks based on the initial matching scheme, the optimal allocation of computing resources, and the optimal number of replicas, and to use the negative value of the average processing latency as the fitness function of the improved genetic algorithm. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0094] The optimization module 704 is used to iteratively optimize the initial matching scheme based on the fitness function until the termination condition is met, and output the optimal container task scheduling scheme. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0095] The scheduling module 705 is used to schedule container tasks based on the optimal container task scheduling scheme. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0096] Figure 8 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 8 As shown, the electronic device may include: a processor 810, a communications interface 820, a memory 830, and a communications bus 840, wherein the processor 810, the communications interface 820, and the memory 830 communicate with each other through the communications bus 840. The processor 810 can call logical instructions in the memory 830 to execute a container task scheduling method in the computing power network. This method includes: obtaining a task set, a set of computing power nodes in the computing power network, and a set of container types within a task scheduling period; generating an initial matching scheme between tasks and computing power nodes using an improved genetic algorithm based on the task set, the set of computing power nodes, and the set of container types, wherein the initial matching scheme assigns a target computing power node to each task; calculating the optimal computing resource allocation for each type of container on each computing power node using a convex optimization algorithm based on the initial matching scheme, such that all replicas of each type of container equally share the computing resources allocated to the corresponding type of container; calculating the optimal number of replicas for each type of container on each computing power node using a dynamic programming algorithm based on the initial matching scheme; calculating the average processing latency of all tasks according to the initial matching scheme, the optimal computing resource allocation, and the optimal number of replicas, and using the negative value of the average processing latency as the fitness function of the improved genetic algorithm; iteratively optimizing the initial matching scheme based on the fitness function until a termination condition is met, outputting an optimal container task scheduling scheme; and performing container task scheduling based on the optimal container task scheduling scheme.
[0097] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0098] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the container task scheduling method in the computing power network provided by the above methods. The method includes: obtaining a task set, a set of computing power nodes in the computing power network, and a set of container types within a task scheduling period; generating an initial matching scheme between tasks and computing power nodes based on the task set, the set of computing power nodes, and the set of container types using an improved genetic algorithm, wherein the initial matching scheme assigns a target computing power node to each task; and using convex optimization based on the initial matching scheme. The algorithm calculates the optimal computing resource allocation for each type of container on each computing node, ensuring that all replicas of each type of container equally share the computing resources allocated to that type of container. Based on the initial matching scheme, a dynamic programming algorithm is used to calculate the optimal number of replicas for each type of container on each computing node. According to the initial matching scheme, the optimal computing resource allocation, and the optimal number of replicas, the average processing latency of all tasks is calculated, and the negative value of the average processing latency is used as the fitness function of the improved genetic algorithm. The initial matching scheme is iteratively optimized based on the fitness function until a termination condition is met, outputting the optimal container task scheduling scheme. Container task scheduling is performed based on the optimal container task scheduling scheme.
[0099] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a container task scheduling method in a computing power network provided by the above methods. This method includes: obtaining a task set within a task scheduling period, a set of computing power nodes in the computing power network, and a set of container types; generating an initial matching scheme between tasks and computing power nodes based on the task set, the set of computing power nodes, and the set of container types using an improved genetic algorithm, wherein the initial matching scheme assigns a target computing power node to each task; and calculating the container types on each computing power node using a convex optimization algorithm based on the initial matching scheme. The optimal computing resource allocation for each container type is determined, ensuring that all replicas of each type of container equally share the computing resources allocated to that type of container. Based on the initial matching scheme, a dynamic programming algorithm is used to calculate the optimal number of replicas for each type of container on each computing node. The average processing latency for all tasks is calculated based on the initial matching scheme, the optimal computing resource allocation, and the optimal number of replicas, and the negative value of the average processing latency is used as the fitness function of the improved genetic algorithm. The initial matching scheme is iteratively optimized based on the fitness function until a termination condition is met, and the optimal container task scheduling scheme is output. Container task scheduling is performed based on the optimal container task scheduling scheme.
[0100] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. 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. Those skilled in the art can understand and implement this without any creative effort.
[0101] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0102] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A container task scheduling method in a computing power network, characterized in that, include: Obtain the task set, the computing node set, and the container type set within the task scheduling period; Based on the task set, computing node set, and container type set, an improved genetic algorithm is used to generate an initial matching scheme between tasks and computing nodes. The initial matching scheme assigns a target computing node to each task. Based on the initial matching scheme, the optimal computing resource allocation for each type of container on each computing node is calculated using the convex optimization algorithm, so that all replicas of each type of container equally share the computing resources allocated to the corresponding type of container. Based on the initial matching scheme, the optimal number of replicas of each type of container on each computing node is calculated using a dynamic programming algorithm; Based on the initial matching scheme, the optimal amount of computing resources allocated, and the optimal number of replicas, the average processing latency of all tasks is calculated, and the negative value of the average processing latency is used as the fitness function of the improved genetic algorithm. The initial matching scheme is iteratively optimized based on the fitness function until the termination condition is met, and the optimal container task scheduling scheme is output. Container task scheduling is performed based on the optimal container task scheduling scheme.
2. The method according to claim 1, characterized in that, The acquisition of the task set within the task scheduling period, the set of computing nodes in the computing power network, and the set of container types includes: Obtain different types of tasks uploaded by the client to the computing power network system to obtain a task set, where each task includes the input data size; Based on the task types in the task set, the required container type is determined to obtain a container type set, wherein each task type corresponds to one container type; Tasks of the same type are sorted in ascending order of input data size and stored in a cache queue; The number of computing nodes is determined based on the number of cache queues, thus obtaining the set of computing nodes.
3. The method according to claim 1 or 2, characterized in that, The process of generating an initial matching scheme between tasks and computing nodes using an improved genetic algorithm based on the task set, computing node set, and container type set includes: Based on the task set, the first computing resource amount and the first memory resource amount of each computing node in the computing node set, the second computing resource amount and the second memory resource amount required for each container type to process a unit of data, and the startup latency, an improved genetic algorithm is used to generate an initial matching scheme between tasks and computing nodes.
4. The method according to claim 3, characterized in that, The step of calculating the optimal computing resource allocation for each type of container on each computing node based on the initial matching scheme using a convex optimization algorithm includes: For each computing node, the corresponding set of tasks assigned to each computing node is obtained according to the initial matching scheme, and the total amount of data to be processed by each type of container is calculated. With the goal of minimizing the cumulative processing latency of all tasks on each computing node, a convex optimization model is established for the allocation of computing resources for each type of container. By using a convex optimization algorithm to solve the convex optimization model through the construction of a Lagrangian function, the optimal allocation of computing resources for each type of container on each computing node is obtained.
5. The method according to claim 3, characterized in that, The step of calculating the optimal number of replicas of each type of container on each computing node based on the initial matching scheme using a dynamic programming algorithm includes: The problem of the number of replicas of each type of container is transformed into a knapsack problem with limited item selection by taking the first memory resource of the corresponding computing node as the knapsack capacity, the memory usage of a single replica as the item weight, and the value objective of reducing task processing latency. The knapsack problem is solved using a dynamic programming algorithm to obtain the optimal number of replicas of each type of container on each computing node.
6. The method according to claim 1, characterized in that, The process of iteratively optimizing the initial matching scheme based on the fitness function until the termination condition is met, and outputting the optimal container task scheduling scheme, includes: Based on the fitness function, an improved genetic algorithm is used to maintain and evolve the population of task-computing node matching schemes. For each matching scheme, the convex optimization algorithm and the dynamic programming algorithm are called in turn to calculate the optimal resource allocation and the number of replicas, and the average processing latency is returned as the fitness. When the maximum number of iterations is reached or the fitness converges, the historically optimal task and computing node matching scheme, resource allocation scheme, and replica configuration scheme are output to obtain the optimal container task scheduling scheme.
7. A container task scheduling device in a computing power network, characterized in that, include: The acquisition module is used to acquire the task set, the computing power node set in the computing power network, and the container type set within the task scheduling period; The generation module is used to generate an initial matching scheme between tasks and computing nodes based on the task set, computing node set, and container type set using an improved genetic algorithm. The initial matching scheme assigns a target computing node to each task. The computing module is used to calculate the optimal computing resource allocation for each type of container on each computing node based on the initial matching scheme using a convex optimization algorithm, so that all replicas of each type of container equally share the computing resources allocated to the corresponding type of container. The calculation module is used to calculate the optimal number of replicas of each type of container on each computing node based on the initial matching scheme using a dynamic programming algorithm. The calculation module is used to calculate the average processing latency of all tasks based on the initial matching scheme, the optimal computing resource allocation, and the optimal number of replicas, and to use the negative value of the average processing latency as the fitness function of the improved genetic algorithm. The optimization module is used to iteratively optimize the initial matching scheme based on the fitness function until the termination condition is met, and output the optimal container task scheduling scheme. The scheduling module is used to schedule container tasks based on the optimal container task scheduling scheme.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the container task scheduling method in the computing power network as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the container task scheduling method in the computing power network as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the container task scheduling method in the computing power network as described in any one of claims 1 to 6.