Micro-service deployment and task unloading method for task with complex dependency relationship
Through confidence propagation algorithm and deep reinforcement learning optimization task offloading and microservice layer cache, the problem of resource allocation imbalanced under complex dependencies is solved, and efficient operation and load balancing of edge computing systems are achieved.
Patent Information
- Application Number
- CN202510620284.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-14
- Publication Date
- 2025-08-08
AI Technical Summary
Existing task offloading and microservice deployment strategies fail to effectively handle complex dependencies, resulting in unreasonable resource allocation, increasing system delay and unbalanced computing resource load, affecting the performance of edge computing systems.
Using an optimization method combining confidence propagation algorithm and deep reinforcement learning, through task offload decisions and microservice layer cache strategy optimization, an optimization model is built to minimize system delay and load balancing variance, and to realize task offload path planning and cache update.
Significantly reduce task processing delay, improve system resource utilization, and improve user experience quality. It is suitable for latency-sensitive and computing-intensive edge computing application scenarios.
Smart Images

Figure CN120448125A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of wireless edge computing, and more particularly to a method for deploying and offloading microservices with complex dependencies. This method models the complex dependencies between tasks and, under limited server resources, minimizes the system's long-term average latency and server computing resource load balancing variance by developing near-optimal joint microservice-level caching and task offloading. Background Art
[0002] Microservices architecture is widely used in edge computing environments. It breaks down applications into independent service units based on functionality, allowing each unit to be independently deployed and upgraded, greatly improving application flexibility and scalability. However, in real-world scenarios, the dependencies between user tasks are complex. For example, in intelligent transportation systems, traffic flow prediction relies on real-time data output from multiple tasks, such as road condition monitoring and vehicle trajectory tracking. These intertwined dependencies complicate task scheduling and resource allocation.
[0003] Existing task offloading and microservice deployment strategies have significant shortcomings. When handling task dependencies, resources are not properly allocated based on the requirements of complex dependencies. This causes some tasks to be delayed due to insufficient resources, or to be offloaded to cloud servers, increasing transmission latency and severely impacting overall system performance. Furthermore, the microservices hierarchy has the potential for resource sharing. For example, underlying basic data services can provide data support for multiple upper-layer application services, but existing strategies fail to fully exploit this feature, resulting in increased system latency. Faced with the current situation of limited edge resources, deeply integrating complex task dependencies with the microservices hierarchy, exploring reasonable microservice layer deployment, optimizing task offloading strategies, and maintaining a balanced load on server computing resources are key breakthroughs in improving system performance and are of great significance for promoting the efficient operation of intelligent applications in edge computing scenarios. Summary of the Invention
[0004] In order to overcome the shortcomings of the existing technology, an optimization method for microservice hierarchical deployment and task offloading with complex dependencies based on a microservice framework is provided. First, in order to minimize the total system latency and the load balancing variance of edge server computing resources, the present invention proposes a complex task dependency and edge service layer caching model. The model fully considers the connectivity between tasks and divides tasks into predecessor tasks and post-tasks. Post-tasks require the output results of predecessor tasks before they can start processing tasks. Secondly, the present invention proposes an optimization algorithm based on the combination of belief propagation and deep reinforcement learning to achieve effective task offloading and microservice layer deployment.
[0005] In order to achieve the above object, the present invention provides the following technical solutions:
[0006] A method for deploying and offloading microservices with complex dependency tasks includes the following steps:
[0007] S1. The system architecture covers multiple base stations, edge servers, and user devices;
[0008] S2. The application generated by the user device contains multiple microservice tasks with complex dependencies, and these tasks are offloaded to the edge server for execution. During the task offloading process, the task offloading decision is optimized within each time slot, and a long-term update strategy is used to manage the microservice layer cache.
[0009] S3. By jointly optimizing the microservice-level caching strategy and task offloading decisions, we constructed an optimization model to address system performance issues. We first used a belief propagation algorithm to plan task offloading paths, then trained the caching strategy using a deep reinforcement learning model. We also employed an alternating optimization algorithm to address the complex task offloading and cache update challenges in different timescales.
[0010] S4. Finally, the trained model is deployed on the edge server to minimize the long-term average latency of the system and achieve server load balancing.
[0011] Wherein, step S1 includes the following steps:
[0012] A1: Deploy V edge servers in the edge network, and the server node index is Indicates, where v = 0 represents the cloud server, and the servers communicate with each other through wireless communication;
[0013] A2: Time is divided into several long time scales of length τ. During this time scale, the server service cache remains unchanged. The time series index is expressed as The long time scale is discretized into a number of equal time slots, denoted by τ = xt, where time slot t is the short time scale and x represents a constant;
[0014] 3. The microservice deployment and task offloading method according to claim 1, wherein S2 comprises the following steps:
[0015] A3: In each time slot, the user generates an application, and the application set is represented as Each application contains multiple dependent tasks, and the task set of user u is represented as A u ={A u,1 ,A u,2 ,…,A u,I}, where I represents the total number of tasks, and A u,i Indicates the i-th task of user u; microservice task type is Indicates that the set of all layers required for microservices is The size of layer l is denoted as H l ; Microservice tasks It consists of three tuples, namely in Indicates the microservice type of the task, Indicates the task size, Indicates the number of CPU cycles required to calculate the task; the deployment set of the microservice layer is used Indicates that It means that the edge server v deploys the service layer l within a long time scale τ;
[0016] A4: After receiving the task, the edge server needs to determine whether the service layer it deploys can meet the service requirements of the microservice layer. If the access base station server does not meet the microservice layer required by the microservice task, the task needs to be offloaded to the neighboring server or cloud that contains its microservice layer. Therefore, the task offloading decision is made by To express;
[0017] A5: There are two types of delays in the system calculation process: one is the update delay caused by the server switching the cache microservice layer over a long time scale. where r v represents the download speed of the base station, and the second is the completion delay of all applications in each time slot, from server v to server v ′ Or the transmission delay of the cloud transmission task data is in represents the i-th task A of user u u,i Whether it is offloaded by server v to other servers or clouds, r vv′ Indicates the transmission rate between servers or between servers and the cloud. Indicates whether microservice z contains layer l. Since microservice tasks are executed in parallel on different edge servers, the completion time of the application is the longest end time of all completed tasks in time slot t. The completion time of the task is in and represents the execution time and start time of the i-th task of user u; the execution time of the task depends on the computing power of the edge server v and the amount of data for the task. The task execution time is where f v,u,i is the computing power allocated by server v to user u for task i; the calculation formula for the start time of the task is expressed as Where p∈pre(u,i) represents the predecessor task p of the i-th task of the u-th user, Indicates the transmission time of the predecessor task, through Find out, o p,i Represents the data result of the previous task, r p,i Indicates the transmission rate between the servers where the two tasks are located. When two microservice tasks are unloaded to the same node, The delay of user u’s application in time slot t is due to the parallel execution of tasks on different servers. Derived from the maximum end time of completed tasks in the application Then the total system delay of the long time scale τ is
[0018] A6: To avoid degradation in service execution performance, we considered load balancing of computing resources. Load imbalance can cause some nodes to be overloaded while other nodes are idle, thus affecting system efficiency. To achieve effective load balancing, we quantify the uniformity of load distribution by calculating the variance of resource occupancy at the edge nodes. Specifically, the smaller the variance of resource occupancy, the more uniform the load distribution and the more stable the system performance. Task A u,i is assigned to server v for computation, then the load on server v is the sum of the computational requirements of all tasks assigned to it, expressed as The load balancing target is expressed as the ratio of server load to computing power, that is, the ratio of each server's load to its computing power is close; the calculation formula for computing resource load balancing variance is
[0019] Wherein, step S3 includes the following steps:
[0020] A7: Taking the hierarchical deployment strategy of all edge servers at each long time scale and the task transmission offload at each time slot as optimization variables, the system can maintain load balancing while reducing latency. The mathematical model is established as follows:
[0021]
[0022]
[0023] Constraint ① is the server cache capacity constraint, and constraint ② is the task transfer offloading constraint;
[0024] A8: Decouple the problem into two sub-problems. The mathematical model is:
[0025]
[0026] The constraint is ②;
[0027]
[0028] The constraints are ①;
[0029] A9: The original problem is solved by successively fixing the long-time-scale caching strategy and the task offloading strategy for each time slot. Break it down into problems and question Using the belief propagation algorithm, we can derive approximate values of various marginal functions from the global function. Specifically, we select the layer that matches the microservice task from multiple base stations and use the belief propagation algorithm to find the task offloading strategy that minimizes application completion time and load balancing.
[0030] A10: Question It is a complex long-term optimization problem, and the layer cache decision is updated on a long time scale. The problem is solved using deep reinforcement learning methods, and the problem is modeled as a Markov decision model. The MDP is represented by the ancestor.<S,A,P,R,γ> , where S is the state space, A is the action space, and P is the state transition probability expressed as P(s τ+1 |s τ ,a), R is the reward function, γ is the discount factor, which represents the coefficient for calculating the cumulative reward. The state space in the model at a long time scale τ is defined as the application generated by the user Expressed as The action space is represented as a τ ={β τ}, the reward function is expressed as
[0031] Wherein, step S4 includes the following steps:
[0032] A11: According to steps A9 and A10 in right 3, the network is trained iteratively to obtain the optimization variables. After obtaining the optimal configuration under the current state, long-term microservice layer deployment and short-time slot task offloading are carried out, and finally task processing is performed.
[0033] The beneficial effects of the present invention are: combining the belief propagation algorithm and deep reinforcement learning, a microservice deployment and task offloading method with complex dependency tasks is proposed. This method fully considers the complex dependencies between tasks and the server load balancing capabilities through single-time slot optimization of task offloading, combined with the long-time scale update strategy of the microservice layer cache. By optimizing task offloading through the belief propagation algorithm and optimizing the microservice layer cache update strategy using deep reinforcement learning, it can dynamically adapt to complex network environments and improve system resource utilization. The invention effectively reduces task processing delays, significantly improves the quality of user experience, and is suitable for delay-sensitive and computationally intensive edge computing application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is the microservice task dependency system model of the present invention.
[0035] Figure 2 This is a conceptual diagram of the method for offloading tasks and deploying microservices at the hierarchical level with complex dependencies in a wireless network of the present invention. DETAILED DESCRIPTION
[0036] The present invention will be further described below with reference to the accompanying drawings.
[0037] Combine Figure 1 and Figure 2 A method for deploying and offloading microservices with complex dependency tasks includes the following steps:
[0038] Step 1: Deploy V edge servers in the edge network. The server node index is Indicates, where v = 0 represents the cloud server, and the servers communicate with each other through wireless communication;
[0039] Step 2: The system is divided into several long time scales of length τ, within which the server service cache remains unchanged. The time series index is expressed as The long time scale is discretized into a number of equal time slots, denoted by τ = xt, where time slot t is the short time scale and x represents a constant;
[0040] Step 3: In any time slot t, the user will generate an application, and the application set is represented as Each application contains multiple dependent tasks, and the task set of user u is represented as A u ={A u,1 ,A u,2 ,…,A u,I}, where I represents the total number of tasks, and A u,i Indicates the i-th task of user u. The microservice task type is Indicates that the set of all layers required for microservices is The size of layer l is denoted as H l . Microservice tasks It consists of three tuples, namely in Indicates the microservice type of the task, Indicates the task size, Indicates the number of CPU cycles required to calculate the task. The deployment set of the microservice layer is used Indicates that It means that the edge server v deploys the service layer l within a long time scale τ;
[0041] Step 4: After receiving the task, the edge server needs to determine whether the service layer it has deployed can meet the layer service requirements of the microservice. When the access base station server does not meet the microservice layer required by the microservice task, the task needs to be offloaded to the neighboring server or cloud that contains its microservice layer. Therefore, the task offloading decision is made by To express;
[0042] Step 5: Two types of delays are generated during the system calculation process: one is the update delay caused by the server v switching cache microservice layer for a long time scale where r v represents the download speed of the base station, and the second is the completion delay of all applications in each time slot, from server v to server v ′ Or the transmission delay of the cloud transmission task data is in represents the i-th task A of user u u,i Whether it is offloaded by server v to other servers or clouds, r vv′ Indicates the transmission rate between servers or between servers and the cloud. Indicates whether microservice z contains layer l. Since microservice tasks are executed in parallel on different edge servers, the completion time of the application is the longest end time of all completed tasks in time slot t. The completion time of the task is in and represents the execution time and start time of the i-th task of user u. The execution time of the task depends on the computing power of the edge server v and the amount of data for the task. The task execution time is where f v,u,i is the computing power that server v allocates to user u for task i. The formula for calculating the start time of a task is expressed as Where p∈pre(u,i) represents the predecessor task p of the i-th task of the u-th user, Indicates the transmission time of the predecessor task, through Find out, o p,i Represents the data result of the previous task, r p,i Indicates the transmission rate between the servers where the two tasks are located. When two microservice tasks are unloaded to the same node, The delay of user u’s application in time slot t is due to the parallel execution of tasks on different servers. It can be obtained by the maximum end time of the completed tasks in the application Then the total system delay of the long time scale τ is
[0043] Step 6: To avoid degradation in service execution performance, load balancing of computing resources is considered. Load imbalance can cause some nodes to be overloaded while other nodes are idle, thus affecting system efficiency. To achieve effective load balancing, the uniformity of load distribution is quantified by calculating the variance of resource occupancy of edge nodes. Specifically, the smaller the variance of resource occupancy, the more uniform the load distribution and the more stable the system performance. Task A u,i is assigned to server v for computation, then the load on server v is the sum of the computational requirements of all tasks assigned to it, expressed as The load balancing target is expressed as the ratio of server load to computing power, that is, the ratio of each server's load to its computing power is close. The calculation formula for computing resource load balancing variance is:
[0044] Step 7: Taking the hierarchical deployment strategy of all edge servers at each long time scale and the task transmission offloading at each time slot as optimization variables, the system can maintain load balancing while reducing latency. The mathematical model is established as follows:
[0045]
[0046] Constraint ① is the server cache capacity constraint, and constraint ② is the task transfer offloading constraint;
[0047] Step 8: After analysis, the problem can be decoupled into two sub-problems, and the mathematical model is:
[0048]
[0049] The constraint is ②;
[0050]
[0051] The constraints are ①;
[0052] Step 9: The original problem is solved by successively fixing the long-time-scale caching strategy and the task offloading strategy for each time slot. Break it down into problems and question Using the belief propagation algorithm, we can derive approximate values of various marginal functions from the global function. Specifically, we select the layer that matches the microservice task from multiple base stations and use the belief propagation algorithm to find the task offloading strategy that minimizes application completion time and load balancing.
[0053] Step 10: Questions This is a complex long-term optimization problem, and the layer cache decision is updated on a long time scale. The problem is solved using deep reinforcement learning methods and modeled as a Markov decision model. The MDP can be represented by the ancestor<S,A,P,R,γ> , where S is the state space, A is the action space, and P is the state transition probability expressed as P(s τ+1 |s τ ,a), R is the reward function, γ is the discount factor, which represents the coefficient for calculating the cumulative reward. The state space in the model at a long time scale τ is defined as the application generated by the user Expressed as The action space is represented as a τ ={β τ}, the reward function is expressed as
[0054] Step 11: According to steps 9 and 10, the network is trained iteratively to obtain the optimization variables. After obtaining the optimal configuration under the current state, long-term microservice layer deployment and short-time slot task offloading are carried out, and finally task processing is carried out.
[0055] For example Figure 1 The specific implementation scheme of the present invention is illustrated by using a task offloading and microservice level deployment scenario with complex dependencies in a wireless edge network.
[0056] First, the system consists of multiple users and edge servers. Each edge server is equipped with limited computing resources and storage space and is connected to a cloud server with unlimited computing and storage capabilities. User devices generate an application in each time slot. Each application consists of multiple microservice tasks, which have load dependencies and can be executed in parallel or serially. Base stations can cache some microservice layers. If a base station cannot cache the layers required for a microservice task, the task is offloaded to a neighboring base station or cloud server for processing.
[0057] Secondly, when a base station receives a user task, it processes it based on the currently cached microservice layer. If a neighboring base station doesn't have the required microservice layer deployed, the task is offloaded to a cloud server. Because cloud servers offer unlimited computing power but high transmission latency, the base station must balance task offloading paths with cache layer updates.
[0058] Thirdly, the present invention takes storage capacity as the constraint condition, task offloading decision of each time slot and microservice cache layer decision of long time scale as optimization variables, and minimizes the long-term average delay and load balancing of the system as the optimization goal to construct the optimization problem
[0059] Finally, to address this optimization problem, this paper proposes an alternating optimization algorithm based on the belief propagation algorithm and deep reinforcement learning. Within each time slot, the microservice layer caching strategy is first fixed, using the belief propagation algorithm to determine the task offload path. Then, the determined offload path is fixed, and the microservice layer cache is optimized using the deep reinforcement learning module. This alternating iteration gradually improves the overall system performance, reduces system latency, and effectively maintains server load balancing.
[0060] The present invention targets scenarios in wireless edge networks with strong task dependencies, complex dependency relationships, and limited service cache capacity. It can help the server formulate reasonable task offloading and microservice layer caching strategies for each long time scale within each time slot when user task requirements change dynamically, thereby effectively reducing system latency while maintaining load balancing and improving user experience quality.
[0061] The embodiments of this specification are merely examples of implementations of the invention and are provided for illustrative purposes only. The scope of protection of the present invention should not be considered limited to the specific embodiments described in these embodiments. The scope of protection of the present invention also extends to equivalent technical means that can be conceived by a person of ordinary skill in the art based on the invention.
Claims
1. A method for deploying and offloading microservices with complex dependency tasks, characterized in that: The method comprises the following steps: S1. The system architecture covers multiple base stations, edge servers, and user devices; S2. The application generated by the user device contains multiple microservice tasks with complex dependencies, and these tasks are offloaded to the edge server for execution; During the task offloading process, the task offloading decision is optimized in each time slot, and a long-term update strategy is used to manage the microservice layer cache. S3. By jointly optimizing the microservice-level caching strategy and task offloading decisions, we constructed an optimization model to address system performance issues. We first used a belief propagation algorithm to plan task offloading paths, then trained the caching strategy using a deep reinforcement learning model. We also employed an alternating optimization algorithm to address the complex task offloading and cache update challenges in different timescales. S4. Finally, the trained model is deployed on the edge server to minimize the long-term average latency of the system and achieve server load balancing.
2. The microservice deployment and task offloading method according to claim 1, characterized in that: The S1 comprises the following steps: A1: Deploy V edge servers in the edge network, and the server node index is Indicates, where v = 0 represents the cloud server, and the servers communicate with each other through wireless communication; A2: Time is divided into several long time scales of length τ. During this time scale, the server service cache remains unchanged. The time series index is expressed as The long time scale is discretized into a number of equal time slots, denoted by τ = xt, where time slot t is the short time scale and x represents a constant.
3. The microservice deployment and task offloading method according to claim 1, characterized in that: The S2 comprises the following steps: A3: In each time slot, the user generates an application, and the application set is represented as Each application contains multiple dependent tasks, and the task set of user u is represented as A u ={A u,1 ,A u,2 ,…,A u,I }, where I represents the total number of tasks, and A u,i Indicates the i-th task of user u; microservice task type is Indicates that the set of all layers required by microservices is The size of layer l is denoted as H l ; Microservice tasks It consists of three tuples, namely in Indicates the microservice type of the task, Indicates the task size, Indicates the number of CPU cycles required to calculate the task; the deployment set of the microservice layer is used Indicates that It indicates that the edge server v deploys the service layer l within a long time scale τ; A4: After receiving the task, the edge server needs to determine whether the service layer it deploys can meet the service requirements of the microservice layer. If the access base station server does not meet the microservice layer required by the microservice task, the task needs to be offloaded to the neighboring server or cloud that contains its microservice layer. Therefore, the task offloading decision is made by To express; A5: There are two types of delays in the system calculation process: one is the update delay caused by the server switching the cache microservice layer over a long time scale. where r v represents the base station download speed, and the second is the completion delay of all applications in each time slot. The transmission delay of task data from server v to server v′ or the cloud is in represents the i-th task A of user u u,i Whether it is offloaded by server v to other servers or clouds, r vv′ Indicates the transmission rate between servers or between servers and the cloud. Indicates whether microservice z contains layer l. Since microservice tasks are executed in parallel on different edge servers, the completion time of the application is the longest end time of all completed tasks in time slot t. The completion time of the task is in and represents the execution time and start time of the i-th task of user u; the execution time of the task depends on the computing power of the edge server v and the amount of data for the task. The task execution time is where f v,u,i is the computing power allocated by server v to user u for task i; the calculation formula for the start time of the task is expressed as Where p∈pre(u,i) represents the predecessor task p of the i-th task of the u-th user, Indicates the transmission time of the predecessor task, through Find out, o p,i Represents the data result of the previous task, r p,i Indicates the transmission rate between the servers where the two tasks are located. When two microservice tasks are unloaded to the same node, The delay of user u’s application in time slot t is due to the parallel execution of tasks on different servers. Derived from the maximum end time of completed tasks in the application Then the total system delay of the long time scale τ is A6: To avoid degradation in service execution performance, we considered load balancing of computing resources. Load imbalance can cause some nodes to be overloaded while other nodes are idle, thus affecting system efficiency. To achieve effective load balancing, we quantify the uniformity of load distribution by calculating the variance of resource occupancy at the edge nodes. Specifically, the smaller the variance of resource occupancy, the more uniform the load distribution and the more stable the system performance. Task A u,i is assigned to server v for computation, then the load on server v is the sum of the computational requirements of all tasks assigned to it, expressed as The load balancing target is expressed as the ratio of server load to computing power, that is, the ratio of each server's load to its computing power is close; the calculation formula for computing resource load balancing variance is 4. The microservice deployment and task offloading method according to claim 1, characterized in that: The S3 comprises the following steps: A7: Taking the hierarchical deployment strategy of all edge servers at each long time scale and the task transmission offload at each time slot as optimization variables, the system can maintain load balancing while reducing latency. The mathematical model is established as follows: st. Constraint ① is the server cache capacity constraint, and constraint ② is the task transfer offloading constraint; A8: Decouple the problem into two sub-problems. The mathematical model is: The constraint is ②; The constraints are ①; A9: The original problem is solved by successively fixing the long-time-scale caching strategy and the task offloading strategy for each time slot. Break it down into problems and question Using the belief propagation algorithm, we can derive approximate values of various marginal functions from the global function. Specifically, we select the layer that matches the microservice task from multiple base stations and use the belief propagation algorithm to find the task offloading strategy that minimizes application completion time and load balancing. A10: Question It is a complex long-term optimization problem, and the layer cache decision is updated on a long time scale. The problem is solved using deep reinforcement learning methods, and the problem is modeled as a Markov decision model. The MDP is represented by the ancestor.<S,A,P,R,γ> , where S is the state space, A is the action space, and P is the state transition probability expressed as P(s τ+1 |s τ ,a), R is the reward function, γ is the discount factor, which represents the coefficient for calculating the cumulative reward. The state space in the model at a long time scale τ is defined as the application generated by the user Expressed as The action space is represented as a τ ={β τ }, the reward function is expressed as 5. The microservice deployment and task offloading method according to claim 1, characterized in that: The S4 comprises the following steps: A11: According to steps A9 and A10 in right 3, the network is trained iteratively to obtain the optimization variables. After obtaining the optimal configuration under the current state, long-term microservice layer deployment and short-time slot task offloading are carried out, and finally task processing is performed.
Citation Information
Cited By
Elastic resource scheduling method and device for micro-service and electronic equipment
CN120909746A
Dependent task unloading method and device for deep reinforcement learning based on Transform
CN121934916A