Micro-service joint deployment and capacity expansion and contraction method, device and system
By fitting the delay feature function of microservices and tolerance for computing resource use, combined with heuristic algorithms and iterative update process, the problems of insufficient accuracy of microservice deployment decisions and excessive resource consumption in the existing technology are solved, and efficient resource allocation and satisfaction of latency goals are achieved.
Patent Information
- Application Number
- CN202411763511.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-12-03
AI Technical Summary
The existing microservice deployment and scaling methods have limitations in modeling the relationship between latency and resource consumption. They do not consider the impact of vertical scaling and resource usage on microservice latency characteristics, resulting in insufficient accuracy of deployment decisions and excess resource consumption.
By fitting the delay feature function of microservices based on historical data, a heuristic algorithm is used to calculate the tolerance of microservices for resource use, a legitimate tolerance scheme is generated, and the resource usage is minimized through the iterative update process, the number and size of containers required for each microservice are calculated, and the scaling scheme is generated.
It improves the accuracy of microservice deployment decisions, reduces resource consumption, and achieves the effect of optimizing resource allocation while meeting latency goals.
Smart Images

Figure CN119621080A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of microservice deployment technology, and in particular to a method, device and system for joint deployment and scaling of microservices. Background Art
[0002] Microservice architecture is a commonly used software architecture in data centers. It decouples applications into independently deployable microservices, each of which performs its own functions and uses isolated resources. This architecture allows system administrators to adjust microservice resources independently based on load, rather than the entire application. Container technology is often used in microservice architecture because of its lightweight and isolation. Each microservice can be run through one or more containers, and container resources such as CPU, memory, and network can be configured independently.
[0003] SLO (Service Level Objective) defines the key attributes of an application, such as availability and latency. Latency SLO is often used as the basis for managing microservice resource algorithms. In order to cope with the dynamic load of the application, it is necessary to decide the deployment strategy of the container, that is, which server the container runs on and how to scale it up and down.
[0004] Existing microservice deployment and scaling methods usually collect microservice latency characteristics offline based on historical data, and allocate SLOs and make scaling decisions online. However, these methods have limitations in modeling the relationship between latency and resource consumption. They only consider horizontal scaling (changing the number of containers) but not vertical scaling (changing the resource configuration of a single container). They also ignore the impact of different node resource usage on microservice latency characteristics, which affects the accuracy of deployment decisions and results in unnecessary resource consumption. Summary of the invention
[0005] In view of this, the embodiments of the present invention provide a method, device and system for joint deployment and scaling of microservices to improve the problem in the prior art that the accuracy of deployment decisions is insufficient and more resource consumption is generated.
[0006] A first aspect of the present invention provides a method for joint deployment and scaling of microservices, the method comprising the following steps:
[0007] According to the historical data of the target application using the microservice architecture running in the computing node cluster, the relationship between the delay of each microservice of the target application and the workload, container size and resource usage of the computing node where each microservice is located is fitted to obtain the delay characteristic function of each microservice of the target application;
[0008] According to the resource usage of each computing node in the current computing node cluster and the workload of the target application, a heuristic algorithm is used based on the delay characteristic function, and the user's delay target for the target application is used as the limit to obtain the tolerance of each microservice of the target application for the resource usage of the computing node where it is located, and generate a tolerance plan;
[0009] Evaluate the feasibility of deploying each microservice of the target application to the computing node cluster according to the tolerance scheme; if all microservices of the target application are successfully deployed on the computing node cluster, and the available resources of the deployed computing nodes meet the tolerance of each microservice for the resource usage of the computing node where it is located, then the tolerance scheme is feasible, and the tolerance scheme is recorded as a legal tolerance scheme, and the deployment scheme corresponding to the tolerance scheme is recorded; otherwise, the tolerance scheme is not feasible, and the next tolerance scheme is re-obtained and evaluated;
[0010] Based on the delay characteristic function, the tolerance of each microservice in the legal tolerance scheme for the resource usage of the computing node where it is located, and the deployment scheme, the number and size of containers required for deploying each microservice are calculated to generate a container expansion and contraction plan with the goal of minimizing the resource usage of the target application;
[0011] According to the container expansion and contraction plan and the deployment plan, a new legal tolerance plan is generated according to the delay characteristic function using the heuristic algorithm; with the goal of minimizing the target application resource usage, the legal tolerance plan and the container expansion and contraction plan are iteratively updated until convergence or a preset number of iterations is reached;
[0012] The optimal deployment plan and the optimal container expansion and contraction plan are selected and applied to the computing power node cluster.
[0013] In some embodiments of the present invention, the feasibility of deploying each microservice of the target application to the computing power node cluster according to the tolerance scheme is evaluated, and the specific steps include:
[0014] Initialize the number of requests processed by each microservice on the node;
[0015] Arrange all microservices into the first queue in ascending order according to the tolerance of each microservice to the resource usage of the computing node where it is located;
[0016] Arrange all computing nodes in the computing node cluster into a second queue in descending order according to the available resources of the computing nodes;
[0017] Popping out the microservice with the smallest tolerance from the first queue in order, searching the second queue for a computing node whose available resources satisfy the tolerance of the microservice for the resource usage of the computing node where it is located; if there is a computing node that satisfies the tolerance of the microservice, deploying the microservice to the computing node; updating the available resources of the computing node, and inserting the computing node into the second queue again in order; the first queue continues to pop out microservices in order, searching and deploying them to computing nodes in the second queue that satisfy its tolerance, until the first queue is empty, and the tolerance is judged to be feasible;
[0018] If a computing node that meets the tolerance of the microservice cannot be found in the second queue, the computing node with the largest amount of available resources is obtained from the second queue, the microservice part is deployed to the computing node, the number of requests processed by the microservice on the computing node is updated, and the microservice is inserted into the first queue again in order; if the second queue is empty and a computing node that meets the tolerance of the microservice still cannot be found, the tolerance plan is judged to be infeasible.
[0019] In some embodiments of the present invention, the heuristic algorithm adopts a particle swarm optimization algorithm, an ant colony algorithm, a genetic algorithm or a simulated annealing algorithm.
[0020] In some embodiments of the present invention, based on the delay characteristic function and the tolerance of each microservice in the legal tolerance scheme for the resource usage of the computing node where it is located, the number of containers and the container size required for deploying each microservice are calculated with the goal of minimizing the resource usage of the target application, and the process includes:
[0021] The computing node resource usage in the delay characteristic function of the microservice is fixed as the tolerance of each microservice to the resource usage of the computing node where it is located; a nonlinear constrained optimization algorithm is used to minimize the resource usage of the target application, and the number and size of containers required to deploy each microservice are calculated.
[0022] In some embodiments of the present invention, the method of fitting the delay characteristic function of the target application includes: a neural network model, a support vector machine or a decision tree model.
[0023] A second aspect of the present invention provides a microservice joint deployment and scaling system, the system comprising:
[0024] A delay fitting module is used to fit the relationship between the delay of each microservice of the target application and the workload, container size and resource usage of the computing node where each microservice is located based on the historical data of the target application using the microservice architecture running in the computing node cluster, so as to obtain the delay characteristic function of each microservice of the target application;
[0025] A tolerance generation module is used to obtain the tolerance of each microservice of the target application to the resource usage of the computing node where it is located based on the delay characteristic function using a heuristic algorithm according to the resource usage of each computing node in the current computing node cluster and the workload of the target application, and to generate a tolerance plan based on the user's delay target for the target application; according to the container expansion and contraction plan and the deployment plan, use the heuristic algorithm to generate a new legal tolerance plan based on the delay characteristic function; with the goal of minimizing the resource usage of the target application, iteratively update the legal tolerance plan and the container expansion and contraction plan until convergence or reaching a preset number of iterations; select the optimal deployment plan and the optimal container expansion and contraction plan and apply them to the computing node cluster;
[0026] A virtual deployment module is used to evaluate the feasibility of deploying each microservice of the target application to the computing node cluster according to the tolerance scheme; if all microservices of the target application are successfully deployed on the computing node cluster, and the available resources of the deployed computing nodes meet the tolerance of each microservice for the use of resources of the computing node where it is located, then the tolerance scheme is feasible, and the deployment scheme corresponding to the tolerance scheme is recorded; otherwise, the tolerance scheme is not feasible, and the next tolerance scheme is re-obtained and evaluated;
[0027] The optimal SLO allocation module is used to calculate the number and size of containers required to deploy each microservice based on the delay characteristic function, the tolerance of each microservice in the legal tolerance scheme for the resource usage of its computing node, and the deployment scheme, with the goal of minimizing the resource usage of the target application, and generate a container expansion and contraction plan;
[0028] In some embodiments of the present invention, the system further comprises:
[0029] The monitoring and collection module is used to obtain historical data of the target application running in the computing node cluster using the microservice architecture;
[0030] A capacity expansion and contraction deployment module is used to deploy the optimal deployment plan and the optimal container capacity expansion and contraction plan to the computing power node cluster.
[0031] The third aspect of the present invention provides a microservice joint deployment and scaling device, including a processor, a memory, and a computer program stored in the memory, wherein the processor is used to execute the computer program, and when the computer program is executed, the device implements the steps of any of the methods described above.
[0032] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the above methods when executed by a processor.
[0033] A fifth aspect of the present invention provides a computer program product, comprising a computer program, which implements the steps of any of the above methods when executed by a processor.
[0034] The beneficial effects of the present invention are at least:
[0035] The present invention provides a method, device and system for joint deployment and scaling of microservices. The method comprises: fitting the relationship between the delay of each microservice of the target application and the workload, container size and resource usage of the computing node where each microservice is located based on the historical data of the target application operation, and obtaining the delay characteristic function of each microservice of the target application. Using a heuristic algorithm, under the delay target limit, according to the computing node resource usage and workload, the resource usage tolerance of each microservice is calculated, and a tolerance scheme is generated. The feasibility of successfully deploying the microservice on the computing node according to the tolerance scheme is evaluated. According to the feasible legal tolerance scheme, with the goal of minimizing resource usage, the number and size of containers required for each microservice are calculated, and a scaling scheme is generated. The tolerance and scaling scheme are iteratively updated using a heuristic algorithm until convergence or the maximum number of iterations is reached. The optimal deployment scheme and container scaling scheme are selected and applied to the computing node cluster. The present invention comprehensively considers the influence of container configuration, node status and decision side effects on microservice delay, proposes scaling and deployment decisions that meet application delay with minimum resource consumption, and provides a fine-grained scheme for deploying microservices and scaling schemes.
[0036] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention may be achieved and obtained by the structures specifically indicated in the specification and the accompanying drawings.
[0037] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of the present application, and do not constitute a limitation of the present invention. In the drawings:
[0039] Figure 1 The present invention is a flowchart of a method for jointly deploying and scaling microservices in accordance with an embodiment of the present invention.
[0040] Figure 2 This is a data flow diagram of the SLO allocation technology in another embodiment of the present invention.
[0041] Figure 3 This is an example diagram of microservice calling in another embodiment of the present invention.
[0042] Figure 4 This is a diagram of the microservice structure applied in another embodiment of the present invention.
[0043] Figure 5 This is a structural diagram of a microservice joint deployment and scaling system in another embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0045] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.
[0046] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.
[0047] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection with an intermediate.
[0048] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0049] Microservices is a software architecture style that designs applications as a series of small, independent services, each of which runs in its own process and communicates with each other through lightweight communication mechanisms. Each microservice can be independently deployed, expanded, and maintained.
[0050] Containers are a virtualization technology used to isolate applications and the runtime environments they depend on. Containers can package applications and their dependencies into a portable, self-contained unit, including application code, runtime environment, system tools, system libraries, etc. By packaging microservices into containers, services can be quickly deployed, expanded, and migrated. Container technology allows microservices to more flexibly choose technology stacks and deployment environments, improving the flexibility and scalability of the system.
[0051] An embodiment of the present invention provides a method, device and system for microservice deployment and scaling. The method for microservice joint deployment and scaling is as follows: Figure 1 As shown, the following steps S101 to S106 are included:
[0052] Step S101: Based on the historical data of the target application using the microservice architecture running in the computing node cluster, the relationship between the delay of each microservice of the target application and the workload, container size and resource usage of the computing node where each microservice is located is fitted to obtain the delay characteristic function of each microservice of the target application.
[0053] Step S102: According to the resource usage of each computing node in the current computing node cluster and the workload of the target application, a heuristic algorithm is used based on the delay characteristic function, and the user's delay target for the target application is used as the limit to obtain the tolerance of each microservice of the target application for the resource usage of the computing node where it is located, and generate a tolerance plan.
[0054] Step S103: Evaluate the feasibility of deploying each microservice of the target application to the computing node cluster according to the tolerance scheme. If all microservices of the target application are successfully deployed on the computing node cluster, and the available resources of the deployed computing nodes meet the tolerance of each microservice for the resource usage of the computing node where it is located, then the tolerance scheme is feasible, and the tolerance scheme is recorded as a legal tolerance scheme, and the deployment scheme corresponding to the tolerance scheme is recorded; otherwise, the tolerance scheme is not feasible, and the next tolerance scheme is obtained and evaluated.
[0055] Step S104: Based on the delay characteristic function, the tolerance of each microservice in the legal tolerance scheme for the resource usage of its computing node and the deployment plan, the goal is to minimize the resource usage of the target application, calculate the number and size of containers required to deploy each microservice, and generate a container expansion and contraction plan.
[0056] Step S105: Based on the container expansion and contraction plan and deployment plan, a new legal tolerance plan is generated according to the delay characteristic function using a heuristic algorithm. With the goal of minimizing the target application resource usage, the legal tolerance plan and container expansion and contraction plan are iteratively updated until convergence or the preset number of iterations is reached.
[0057] Step S106: Select the optimal deployment plan and the optimal container expansion and contraction plan and apply them to the computing node cluster.
[0058] The user's delay target for the target application is the delay SLO (Service Level Objective) of the target application.
[0059] The workload is the number of requests, which is expressed in RPS (Requests Per Second).
[0060] Among them, the delay characteristic function can be fitted by regression analysis or machine learning algorithm to fit the relationship between the delay and each variable.
[0061] In some embodiments, the feasibility of deploying each microservice of the target application to the computing node cluster according to the tolerance scheme is evaluated, and the specific steps include:
[0062] Initialize the number of requests that each microservice handles on the node.
[0063] Arrange all microservices into the first queue in ascending order according to each microservice's tolerance for the resource usage of the computing node where it is located.
[0064] Arrange all computing nodes in the computing node cluster into the second queue in descending order according to the available resources of the computing nodes.
[0065] The microservice with the smallest tolerance is popped out from the first queue in order, and a computing node whose available resources meet the tolerance of the microservice for the resource usage of its computing node is searched from the second queue; if there is a computing node that meets the tolerance of the microservice, the microservice is deployed to the computing node; the available resources of the computing node are updated, and the computing node is inserted into the second queue again in order; the first queue continues to pop out microservices in order, and searches and deploys them to computing nodes in the second queue that meet its tolerance, until the first queue is empty, and the tolerance is judged to be feasible.
[0066] If a computing node that meets the tolerance of the microservice cannot be found in the second queue, the computing node with the largest amount of available resources is obtained from the second queue, the microservice part is deployed to the computing node, the number of requests processed by the microservice on the computing node is updated, and the microservice is inserted into the first queue again in order; if the second queue is empty and a computing node that meets the tolerance of the microservice still cannot be found, the tolerance plan is judged to be infeasible.
[0067] In some embodiments, the heuristic algorithm uses a particle swarm optimization algorithm, an ant colony algorithm, a genetic algorithm, or a simulated annealing algorithm.
[0068] In some embodiments, based on the delay characteristic function and the tolerance of each microservice in the legal tolerance scheme for the resource usage of the computing node where it is located, the number of containers and the container size required for deploying each microservice are calculated with the goal of minimizing the resource usage of the target application, and the process includes:
[0069] The computing node resource usage in the delay characteristic function of the microservice is fixed as the tolerance of each microservice to the computing node resource usage. A nonlinear constrained optimization algorithm is used to minimize the target application resource usage, and the number and size of containers required to deploy each microservice are calculated.
[0070] In some embodiments, the method of fitting the delay characteristic function of the target application includes: a neural network model, a support vector machine, or a decision tree model.
[0071] The microservice joint deployment and scaling system proposed in this embodiment includes:
[0072] The delay fitting module is used to fit the relationship between the delay of each microservice of the target application and the workload, container size and resource usage of the computing node where each microservice is located based on the historical data of the target application using the microservice architecture running in the computing node cluster, so as to obtain the delay characteristic function of each microservice of the target application.
[0073] The tolerance generation module is used to obtain the tolerance of each microservice of the target application to the resource usage of its computing node based on the delay characteristic function, based on the resource usage of each computing node in the current computing node cluster and the workload of the target application, and generate a tolerance plan based on the user's delay target for the target application; based on the container scaling plan and deployment plan, a new legal tolerance plan is generated based on the delay characteristic function using a heuristic algorithm; with the goal of minimizing the resource usage of the target application, the legal tolerance plan and container scaling plan are iteratively updated until convergence or the preset number of iterations is reached; the optimal deployment plan and the optimal container scaling plan are selected and applied to the computing node cluster.
[0074] The virtual deployment module is used to evaluate the feasibility of deploying each microservice of the target application to the computing node cluster according to the tolerance plan; if all microservices of the target application are successfully deployed on the computing node cluster, and the available resources of the deployed computing nodes meet the tolerance of each microservice for the resource usage of its computing node, then the tolerance plan is feasible and the deployment plan corresponding to the tolerance plan is recorded; otherwise, the tolerance plan is not feasible, and the next tolerance plan is obtained again and evaluated.
[0075] The optimal SLO allocation module is used to solve the problem of minimizing the resource usage of the target application based on the latency characteristic function, the resource usage tolerance of each microservice in the legal tolerance scheme, and the deployment scheme of the computing node where it is located. It calculates the number and size of containers required to deploy each microservice and generates a container expansion and contraction plan.
[0076] In some embodiments, the system further comprises:
[0077] The monitoring and collection module is used to obtain historical data of the target application running in the computing node cluster using the microservice architecture.
[0078] The scaling deployment module is used to deploy the optimal deployment plan and the optimal container scaling plan to the computing node cluster.
[0079] Among them, the monitoring and collection module can collect historical data by collecting log records of the target application, calling the API interface of the target application, etc.
[0080] Among them, the expansion and contraction deployment module can realize the automatic deployment and expansion and contraction of containers through container orchestration tools (such as Kubernetes).
[0081] The microservice joint deployment and scaling device proposed in this embodiment includes a processor, a memory, and a computer program stored in the memory. The processor is used to execute the computer program. When the computer program is executed, the device implements the steps of any of the above methods.
[0082] Accordingly, this embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0083] Accordingly, this embodiment provides a computer program product, including a computer program, which implements the steps of any of the above methods when executed by a processor.
[0084] Another embodiment of the present invention provides a method for joint deployment and scaling of microservices, which comprehensively considers the impact of container configuration, node status, and decision side effects on microservice latency and proposes scaling and deployment decisions that meet application SLOs with minimal resource consumption to overcome the shortcomings of the prior art.
[0085] The SLO allocation technology in the prior art is to allocate the end-to-end SLO of the target application to the multiple microservices that make up the application. Each microservice allocates resources according to the assigned sub-SLO. This technology usually requires offline collection of the delay characteristics of each microservice based on the historical data of the target application running in the cluster, expressed as a function of the delay to the workload and other factors that directly affect the delay. Then, based on the delay characteristics and the current status of the cluster and the target application, the results of the SLO allocation and the final scaling and deployment decisions are obtained online. The whole process is as follows: Figure 2 shown.
[0086] Specifically, during the online operation of the existing SLO allocation algorithm, it is necessary to obtain the final application delay based on an arbitrary SLO allocation scheme. This process needs to be achieved by analyzing the microservice call relationship. For each microservice that makes up the application, its delay will be as close as possible to its assigned sub-SLO to reduce resource consumption. Therefore, the delay of each microservice after implementing a given SLO allocation scheme is regarded as its assigned sub-SLO in the scheme. Then the application delay is obtained based on the delay of the microservice. This process is usually completed by analyzing the microservice call graph of the application. The microservice call graph usually appears in the form of a directed acyclic graph (DAG), and different methods may adjust its structure as needed. The structure adopted in this method is Figure 3 Take 1 as an example. Each node in the graph represents a microservice, and the edge represents the calling relationship between microservices. For example, in the figure, microservice 1 only calls microservice 2, and microservice 2 calls the other 7 microservices. There are two situations of microservice calling: parallel and serial. Parallel microservice calls use arrows of the same color. As shown in the figure, microservices 3 to 6 are called in parallel by microservice 2, and after execution, microservice 2 calls microservices 9 to 11 in serial. According to the call graph, the delays of the microservices executed in serial are added, and the delays of the microservices executed in parallel are maximized to obtain the delay of the entire application. This process can obtain the delay of the application according to the given SLO allocation scheme.
[0087] by Figure 4 Taking the microservice structure as an example, the method and system for joint deployment and scaling of microservices are described. Figure 4 The application microservice structure shown is deployed to a cluster with five nodes with the same configuration. The application has been running in the cluster for a while, and there is enough data to fit its latency characteristics. Because other applications are running in the cluster, the initial resource usage of each node is different.
[0088] The structure diagram of the system is as follows Figure 5 As shown, the steps of the method include:
[0089] 1. The Latency Profiling module collects historical operating data of the target application's container from the node cluster offline, and fits the latency as a function of the load, container configuration, and current resource usage of the node where the container is located.
[0090] 2. The Tolerance Generation module obtains the latency characteristic function of each microservice of the target application from the Latency Profiling module;
[0091] 3. The Tolerance Generation module collects the resource usage of each node in the current cluster and the load of the target application in real time from the cluster, and then obtains the tolerance of each microservice of the target application to the maximum resource usage of its own node based on the PSO (Particle Swarm Optimization) algorithm (or other heuristic algorithms, such as ant colony algorithm, genetic algorithm, simulated annealing algorithm, etc.), that is, how many resources of this node are occupied at most (the tolerance of each microservice to the resources occupied by its node).
[0092] 4. The Virtual Deployment module obtains a tolerance solution from the Tolerance Generation module, and then tries to deploy each microservice on the cluster according to the solution to see if it is feasible. Figure 5 The Virtual Deployment module in the example shows two tolerance schemes. In the above scheme, microservices 1, 2, 3, and 4 have high tolerances, while microservice 5 has low tolerances, so the first four microservices are run together on one node, while microservice 5 is run on another node. Because all nodes can deploy and meet their tolerances, this tolerance scheme is legal. In the following scheme, microservice 1 has a very low tolerance, while the other microservices have high tolerances, so microservice 1 is deployed on one node to leave enough space for it. After deploying microservices 2, 3, and 4, it is found that there is not enough space to deploy microservice 5, so this tolerance scheme is illegal.
[0093] The specific process of deploying microservices in the Virtual Deployment module is as follows:
[0094] Step 1: For all microservices m∈[1,M] and nodes s∈[1,N], where M is the number of microservices and N is the number of nodes, let λ m,s =0,Λ m = Λ, where λ m,s is the number of requests processed by microservice m on node s, and Λ is the current RPS of the application.m Sort in ascending order and put them into priority queue Q1, where rr m is the minimum remaining resource of the node where the microservice m instance is located. s Sort in descending order and put them into priority queue Q2, where Rem s is the currently available resource of the node. According to Λ, the actual resource usage of each microservice is obtained. m =h m (Λ), h m (Λ) is the actual resource consumed by microservice m when the application RPS is Λ. Go to step 2;
[0095] Step 2: Pop rr from Q1 m The smallest microservice m, query from Q2 to satisfy Rem s -ru m ≥rr m In the node Rem s The smallest node s is popped up. Deploy microservice m to node s, let λ m,s =Λ m , Λ m = 0. Let Rem s =Rem s -ru m ,ru m = 0, insert node s into Q2 again and keep descending order, and go to step 3. If there is no such node, go to step 4;
[0096] Step 3: If Q1 is empty, the solution is legal and Virtual Deployment exits, otherwise return to step 2;
[0097] Step 4: Take Rem from Q2 s The largest node s, deploy part of microservice m to node s, let λ m,s =(Rem s -rr m ) / (Rem s -ru m )*Λ m , Λ m =Λ m -λ m,s . m =Rem s -rr m , Rem s = 0. Insert microservice m into Q1 again and keep it in ascending order, and return to step 3. If there is no such node, the solution is illegal and Virtual Deployment exits.
[0098] 5. If the tolerance plan is legal, the deployment plan is recorded and the Optimal SLO Assignment module is entered, otherwise it returns to the Tolerance Generation module to obtain the next plan. After entering the tolerance plan of the Optimal SLO Assignment module, the variable "resource usage of the node" in the application's delay characteristics is fixed as its tolerance, and then the SLSQP (Sequential Least Squares Quadratic Programming) algorithm or other algorithms for solving constrained nonlinear optimization problems are used to solve the problem with the goal of minimizing the overall resource usage of the application, and the number and size of each container are obtained.
[0099] By properly configuring the number and size of microservice containers, the system latency can meet user requirements while minimizing resource consumption and operating costs. The optimization process focuses on two aspects: one is to find the best container configuration to minimize resource usage, and the other is to ensure that this configuration can meet user requirements for latency.
[0100] The solution to the microservice latency optimization problem is to adjust the number and size of containers to minimize resource costs. The specific process is as follows:
[0101] The previously fitted delay function is a function of the load, container configuration, and current resource usage of the node where the container is located, denoted as f m,s (λ m ,θ m ,Rem s ′). Here λ m is the load of each container of microservice m, θ m is the container size of microservice m. Here Rem s ′ is the resource of node s after adopting the resource allocation scheme and deployment scheme, and Rem s It is the resource of the node when the application is not deployed, so the two are not the same. s ' is fixed to rr m , so that m,s It has nothing to do with s. r m is the number of containers of microservice m, that is, Make it entirely a function of the number and size of microservice containers.
[0102] Then solve according to the microservice structure in the embodiment:
[0103]
[0104] stg1(r1,θ1)+max(g2(r2,θ2)+g4(r4,θ4),g3(r3,θ3)+g5(r5,θ5))≤SLO;
[0105] Among them, SLO is the latency target specified by the user.
[0106] 6. The deployment plan, horizontal and vertical scaling results, and final resource consumption are returned from the Optimal SLOAssignment module to the Tolerance Generation module, which updates the state and generates a new tolerance plan based on the PSO algorithm to minimize resource consumption. It guides convergence or reaches the maximum number of iterations.
[0107] 7. The Tolerance Generation module selects the globally optimal deployment and scaling solutions and applies them to the cluster.
[0108] In summary, the present invention provides a method, device and system for joint deployment and scaling of microservices. The method includes: based on the historical data of the target application, fitting the relationship between the delay of each microservice of the target application and the workload, container size and resource usage of the computing node where each microservice is located, and obtaining the delay characteristic function of each microservice of the target application. Using a heuristic algorithm, under the delay target limit, according to the computing node resource usage and workload, the resource usage tolerance of each microservice is calculated, and a tolerance scheme is generated. The feasibility of successfully deploying the microservice on the computing node according to the tolerance scheme is evaluated. According to the feasible legal tolerance scheme, with the goal of minimizing resource usage, the number and size of containers required for each microservice are calculated, and a scaling scheme is generated. The tolerance and scaling scheme are iteratively updated using a heuristic algorithm until convergence or the maximum number of iterations is reached. The optimal deployment scheme and container scaling scheme are selected and applied to the computing node cluster. The present invention can comprehensively consider the impact of container configuration, computing node status and decision on the computing node resource usage status, and iterate the optimal container scaling scheme and microservice deployment decision with the goal of minimizing application resource consumption.
[0109] Corresponding to the above method, the present invention also provides an apparatus, which includes a computer device, the computer device includes a processor and a memory, the memory stores computer instructions, the processor is used to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the apparatus implements the steps of the method described above.
[0110] The embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned edge computing server deployment method are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0111] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.
[0112] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.
[0113] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.
[0114] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for joint deployment and scaling of microservices, characterized in that: The method comprises the following steps: According to the historical data of the target application using the microservice architecture running in the computing node cluster, the relationship between the delay of each microservice of the target application and the workload, container size and resource usage of the computing node where each microservice is located is fitted to obtain the delay characteristic function of each microservice of the target application; According to the resource usage of each computing node in the current computing node cluster and the workload of the target application, a heuristic algorithm is used based on the delay characteristic function, and the user's delay target for the target application is used as the limit to obtain the tolerance of each microservice of the target application for the resource usage of the computing node where it is located, and generate a tolerance plan; Evaluate the feasibility of deploying each microservice of the target application to the computing node cluster according to the tolerance scheme; if all microservices of the target application are successfully deployed on the computing node cluster, and the available resources of the deployed computing nodes meet the tolerance of each microservice for the resource usage of the computing node where it is located, then the tolerance scheme is feasible, and the tolerance scheme is recorded as a legal tolerance scheme, and the deployment scheme corresponding to the tolerance scheme is recorded; otherwise, the tolerance scheme is not feasible, and the next tolerance scheme is re-obtained and evaluated; Based on the delay characteristic function, the tolerance of each microservice in the legal tolerance scheme for the resource usage of the computing node where it is located, and the deployment scheme, the number and size of containers required for deploying each microservice are calculated to generate a container expansion and contraction plan with the goal of minimizing the resource usage of the target application; According to the container expansion and contraction plan and the deployment plan, a new legal tolerance plan is generated according to the delay characteristic function using the heuristic algorithm; with the goal of minimizing the target application resource usage, the legal tolerance plan and the container expansion and contraction plan are iteratively updated until convergence or a preset number of iterations is reached; The optimal deployment plan and the optimal container expansion and contraction plan are selected and applied to the computing power node cluster.
2. The method for joint deployment and expansion of microservices according to claim 1, characterized in that: Evaluate the feasibility of deploying each microservice of the target application to the computing power node cluster according to the tolerance scheme, and the specific steps include: Initialize the number of requests processed by each microservice on the node; Arrange all microservices into the first queue in ascending order according to the tolerance of each microservice to the resource usage of the computing node where it is located; Arrange all computing nodes in the computing node cluster into a second queue in descending order according to the available resources of the computing nodes; Popping out the microservice with the smallest tolerance from the first queue in order, searching the second queue for a computing node whose available resources satisfy the tolerance of the microservice for the resource usage of the computing node where it is located; if there is a computing node that satisfies the tolerance of the microservice, deploying the microservice to the computing node; updating the available resources of the computing node, and inserting the computing node into the second queue again in order; the first queue continues to pop out microservices in order, searching and deploying them to computing nodes in the second queue that satisfy its tolerance, until the first queue is empty, and the tolerance is judged to be feasible; If a computing node that meets the tolerance of the microservice cannot be found in the second queue, the computing node with the largest amount of available resources is obtained from the second queue, the microservice part is deployed to the computing node, the number of requests processed by the microservice on the computing node is updated, and the microservice is inserted into the first queue again in order; if the second queue is empty and a computing node that meets the tolerance of the microservice still cannot be found, the tolerance plan is judged to be infeasible.
3. The method for joint deployment and expansion of microservices according to claim 1, characterized in that: The heuristic algorithm adopts particle swarm optimization algorithm, ant colony algorithm, genetic algorithm or simulated annealing algorithm.
4. The method for joint deployment and expansion of microservices according to claim 1, characterized in that: Based on the delay characteristic function and the tolerance of each microservice in the legal tolerance scheme for the resource usage of the computing power node where it is located, the number of containers and the container size required for deploying each microservice are calculated with the goal of minimizing the resource usage of the target application, and the process includes: The computing node resource usage in the delay characteristic function of the microservice is fixed as the tolerance of each microservice to the resource usage of the computing node where it is located; a nonlinear constrained optimization algorithm is used to minimize the resource usage of the target application, and the number and size of containers required to deploy each microservice are calculated.
5. The method for joint deployment and expansion of microservices according to claim 1, characterized in that: Methods for fitting the delay characteristic function of the target application include: a neural network model, a support vector machine or a decision tree model.
6. A system for joint deployment and expansion of microservices, characterized in that: The system includes: A delay fitting module is used to fit the relationship between the delay of each microservice of the target application and the workload, container size and resource usage of the computing node where each microservice is located based on the historical data of the target application using the microservice architecture running in the computing node cluster, so as to obtain the delay characteristic function of each microservice of the target application; A tolerance generation module is used to obtain the tolerance of each microservice of the target application to the resource usage of the computing node where it is located based on the delay characteristic function using a heuristic algorithm according to the resource usage of each computing node in the current computing node cluster and the workload of the target application, and to generate a tolerance plan based on the user's delay target for the target application; according to the container expansion and contraction plan and the deployment plan, use the heuristic algorithm to generate a new legal tolerance plan based on the delay characteristic function; with the goal of minimizing the resource usage of the target application, iteratively update the legal tolerance plan and the container expansion and contraction plan until convergence or reaching a preset number of iterations; select the optimal deployment plan and the optimal container expansion and contraction plan and apply them to the computing node cluster; A virtual deployment module is used to evaluate the feasibility of deploying each microservice of the target application to the computing node cluster according to the tolerance scheme; if all microservices of the target application are successfully deployed on the computing node cluster, and the available resources of the deployed computing nodes meet the tolerance of each microservice for the use of resources of the computing node where it is located, then the tolerance scheme is feasible, and the deployment scheme corresponding to the tolerance scheme is recorded; otherwise, the tolerance scheme is not feasible, and the next tolerance scheme is re-obtained and evaluated; The optimal SLO allocation module is used to solve the problem of minimizing the resource usage of the target application based on the delay characteristic function, the tolerance of each microservice in the legal tolerance scheme for the resource usage of its computing node, and the deployment scheme, calculate the number and size of containers required to deploy each microservice, and generate a container expansion and contraction plan.
7. The system for joint deployment and expansion of microservices according to claim 6, characterized in that: The system also includes: The monitoring and collection module is used to obtain historical data of the target application running in the computing node cluster using the microservice architecture; A capacity expansion and contraction deployment module is used to deploy the optimal deployment plan and the optimal container capacity expansion and contraction plan to the computing power node cluster.
8. A device for joint deployment and expansion of microservices, comprising a processor, a memory, and a computer program stored in the memory, characterized in that: The processor is used to execute the computer program. When the computer program is executed, the device implements the steps of the method according to any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Online application dynamic capacity expansion and shrinkage method based on micro-service call dependence perception
CN112199150A
Micro-service dynamic scaling and migration method and device
CN112988398A
Micro-service elastic scaling scheduling method and system oriented to time delay and resource utilization rate
CN116980316A
Dynamic capacity expansion and contraction method and device for distributed computing power network service and storage medium
CN117527814A
Resource management method and device, equipment and storage medium
CN117785457A
Cited By
Micro-service and low-code platform application autonomous extension method
CN121233339A
Micro-service and low-code platform application autonomous expansion method
CN121233339B
