Micro-service automatic scaling method and system based on edge server
By applying the microservice instance scaling algorithm based on A3C network on edge servers, the problem of limited resources of edge servers is solved, dynamic adjustment of automatic scaling of microservices is realized, and service delay, energy consumption and dynamic losses are optimized.
Patent Information
- Application Number
- CN202411635415.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-11-15
AI Technical Summary
The limited resources of edge servers make it difficult for microservice automatic scaling strategies to achieve ideal results, especially when facing complex microservice dependencies and dynamic service requests.
The microservice instance scaling algorithm based on A3C network is adopted, and the number of microservice instances is adjusted in real time by building objective functions and constraints, combined with reinforcement learning methods to minimize service delay, energy consumption and dynamic losses.
It realizes dynamic adjustment of microservice instances in an edge computing environment to optimize resource utilization and performance, and adapt to complex microservice dependencies and dynamic service requests.
Smart Images

Figure CN119767321A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of edge computing technology, and in particular to an edge server-based microservice automatic scaling method and system. Background Art
[0002] Mobile edge computing (MEC) deploys computing and storage close to the data source. It is an innovative computing architecture. Edge computing significantly reduces latency, enhances real-time response capabilities, and reduces central network pressure by processing data at the edge of the network. Therefore, edge computing is particularly suitable for application scenarios that require instant processing and action, such as autonomous driving, industrial automation, and smart cities. Edge computing also solves privacy and security issues to a certain extent by keeping sensitive data close to the data source to reduce its exposure risk. Microservice architecture is a modern software development method that structures applications into a set of loosely coupled, independently deployed microservices. Each microservice undertakes an independent business and communicates with other microservices through well-defined APIs, which usually use lightweight protocols such as HTTP / REST or gRPC. The advantages of microservice architecture include modularity, scalability, and elasticity. Modularity means that each microservice can be developed and deployed independently; scalability means that when an application is updated and iterated, only the corresponding microservice needs to be upgraded without changing other microservices; elasticity means that enterprises can quickly increase or decrease microservice instances to respond to the dynamic nature of service requests based on actual conditions. Due to the above advantages, microservice architecture has become the first choice for modern cloud-native applications.
[0003] The combination of edge computing and microservice architecture brings together the advantages of both, providing a new idea for solving the current large-scale, high-concurrency service needs. However, this integration also brings new challenges, especially in resource management and performance optimization. First, the limited resources of edge servers make resource scheduling more difficult; second, in edge computing, the dependencies between microservices are more complex; third, the edge environment is highly dynamic, and microservice deployment needs to be adjusted in real time to cope with dynamic service requests. An important method to solve the above problems is microservice autoscaling, that is, automatically adjusting the number of running microservice instances according to real-time request requirements. However, most of the current research on microservice autoscaling is based on a single server, similar to the microservice autoscaling in cloud computing. However, due to the limited resources of edge servers, the above strategies are often difficult to achieve ideal results. Therefore, in order to solve the above problems. A microservice scaling strategy that responds to the request needs in edge computing is urgently needed to solve the limited resources of edge servers and adapt to the complex call relationship of microservices and the dynamic nature of requests in edge environments. Summary of the invention
[0004] The purpose of the present invention is to overcome the problems existing in the prior art in the system integrating edge computing and microservice architecture, such as the limited resources of the edge server, the difficulty in resource scheduling, the complex dependencies between microservices in edge computing, and the difficulty in real-time adjustment of microservice deployment to cope with dynamic service requests, and provide a microservice automatic scaling method and system based on an edge server.
[0005] To achieve the above objectives, the technical solution of the present invention is: In a first aspect, the present invention provides a microservice automatic scaling method based on an edge server, comprising the following steps:
[0006] S1. Build a server cluster, wherein the server cluster includes a plurality of edge servers that are close to each other, and the plurality of 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 service latency, energy consumption, and dynamic loss, and construct the objective function and constraints of the microservice instance scaling algorithm;
[0008] S3. Automatically scaling the microservices of the server cluster is controlled by the microservice instance scaling algorithm.
[0009] In step S3, controlling the automatic scaling adjustment of microservices of the server cluster by 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 in the previous preset time period to update the network parameters of the microservice instance scaling algorithm;
[0011] Each of the preset time periods includes multiple continuous sub-time periods. At the beginning of a sub-time period, the microservice instance scaling algorithm calculates the microservice instance automatic scaling strategy for the next sub-time period based on the status data of each edge server in the server cluster in the previous sub-time periods.
[0012] The microservice instance scaling algorithm is deployed on a master server, which is an edge server in a server cluster.
[0013] The objective function is:
[0014]
[0015] Where, T latency (l) is the total service response delay in sub-time period l; E cost (l) is the total energy consumption in sub-time period l; D cost(l) is 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 included in a preset time period;
[0016] The constraints of the microservice instance scaling algorithm are:
[0017]
[0018] In the formula, we use an undirected graph H(E,V) to represent the distribution of edge servers; 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 means deploying an S i The computing resources required by the instance, S i .mem means deploying an S i Memory resources required by the instance; Indicates that it is deployed on edge server E in sub-time period l m S i Number of instances; Indicates that it is deployed on edge server E in sub-time period l n S i Number of instances; E m cpu represents the edge server E m The maximum computing resource constraint, E m .mem indicates server E m Maximum memory constraint; Indicates the sub-time period l S i Instance 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 S in sub-time period l i Instance on edge server E m The arrival rate on i,m (l) represents S in sub-time period l i Instance on edge server E m The service rate on.
[0022] In the objective function, the total service delay T latencyThe calculation formula of (l) is as follows:
[0023]
[0024] In the formula, The request in sub-time period l is on edge server E m Service response delay in is the number of nodes from edge server E in sub-time period l. m The arrival rate of the requests that arrive;
[0025] The service response delay for a request is the sum of the transmission delay and processing delay of the request. The calculation formula is as follows:
[0026]
[0027] In the formula, ∑T t (l) is the sum of the transmission delays of the requests; ∑T p (l) represents the sum of the processing delays of the requests;
[0028] We denote application requests as R = [R1, R2, …, R K ], for the request R in the sub-time period l k , request R k For deployment on edge server E m Microservices on S i Call deployed on edge server E n The microservice on calls microservice S j , then the request R k The transmission delay T t (l) and processing delay T p The calculation formula of (l) is as follows:
[0029]
[0030] In the formula, data i,j For deployment on edge server E m Microservices on S i Call deployed on edge server E n The microservice on calls microservice S j The data size of V m,n represents the edge server E m With E n The transmission rate between To request R k The final execution delay of q To request R k The queuing delay; For edge server Em Microservices S i The average arrival rate of q is the length of the service queue;
[0031] In the objective function, the total energy consumption E cost The calculation formula of (l) is as follows:
[0032]
[0033] Where P m (l) is the edge server E in sub-time period l m Energy consumption, P startup is the edge server E in sub-time period l m Starting energy consumption; is the edge server E in sub-time period l m When the edge server E m When there is no instance in the edge server E m Energy consumption m is 0;
[0034] In the objective function, the dynamic loss D cost The calculation formula of (l) is as follows:
[0035]
[0036] Where c is the dynamic cost of creating or deleting an instance, which is a constant; The edge server E is deployed in the previous sub-time period (l-1). m S 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 is the service delay, r p The penalty adjusted for failure, r p is a large positive number.
[0041] At the beginning of the first sub-time period in the preset time period, the microservice instance is deployed according to the following method;
[0042] S301, arranging all requests in order;
[0043] S302: For each segment of the request, the number of instances required by all microservices in the segment of the request is calculated, and the instances required by the segment of the request are deployed sequentially to the available edge servers using a greedy strategy with the goal of minimizing the distance between the edge servers where the instances are located.
[0044] In a second aspect, the present invention provides a microservice automatic scaling system based on an edge server, comprising:
[0045] A cluster building module, used to build a server cluster, wherein the server cluster includes a plurality of edge servers that are close to each other, and the plurality of edge servers communicate through a base station;
[0046] The scaling algorithm construction module is used to build a microservice instance scaling algorithm based on the A3C network. The objective function and constraints of the microservice instance scaling algorithm are constructed with the goal of minimizing service latency, energy consumption, and dynamic loss.
[0047] The control module is used to control the automatic scaling adjustment of microservices of the server cluster through the microservice instance scaling algorithm.
[0048] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the steps in the above-mentioned method for automatic scaling of microservices based on an edge server when executing the computer program.
[0049] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above-mentioned methods for automatic scaling of microservices based on edge servers are implemented.
[0050] Compared with the prior art, the present invention has the following beneficial effects:
[0051] 1. In a microservice automatic scaling method based on an edge server of the present invention, in a cluster including multiple edge servers, an edge server is selected as the main server of the cluster, and a microservice instance scaling algorithm based on reinforcement learning is deployed on the main server. The main server obtains the microservice data of each edge server in the cluster in real time, and runs the microservice instance scaling algorithm based on reinforcement learning based on the microservice data of each edge server to perform microservice automatic scaling; at the same time, the intelligent agent runs the learning program of the algorithm at a certain frequency according to the microservice data fed back by each edge server to update the network parameters of the microservice instance scaling algorithm based on reinforcement learning, ensure that the network parameters are updated in real time, and calculate the deployment strategy with the latest network parameters. The microservice automatic scaling method in this design considers long-term optimization and dynamic scenarios (service requests change in real time, and microservice instance deployment needs to be adjusted in real time) to achieve the optimal deployment in dynamic scenarios. Therefore, the present invention considers long-term optimization, regularly updates the network parameters of the microservice instance scaling algorithm based on reinforcement learning, ensures that the network parameters are updated in real time, and achieves the optimal deployment in dynamic scenarios.
[0052] 2. The objective function of the microservice instance scaling algorithm based on reinforcement learning in the microservice automatic scaling method based on edge servers of the present invention is constructed with the overall minimum of service delay, energy consumption, and dynamic loss as the goal. The optimization goal of the algorithm is to average the delay, energy consumption, dynamic loss, etc. of all time periods to seek the overall optimum. Therefore, the present invention can seek the overall optimum for the delay, energy consumption, dynamic loss, etc. of all time periods. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 It is a flow chart of the automatic scaling method of microservices based on edge servers provided by the present invention.
[0054] Figure 2 It is a flow chart of the automatic scaling strategy of microservices in edge computing provided by the present invention.
[0055] Figure 3 It is a structural diagram of the microservice structure of the network edge architecture system provided by the present invention.
[0056] Figure 4 It is a flow chart of a microservice instance scaling algorithm based on reinforcement learning provided by the present invention.
[0057] Figure 5 It is a network structure diagram of the microservice instance scaling algorithm based on reinforcement learning provided by the present invention.
[0058] Figure 6 It is a structural schematic diagram of the edge server-based microservice automatic scaling system provided by the present invention.
[0059] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0060] The present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0061] Microservice autoscaling refers to automatically adjusting the number of running microservice instances in a microservice architecture based on real-time request requirements. However, most current studies on microservice autoscaling are based on a single server, similar to microservice autoscaling in cloud computing. However, due to limited resources on edge servers, the above strategies often fail to achieve ideal results. In order to solve the technical problems existing in the related art, an embodiment of the present invention provides a microservice autoscaling method based on an edge server, such as Figure 1 As shown, Figure 1 The present invention is a flow chart of a microservice automatic scaling method based on an edge server, the method comprising steps S1 to S3:
[0062] S1. Building a server cluster, wherein the server cluster includes a plurality of edge servers that are close to each other, and the plurality of edge servers communicate through a base station.
[0063] In this embodiment, the edge server-based microservice automatic scaling method is based on an edge architecture, which includes multiple edge nodes, each edge node covers an area, and the request arrival rate in the area changes with time. Each edge node needs to dynamically adjust the microservice instances on the server to cope with the changes in the request arrival rate.
[0064] Taking into account the resource limitations of edge servers, the conventional microservice automatic scaling strategy applicable to cloud servers is difficult to achieve ideal results on edge servers. Therefore, the present invention proposes a microservice automatic scaling adjustment strategy based on edge computing, which regards multiple edge servers as a cluster and designs a microservice automatic scaling strategy based on the cluster to overcome the problem of limited edge server resources.
[0065] like Figure 3 As shown, Figure 3 A schematic diagram of a microservice structure of a network edge architecture system provided by 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 set of edge servers, each of which has a maximum computing resource constraint and a maximum memory constraint, respectively denoted by E m ·cpu and E m.mem; in the model, we ignore the specific connections between servers and use V m,n Server E m and E n The transmission rate between.
[0066] In the microservice 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 computing resources and memory resources required by the instance; we represent the application request as R = [R1, R2, …, R K ], an application request is composed of a series of microservices arranged in a specific order, and we need to complete all the required microservices to satisfy the application request. Considering the general scenario, we assume that the edge server is deployed near the base station. The user's application request initially arrives at the base station closest to the user, and the edge server near the base station will confirm the request; after that, the request is forwarded between edge servers until all microservices in the request are completed.
[0067] Due to the limited resources of edge servers, the microservices required for a request may be deployed on one or more edge servers. This means that processing a request may require the participation of one or more edge servers. Therefore, a request routing strategy is needed to select the corresponding edge server. In order to balance efficiency and load, we adopt a weighted routing method.
[0068] In this embodiment, the corresponding edge server is selected by the request routing strategy of weighted routing. Specifically, the closer the distance between edge servers is, the higher the routing probability is to meet the transmission speed requirement; at the same time, the more instances are deployed on the edge server, the higher the routing probability is to meet the load balancing requirement. For example, after completing the microservice S i Then you need to call microservice S j , assuming S i Deployed on edge server E m The request routing strategy of the weighted routing 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 the edge server E m Microservices on S i Call the edge server E n Microservice S j The probability of V m,n Indicates E m and E n The transmission rate between Indicates that it is located at the edge server E n Microservice S j The number of instances of , ω1 and ω2 are adjustable parameters.
[0072] In this embodiment, microservice deployment needs to rely on a routing strategy, and different routing strategies result in different optimal microservice deployment strategies. The microservice automatic scaling method provided in the embodiment of the present invention 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 service latency, energy consumption, and dynamic loss, and construct the objective function and constraints of the microservice instance scaling algorithm.
[0074] like Figure 2 As shown, Figure 2 This is a flow chart of the automatic scaling strategy of microservices in edge computing provided by an embodiment of the present invention. In this embodiment, the microservice instance scaling algorithm based on reinforcement learning is deployed on the main server, which is an edge server in the server cluster. At the same time, 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, with the goal of minimizing service latency, energy consumption, and dynamic loss. The objective function and constraints of the microservice instance scaling algorithm include:
[0076] Build a microservice instance scaling algorithm based on the A3C network, and define the state, action, and reward function of the microservice instance scaling algorithm.
[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 expressed as:
[0078]
[0079] In the formula, is the request arrival rate on each edge server in the past few sub-time periods; Indicates the service request latency of each edge server in the past few sub-time periods; Indicates the energy consumption of each edge server in the past few sub-time periods; N is the current microservice instance deployment; N(l-1) is the microservice instance deployment in the previous sub-time period; RS indicates the remaining resources on the current server, including computing resources and storage resources; P indicates the number of actions in this adjustment that the current action is. In order to reduce the action space, this method calculates the adjustment of one microservice instance at a time and completes the adjustment of all instances in one sub-time period. It takes multiple actions to complete the adjustment of all instances, so P is used to record the number of actions in the current sub-time period that the current action is.
[0080] In the microservice scaling adjustment strategy, multiple actions are required in a sub-time period. One action calculates the adjustment of one microservice instance. One action of the microservice instance scaling algorithm can be expressed as:
[0081] a={I,E src ,ms};
[0082] In the formula, the action of the microservice instance scaling algorithm includes an action indicator, a target server, and a target service instance. Specifically, I is an indicator; its value is {0, 1, 2}, which respectively represent addition, deletion, and unchanged; E src is the target server; ms is the target microservice instance. The adjustment action of a microservice instance indicates which microservice is added or reduced on a certain edge server. For example, {0,5,2} indicates adding an instance of microservice S2 on edge server E5.
[0083] In this embodiment, in order to evaluate the quality of the microservice automatic scaling strategy, after in-depth analysis of the needs of the actual production environment, the present invention proposes a multi-objective long-term plan based on latency, energy consumption, and dynamic loss.
[0084] In order to achieve the above long-term planning goals, we construct an objective function with the goal of minimizing service latency, energy consumption, and overall dynamic loss. At the same time, our optimization goal is the long-term performance of the automatic scaling system. In different time periods, the request arrival rate and instance deployment will be different.
[0085] In order to minimize service delay, energy consumption, and dynamic loss, while taking into account the average performance of all sub-time periods, the objective function can be expressed as:
[0086]
[0087] Where, T latency (l) is the total service response delay in sub-time period l; E cost (l) is the total energy consumption in sub-time period l; Dcost (l) is 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 loss, and vice versa, so in practical applications, we need to balance these weights to achieve optimal performance.
[0089] There are two constraints in the objective function: resource constraint and load constraint. Resource constraint ensures that the computing and memory resources used by the server do not exceed the total computing and memory resources available to the server; load constraint mainly ensures the normal operation of the server and prevents problems such as large packet loss and server crash. We use the ratio of total arrival rate to total service rate to represent the load.
[0090] In this embodiment, the constraint conditions of the objective function are:
[0091]
[0092] In the formula, is deployed on edge server E in sub-time period l m S i Number of instances; is deployed on edge server E in sub-time period l n S i Number of instances; E m ·CPU is edge server E m The maximum computing resource constraint, E m .mem is server E m Maximum memory constraint; When S is sub-time period l i Instance on edge server E m The load on max is the load threshold, S i .cpu is used to deploy an S i The computing resources required by the instance, S i .mem is used to deploy an S i The memory resources required by the instance; I is the total number of microservices;
[0093] In this example, we will request R k On the edge server E m The average service response delay in is denoted as T k,m , the total service response delay can be expressed as:
[0094]
[0095] We denote application requests as R = [R1, R2, …, R K ], where Request R in sub-time period l k On the edge server E m Service response delay in is the number of nodes from edge server E in sub-time period l. m The arrival rate of requests arriving.
[0096] Specifically, the service delay of a request is determined by two parts: transmission delay and processing delay. The service response delay of a request is the sum of the transmission delay and processing delay of the request. Therefore, the service response delay It can be expressed as:
[0097]
[0098] In the formula, ∑T t (l) is the sum of the transmission delays of the requests in sub-time period l; T p (l) represents the sum of the processing delays of requests in sub-time period l.
[0099] For the request R in the sub-time period l k , assuming that the request R k For deployment on edge server E m Microservices on S i Call deployed on edge server E n The microservice on calls microservice S j , then request R k The corresponding transmission delay T t (l) can be expressed as:
[0100]
[0101] data i,j For deployment on edge server E m Microservices on S i Call deployed on edge server E n The microservice on calls microservice S j The data size of V m,n represents the edge server E m With E n The transmission rate between.
[0102] As for the processing delay, it is determined by the queuing delay and the final execution delay. In actual applications, when a request arrives at the server, it may not be processed immediately, but a queuing delay will be generated. At present, in order to cope with high concurrent service requirements, multi-instance deployment is usually adopted. Therefore, we use the M / M / C queuing theory to model the queuing delay. For the edge server E m Microservices on S i Instance, the number of instances is The average service rate of a single instance is is a constant; the edge server E m Microservices S i The average arrival rate is Processing delay T p It can be expressed as:
[0103]
[0104] In the formula, is the final execution delay of the request; T q is the queuing delay; For edge server E m Microservices S i The average arrival rate of q is the length of the service queue.
[0105] In this embodiment, the energy consumption consists of two parts: the first part is the startup energy consumption, which represents the fixed energy required to start the server. By default, when no instance is deployed on the server, the server is turned off; the second part is the instance energy consumption. Each deployed instance consumes a certain amount of energy. m When there is no instance in the edge server E m Energy consumption m is 0, when the edge server E m When there are instances in the system, each deployed instance consumes a certain amount of energy, and the total energy consumption is E cost (l) can be expressed as:
[0106]
[0107] Where P m (l) is the edge server E in sub-time period l m Energy consumption, P startup is the edge server E in sub-time period l m Starting energy consumption; is the edge server E in sub-time period l m Instance energy consumption.
[0108] Since it takes time to create and delete instances, resources will be unavailable for a period of time, which cannot be ignored in a production environment. In the present invention, dynamic loss is used to measure this part of the 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 count the changes in microservice instances compared with the previous time period. Therefore, the dynamic loss is expressed as:
[0110]
[0111] Where c is the dynamic cost of creating or deleting an instance, which is a constant; The edge server E is deployed in the previous sub-time period (l-1). m S i Number of instances.
[0112] Based on the above objective function, we define the reinforcement learning reward function of the microservice instance scaling algorithm. The reward function r of the microservice instance scaling algorithm is:
[0113] r=-(r a +r p );
[0114] r a =αT latency +βE cost +γD cost ;
[0115] In the formula, r a is the service delay, r p The penalty adjusted for failure, r p is a large positive number.
[0116] S3. Automatically scaling the microservices of the server cluster is controlled by the microservice instance scaling algorithm.
[0117] like Figure 4 As shown, Figure 4 1 is a flow chart of a microservice instance scaling algorithm based on reinforcement learning provided by an embodiment of the present invention. In this embodiment, controlling the automatic scaling adjustment of microservices of a server cluster by the microservice instance scaling algorithm includes:
[0118] 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 in the previous preset time period to update the network parameters of the microservice instance scaling algorithm. The length of the preset time period is selected according to the needs. For example, the length of the preset time period can be set to one day or one hour.
[0119] Each of the preset time periods includes multiple continuous sub-time periods. At the beginning of a sub-time period, the microservice instance scaling algorithm calculates the microservice instance automatic scaling strategy for the next sub-time period based on the status data of each edge server in the server cluster in the previous sub-time periods.
[0120] The status data includes: request arrival rate, service request latency, energy consumption, microservice instance deployment, and resource remaining status.
[0121] In this embodiment, at the beginning of each sub-time period, the main server obtains the historical status data of each edge server in the server cluster in the previous sub-time periods, and obtains the state input s according to the historical status data of each edge server in the server cluster in the previous sub-time periods. The state input s is expressed as:
[0122]
[0123] In the formula, is the request arrival rate on each edge server in the past few sub-time periods; Indicates the service request latency of each edge server in the past few sub-time periods; Indicates the energy consumption of each edge server in the past few sub-time periods; N is the current microservice instance deployment; N(l-1) is the microservice instance deployment in the previous sub-time period; RS indicates the remaining resources on the current server, including computing resources and storage resources; P indicates the number of actions the current action is in the current sub-time period. In order to reduce the action space, this method calculates the adjustment of a microservice instance for one action, and updates the status data after each action. It takes multiple actions to complete the automatic scaling adjustment of microservices in the sub-time period. P is used to record the number of adjustments the current action is in the current time period.
[0124] The reinforcement learning-based microservice instance scaling algorithm outputs a microservice scaling adjustment strategy according to the state input s, and sends the microservice scaling adjustment strategy to each edge server in the server cluster.
[0125] The microservice scaling adjustment strategy includes multiple adjustment actions, one adjustment action indicates the adjustment of one microservice instance, and one adjustment action can be expressed as:
[0126] a={I,E src ,ms};
[0127] Where I is an indicator with values of {0, 1, 2}, representing addition, deletion, and unchanged, respectively; E src is the target server; ms is the target microservice instance.
[0128] In this embodiment, a microservice instance scaling algorithm based on reinforcement learning, namely DRL_MAE (DRL-basedmicroservice 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 of the algorithm. Thereafter, in subsequent time periods, the microservice instance scaling algorithm will output a microservice instance automatic scaling strategy, and make scaling adjustments based on the deployment in the previous time period according to the microservice instance automatic scaling strategy, without considering the deployment of the microservice from scratch.
[0129] For initial deployment, the present invention proposes a Microservice first-fit decreasing algorithm (MFFD) in the field of microservice deployment based on the First-fit decreasing algorithm (FFD) in the field of service deployment. The core idea of the First-fit decreasing algorithm is to select the nearest server for the connected microservices through a greedy strategy to reduce transmission delay.
[0130] The pseudo code of the microservice first fit decreasing algorithm (MFFD) is as follows:
[0131] Input: service request arrival rate Λ, edge server resource limit E m ·cpu and E m .mem, where m∈{0,1,2…,M}, the distance between edge servers d 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 of the servers they are on, and record them as set REQ;
[0134] 2. Create a new heap and initialize it
[0135] 3.for req in REQ do;
[0136] 4.REQ\=req
[0137] 5. Get the initial server E of req s ;
[0138] 6. Get the service arrival rate λ of req s ;
[0139] 7. Get the first microservice m of 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. The arrival rate of microservice requests is λ s ;
[0142] 10.while stack is not empty do;
[0143] 11.[E,m,λ]=stack.pop()
[0144] 12. Calculate the number of instances K required by the current microservice m based on the microservice arrival rate λ according to the formula;
[0145] 13. Get the next microservice m to be deployed n ;
[0146] 14. Sort all servers in ascending order of distance from server E, recorded as ordered list
[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 Deploy microservice instances
[0150] 18. Update resource usage E m ·cpu and E m .mem;
[0151] 19. Part of the request will be based on the instance deployment n Import N E ;
[0152] 20.If m n There are do\\There are still remaining microservices in the current request
[0153] 21.stack.push([E s ,m s ,λ s]);
[0154] 22.If the number of instances K required by microservice m is deployed, do;
[0155] 23.Break.
[0156] In this embodiment, the MFFD algorithm is divided into steps S301-S302:
[0157] S301: Arrange all requests in order. The order is arbitrary. For example, the order can be based on the server, 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 , so the sequence can be:
[0158] E1R1,E1R2,…E1R K ,E2R1,…E N R K .
[0159] S302: deploying microservice instances, including: for each request segment, calculating the number of instances required by all microservices in the request segment, with the goal of minimizing the distance between edge servers where the instances are located, and using 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 the microservice instance 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 Then we can transform S j Deploy to the closest E m available edge servers to save communication delay. Therefore, for each request segment, such as E n R k ,We calculate the number of instances required by all microservices in this request, and then deploy them on the edge servers according to the greedy strategy. It is worth noting that there may be no available server with enough resources to deploy all the required microservice instances. In this case, we choose the nearest server to deploy some instances, and then deploy the remaining instances on the second closest server, and so on.
[0161] In the subsequent sub-periods, the microservice instances on the edge servers are automatically scaled up and down through deep reinforcement learning. Deep reinforcement learning is an iterative algorithm in which the agent obtains rewards by interacting with the environment and gradually optimizes its behavior by maximizing the cumulative reward.
[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, one is a training part, and the other is a reasoning part.
[0163] The training part continuously updates the network parameters of the algorithm to ensure real-time network updates. For example, we use one day as a preset time period, and 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 in the previous preset time period 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 resource remaining status.
[0166] Based on the status data of each edge server in the server cluster in the previous preset time period, training the microservice instance scaling algorithm includes the following steps:
[0167] Input epoch number M, soft update factor μ, reward discount factor μ, initial deployment Then, the status data of each edge server in the server cluster in the previous preset time period is input to train the microservice instance scaling algorithm, and 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 copy the critic network parameters to the target critic network, copy the actor network parameters to the target actor network, and then perform M training cycles;
[0169] Perform M training cycles, where one training cycle includes the following steps:
[0170] Initialize state, initialize counter, initialize random noise;
[0171] A time cycle is performed according to the data of each sub-time period in the training data, and each time cycle includes the following steps:
[0172] Perform z action cycles, each of which determines the adjustment of a microservice instance. Each action cycle includes:
[0173] The actor network selects an action based on the current state and adds a noise term to increase exploration;
[0174] Execute the action. If the action fails, the reward is calculated according to the reward function and the current training cycle ends. At this time, the reward is a penalty term, r = r p , if the action is executed successfully, the reward is calculated according to the reward function, and the reward r = αT latency +βE cost +γD cost , and update the instance deployment N and resource remaining status RS;
[0175] Update request arrival rate Service delay Energy consumption And calculate the reward r i ;
[0176] After the z action cycles are completed, the new value is calculated 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 reviewer network;
[0179] Update the actor network by maximizing the value function via gradient ascent:
[0180]
[0181] According to the critic network and actor network, update the target actor network and target critic network:
[0182]
[0183] Specifically, the pseudo code for the training part of the microservice instance scaling algorithm based on reinforcement learning is as follows:
[0184] Input: epoch number M, soft update factor μ, reward discount factor μ, initial deployment
[0185]
[0186]
[0187]
[0188] The purpose of the reasoning part is to calculate the deployment strategy using the latest network parameters. Specifically, the microservice instance scaling algorithm solves the objective function according to the state input s and calculates the microservice scaling adjustment strategy.
[0189] In this embodiment, each of the preset time periods includes multiple continuous sub-time periods. At the beginning of a sub-time period, the microservice instance scaling algorithm calculates the microservice instance automatic scaling strategy for the next sub-time period based on the status data of each edge server in the server cluster in the previous sub-time periods.
[0190] The microservice instance scaling algorithm calculates the microservice instance automatic scaling strategy for the next sub-time period based on the status data of each edge server in the server cluster in the previous sub-time periods, including the following steps:
[0191] Import pre-trained actor and critic networks;
[0192] Get the request arrival rate of each edge server in the past few sub-time periods Service request latency on each edge server in the past few sub-time periods Energy consumption of each edge server in the past few sub-time periods The current microservice instance deployment N, the microservice instance deployment N(l-1) in the previous sub-time period, the remaining resources RS on the current server, and the current status is determined based on the acquired data;
[0193] Perform z action cycles, and calculate the adjustment of a microservice instance for each action. Each action and each action cycle includes:
[0194] The actor network selects an action based on the current state and may add a noise term To increase the exploratory nature, execute actions and update the microservice instance deployment N, the remaining resource situation RS, and obtain a new state;
[0195] Record the updated deployment of microservice instances;
[0196] After the loop is completed, the computing microservice instance automatic scaling strategy is output, and the computing microservice instance automatic scaling strategy includes the z actions selected in the z cycles.
[0197] Specifically, the pseudo code of the reasoning part of the microservice instance scaling algorithm based on reinforcement learning is as follows:
[0198] Input: Initial deployment
[0199] Output: Microservice deployment in the next time period l=1,2,3,…L
[0200] 1. Import the pre-trained actor network σ(s|θ σ )
[0201] 2. Import the pre-trained critic 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 delay T(G) and energy loss E(G)
[0205] 6. Combine the data of the current time period with the data of the previous time periods to obtain
[0206] 7. Get status s j
[0207] 8.for P=0,1,...z do
[0208] 9. Choose an action
[0209] 10. Perform action a j
[0210] 11. Update microservice instance deployment N and resource usage RS
[0211] 12. Get status s j+1
[0212] 13.j←j+1
[0213] 14.
[0214] In this embodiment, in the server cluster, the main server is the central agent, responsible for monitoring, calculation and decision-making; other edge servers in the server cluster are working agents, responsible for data collection and instruction execution. The data collected by the edge server 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 the data to the main server. The status data includes request arrival rate, service delay, energy loss, microservice instance deployment, resource usage, etc. Some of these data will be used for action decisions. The intelligent agent calculates the automatic scaling strategy of the microservice instance 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 intelligent agent's decision on the previous preset time period. The intelligent agent updates the network parameters of the microservice instance scaling algorithm based on these feedbacks.
[0216] In our algorithm, in order to avoid an overly large action space, we divide the entire instance adjustment process into multiple steps, and in each step the agent only calculates the adjustment of one instance. Once all instances have been adjusted, the environment will give rewards as feedback on the adjustment strategy. For example, suppose we limit the execution of z-step adjustments in each sub-time period, so that in each sub-time period, the agent will perform z-step actions. After performing z actions, the instance adjustment of the current sub-time period is completed. The present invention is an active method, and the instance adjustment of the current sub-time period is to respond to the request change of the next sub-time period.
[0217] In the microservice instance scaling algorithm based on reinforcement learning, the reinforcement learning reward consists of two parts. The first part is the penalty for each abnormal action. Abnormal actions include adding instances that exceed the server resource limit and removing instances that do not exist on the server. We denote it as r p , r p is a larger value; the second part is the optimization goal. At the end of each sub-time period, the edge server will complete the adjustment of the microservice instance according to the instructions of the intelligent agent, and then 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 microservice instance scaling algorithm based on reinforcement learning is:
[0219] r=-(r a +r p );
[0220] r a=αT latency +βE cost +γD cost ;
[0221] In the formula, r a is the service delay of the corresponding sub-time period; r p The penalty adjusted for failure, r p is a large positive number; reward r a =αT latency +βE cost +γD cost Indicates the quality of the adjustment strategy. Since the goal of reinforcement learning is to maximize the overall reward, r is set in each time period. a As a reward, it can guide the agent to achieve long-term optimization goals If the agent has not yet completed all instance adjustments, this reward will be set to zero.
[0222] In summary, the embodiment of the present invention provides an automatic scaling method for microservices based on edge servers, which comprehensively considers multi-objective long-term optimization of service latency, energy consumption and dynamic loss, and can cope with the environmental dynamics in edge computing. At the same time, the present invention provides an optimization solution algorithm based on deep reinforcement learning (DRL), which continuously updates the parameters of the intelligent agent neural network by interacting with the environment, ensures that the network parameters are updated in real time, and calculates the microservice deployment strategy with the latest network parameters.
[0223] According to the method described in the above embodiment, this embodiment will be further described from the perspective of an edge server-based microservice automatic scaling system. The system can be implemented as an independent entity or integrated in an electronic device, such as a terminal.
[0224] See also Figure 6 , Figure 6 1 is a schematic diagram of a structure of an edge server-based microservice automatic scaling system provided by an embodiment of the present invention, wherein the system includes:
[0225] A cluster building module, used to build a server cluster, wherein the server cluster includes a plurality of edge servers that are close to each other, and the plurality of edge servers communicate through a base station;
[0226] The scaling algorithm construction module is used to build a microservice instance scaling algorithm based on the A3C network. The objective function and constraints of the microservice instance scaling algorithm are constructed with the goal of minimizing service latency, energy consumption, and dynamic loss.
[0227] The reinforcement learning-based microservice instance scaling algorithm is deployed on a master server, which is an edge server in a server cluster. The edge servers in the server cluster communicate through a base station.
[0228] The objective function is:
[0229]
[0230] Where, T latency (l) is the total service response delay in sub-time period l; E cost (l) is the total energy consumption in sub-time period l; D cost (l) is 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 included in a preset time period;
[0231] The constraints of the microservice instance scaling algorithm are:
[0232]
[0233] In the formula, we use an undirected graph H(E,V) to represent the distribution of edge servers; 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 used to deploy an S i The computing resources required by the instance, S i .mem is used to deploy an S i Memory resources required by the instance; is deployed on edge server E in sub-time period l m S i Number of instances; is deployed on edge server E in sub-time period l n S i Number of instances; E m ·CPU is edge server E m The maximum computing resource constraint, E m .mem is server E m Maximum memory constraint; When S is the sub-time period l i Instance 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 S in sub-time period l i Instance on edge server E m The arrival rate on i,m (l) represents S in sub-time period l i Instance on edge server E m The service rate on.
[0237] In the objective function, the total service delay T latency The calculation formula of (l) is as follows:
[0238]
[0239] In the formula, The request in sub-time period l is on edge server E m Service response delay in is the number of nodes from edge server E in sub-time period l. m The arrival rate of the requests that arrive;
[0240] The service response delay for a request is the sum of the transmission delay and processing delay of the request. The calculation formula is as follows:
[0241]
[0242] In the formula, ∑T t (l) is the sum of the transmission delays of the requests; ∑T p (l) represents the sum of the processing delays of the requests;
[0243] We denote application requests as R = [R1, R2, …, R K ], for the request R in the sub-time period l k , request R k For deployment on edge server E m Microservices on S i Call deployed on edge server E n The microservice on calls microservice S j , then the request R k The transmission delay T t (l) and processing delay T p The calculation formula of (l) is as follows:
[0244]
[0245] In the formula, data i,j For deployment on edge server E mMicroservices on S i Call deployed on edge server E n The microservice on calls microservice S j The data size of V m,n represents the edge server E m With E n The transmission rate between For request R k The final execution delay of q For request R k The queuing delay; For edge server E m Microservices S i The average arrival rate of q is the length of the service queue;
[0246] In the objective function, the total energy consumption E cost The calculation formula of (l) is as follows:
[0247]
[0248] Where P m (l) is the edge server E in sub-time period l m Energy consumption, P startup is the edge server E in sub-time period l m Starting energy consumption; is the edge server E in sub-time period l m When the edge server E m When there is no instance in the edge server E m Energy consumption m is 0;
[0249] In the objective function, the dynamic loss D cost The calculation formula of (l) is as follows:
[0250]
[0251] Where c is the dynamic cost of creating or deleting an instance, which is a constant; The edge server E is deployed in the previous sub-time period (l-1). m S 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 is the service delay, r p The penalty adjusted for failure, r p is a large positive number.
[0256] A control module is used to control the automatic scaling adjustment of microservices in a server cluster through the microservice instance scaling algorithm. The control module includes a training module and a prediction module, wherein the training module is used to train the microservice instance scaling algorithm based on reinforcement learning at the beginning of each preset time period based on the status data of each edge server in the server cluster in the previous preset time period to update the network parameters of the microservice instance scaling algorithm; the status data includes: request arrival rate, service request latency, energy consumption, microservice instance deployment, and resource remaining status. The prediction module is used to calculate the microservice instance automatic scaling strategy at the beginning of a sub-time period according to the status data of each edge server in the server cluster in the previous sub-time periods.
[0257] Also, see Figure 7 , Figure 7 is a schematic diagram of a structure of an electronic device provided by an embodiment of the present invention, such as Figure 7 As shown, the electronic device includes a processor and a memory. The processor is electrically connected to the memory. 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, the steps in the above-mentioned microservice automatic scaling method based on the edge server are implemented.
[0258] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, which can be stored in a computer-readable storage medium and loaded and executed by a processor. To this end, an embodiment of the present invention provides a storage medium, on which a computer program is stored, and when the computer program is executed by the processor, the above-mentioned microservice automatic scaling method based on the edge server is implemented.
Claims
1. A microservice automatic scaling method based on edge servers, characterized in that: The following steps are involved: S1. Build a server cluster, wherein the server cluster includes a plurality of edge servers that are close to each other, and the plurality of edge servers communicate through a base station; S2. Construct a microservice instance scaling algorithm based on the A3C network, with the goal of minimizing service latency, energy consumption, and dynamic loss, and construct the objective function and constraints of the microservice instance scaling algorithm; S3. Automatically scaling the microservices of the server cluster is controlled by the microservice instance scaling algorithm.
2. According to claim 1, a microservice automatic scaling method based on edge server is characterized in that: In step S3, controlling the automatic scaling adjustment of microservices of the server cluster by the microservice instance scaling algorithm includes: 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 in the previous preset time period to update the network parameters of the microservice instance scaling algorithm; Each of the preset time periods includes a plurality of continuous sub-time periods. At the beginning of a sub-time period, the microservice instance scaling algorithm calculates the microservice instance automatic scaling strategy according to the status data of each edge server in the server cluster in the previous sub-time periods; The status data includes: request arrival rate, service request latency, energy consumption, microservice instance deployment, and resource remaining status.
3. According to the edge server-based microservice automatic scaling method of claim 2, it is characterized by: The microservice instance scaling algorithm is deployed on a master server, which is an edge server in a server cluster.
4. A microservice automatic scaling method based on edge servers according to claim 2 or 3, characterized in that: The objective function is: Where, T latency (l) is the total service response delay in sub-time period l; E cost (l) is the total energy consumption in sub-time period l; D cost (l) is 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 included in a preset time period; The constraints of the microservice instance scaling algorithm are: In the formula, we use an undirected graph H(E,V) to represent the distribution of edge servers; 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 used to deploy an S i The computing resources required by the instance, S i .mem is used to deploy an S i Memory resources required by the instance; is deployed on edge server E in sub-time period l m S i Number of instances; is deployed on edge server E in sub-time period l n S i Number of instances; E m ·CPU is edge server E m The maximum computing resource constraint, E m .mem is server E m Maximum memory constraint; When S is sub-time period l i Instance on edge server E m The load on max Indicates the load threshold; The load The calculation formula is as follows: In the formula, λ i,m (l) represents S in sub-time period l i Instance on edge server E m The arrival rate on i,m (l) represents S in sub-time period l i Instance on edge server E m The service rate on.
5. The method for automatically scaling microservices based on edge servers according to claim 4, characterized in that: In the objective function, the total service delay T latency The calculation formula of (l) is as follows: In the formula, The request in the sub-time period l is on the edge server E m Service response delay in is the number of nodes from edge server E in sub-time period l. m The arrival rate of the requests that arrive; The service response delay for a request is the sum of the transmission delay and processing delay of the request. The calculation formula is as follows: In the formula, ∑T t (l) is the sum of the transmission delays of the requests; ∑T p (l) represents the sum of the processing delays of the requests; We denote application requests as R = [R1, R2, …, R K ], for the request R in the sub-time period l k , request R k For deployment on edge server E m Microservices on S i Call deployed on edge server E n The microservice on calls microservice S j , then the request R k The transmission delay T t (l) and processing delay T p The calculation formula of (l) is as follows: In the formula, data i,j For deployment on edge server E m Microservices on S i Call deployed on edge server E n The microservice on calls microservice S j The data size of V m,n represents the edge server E m With E n The transmission rate between For request R k The final execution delay of q For request R k The queuing delay; For edge server E m Microservices S i The average arrival rate of q is the length of the service queue; In the objective function, the total energy consumption E cost The calculation formula of (l) is as follows: Where P m (l) is the edge server E in sub-time period l m Energy consumption, P startup is the edge server E in sub-time period l m Starting energy consumption; is the edge server E in sub-time period l m When the edge server E m When there is no instance in the edge server E m Energy consumption m is 0; In the objective function, the dynamic loss D cost The calculation formula of (l) is as follows: Where c is the dynamic cost of creating or deleting an instance, which is a constant; The edge server E is deployed in the previous sub-time period (l-1). m S i Number of instances.
6. The method for automatically scaling microservices based on edge servers according to claim 5, characterized in that: The reinforcement learning reward function r of the microservice instance scaling algorithm is: r=-(r a +r p ); r a =αT latency +βE cost +γD cost ; In the formula, r a is the service delay, r p The penalty adjusted for failure, r p is a large positive number.
7. The microservice automatic scaling method based on edge server according to claim 6 is characterized by: At the beginning of the first sub-time period in the preset time period, the microservice instance is deployed according to the following method; S301, arranging all requests in order; S302: For each segment of the request, the number of instances required by all microservices in the segment of the request is calculated, and the instances required by the segment of the request are deployed sequentially to the available edge servers using a greedy strategy with the goal of minimizing the distance between the edge servers where the instances are located.
8. A microservice automatic scaling system based on an edge server, comprising: A cluster building module, used to build a server cluster, wherein the server cluster includes a plurality of edge servers that are close to each other, and the plurality of edge servers communicate through a base station; The scaling algorithm construction module is used to build a microservice instance scaling algorithm based on the A3C network. The objective function and constraints of the microservice instance scaling algorithm are constructed with the goal of minimizing service latency, energy consumption, and dynamic loss. The control module is used to control the automatic scaling adjustment of microservices of the server cluster through the microservice instance scaling algorithm.
9. An electronic device, characterized in that: The electronic device comprises 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 according to 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 when the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 7 are implemented.
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
Heterogeneous multi-edge cloud collaborative micro-service deployment and routing joint optimization method and system
CN116915686A
Distributed power service providing method and distributed power service system
CN117713382A
Method for acquiring service caching strategy, electronic equipment and storage medium
CN118631897A