A Method and System for Optimizing Medium-Performance Resource Costs in a Microservices Architecture
By identifying the critical paths in the microservice call link and using a multi-objective tuning algorithm to optimize the configuration parameters of the microservice system, the problem of no multi-objective optimization and high-dimensional configuration space in the existing technology is solved, and the coordinated optimization of performance and cost is achieved, the overall performance of the microservice system is improved and the holding cost is reduced.
Patent Information
- Application Number
- CN202310002221.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-03
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2043-01-03
AI Technical Summary
The existing technology has not carried out multi-objective optimization of performance indicators and cost overhead, has not coordinated the microservice resource configuration parameters and the microservice own software parameters, and has not properly reduced the dimensionality of the high-dimensional parameter configuration space.
By identifying the key paths in the microservice call link, combining multi-objective tuning algorithms such as genetic algorithms, dynamic dimension search algorithms, particle swarm optimization algorithms, and Bayesian optimization algorithms, new configuration solutions are generated and applied in the microservice system to optimize the configuration parameters of key services and reduce the high-dimensional configuration space.
Multi-objective optimization is achieved, and the trade-offs between multiple goals are correctly captured, which avoids the negative impact caused by over-allocating resources, improves the overall performance of the microservice system and reduces holding costs.
Smart Images

Figure CN116149855B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of microservices, and particularly to a method and system for optimizing the cost of performance resources under a microservice architecture. Background Art
[0002] With the development of microservice technology, the concept of microservices has long been deeply rooted in people's minds, and more and more companies have started to use microservice architectures to develop business applications. A research report by O'Reilly in 2020 shows that 77% of users have already used the development mode of microservice architectures, and 92% of them have obtained successful experiences.
[0003] Containers are excellent examples of microservice architectures. Modern cloud-native applications are usually built as microservices using containers. With the good isolation and resource allocation characteristics of containers, corresponding resources can be allocated to each service to meet its performance requirements. With the increasing popularity of cloud infrastructure, developers are more inclined to deploy microservice-based applications on the cloud to take advantage of the elasticity of cloud infrastructure.
[0004] The existing invention patent application document "A Method for Optimizing Microservice Resource Configuration Parameters of a Power Trading Platform" with publication number CN114924887A includes: obtaining real-time network operation parameter data, platform system operation parameter data, and microservice performance parameter data, respectively constructing a network configuration vector, a system perception vector, and a microservice performance observation vector, and inputting them into a pre-trained sequence-to-sequence model seq2seq for calculation and inference; determining optimized microservice resource configuration parameters according to the output of the seq2seq model, and then performing microservice resource parameter configuration on the power trading platform. The training samples of the seq2seq model are continuous time series data of platform processing performance vectors with known microservice resource configuration vectors, and the microservice resource configuration parameters include the number of CPU cores, memory size, bandwidth, and the number of instances. In the aforementioned existing solution, although public cloud products can be considered to have infinite resources, the deployment of microservice applications in the real world is usually limited by cost overhead. How to appropriately allocate limited resources (such as CPU usage time, memory capacity, the number of microservice replicas) to microservices to meet specific performance goals is an important research issue in the field of microservices.
[0005] Optimizing resource allocation while ensuring end-to-end service quality is a very important topic for both cloud service providers and users. From the perspective of cloud service providers, it is related to company profits and product reputation. From the perspective of users, optimizing resource allocation is related to the holding cost of infrastructure and service performance (such as latency). The existing invention patent application document "Resource Allocation Method for Cost Optimization of Microservices in the Cloud Based on L-ACO" with publication number CN111913800A includes: allocating the completion service deadline of the entire composite service to each task, calculating the probability upward rank of each task to form a sub-deadline; using the probability upward rank as the heuristic information in the ant colony for iterative calculation, and dynamically updating the pheromone weight, heuristic information weight, and pheromone evaporation rate during the iterative calculation process, and updating the pheromone trail according to the local optimal solution during the iterative process; according to the sub-deadline, successively select the resource configuration that meets its sub-deadline for the executor of each task, that is, the service instance, to find the global optimal solution for cost optimization. A corresponding trade-off needs to be made according to the situation between the holding cost and service performance. In the aforementioned prior art, by reducing the resource allocation to reduce the holding cost, the microservice response latency may increase. Since ensuring service performance usually has a higher priority than reducing the holding cost, a common approach is to over-allocate resources to ensure service performance. This method allocates resources according to the resource quantity required at peak load, resulting in underutilization of resources most of the time, which has a negative impact on the holding cost.
[0006] In addition, the following performance problems also exist in the existing tuning technical solutions:
[0007] (1) Multi-objective optimization problem:
[0008] For the optimization problem in the microservice scenario, most current solutions are to perform single-objective optimization with performance as the optimization goal under the premise of meeting the preset holding cost constraint. Or formalize multiple optimization goals such as performance and cost as performance / cost, and then optimize through a single-objective optimization algorithm. However, this single-objective optimization method ignores the inherent competition relationship between multiple goals, making it difficult to correctly capture the trade-off between multiple goals. As a result, radical exploration behaviors may occur during the optimization process, leading to suboptimal optimization results. There is a trade-off between the holding cost and performance indicators that requires multi-objective optimization, but multi-objective optimization is not carried out in the prior art.
[0009] (2) Co-optimization problem of software parameters and resource parameters:
[0010] The existing approach aims to reduce costs and improve efficiency by adjusting the machine resources occupied by microservice containers and the number of replicas. However, this optimization strategy does not consider the software deployed within the microservices themselves. In a microservices architecture, one or more database software (such as Redis, Mongodb, etc.) are usually accessed to store data, and Nginx may be deployed as the service front-end for traffic governance. There are a large number of adjustable parameters in these software, and optimizing the software parameters also plays a crucial role in reducing costs and improving efficiency for the overall microservices system. In addition, there is a dependency between the adjustment of these software parameters and the resources of the service containers. The optimal software parameter configuration changes with the size of the resources allocated to the containers. For example, Nginx sets the number of worker processes used to handle requests through the worker_processes parameter, and the optimal configuration of this parameter needs to jointly consider the CPU resources allocated to the container. Therefore, it is necessary to co-optimize the software parameters and resource parameters. In the prior art, there is no co-optimization of the resource configuration parameters of microservices (such as the number of CPU cores, memory size, number of service replicas) and the software parameters of the microservices themselves (such as the configuration parameters of Redis, Mongodb, Nginx).
[0011] (3) High-dimensional configuration space problem:
[0012] Under the microservices architecture, there may be dozens to hundreds of microservices. Each microservice has various types of resource configuration parameters that can be adjusted, such as the number of CPU cores, the number of service replicas, memory size, etc. Suppose there are currently n microservices, and each microservice has m resource configuration parameters, then the parameter search space in the microservices system optimization process is m n ^n. It can be seen that the parameter search space grows exponentially with the number of microservices. At the same time, the software parameters in the microservices system also affect the system optimization effect. It is necessary to jointly consider the resource configuration parameters and software configuration parameters, which further increases the parameter search space. Therefore, a reasonable method needs to be adopted for dimensionality reduction processing to solve the problem of the high-dimensional search space. However, in the prior art, there is no good dimensionality reduction processing for the high-dimensional parameter configuration space.
[0013] In summary, the prior art has the technical problems of not performing multi-objective optimization of performance indicators and cost overhead, not co-optimizing the microservice resource configuration parameters and the microservice's own software parameters, and not having good dimensionality reduction processing for the high-dimensional parameter configuration space. Summary of the Invention
[0014] The technical problem to be solved by the present invention is how to solve the technical problems in the prior art of not performing multi-objective optimization of performance indicators and cost overhead, not co-optimizing the microservice resource configuration parameters and the microservice's own software parameters, and not having good dimensionality reduction processing for the high-dimensional parameter configuration space.
[0015] The present invention solves the above technical problems by adopting the following technical solutions: A method for optimizing the cost of medium-performance resources in a microservices architecture includes:
[0016] S1. For the microservice call chain and service metrics, identify and obtain the critical path in the request chain, and optimize the configuration parameters of the critical services accordingly;
[0017] S2. Initialize the configuration parameters and run the microservices system;
[0018] S3. For the microservices system, conduct a stress test and collect the performance metrics of the stress test system. Step S3 includes:
[0019] S31. Conduct a stress test on the running microservices system to obtain the performance metrics of the stress test system;
[0020] S32. When the number of sent network requests reaches the preset upper limit threshold, request the microservice call chain to cover the microservices in the microservices system;
[0021] S33. Process the resource cost overhead of the current configuration scheme of the microservices system;
[0022] S4. Use a multi-objective optimization algorithm to generate a new configuration scheme and apply the change to the microservices system. Among them, the multi-objective optimization algorithm includes: genetic algorithm, dynamic dimension search algorithm, particle swarm optimization algorithm, Bayesian optimization algorithm. Step S4 includes:
[0023] S41. Use the genetic algorithm to imitate natural selection and select a subset of candidate solutions according to the preset objective function value;
[0024] S42. Perform mutation operations and crossover operations, randomly change specific parameter configurations and combined candidate solution configurations, and generate new candidate solutions accordingly. Among them, the genetic algorithm includes: NSGA-II algorithm;
[0025] S43. Take the current configuration scheme as the input data of the NSGA-II algorithm. Under this configuration scheme, take the performance metrics of the stress test system and the cost overhead as the objective function;
[0026] S44. Generate a new configuration scheme according to the configuration scheme and the objective function;
[0027] S45. Apply the new configuration scheme to the microservices system to change the preset application to the microservices system and make the microservices system run under the new configuration scheme;
[0028] S5. Loop through steps S3 and S4 until the number of loops reaches the preset repetition threshold, and apply the current optimal configuration to the microservices system as the subsequent execution configuration scheme.
[0029] The present invention adopts a multi-objective optimization method to obtain a Pareto-optimal configuration solution, which solves the defect that the single-objective optimization method in the prior art ignores the competition relationship between multiple objectives. The present invention can correctly capture the trade-off between multiple objectives, avoid the over-aggressive exploration behavior during the optimization process, and can obtain an optimized optimization result, solving the multi-objective optimization problem. At the same time, it avoids the negative impact of the holding cost caused by the resource over-allocation guarantee method in the traditional solution.
[0030] The tuning strategy adopted by the present invention considers the resource configuration parameters of the microservices themselves and the adjustable parameters widely existing in the software where the microservices are deployed, which is beneficial to reducing costs and increasing efficiency for the overall microservice system.
[0031] In a more specific technical solution, step S1 includes:
[0032] S11. Regarding the microservices on the critical path as critical services;
[0033] S12. Tuning the configuration parameters of the critical services.
[0034] In a more specific technical solution, in step S12, by tuning the configuration parameters, the search space of the configuration parameters of the critical services is reduced.
[0035] The present invention comprehensively deals with the exponential growth of the parameter search space with the number of microservices and the influence of the software parameters in the microservice system on the tuning operation, jointly considers the resource configuration parameters and the software configuration parameters, and for the high-dimensional configuration space brought by the joint consideration, through dimensionality reduction processing, the parameter search space is reduced, solving the problem of the high-dimensional search space.
[0036] In a more specific technical solution, in step S2, by obtaining user information, the configuration parameters of the critical services are jointly optimized.
[0037] The present invention combines the perspectives of cloud service providers and users to obtain user information, and shows that optimizing resource allocation is related to the holding cost of the infrastructure and service performance, improving the parameter tuning effect of the microservice system.
[0038] In a more specific technical solution, in step S2, the configuration parameters include: the hardware resource configuration parameters of the microservice system and the software configuration parameters of the microservice system.
[0039] In a more specific technical solution, for the critical services, the hardware resource configuration parameters and the software configuration parameters are set to control the operation of the microservice system of the critical services.
[0040] In a more specific technical solution, software configuration parameters of a preset software are obtained, where the preset software includes: Redis, Mongodb, and Nginx.
[0041] In view of the characteristic that there is a dependency between the adjustment of software parameters and service container resources, the present invention jointly considers the optimal configuration of parameters including Nginx, etc., and takes into account the CPU resources, memory, and the number of service replicas allocated to the container. The present invention solves the problem of collaborative optimization of software parameters and resource parameters.
[0042] In a more specific technical solution, step S32 further includes:
[0043] S321: Invoke each microservice with different call times, and collect the performance metrics of the stress testing system;
[0044] S322: When there is a delay in the microservice request link, request the number of requests processed per second with the same call times.
[0045] In a more specific technical solution, in step S33, the cost includes: the cost generated by the usage of hardware resources.
[0046] In a more specific technical solution, a performance resource cost optimization system under a microservice architecture includes:
[0047] A key service identification module, which is used to identify and obtain the critical path in the request link based on the microservice call link and service metrics, and optimize the configuration parameters of the key service accordingly;
[0048] A parameter initialization and microsystem operation module, which is used to initialize the configuration parameters and run the microservice system. The parameter initialization and microsystem operation module is connected to the key service identification module;
[0049] A testing and duty collection module, which is used to perform stress testing on the microservice system and collect the performance metrics of the stress testing system. The testing and duty collection module is connected to the parameter initialization and microsystem operation module. The testing and duty collection module includes:
[0050] A stress testing module, which is used to perform stress testing on the running microservice system to obtain the performance metrics of the stress testing system;
[0051] A link coverage module, which is used to request the microservice call link to cover the microservices in the microservice system when the number of sent network requests reaches the preset upper limit threshold. The link coverage module is connected to the stress testing module;
[0052] A cost acquisition module, which is used to process the resource cost of the current configuration scheme of the microservice system. The cost acquisition module is connected to the link coverage module;
[0053] The multi-objective optimization module is used to generate new configuration solutions using multi-objective optimization algorithms and apply and change them to the microservice system. Among them, the multi-objective optimization algorithms include: dynamic dimension search algorithm, particle swarm optimization algorithm, Bayesian optimization algorithm, and genetic algorithm. The multi-objective optimization module is connected to the test and duty collection module. The multi-objective optimization module includes:
[0054] The solution subset selection module is used to imitate natural selection using the genetic algorithm and select a candidate solution subset according to the preset objective function value;
[0055] The candidate solution generation module is used to perform mutation operations and crossover operations, randomly change specific parameter configurations and combine candidate solution configurations, and generate new candidate solutions accordingly. Among them, the genetic algorithm includes: NSGA-II algorithm. The candidate solution generation module is connected to the solution subset selection module;
[0056] The objective function setting module is used to use the current configuration solution as the input data of the NSGA-II algorithm. Under this configuration solution, the performance indicators and cost of the stress testing system are used as the objective function. The objective function setting module is connected to the candidate solution generation module;
[0057] The new solution generation module is used to generate a new configuration solution according to the configuration solution and the objective function. The new solution generation module is connected to the objective function setting module;
[0058] The application update and operation module is used to apply the new configuration solution to the microservice system to change the preset application to the microservice system and make the microservice system run under the new configuration solution. The application update and operation module is connected to the new solution generation module;
[0059] The subsequent execution module is used to repeatedly execute stress testing, collect system performance indicators, generate new configuration solutions, and change the application to the microservice system until the number of repetitions reaches the preset repetition threshold. Then, apply the current optimal configuration to the microservice system as the subsequent execution configuration solution. The subsequent execution module is connected to the multi-objective optimization module.
[0060] The present invention has the following advantages compared with the prior art: The present invention adopts a multi-objective optimization method to obtain the Pareto optimal configuration solution, solves the defect that the single-objective optimization method in the prior art ignores the competition relationship between multiple objectives, can correctly capture the trade-off between multiple objectives, avoids the radical exploration behavior in the optimization process, can obtain optimized optimization results, solves the multi-objective optimization problem, and at the same time avoids the negative impact of the holding cost caused by the over-allocation of resources in the traditional solution.
[0061] The optimization strategy adopted by the present invention takes into account the resource configuration parameters of microservices themselves and the adjustable parameters widely existing in the software where microservices are deployed, which is beneficial to reducing costs and increasing efficiency for the overall microservice system.
[0062] The present invention comprehensively processes the exponential growth of the parameter search space with the number of microservices and the influence of software parameters in the microservice system on the optimization operation, jointly considers the resource configuration parameters and software configuration parameters, and reduces the parameter search space through dimensionality reduction processing for the high-dimensional configuration space brought about by the joint consideration, thus solving the problem of the high-dimensional search space.
[0063] The present invention combines perspectives from cloud service providers and users to obtain user information, and shows that optimizing resource allocation is related to the holding cost of infrastructure and service performance, thereby improving the parameter tuning effect of the microservice system.
[0064] In view of the characteristic that there is a dependence between the adjustment of software parameters and the resources of service containers, the present invention jointly considers the optimal configuration of parameters including Nginx, etc., and takes into account the CPU resources, memory, and the number of microservice replicas allocated to the containers. The present invention solves the problem of collaborative optimization of software parameters and resource parameters.
[0065] The present invention solves the technical problems in the prior art, such as the lack of multi-objective optimization of performance indicators and cost overhead, the lack of collaborative tuning of microservice resource configuration parameters and microservice own software parameters, and the failure to perform dimensionality reduction processing on the high-dimensional parameter configuration space well. Description of the Drawings
[0066] Figure 1 It is a schematic diagram of the basic steps of a method for optimizing performance resource costs in a microservice architecture according to Embodiment 1 of the present invention;
[0067] Figure 2 It is a schematic diagram of the steps for optimizing resource costs according to Embodiment 2 of the present invention. Detailed Embodiments
[0068] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are some, rather than all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0069] Embodiment 1
[0070] As Figure 1 shown, a method for optimizing performance resource costs in a microservice architecture provided by the present invention includes the following basic steps:
[0071] S1. Identification of key services in the microservice system;
[0072] The dependencies between microservices are complex. Usually, a complete application is formed through complex RPC requests among numerous microservices. The relationship between services is no longer a simple hierarchical relationship but a complex network structure. Before a request is fully processed, it may pass through several microservices. Therefore, when performance issues occur, it is difficult to identify from a macroscopic perspective which potential microservices have an impact.
[0073] In this embodiment, the critical path is the call link that plays a decisive role in the system performance metrics in the request link. By optimizing the microservices on the critical path, the overall performance of the microservice system can be significantly improved. At the same time, since only the microservices on the critical path are optimized, the purpose of reducing the search space of configuration parameters is also achieved. In this embodiment, first, the critical path is identified. By analyzing the microservice call link and service metrics, the critical path is identified, and the services on this path are regarded as key services and the configuration parameters are tuned in subsequent steps. In this embodiment, the service metrics include but are not limited to: such as the number of request failures, the number of calls, and the call latency.
[0074] S2. Configure the initial parameters of the key services and start the microservice system;
[0075] The configuration optimization tools provided by cloud computing providers achieve the purpose of performance optimization or cost optimization by adjusting the hardware resource parameters used by the microservice system. Since the specific software running on the microservice system deployed by users is unknown to cloud computing providers, it is difficult for the configuration optimization tools provided by cloud computing providers to further optimize by adjusting the application software parameters (such as Redis, Mongodb, Nginx, etc.) in the microservice system.
[0076] In this embodiment, the configuration optimization is considered jointly from the user's perspective for the hardware resource configuration parameters and software configuration parameters in the microservice system. Therefore, step S2 will set the officially recommended hardware resource configuration parameters and software configuration parameters for the key services extracted in the first step and run the microservice system with this configuration.
[0077] S3. Conduct load testing and collect system performance metrics;
[0078] In this embodiment, a stress test is performed on the running microservice system, such as sending a large number of network requests. The call chains generated by the requests should cover as many microservices in the system as possible, but the number of calls to each microservice does not have to be the same and can have a focus. System performance metrics during the stress test are collected. In this embodiment, the system performance metrics include but are not limited to: service request link latency, number of requests processed per second, etc. Finally, it is necessary to calculate the resource cost overhead brought by the current microservice system configuration scheme, that is, the cost generated by the usage of hardware resources.
[0079] S4. Check whether the optimization effect reaches the expected level or the number of iterations reaches the upper limit;
[0080] S5. Use a multi-objective optimization algorithm to generate a new configuration scheme and apply it;
[0081] In this embodiment, the genetic algorithm mimics natural selection. First, a subset of candidate solutions is selected based on the objective function value, and then the configurations of some parameters are randomly changed (mutation) and the configurations of the candidate solutions are combined (crossover) to generate new candidate solutions. NSGA-II is one of the most popular multi-objective genetic algorithms currently. It reduces the complexity of the non-dominated sorting genetic algorithm, has the advantages of fast running speed and good convergence of the solution set, and has become the benchmark for the performance of other multi-objective optimization algorithms.
[0082] Take the current configuration scheme as the input of NSGA-II. The corresponding performance metrics and resource costs collected in step S3 under this configuration scheme are used as the objective function to generate a new configuration scheme and apply it to the microservice system, so that the microservice system runs under the newly generated configuration scheme.
[0083] S6. Apply the finally generated optimal configuration as the operating parameters of the microservice system.
[0084] In this embodiment, repeat step S3 and step S4 until the preset repetition times threshold, and apply the currently optimal configuration to the system as the subsequent execution configuration scheme.
[0085] Embodiment 2
[0086] A method for optimizing performance and resource costs in a microservice architecture provided by the present invention may also adopt the following steps:
[0087] S1'. Select a few services that have the greatest impact on the overall performance of the microservice system as the target services for subsequent configuration parameter optimization, thereby reducing the configuration space;
[0088] In this embodiment, taking the services on the critical path as critical services is an optional method, not the only one. The purpose of this step is to select a few services that have the greatest impact on the overall performance of the microservice system as the target services for subsequent optimization of configuration parameters. In this way, the purpose of reducing the configuration space is achieved. In addition, there are other optional methods, such as selecting critical services through domain experts, or analyzing them in combination with root cause localization algorithms, etc.
[0089] S2’. The configuration parameters can also be initialized by being set by domain experts or generated randomly.
[0090] S3’. Generate system performance metrics in a specific way;
[0091] In this embodiment, the specific ways include but are not limited to: extracting historical data and generating system performance metrics in real time under real load. The system performance metrics can be obtained by means other than stress testing, such as extracting historical data or generating them in real time under real load. The system performance metrics and cost overhead are used as the objective function of the configuration parameter tuning algorithm in the subsequent steps. Therefore, parameters other than the service request link delay and the number of requests processed per second can be selected according to the specific scenario.
[0092] S4’. Use a specific optimization algorithm to generate a new configuration plan and apply the change to the microservice system;
[0093] In this embodiment, the specific tuning objectives can be switched according to the scenario, and there are also other optional solutions for the multi-objective tuning algorithm, such as the dynamic dimension search algorithm, the particle swarm optimization algorithm, the Bayesian optimization algorithm, etc. The multi-objective optimization algorithm can select one or more combinations according to the scenario.
[0094] S5’. When the repetition number threshold is not reached, if the current configuration plan has achieved the ideal effect or the tuning objective has converged, end the tuning in advance.
[0095] In summary, the present invention uses a multi-objective optimization method to obtain the Pareto-optimal configuration plan, solves the defect of the single-objective optimization method in the prior art that ignores the competition relationship between multiple objectives. The present invention can correctly capture the trade-off between multiple objectives, avoid the radical exploration behavior in the optimization process, and can obtain optimized optimization results, solve the multi-objective optimization problem, and at the same time avoid the negative impact of the holding cost caused by the over-allocation of resources guarantee method in the traditional solution.
[0096] The tuning strategy adopted by the present invention considers the resource configuration parameters of the microservice itself and the adjustable parameters widely existing in the software where the microservice is deployed. It is beneficial to reduce costs and increase efficiency for the overall microservice system.
[0097] In the present invention, the comprehensive processing parameter search space grows exponentially with the number of microservices, and considering the impact of software parameters in the microservice system on the tuning operation, the resource configuration parameters and software configuration parameters are jointly considered. For the high-dimensional configuration space brought about by the joint consideration, through dimensionality reduction processing, the parameter search space is reduced, and the problem of the high-dimensional search space is solved.
[0098] From the perspectives of cloud service providers and users, the present invention obtains user information to show that optimizing resource allocation is related to the holding cost and service performance of the infrastructure, and improves the parameter tuning effect of the microservice system.
[0099] In view of the fact that there is a dependence between the adjustment of software parameters and the resources of service containers, the present invention jointly considers the optimal configuration of parameters including Nginx, etc., and takes into account the CPU resources, memory, and the number of microservice replicas allocated to the containers. The present invention solves the problem of collaborative optimization of software parameters and resource parameters.
[0100] The present invention solves the technical problems in the prior art, such as the lack of multi-objective optimization of performance indicators and cost overhead, the lack of collaborative tuning of microservice resource configuration parameters and the software parameters of microservices themselves, and the failure to perform dimensionality reduction processing on the high-dimensional parameter configuration space well.
[0101] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for optimizing the cost of medium-performance resources under a microservices architecture, characterized in that, The method includes: S1. For the microservice call chain and service metrics, identify and obtain the critical path in the request chain, and optimize the configuration parameters of the critical services accordingly; S2. Initialize the configuration parameters and run the microservice system; S3. Conduct a stress test on the microservice system and collect the performance metrics of the stress test system. Step S3 includes: S31. Conduct a stress test on the running microservice system to obtain the performance metrics of the stress test system; S32. When the number of sent network requests reaches the preset upper limit threshold, request the microservice call chain to cover the microservices in the microservice system; S33. Process the resource cost overhead of the current configuration scheme of the microservice system; S4. Use a multi-objective optimization algorithm to generate a new configuration scheme and apply it to the microservice system. Among them, the multi-objective optimization algorithm includes: genetic algorithm, dynamic dimension search algorithm, particle swarm optimization algorithm, Bayesian optimization algorithm. Step S4 includes: S41. Use the genetic algorithm to select a subset of candidate solutions according to the preset objective function value; S42. Perform mutation operations and crossover operations, randomly change specific parameter configurations and combined candidate solution configurations to generate new candidate solutions. Among them, the genetic algorithm includes: NSGA-II algorithm; S43. Use the current configuration scheme as the input data of the NSGA-II algorithm. Under this configuration scheme, use the performance metrics of the stress test system and the cost overhead as the objective function; S44. Generate a new configuration scheme according to the configuration scheme and the objective function; S45. Apply the new configuration scheme to the microservice system to change the preset application to the microservice system and make the microservice system run under the new configuration scheme; S5. Loop through steps S3 and S4 until the number of loops reaches the preset repetition threshold, and apply the current optimal configuration to the microservice system as the subsequent execution configuration scheme.
2. The method for optimizing medium-performance resource costs in a microservices architecture according to claim 1, wherein Step S1 includes: S11. Take the microservices on the critical path as critical services; S12. Optimize the configuration parameters of the critical services.
3. The method for optimizing medium-performance resource cost in a microservices architecture according to claim 2, wherein In step S12, by optimizing the configuration parameters, reduce the configuration parameter search space of the critical services.
4. A method for optimizing medium performance resource costs in a microservices architecture according to claim 1, characterized in that In step S2, by obtaining user information, jointly optimize the configuration parameters of the critical services.
5. A method for optimizing medium performance resource costs in a microservices architecture according to claim 1, characterized in that In step S2, the configuration parameters include: microservice system hardware resource configuration parameters and microservice system software configuration parameters.
6. A method for optimizing medium performance resource costs in a microservices architecture according to claim 5, characterized in that For the critical services, set the hardware resource configuration parameters and the software configuration parameters to control the operation of the microservice system of the critical services.
7. A method for optimizing medium-performance resource costs in a microservices architecture according to claim 6, characterized in that Obtain the software configuration parameters of the preset software, where the preset software includes: Redis, Mongodb, Nginx.
8. A method for optimizing medium performance resource costs in a microservices architecture according to claim 1, characterized in that, Step S32 further includes: S321. Call each microservice with different call times and collect the performance metrics of the stress test system; S322. When there is a delay in the microservice request link, request the number of requests processed per second with the same number of calls.
9. A method for optimizing medium-performance resource costs in a microservices architecture according to claim 1, characterized in that In step S33, the cost includes: the cost generated by the usage of hardware resources.
10. A system for optimizing the cost of medium-performance resources under a microservices architecture, characterized in that, The system includes: A key service identification module, used to identify and obtain the critical path in the request link based on the microservice call link and service metrics, and optimize the configuration parameters of the key service accordingly; A parameter initialization and microsystem operation module, used to initialize the configuration parameters and run the microservice system. The parameter initialization and microsystem operation module is connected to the key service identification module; A test and duty collection module, used to perform a stress test on the microservice system and collect the performance metrics of the stress test system. The test and duty collection module is connected to the parameter initialization and microsystem operation module. The test and duty collection module includes: A stress test module, used to perform a stress test on the running microservice system to obtain the performance metrics of the stress test system; A link coverage module, used to request the microservice call link to cover the microservices in the microservice system when the number of network requests sent reaches the preset upper limit threshold. The link coverage module is connected to the stress test module; A cost acquisition module, used to process the resource cost of the current configuration plan of the microservice system. The cost acquisition module is connected to the link coverage module; A multi-objective optimization module, used to generate a new configuration plan using a multi-objective optimization algorithm and apply it to the microservice system. The multi-objective optimization module is connected to the test and duty collection module. Among them, the multi-objective optimization algorithm includes: genetic algorithm, dynamic dimension search algorithm, particle swarm optimization algorithm, Bayesian optimization algorithm. The multi-objective optimization module includes: A solution subset selection module, used to select a candidate solution subset according to the preset objective function value using the genetic algorithm; A candidate solution generation module, used to perform mutation operations and crossover operations, randomly change specific parameter configurations and combine candidate solution configurations to generate new candidate solutions. Among them, the genetic algorithm includes: NSGA-II algorithm. The candidate solution generation module is connected to the solution subset selection module; An objective function setting module, used to use the current configuration plan as the input data of the NSGA-II algorithm. Under this configuration plan, use the performance metrics of the stress test system and the cost as the objective function. The objective function setting module is connected to the candidate solution generation module; A new solution generation module, used to generate a new configuration plan according to the configuration plan and the objective function. The new solution generation module is connected to the objective function setting module; An application update and operation module, used to apply the new configuration plan to the microservice system to change the preset application to the microservice system and make the microservice system run under the new configuration plan. The application update and operation module is connected to the new solution generation module; A subsequent execution module is used to repeatedly execute the stress test, collect system performance metrics, generate a new configuration plan, and change and apply it to the microservice system until the number of loops reaches a preset repetition threshold. Then, apply the current optimal configuration to the microservice system as the subsequent execution configuration plan, and apply the optimal configuration to the microservice system as the subsequent execution configuration plan. The subsequent execution module is connected to the multi-objective tuning module.
Citation Information
Patent Citations
Resource allocation method for optimizing micro-service cost in cloud based on L-ACO
CN111913800A
Micro-service resource configuration parameter optimization method for power trading platform
CN114924887A
Microservice concern overload peculiar smell reconstruction method based on genetic algorithm
CN115469880A
Dynamic measurement analysis and optimization of micro-service architecture for edge computing
US11477301B1