An edge server-based micro-service automatic scaling method and system
By constructing a microservice instance scaling algorithm based on the A3C network and using reinforcement learning to optimize the automatic scaling of microservices in edge server clusters, the problem of limited resources and complex dependencies in edge computing is solved, and optimal deployment and resource utilization are achieved in dynamic scenarios.
Patent Information
- Application Number
- CN202411635415.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2044-11-15
AI Technical Summary
In edge computing environments, edge server resources are limited, and the dependencies between microservices are complex. Existing microservice autoscaling strategies are unable to effectively handle dynamic service requests, leading to difficulties in resource scheduling and non-real-time deployment.
We construct a microservice instance scaling algorithm based on the A3C network. We optimize the scaling of microservice instances through reinforcement learning. By utilizing multiple edge server clusters and taking service latency, energy consumption, and dynamic loss as objectives, we construct objective functions and constraints to achieve automatic scaling of microservices.
It achieves optimal microservice deployment in dynamic scenarios, optimizes resource utilization, reduces latency and energy consumption, and adapts to the dynamic nature of edge environments.
Smart Images

Figure CN119767321B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of edge computing technology, and in particular to a method and system for automatic scaling of microservices based on edge servers. Background Technology
[0002] Mobile edge computing (MEC) is an innovative computing architecture that deploys computing and storage close to the data source. By processing data at the network edge, edge computing significantly reduces latency, enhances real-time responsiveness, and reduces pressure on the central network. Therefore, edge computing is particularly suitable for applications requiring immediate processing and action, such as autonomous driving, industrial automation, and smart cities. Edge computing also addresses privacy and security concerns to some extent by keeping sensitive data near the data source, reducing its exposure risk. Microservice architecture is a modern software development methodology that structures applications into a set of loosely coupled, independently deployed microservices. Each microservice performs an independent business function and communicates with other microservices through well-defined APIs, typically using lightweight protocols such as HTTP / REST or gRPC. The advantages of microservice architecture include modularity, scalability, and resilience. Modularity means that each microservice can be developed and deployed independently; scalability means that when the application is updated and iterated, only the corresponding microservice needs to be upgraded, without modifying other microservices; resilience means that enterprises can quickly add or remove microservice instances to cope with the dynamic nature of service requests. Due to these advantages, microservice architecture has become the preferred choice for modern cloud-native applications.
[0003] The combination of edge computing and microservice architecture leverages the advantages of both, offering a new approach to addressing the current demands for large-scale, high-concurrency services. However, this integration also brings new challenges, particularly in resource management and performance optimization. First, the limited resources of edge servers make resource scheduling more difficult. Second, the dependencies between microservices are more complex in edge computing. Third, the edge environment is highly dynamic, requiring real-time adjustments to microservice deployments to handle dynamic service requests. A key solution to these problems is microservice autoscaling, which automatically adjusts the number of running microservice instances based on real-time request demands. However, most current research on microservice autoscaling is based on a single server, similar to autoscaling in cloud computing. But due to resource constraints on edge servers, this strategy often fails to achieve ideal results. Therefore, to address these issues, a microservice scaling strategy is urgently needed to meet the request demands of edge computing, resolving resource constraints on edge servers and adapting to the complex call relationships of microservices and the dynamic nature of requests in the edge environment. Summary of the Invention
[0004] The purpose of this invention is to overcome the problems existing in the prior art of integrated edge computing and microservice architecture, such as limited resources and difficulty in resource scheduling of edge servers, complex dependencies between microservices in edge computing, and difficulty in real-time adjustment of microservice deployment to cope with dynamic service requests. This invention provides a method and system for automatic scaling of microservices based on edge servers.
[0005] To achieve the above objectives, the technical solution of the present invention is as follows: Firstly, the present invention provides a microservice auto-scaling method based on edge servers, comprising the following steps:
[0006] S1. Construct a server cluster, which includes multiple edge servers located close to each other, and the multiple edge servers communicate through a base station;
[0007] S2. Construct a microservice instance scaling algorithm based on the A3C network, with the goal of minimizing overall service latency, energy consumption, and dynamic loss. Construct the objective function and constraints of the microservice instance scaling algorithm.
[0008] S3. The microservice instance scaling algorithm is used to control the automatic scaling and adjustment of microservices in the server cluster.
[0009] In step S3, controlling the automatic scaling and adjustment of microservices in the server cluster through the microservice instance scaling algorithm includes:
[0010] At the beginning of each preset time period, the microservice instance scaling algorithm is trained based on the status data of each edge server in the server cluster of the previous preset time period, so as to update the network parameters of the microservice instance scaling algorithm.
[0011] Each preset time period includes multiple consecutive sub-time periods. At the beginning of a sub-time period, the microservice instance scaling algorithm calculates the microservice instance auto-scaling strategy for the next sub-time period based on the status data of each edge server in the server cluster of the previous few sub-time periods.
[0012] The microservice instance scaling algorithm is deployed on the master server, which is an edge server in the server cluster.
[0013] The objective function is:
[0014]
[0015] In the formula, T latency (l) represents the total service response latency for sub-time period l; E cost (l) represents the total energy consumption of sub-time period l; D cost(l) represents the dynamic loss of sub-time period l; α, β, and γ are the weights of total service response latency, total energy consumption, and dynamic loss, respectively; L is the total number of sub-time periods contained in a preset time period.
[0016] The constraints of the microservice instance scaling algorithm are as follows:
[0017]
[0018] In the formula, we use an undirected graph H(E,V) to represent the distribution of edge servers; and use S=[S1,S2,…,S… I ] represents a collection of microservices; E = [E1, E2, ..., E M ] represents the set of edge servers in the cluster; S i .cpu indicates the deployment of an S i The computing resources required for the instance, S i .mem indicates the deployment of an S i The memory resources required for the instance; This indicates that the edge server E was deployed during sub-time period l. m S on i Number of instances; This indicates that the edge server E was deployed during sub-time period l. n S on i Number of instances; E m • CPU represents the edge server E m Maximum computational resource constraint, E m .mem represents server E m Maximum memory constraints; Indicates sub-time period l time S i The instance is on edge server E m The load on; ρ max Indicates the load threshold;
[0019] The load The calculation formula is as follows:
[0020]
[0021] In the formula, λ i,m (l) represents the sub-time period l at time S. i The instance is on edge server E m Arrival rate on; μ i,m (l) represents the sub-time period l at time S. i The instance is on edge server E m Service rate.
[0022] In the objective function, the total service delay T latencyThe formula for calculating (l) is as follows:
[0023]
[0024] In the formula, For the request in the sub-time period l on the edge server E m Service response delay in For sub-time period l from edge server E m The arrival rate of the received requests;
[0025] The service response latency for a request is the sum of the request's transmission latency and processing latency. Therefore, the service response latency is... The calculation formula is as follows:
[0026]
[0027] In the formula, ∑T t (l) represents the sum of the requested transmission delays; ∑T p (l) represents the total processing delay of the request;
[0028] We represent application requests as R = [R1, R2, ..., R...] K For request R in the sub-time period l k Request R k For deployment on edge server E m Microservices on S i Calling the edge server E n Microservice calls microservice S j Then the request R k Transmission delay T t (l) and processing delay T p The formula for calculating (l) is as follows:
[0029]
[0030] In the formula, data i,j For deployment on edge server E m Microservices on S i Calling the edge server E n Microservice calls microservice S j Data size; V m,n To represent edge server E m With E n The transmission rate between them; To request R k The final execution delay; T q To request R k Queuing delay; For edge server Em Microservices S i Average arrival rate; L q The length of the service queue;
[0031] In the objective function, the total energy consumption E cost The formula for calculating (l) is as follows:
[0032]
[0033] In the formula, P m (l) represents the edge server E in sub-time period l. m Energy consumption, P startup For the edge server E in sub-time period l m Startup energy consumption; For the edge server E in sub-time period l m The energy consumption of the instance; when the edge server E m When there are no instances in the edge server E m Energy consumption P m =0;
[0034] In the objective function, the dynamic loss D cost The formula for calculating (l) is as follows:
[0035]
[0036] In the formula, c is the dynamic cost of creating or deleting an instance, which is a constant; For the previous sub-time period (l-1), the edge server E was deployed. m S on i Number of instances.
[0037] The reinforcement learning reward function r of the microservice instance scaling algorithm is:
[0038] r = -(r a +r p );
[0039] r a =αT latency +βE cost +γD cost ;
[0040] In the formula, r a For service latency, r p The penalty for failure adjustment, r p It is a large positive number.
[0041] At the beginning of the first sub-time period within the preset time period, deploy microservice instances according to the following method;
[0042] S301. Arrange all requests in order;
[0043] S302. For each request segment, calculate the number of instances required by all microservices in that segment. With the goal of minimizing the distance between the edge servers where the instances are located, use a greedy strategy to deploy the instances required by the segment to the available edge servers in sequence.
[0044] Secondly, the present invention provides a microservice auto-scaling system based on edge servers, including...
[0045] A cluster building module is used to build a server cluster, which includes multiple edge servers located close to each other, and the multiple edge servers communicate with each other through a base station;
[0046] The scaling algorithm construction module is used to build a microservice instance scaling algorithm based on the A3C network. With the goal of minimizing the overall service latency, energy consumption, and dynamic loss, it constructs the objective function and constraints of the microservice instance scaling algorithm.
[0047] The control module is used to control the automatic scaling and adjustment of microservices in the server cluster through the microservice instance scaling algorithm.
[0048] Thirdly, embodiments of the present invention provide an electronic device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the microservice autoscaling method based on edge servers described above.
[0049] Fourthly, embodiments of the present invention provide a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps in the microservice autoscaling method based on edge servers described above.
[0050] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0051] 1. This invention discloses a microservice auto-scaling method based on edge servers. In a cluster containing multiple edge servers, one edge server is selected as the master server. A reinforcement learning-based microservice instance scaling algorithm is deployed on the master server. The master server obtains microservice data from each edge server in real time and runs the reinforcement learning-based microservice instance scaling algorithm based on this data to auto-scale the microservices. Simultaneously, an agent runs the algorithm's learning program at a certain frequency based on the microservice data fed back from each edge server to update the network parameters of the reinforcement learning-based microservice instance scaling algorithm, ensuring real-time updates of the network parameters. The deployment strategy is then calculated using the latest network parameters. This microservice auto-scaling method considers long-term optimization and dynamic scenarios (where service requests change in real time, requiring real-time adjustments to microservice instance deployment) to achieve optimal deployment in dynamic scenarios. Therefore, this invention considers long-term optimization and periodically updates the network parameters of the reinforcement learning-based microservice instance scaling algorithm to ensure real-time updates and achieve optimal deployment in dynamic scenarios.
[0052] 2. In the microservice autoscaling method based on edge servers of this invention, the objective function of the microservice instance scaling algorithm based on reinforcement learning is constructed with the goal of minimizing overall service latency, energy consumption, and dynamic loss. The optimization objective of the algorithm is to average the latency, energy consumption, and dynamic loss over all time periods to find the overall optimum. Therefore, this invention can find the overall optimum for latency, energy consumption, and dynamic loss over all time periods. Attached Figure Description
[0053] Figure 1 This is a flowchart illustrating a microservice auto-scaling method based on edge servers provided by the present invention.
[0054] Figure 2 This is a flowchart illustrating a microservice auto-scaling strategy in edge computing provided by the present invention.
[0055] Figure 3 This is a schematic diagram of a microservice architecture for a network edge system provided by the present invention.
[0056] Figure 4 This is a flowchart illustrating a microservice instance scaling algorithm based on reinforcement learning provided by the present invention.
[0057] Figure 5 This invention provides a network structure diagram for a microservice instance scaling algorithm based on reinforcement learning.
[0058] Figure 6 This is a schematic diagram of a microservice auto-scaling system based on an edge server provided by the present invention.
[0059] Figure 7 This is a schematic diagram of the structure of an electronic device provided by the present invention. Detailed Implementation
[0060] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0061] Microservice autoscaling refers to the automatic adjustment of the number of running microservice instances in a microservice architecture based on real-time request demand. However, most current research on microservice autoscaling considers a single server, similar to microservice autoscaling in cloud computing. However, due to resource constraints on edge servers, the above strategies often fail to achieve ideal results. To address the technical problems existing in related technologies, this invention provides a microservice autoscaling method based on edge servers, such as... Figure 1 As shown, Figure 1 This is a flowchart illustrating a microservice autoscaling method based on edge servers, which includes steps S1 to S3:
[0062] S1. Construct a server cluster, which includes multiple edge servers located close to each other, and the multiple edge servers communicate with each other through a base station.
[0063] In this embodiment, the microservice autoscaling method based on edge servers is based on an edge architecture, which includes multiple edge nodes, each covering a region. The request arrival rate within the region changes over time, and each edge node needs to dynamically adjust the microservice instances on the server to cope with the changes in the request arrival rate.
[0064] Considering the resource limitations of edge servers, conventional microservice autoscaling strategies suitable for cloud servers are difficult to achieve ideal results on edge servers. Therefore, this invention proposes a microservice autoscaling adjustment strategy based on edge computing, which treats multiple edge servers as a cluster and designs microservice autoscaling strategies on a cluster-by-cluster basis to overcome the problem of limited resources on edge servers.
[0065] like Figure 3 As shown, Figure 3 This is a schematic diagram of a microservice architecture system for network edge architecture provided in an embodiment of the present invention. We use an undirected graph H(E,V) to represent the distribution of edge servers; E = [E1, E2, ..., E...]. M [] represents a collection of edge servers, each with a maximum computing resource constraint and a maximum memory constraint, denoted by E. m ·cpu and E m.mem represents; in the model, we ignore the specific connections between servers and use V. m,n Indicates server E m and E n The transmission rate between them.
[0066] In a microservices architecture, a complete service is decomposed into a series of independent microservices, which can be deployed on the same or different edge servers. We use S = [S1, S2, ..., S...] I ] represents a collection of microservices; S i .cpu and S i .mem represents the deployment of a microservice S. i The computational and memory resources required by the instance; we represent the application request as R = [R1, R2, ..., R... K An application request consists of a series of microservices arranged in a specific order. We need to complete all the required microservices to satisfy the application request. Considering a general scenario, we assume that edge servers are deployed near base stations. The user's application request initially arrives at the base station closest to the user, where the edge server confirms the request. Afterward, the request is forwarded between edge servers until all microservices within the request are completed.
[0067] Because edge servers have limited resources, the microservices required for a single request may be deployed on one or more edge servers. This means that processing a single request may require the participation of one or more edge servers. Therefore, a request routing strategy is needed to select the appropriate edge server. To balance efficiency and load, we adopt a weighted routing method.
[0068] In this embodiment, a weighted routing request routing strategy is used to select the corresponding edge server. Specifically, the closer the edge servers are to each other, the higher the routing probability to meet transmission speed requirements; simultaneously, the more instances deployed on the edge servers, the higher the routing probability to meet load balancing requirements. For example, when completing microservice S... i Then it is necessary to call the microservice S j Assume S i Deployed on edge server E m The weighted routing request routing strategy described above can be expressed as:
[0069]
[0070] Θ={k∣S j in E k};
[0071] In the formula, P(S) i ,S j |Em E n ) indicates that it is located on the edge server E m Microservices on S i Calling the edge server E n Microservices j The probability of V; m,n E represents m and E n The transmission rate between them Indicates that it is located on edge server E n Microservices j The number of instances, ω1 and ω2 are adjustable parameters.
[0072] In this embodiment, microservice deployment relies on a routing strategy, and different routing strategies result in different optimal microservice deployment strategies. The microservice autoscaling method provided in this embodiment is applicable to various request routing strategies, including weighted routing.
[0073] S2. Construct a microservice instance scaling algorithm based on the A3C network, with the goal of minimizing overall service latency, energy consumption, and dynamic loss. Construct the objective function and constraints of the microservice instance scaling algorithm.
[0074] like Figure 2 As shown, Figure 2 This is a flowchart illustrating a microservice autoscaling strategy in edge computing provided by an embodiment of the present invention. In this embodiment, a reinforcement learning-based microservice instance scaling algorithm is deployed on a master server, which is an edge server in a server cluster. Each edge node consists of a base station and an edge server, where the base station is responsible for communication and the edge server is responsible for request processing.
[0075] Specifically, a microservice instance scaling algorithm based on the A3C network is constructed, aiming to minimize overall service latency, energy consumption, and dynamic losses. The objective function and constraints of the microservice instance scaling algorithm include:
[0076] A microservice instance scaling algorithm is constructed based on the A3C network, and the state, action and reward functions of the microservice instance scaling algorithm are defined.
[0077] The state of the microservice instance scaling algorithm refers to the current situation of the agent in the environment or the current configuration of the environment. The state of the microservice instance scaling algorithm can be represented as follows:
[0078]
[0079] In the formula, The request arrival rate on each edge server over the past few sub-time periods; This indicates the latency of service requests on each edge server over the past few sub-time periods; This represents the energy consumption of each edge server over the past few sub-time periods; N represents the current microservice instance deployment; N(l-1) represents the microservice instance deployment in the previous sub-time period; RS represents the remaining resources on the current server, including computing and storage resources; P represents the number of times the current action is performed in this adjustment. To reduce the action space, this method calculates the adjustment of one microservice instance per action and completes the adjustment of all instances within a sub-time period. Completing the adjustment of all instances requires multiple actions, so P is used to record which action the current action is in the current sub-time period.
[0080] In a microservice scaling and adjustment strategy, multiple actions are required within a sub-time period. Each action calculates the adjustment of one microservice instance. One action of the microservice instance scaling algorithm can be represented as:
[0081] a={I,E src ,ms};
[0082] In the formula, the actions of the microservice instance scaling algorithm include an action indicator, a target server, and the target being the service instance. Specifically, I is the indicator; its value is {0, 1, 2}, representing addition, deletion, and no change, respectively; E src `ms` represents the target server; `ms` represents the target microservice instance. Adjusting a microservice instance indicates adding or removing a microservice from a specific edge server. For example, `{0,5,2}` indicates adding a microservice S2 instance on edge server E5.
[0083] In this embodiment, in order to evaluate the effectiveness of the microservice autoscaling strategy, after in-depth analysis of the needs of the real production environment, the present invention proposes a multi-objective long-term planning based on three aspects: latency, energy consumption, and dynamic loss.
[0084] To achieve the aforementioned long-term planning goals, we construct an objective function with the overall goal of minimizing service latency, energy consumption, and dynamic losses. Meanwhile, our optimization objective is the long-term performance of the auto-scaling system, as request arrival rates and instance deployments will vary at different times.
[0085] To minimize overall service latency, energy consumption, and dynamic losses, while also considering the average performance across all sub-time periods, the objective function can be expressed as:
[0086]
[0087] In the formula, T latency (l) represents the total service response latency for sub-time period l; E cost (l) represents the total energy consumption of sub-time period l; Dcost (l) represents the dynamic loss of sub-time period l; α, β, and γ are the weights of total service response delay, total energy consumption, and dynamic loss, respectively; L is the total number of sub-time periods contained in a preset time period.
[0088] Generally, reducing service latency tends to increase energy consumption and dynamic losses, and vice versa. Therefore, in practical applications, we need to balance these weights to achieve optimal performance.
[0089] The objective function has two constraints: resource constraints and load constraints. Resource constraints ensure that the computing and memory resources used by the server do not exceed the total available computing and memory resources. Load constraints primarily ensure the normal operation of the server, preventing problems such as massive packet loss and server crashes. We use the ratio of total arrival rate to total service rate to represent the load.
[0090] In this embodiment, the constraints of the objective function are:
[0091]
[0092] In the formula, To deploy on edge server E during sub-time period l m S on i Number of instances; To deploy on edge server E during sub-time period l n S on i Number of instances; E m • CPU for edge server E m Maximum computational resource constraint, E m .mem is for server E m Maximum memory constraints; For sub-time period l, S i The instance is on edge server E m The load on; ρ max S is the load threshold. i .cpu is for deploying an S i The computing resources required for the instance, S i .mem is for deploying an S i The memory resources required for the instance; I is the total number of microservices;
[0093] In this embodiment, we will request R k On edge server E m The average service response latency in the data is represented by T. k,m The total service response latency can be expressed as:
[0094]
[0095] We represent application requests as R = [R1, R2, ..., R...] K In the formula, Request R for sub-time period l k On edge server E m Service response delay in For sub-time period l from edge server E m The arrival rate of the received requests.
[0096] Specifically, the service latency of a request is determined by two parts: transmission latency and processing latency. The service response latency of a request is the sum of its transmission latency and processing latency. Therefore, the service response latency... It can be represented as:
[0097]
[0098] In the formula, ∑T t (l) represents the sum of the requested transmission delays within sub-time period l; T p (l) represents the total processing delay of requests in sub-time period l.
[0099] For request R in the sub-time period l k Suppose request R k For deployment on edge server E m Microservices on S i Calling the edge server E n Microservice calls microservice S j Then request R k The corresponding transmission delay T t (l) can be represented as:
[0100]
[0101] data i,j For deployment on edge server E m Microservices on S i Calling the edge server E n Microservice calls microservice S j Data size; V m,n To represent edge server E m With E n The transmission rate between them.
[0102] The processing latency is determined by queuing latency and final execution latency. In practical applications, when a request arrives at the server, it is not necessarily processed immediately, resulting in queuing latency. Currently, to cope with high-concurrency service demands, multi-instance deployment is commonly used. Therefore, we use the M / M / C queuing theory to model queuing latency. For deployments on edge servers E... m Microservices on S i Instances, the number of which is The average service rate of a single instance is It is a constant; Edge server E m Microservices S i The average arrival rate Processing delay T p It can be represented as:
[0103]
[0104] In the formula, T represents the final execution delay of the request. q To delay queuing; For edge server E m Microservices S i Average arrival rate; L q This is the length of the service queue.
[0105] In this embodiment, energy consumption consists of two parts: the first part is startup energy consumption, representing the fixed energy required to start the server. By default, the server is shut down when no instances are deployed. The second part is instance energy consumption, where each deployed instance consumes a certain amount of energy. When the edge server E... m When there are no instances in the edge server E m Energy consumption P m The value is 0 when the edge server E m When instances exist, each deployed instance consumes a certain amount of energy, with the total energy consumption E cost (l) can be represented as:
[0106]
[0107] In the formula, P m (l) represents the edge server E in sub-time period l. m Energy consumption, P startup For the edge server E in sub-time period l m Startup energy consumption; For the edge server E in sub-time period l m The energy consumption of the instance.
[0108] Since creating and deleting instances takes time, it can cause a period of resource unavailability, which cannot be ignored in a production environment. In this invention, dynamic loss is used to measure this cost.
[0109] In this embodiment, we assume that the dynamic cost of creating or deleting an instance is a constant c. Therefore, in each time period, we statistically analyze the changes in microservice instances compared to the previous time period. Thus, the dynamic loss is expressed as:
[0110]
[0111] In the formula, c is the dynamic cost of creating or deleting an instance, which is a constant; For the previous sub-time period (l-1), the edge server E was deployed. m S on i Number of instances.
[0112] Based on the above objective function, we define the reinforcement learning reward function r for the microservice instance scaling algorithm:
[0113] r = -(r a +r p );
[0114] r a =αT latency +βE cost +γD cost ;
[0115] In the formula, r a For service latency, r p The penalty for failure adjustment, r p It is a large positive number.
[0116] S3. The microservice instance scaling algorithm is used to control the automatic scaling and adjustment of microservices in the server cluster.
[0117] like Figure 4 As shown, Figure 4 This is a flowchart illustrating a microservice instance scaling algorithm based on reinforcement learning provided in this embodiment of the invention. In this embodiment, controlling the automatic scaling and adjustment of microservices in a server cluster through the microservice instance scaling algorithm includes:
[0118] At the start of each preset time period, the microservice instance scaling algorithm is trained based on the status data of each edge server in the server cluster from the previous preset time period, in order to update the network parameters of the microservice instance scaling algorithm. The length of the preset time period can be selected according to requirements; for example, the length of the preset time period can be set to one day or one hour.
[0119] Each preset time period includes multiple consecutive sub-time periods. At the beginning of a sub-time period, the microservice instance scaling algorithm calculates the microservice instance auto-scaling strategy for the next sub-time period based on the status data of each edge server in the server cluster of the previous few sub-time periods.
[0120] The status data includes: request arrival rate, service request latency, energy consumption, microservice instance deployment, and remaining resources.
[0121] In this embodiment, at the beginning of each sub-time period, the main server obtains the historical state data of each edge server in the server cluster of the previous few sub-time periods. Based on the historical state data of each edge server in the server cluster of the previous few sub-time periods, the state input s is obtained, and the state input s is represented as:
[0122]
[0123] In the formula, The request arrival rate on each edge server over the past few sub-time periods; This indicates the latency of service requests on each edge server over the past few sub-time periods; This represents the energy consumption of each edge server over the past few sub-periods; N represents the current microservice instance deployment; N(l-1) represents the microservice instance deployment in the previous sub-period; RS represents the remaining resources on the current server, including computing and storage resources; P represents the nth time the current action is within the current sub-period. To reduce the action space, this method calculates the adjustment of one microservice instance per action, and updates the status data after each action. Completing the automatic scaling adjustment of microservices within a sub-period requires multiple actions, so P is used to record which adjustment the current action is within the current time period.
[0124] The reinforcement learning-based microservice instance scaling algorithm outputs a microservice scaling adjustment strategy based on the state input s, and distributes the microservice scaling adjustment strategy to each edge server in the server cluster.
[0125] The microservice scaling adjustment strategy includes multiple adjustment actions. Each adjustment action indicates the adjustment of a microservice instance. An adjustment action can be represented as:
[0126] a={I,E src ,ms};
[0127] In the formula, I is an indicator with values {0, 1, 2}, representing addition, deletion, and no change, respectively; E src ms represents the target server; ms represents the target microservice instance.
[0128] In this embodiment, the reinforcement learning-based microservice instance scaling algorithm, namely DRL_MAE (DRL-based microservice autoscaling in edge environment), divides a preset time period into multiple sub-time periods. In the first sub-time period G0, an initial deployment is required as the initial solution for the algorithm. Subsequently, in the following time periods, the microservice instance scaling algorithm will output an automatic scaling strategy for microservice instances. Based on the deployment in the previous time period, the algorithm will make scaling adjustments according to the automatic scaling strategy for microservice instances, without having to consider the deployment of microservices from scratch.
[0129] For initial deployment, this invention proposes a microservice first-fit decreasing algorithm (MFFD) based on the first-fit decreasing algorithm (FFD) in the service deployment domain. The core idea of the first-fit decreasing algorithm is to select the nearest server for connected microservices using a greedy strategy to reduce transmission latency.
[0130] The pseudocode for the First-Fit Decreasing Algorithm (MFFD) for microservices is as follows:
[0131] Inputs: Service request arrival rate Λ, edge server resource limit E m ·cpu and E m .mem, where m∈{0,1,2…,M}, and d is the distance between edge servers. m,n Where m, n∈{0,1,2…,M};
[0132] Output: Initial service instance deployment plan i∈{0,1,2…,I}, m∈{0,1,2…,M};
[0133] 1. Arrange all requests in the order they reside on the servers they belong to, and denote this as the set REQ;
[0134] 2. Create a new heap and initialize it.
[0135] 3. for req in REQ do;
[0136] 4. REQ = req
[0137] 5. Obtain the initial server E for req. s ;
[0138] 6. Obtain the service delivery rate λ of req. s ;
[0139] 7. The first microservice m that receives req s ;
[0140] 8. stack.push([E s ,m s ,λ s ]); \\Current server E s The next microservice to be deployed is m s ;
[0141] 9. Microservice request arrival rate λ s ;
[0142] 10.while stack is not empty do;
[0143] 11. [E,m,λ] = stack.pop()
[0144] 12. Calculate the number of instances K required for the current microservice m based on the microservice reach rate λ using the formula;
[0145] 13. Obtain the next microservice m to be deployed. n ;
[0146] 14. Sort all servers in ascending order of their distance from server E, and denote this as a sequence.
[0147] 15. for E n in do;
[0148] 16. Calculate E s The number of microservice instances that can be deployed in K E ;
[0149] 17. Update server E n Deployment of microservice instances
[0150] 18. Update resource usage information (E) m ·cpu and E m .mem;
[0151] 19. Based on the instance deployment, allocate some requests to λ n Import N E ;
[0152] 20. If m n There are still microservices remaining for the current request.
[0153] 21.stack.push([E s ,m s ,λ s]);
[0154] 22. If the number of instances required by microservice m, K, has been deployed, then do;
[0155] 23. Break.
[0156] In this embodiment, the MFFD algorithm consists of steps S301-S302:
[0157] S301: Arrange all requests in a sequential order, which is arbitrary. For example, the order could be server-based, starting with all requests on E1, then all requests on E2, and so on. We use E... n R k To represent server E n Request R in k Therefore, the order could be:
[0158] E1R1,E1R2,…E1R K ,E2R1,…E N R K .
[0159] S302: Deploy microservice instances, including: For each request segment, calculate the number of instances required by all microservices in that request segment, and with the goal of minimizing the distance between the edge servers where the instances are located, use a greedy strategy to deploy the instances required by the request segment to the available edge servers in sequence.
[0160] Specifically, for each request, a greedy strategy is used to deploy microservice instances to the nearest server. For example, for a pair of microservices S in a service request... i and S j If S i Deployed on server E m Up, then we can put S j Deploy to the closest E m Available edge servers are used to save communication latency. Therefore, for each segment of a request, such as E n R k We calculate the number of instances required for all microservices in this request and then deploy them on edge servers using a greedy strategy. It's worth noting that there might be servers without enough resources to deploy all the required microservice instances. In this case, we select the nearest server to deploy some instances, then deploy the remaining instances on the second nearest server, and so on.
[0161] In subsequent sub-time periods, microservice instances on edge servers are automatically scaled using deep reinforcement learning. Deep reinforcement learning is an iterative algorithm where the agent receives rewards by interacting with the environment and progressively optimizes its behavior by maximizing the accumulated rewards.
[0162] In this embodiment, a reinforcement learning-based microservice instance scaling algorithm (DRL_MAE, DRL-based microservice autoscaling in edge environment) is designed based on A3C. The microservice instance scaling algorithm is divided into two parts: a training part and an inference part.
[0163] The training part continuously updates the network parameters of the algorithm to ensure real-time network updates. For example, if we use a day as a preset time period, we can run the above training part once a day to update the network parameters of the microservice instance scaling algorithm, and then use the latest network parameters for inference every day.
[0164] In this embodiment, at the beginning of each preset time period, the microservice instance scaling algorithm is trained based on the status data of each edge server in the server cluster of the previous preset time period, so as to update the network parameters of the microservice instance scaling algorithm.
[0165] The status data includes: request arrival rate, service request latency, energy consumption, microservice instance deployment, and remaining resources.
[0166] Training the microservice instance scaling algorithm based on the status data of each edge server in the server cluster during the previous preset time period includes the following steps:
[0167] Input epochs M, soft update factor μ, reward discount factor μ, initial deployment Then, the status data of each edge server in the server cluster from the previous preset time period is input to train the microservice instance scaling algorithm. The training includes:
[0168] Initialize the network: Initialize the actor network σ(s|θ) σ ), target actor network * (s∣θ σ ), critic network Q(s,a|θ) Q ), Target critic network Q* (s,a∣θ Q Then, the parameters of the commentator network are copied to the target commentator network, and the parameters of the actor network are copied to the target actor network. Then, M training cycles are performed.
[0169] Perform M training cycles, where each training cycle includes the following steps:
[0170] Initialize the state, initialize the counter, and initialize random noise;
[0171] A time loop is performed based on the data from each sub-time period in the training data, and each time loop includes the following steps:
[0172] Perform z action loops, each action determining the adjustment of a microservice instance. Each action loop includes:
[0173] The actor network selects an action based on the current state and adds a noise term to increase exploratory power;
[0174] If an action fails, a reward is calculated based on the reward function, and the current training cycle ends. In this case, the reward becomes a penalty, r = r p If the action is successfully executed, the reward is calculated according to the reward function, and the reward is r = αT. latency +βE cost +γD cost And update the instance deployment N and resource remaining status RS;
[0175] Update request arrival rate Service latency Energy consumption And calculate the reward r i ;
[0176] After z action cycles are completed, calculate the new value based on all the rewards calculated in the z action cycles:
[0177]
[0178] Based on the new value, by minimizing the loss function Update the commentator network;
[0179] Update the actor network by maximizing the value function through gradient ascent:
[0180]
[0181] Based on the commentator network and actor network, update the target actor network and target commentator network:
[0182]
[0183] Specifically, the pseudocode for the training part of the reinforcement learning-based microservice instance scaling algorithm is as follows:
[0184] Input: Number of epochs M, soft update factor μ, reward discount factor μ, initial deployment
[0185]
[0186]
[0187]
[0188] The purpose of the inference part is to calculate the deployment strategy using the latest network parameters. Specifically, the microservice instance scaling algorithm solves the objective function based on the state input s to calculate the microservice scaling adjustment strategy.
[0189] In this embodiment, each preset time period includes multiple consecutive sub-time periods. At the beginning of a sub-time period, the microservice instance scaling algorithm calculates the microservice instance auto-scaling strategy for the next sub-time period based on the status data of each edge server in the server cluster of the previous few sub-time periods.
[0190] The microservice instance scaling algorithm calculates the microservice instance auto-scaling strategy for the next sub-period based on the status data of each edge server in the server cluster in the previous few sub-periods, including the following steps:
[0191] Import the pre-trained actor network and commentator network;
[0192] Get the request arrival rate on each edge server over the past few sub-time periods. Service request latency on various edge servers over the past few sub-time periods Energy consumption of each edge server over the past few sub-periods The current microservice instance deployment N, the previous sub-time period microservice instance deployment N(l-1), and the remaining resources on the current server RS are used to determine the current status.
[0193] Perform z action loops, with each action calculating the adjustment of one microservice instance. Each action and each action loop includes:
[0194] The actor network selects an action based on the current state, and may add a noise term. To increase exploratory behavior, actions are performed and the microservice instance deployment N and resource remaining status RS are updated to obtain a new state;
[0195] Record the updated deployment status of microservice instances;
[0196] After the loop is completed, the autoscaling strategy for the compute microservice instance is output, which includes z actions selected in the z loops.
[0197] Specifically, the pseudocode for the inference part of the reinforcement learning-based microservice instance scaling algorithm is as follows:
[0198] Input: Initial deployment
[0199] Output: Microservice deployment in the subsequent time period l = 1, 2, 3, ... L
[0200] 1. Import the pre-trained actor network σ(s|θ) σ )
[0201] 2. Import the pre-trained commenter network Q(s,a|θ) Q )
[0202] 3.j←0
[0203] 4.for timeslot G=1,2,3,…L do
[0204] 5. Collect data for the current time period, including request arrival rate Λ(G), service latency T(G), and energy consumption E(G).
[0205] 6. Combine the data from the current time period with the data from the previous few time periods to obtain...
[0206] 7. Obtain state s j
[0207] 8. For P=0,1,...z do
[0208] 9. Choose one action
[0209] 10. Perform action a j
[0210] 11. Update the microservice instance deployment N and resource usage RS.
[0211] 12. Obtain state s j+1
[0212] 13. j←j+1
[0213] 14.
[0214] In this embodiment, the master server in the server cluster acts as the central agent, responsible for monitoring, computation, and decision-making; the other edge servers in the server cluster act as working agents, responsible for data collection and instruction execution. The data collected by the edge servers is divided into two parts: one part is used for prediction, and the other part is used to calculate rewards for the central agent.
[0215] At the beginning of each sub-time period, all edge servers collect status data and transmit it to the master server. This status data includes request arrival rate, service latency, energy consumption, microservice instance deployment status, resource usage, etc. Some of this data is used for action decisions. The agent calculates the microservice instance autoscaling strategy for the next time period based on this data and returns the strategy to each edge server. This data is also used as feedback from the environment to the agent's decisions in the previous preset time period. The agent updates the network parameters of the microservice instance scaling algorithm based on this feedback.
[0216] In our algorithm, to avoid an excessively large action space, we divide the entire instance adjustment process into multiple steps, with the agent calculating the adjustment for only one instance in each step. Once all instances have been adjusted, the environment provides a reward as feedback on the adjustment strategy. For example, suppose we limit the adjustment to z steps within each sub-time period. In each sub-time period, the agent will perform z actions, and after performing z actions, the instance adjustment for the current sub-time period is complete. This invention is an active method; the instance adjustment for the current sub-time period is to respond to changes in requests in the next sub-time period.
[0217] In the reinforcement learning-based microservice instance scaling algorithm, the reinforcement learning reward consists of two parts. The first part is the penalty for each abnormal action, which includes adding instances that exceed server resource limits and removing instances that do not exist on the server. We denote this as r. p r p The first part is a relatively large value; the second part is the optimization objective. At the end of each sub-time period, the edge server will complete the adjustment of the microservice instances according to the instructions of the agent. After the adjustment is completed, it will enter the next time period. At this time, the environment will return a reward to evaluate the instance adjustment strategy.
[0218] In this embodiment, the reward function of the reinforcement learning-based microservice instance scaling algorithm is:
[0219] r = -(r a +r p );
[0220] ra =αT latency +βE cost +γD cost ;
[0221] In the formula, r a For the service delay corresponding to the sub-time period; r p The penalty for failure adjustment, r p Given a large positive number; reward r a =αT latency +βE cost +γD cost This indicates the effectiveness of the adjusted strategy. Since the goal of reinforcement learning is to maximize the overall reward, r is adjusted at each time interval. a As a reward, it can incentivize the agent to achieve long-term optimization goals. If the agent has not yet completed all instance adjustments, the reward will be set to zero.
[0222] In summary, this invention provides a microservice autoscaling method based on edge servers. This method comprehensively considers multi-objective long-term optimization of service latency, energy consumption, and dynamic losses, and can cope with the environmental dynamism in edge computing. Simultaneously, this invention provides an optimization algorithm based on deep reinforcement learning (DRL). This algorithm continuously updates the neural network parameters of the agent by interacting with the environment, ensuring real-time updates of the network parameters, and uses the latest network parameters to calculate the microservice deployment strategy.
[0223] Based on the methods described in the above embodiments, this embodiment will further describe the system from the perspective of an edge server-based microservice autoscaling system. This system can be implemented as an independent entity or integrated into an electronic device, such as a terminal.
[0224] Please see Figure 6 , Figure 6 This is a schematic diagram of a microservice auto-scaling system based on an edge server provided in an embodiment of the present invention. The system includes:
[0225] A cluster building module is used to build a server cluster, which includes multiple edge servers located close to each other, and the multiple edge servers communicate with each other through a base station;
[0226] The scaling algorithm construction module is used to build a microservice instance scaling algorithm based on the A3C network. With the goal of minimizing the overall service latency, energy consumption, and dynamic loss, it constructs the objective function and constraints of the microservice instance scaling algorithm.
[0227] The reinforcement learning-based microservice instance scaling algorithm is deployed on the main server, which is an edge server in a server cluster. The edge servers in the server cluster communicate with each other through base stations.
[0228] The objective function is:
[0229]
[0230] In the formula, T latency (l) represents the total service response latency for sub-time period l; E cost (l) represents the total energy consumption of sub-time period l; D cost (l) represents the dynamic loss of sub-time period l; α, β, and γ are the weights of total service response latency, total energy consumption, and dynamic loss, respectively; L is the total number of sub-time periods contained in a preset time period.
[0231] The constraints of the microservice instance scaling algorithm are as follows:
[0232]
[0233] In the formula, we use an undirected graph H(E,V) to represent the distribution of edge servers; and use S=[S1,S2,…,S… I ] represents a collection of microservices; E = [E1, E2, ..., E M ] represents the set of edge servers in the cluster; S i .cpu is for deploying an S i The computing resources required for the instance, S i .mem is for deploying an S i The memory resources required for the instance; To deploy on edge server E during sub-time period l m S on i Number of instances; To deploy on edge server E during sub-time period l n S on i Number of instances; E m • CPU for edge server E m Maximum computational resource constraint, E m .mem is for server E m Maximum memory constraints; For sub-time period l, S i The instance is on edge server E m The load on; ρ max Indicates the load threshold;
[0234] The load The calculation formula is as follows:
[0235]
[0236] In the formula, λ i,m (l) represents the sub-time period l at time S. i The instance is on edge server E m Arrival rate on; μ i,m (l) represents the sub-time period l at time S. i The instance is on edge server E m Service rate.
[0237] In the objective function, the total service delay T latency The formula for calculating (l) is as follows:
[0238]
[0239] In the formula, For the request in the sub-time period l on the edge server E m Service response delay in For sub-time period l from edge server E m The arrival rate of the received requests;
[0240] The service response latency for a request is the sum of the request's transmission latency and processing latency. Therefore, the service response latency is... The calculation formula is as follows:
[0241]
[0242] In the formula, ∑T t (l) represents the sum of the requested transmission delays; ∑T p (l) represents the total processing delay of the request;
[0243] We represent application requests as R = [R1, R2, ..., R...] K For request R in the sub-time period l k Request R k For deployment on edge server E m Microservices on S i Calling the edge server E n Microservice calls microservice S j Then the request R k Transmission delay T t (l) and processing delay T p The formula for calculating (l) is as follows:
[0244]
[0245] In the formula, data i,j For deployment on edge server E mMicroservices on S i Calling the edge server E n Microservice calls microservice S j Data size; V m,n To represent edge server E m With E n The transmission rate between them; To request R k The final execution delay; T q To request R k Queuing delay; For edge server E m Microservices S i Average arrival rate; L q The length of the service queue;
[0246] In the objective function, the total energy consumption E cost The formula for calculating (l) is as follows:
[0247]
[0248] In the formula, P m (l) represents the edge server E in sub-time period l. m Energy consumption, P startup For the edge server E in sub-time period l m Startup energy consumption; For the edge server E in sub-time period l m The energy consumption of the instance; when the edge server E m When there are no instances in the edge server E m Energy consumption P m =0;
[0249] In the objective function, the dynamic loss D cost The formula for calculating (l) is as follows:
[0250]
[0251] In the formula, c is the dynamic cost of creating or deleting an instance, which is a constant; For the previous sub-time period (l-1), the edge server E was deployed. m S on i Number of instances.
[0252] The reinforcement learning reward function r of the microservice instance scaling algorithm is:
[0253] r = -(r a +r p );
[0254] r a =αTlatency +βE cost +γD cost ;
[0255] In the formula, r a For service latency, r p The penalty for failure adjustment, r p It is a large positive number.
[0256] A control module is used to control the automatic scaling of microservices in the server cluster through the microservice instance scaling algorithm. The control module includes a training module and a prediction module. The training module, at the beginning of each preset time period, trains the reinforcement learning-based microservice instance scaling algorithm based on the state data of each edge server in the server cluster from the previous preset time period to update the network parameters of the algorithm. The state data includes: request arrival rate, service request latency, energy consumption, microservice instance deployment, and resource availability. The prediction module, at the beginning of a sub-time period, calculates the automatic scaling strategy for microservice instances based on the state data of each edge server in the server cluster from the previous few sub-time periods.
[0257] Additionally, please see Figure 7 , Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention, such as... Figure 7 As shown, the electronic device includes a processor and a memory. The processor and memory are electrically connected. The electronic device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the aforementioned microservice autoscaling method based on an edge server.
[0258] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by instructions, which can be stored in a computer-readable storage medium and loaded and executed by a processor. Therefore, embodiments of the present invention provide a storage medium on which a computer program is stored, which, when executed by a processor, implements the above-described microservice autoscaling method based on an edge server.
Claims
1. An edge server-based microservice automatic scaling method, characterized in that, The method comprises the following steps: S1, constructing a server cluster, wherein the server cluster comprises a plurality of edge servers with close distances, and the plurality of edge servers communicate through base stations; S2, constructing a micro-service instance scaling algorithm based on an A3C network, taking a total minimum of service time delay, energy consumption and dynamic loss as a target, constructing a target function and constraint conditions of the micro-service instance scaling algorithm; S3, controlling automatic scaling adjustment of micro services of the server cluster through the micro-service instance scaling algorithm; The target function is: ; In the formula, is the total service response delay of the sub time period ; is the total energy consumption of the sub time period ; is the dynamic loss of the sub time period ; , , are weights of the total service response delay, the total energy consumption, and the dynamic loss, respectively; is the total number of sub time periods contained in a preset time period. In the objective function, the dynamic loss The calculation formula is as follows: ; In the formula, The dynamic cost of creating or deleting an instance, which is a constant; In sub-time period Deployed on edge servers On Number of instances; For the previous sub-time period Deployed on edge servers On Number of instances; For the total number of microservices, This represents the total number of edge servers in the cluster.
2. The micro-service automatic scaling method based on edge servers according to claim 1, wherein: In the step S3, the automatic scaling adjustment of micro services of the server cluster through the micro-service instance scaling algorithm comprises: At the beginning of each preset time period, the micro-service instance scaling algorithm is trained based on state data of each edge server in the server cluster in the last preset time period, so as to update network parameters of the micro-service instance scaling algorithm; Each of the preset time periods comprises a plurality of continuous sub-time periods, and at the beginning of a sub-time period, the micro-service instance scaling algorithm calculates a micro-service instance automatic scaling strategy according to state data of each edge server in the server cluster in the previous several sub-time periods; The state data comprises request arrival rate, service request time delay, energy consumption, micro-service instance deployment and resource remaining condition.
3. The micro-service automatic scaling method based on edge servers according to claim 2, wherein: The micro-service instance scaling algorithm is deployed on a master server, and the master server is one of the edge servers in the server cluster.
4. The micro-service automatic scaling method based on edge servers according to claim 2 or 3, wherein: The constraint condition of the micro-service instance scaling algorithm is: ; where we use an undirected graph to represent the distribution of edge servers; use to represent the set of microservices; use to represent the set of edge servers in a cluster; to represent the computing resources required to deploy an instance, to represent the memory resources required to deploy an instance; to represent the number of instances deployed on edge servers at a sub-time period ; to represent the number of instances deployed on edge servers at a sub-time period ; to represent the maximum computing resource constraint of an edge server , to represent the maximum memory constraint of a server ; to represent the load of an instance on an edge server at a sub-time period ; to represent the load threshold value; The load The calculation formula is as follows: ; wherein denotes a sub-period when the arrival rate at the edge server ; denotes a sub-period when the service rate at the edge server .
5. The micro-service automatic scaling method based on edge servers according to claim 4, wherein: In the objective function, the total service delay is calculated as follows: ; wherein is a sub-period request in the edge server service response delay, is a sub-period request arrival rate from the edge server arrival; The service response delay for a request is the sum of the transmission delay and the processing delay for the request, and thus the service response delay is calculated as follows: ; In the formula, is the sum of the transmission delays of the requests; denotes the sum of the processing delays of the requests; We represent application requests as For the sub-time period Request in ,ask For deployment on edge servers microservices Calling the edge server Microservice calling microservice Then the request transmission delay and processing delay The calculation formula is as follows: ; ; ; ; ; ; wherein, is the number of microservices deployed on the edge server ; is the number of microservices deployed on the edge server ; is the data size of the microservice call by the microservice deployed on the edge server ; is the transmission rate between the edge server ; is the final execution latency of the request ; is the queuing latency of the request ; is the average arrival rate of the microservices in the edge server ; is the service queue length; In the objective function, the total sum of energy consumption The calculation formula is as follows: ; ; wherein is the energy consumption of the edge server for a sub-period is the energy consumption of the edge server for a sub-period is the start-up energy consumption of the edge server for a sub-period is the instance energy consumption of the edge server for a sub-period is the instance energy consumption of the edge server for a sub-period is the energy consumption of the edge server for a sub-period 6. The micro-service automatic scaling method based on edge servers according to claim 5, wherein: Reinforcement learning reward function for microservice instance scaling algorithm is: ; ; In the formula, is the service latency, is the penalty for failure adjustment.
7. The micro-service automatic scaling method based on edge servers according to claim 6, wherein: At the beginning of the first sub-time period in the preset time period, the micro-service instance is deployed according to the following method: S301, arranging all requests in order; S302, for each request, calculating the number of instances required by all micro services in the request, taking the distance between the edge servers where the instances are located as a target, and using a greedy strategy to deploy the instances required by the request to available edge servers in turn.
8. A micro-service automatic scaling system based on edge servers, comprising: a cluster construction module, configured to construct a server cluster, wherein the server cluster comprises a plurality of edge servers with close distances, and the plurality of edge servers communicate through base stations; a scaling algorithm construction module, configured to construct a micro-service instance scaling algorithm based on an A3C network, taking a total minimum of service time delay, energy consumption and dynamic loss as a target, and construct a target function and constraint conditions of the micro-service instance scaling algorithm; The target function is: ; In the formula, is the total service response delay of the sub time period ; is the total energy consumption of the sub time period ; is the dynamic loss of the sub time period ; , , respectively are the weights of the total service response delay, the total energy consumption, and the dynamic loss; is the total number of sub time periods contained in a preset time period; In the objective function, the dynamic loss The calculation formula is as follows: ; wherein is the dynamic cost for creating or deleting an instance, which is a constant; is the previous sub-period is deployed on an edge server at time is the number of instances; is the total number of microservices, is the total number of edge servers in the cluster; A control module is configured to control automatic scaling of microservices of a server cluster by the microservice instance scaling algorithm.
9. An electronic device, comprising: The electronic device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the steps in the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps in the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Micro-service deployment and routing method based on network edge system
CN114338504A
Self-adaptive automatic scaling method and system in multi-micro-service calling environment
CN114650297A