A web micro-service combination optimization method based on GWO-DBO algorithm
By combining the gray wolf optimization algorithm and the dung beetle optimization algorithm, and introducing the roles of wandering wolves and raiding wolves, the problems of low convergence accuracy and low efficiency in microservice composition optimization are solved, and more stable and efficient microservice composition optimization is achieved.
Patent Information
- Application Number
- CN202311756103.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-19
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2043-12-19
AI Technical Summary
Existing swarm intelligence algorithms suffer from low convergence accuracy, low stability, and low search efficiency in microservice combinatorial optimization. Furthermore, the traditional Grey Wolf algorithm has a fast convergence speed but poor accuracy and is prone to getting trapped in local optima.
By combining the Grey Wolf Optimization (GWO) and Dung Beetle Optimization (DBO) algorithms and introducing the roles of wandering wolves and raiding wolves, we can perform microservice composition optimization through a hybrid algorithm. We can also use the hybrid Grey Wolf-Dung Beetle algorithm for global and local searches to improve convergence speed and accuracy.
It achieves more stable and accurate microservice composition optimization, improves search efficiency and accuracy, and generates the best composition scheme based on QoS objectives.
Smart Images

Figure CN117714282B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of software engineering technology in cloud computing environment, and in particular relates to a Web microservice composition optimization method based on GWO-DBO algorithm. Background Technology
[0002] In the rapidly evolving internet environment, cloud computing provides a virtualized, elastically scalable service platform, enabling applications to run in distributed systems. With the development of cloud computing, more and more systems are moving away from monolithic architectures, requiring different service modules to run on different servers. Therefore, microservices, a loosely coupled development and deployment model, has become mainstream. In a microservices model, a system providing a complete service is divided into multiple different, independently providing services. Each service module is developed, deployed, and maintained separately. This demonstrates that microservice architecture offers greater flexibility, scalability, and maintainability. Due to these advantages, microservice architecture has become the dominant architectural pattern. However, each service module has multiple service instances, and a complete system composed of multiple service modules can have hundreds or even thousands of microservice combinations, each offering varying service quality. Therefore, choosing the combination with the optimal service quality among numerous microservice combinations is a valuable research question.
[0003] Swarm intelligence algorithms do not rely on gradients and exhibit good performance, thus they are often used to solve microservice composition optimization problems. However, they generally suffer from low convergence accuracy, poor stability, and low search efficiency. In 2022, Professor Shen Bo's team at Donghua University proposed a novel swarm intelligence optimization algorithm, the Dung Beetle Optimizer (DBO), which simulates the behaviors of dung beetles, such as rolling balls, dancing, reproducing, foraging, and stealing. This algorithm classifies four different dung beetle roles, each with a different search method, balancing global and local search, and achieving a good balance between the two. However, it suffers from complex search steps and slow convergence speed. In 2014, Seyedali Mirjalili et al. proposed the Grey Wolf Optimizer (GWO), which has the advantage of fast convergence speed. The Grey Wolf Optimizer divides the wolf pack into four levels: α, β, and δ belong to the high-level elite group, and ω belongs to the non-elite group. The search process is characterized by the non-elite group moving towards the elite group. Compared to traditional optimizers such as particle swarm optimization and ant colony optimization, the Grey Wolf algorithm has a simpler search process, resulting in a significantly faster convergence speed. However, it inevitably suffers from poor convergence accuracy and is prone to getting trapped in local optima when solving multi-peak optimization problems. In 2022, Cui Ming et al. proposed a Grey Wolf algorithm based on the Levy flight strategy. By introducing a nonlinear convergence factor and the Levy flight strategy, they improved the local search capability of the Grey Wolf algorithm. However, this method introduces more parameters, reducing the algorithm's stability. Summary of the Invention
[0004] The technical problem solved by this invention is to overcome the shortcomings of existing technologies and propose a Web microservice composition optimization method based on the GWO-DBO algorithm, which can solve the microservice composition optimization problem more stably and accurately.
[0005] The technical solution of this invention is:
[0006] A Web microservice composition optimization method based on the GWO-DBO algorithm, the steps of which include:
[0007] Step 1: Establish a microservice composition model, the specific method is as follows:
[0008] Let the complete system service be S. A complete system can be divided into m microservice modules: S = {MS1, MS2, ..., MS...} k MS m}, k∈{1,2,...,m}, where MS k This represents the k-th microservice module. Each microservice module has n candidate microservice instances, MS k ={MSk1 MS k2 MS ki MS kn}, i∈{1,...,n}, where MS ki This represents the i-th candidate microservice instance of the k-th microservice module;
[0009] The solution to the microservice composition model can be represented as a set of vectors. Where x j This indicates that the j-th microservice module uses the x-th method. j Ten candidate microservice instances. Assuming a complete system consists of four microservice modules, each with ten candidate microservice instances, then when... When, it indicates that {MS} is selected. 1,3 MS 2,5 MS 3,1 MS 4,7} is a set of solutions obtained by the optimization algorithm.
[0010] Step 2, define the fitness calculation method. Define the optimization objective of microservice composition optimization as fun. Individual fitness
[0011] Among them, Q t Q c Q re Q av These are four metrics for evaluating the quality of a microservice system: response time, execution cost, reliability, and availability. t w c w re w av These are their corresponding weights; in the microservice composition optimization problem, the smaller this fitness function is, the better.
[0012] Step 3: Optimize the results using the hybrid gray wolf-dung beetle algorithm. The specific method is as follows:
[0013] (1) Initialize the gray wolf population and parameters. The specific method is as follows: use a uniform distribution to randomly generate an initial gray wolf population of size popNum. Set the algorithm parameters, including the maximum number of iterations MaxIter, the offset coefficient k, the reverse probability threshold λ, the light source influence coefficient b, the number of wandering wolves p1, and the number of running wolves p2;
[0014] (2) Divide the gray wolf population. The specific method is as follows: Calculate the fitness value of each gray wolf individual, and divide the gray wolf population into four levels, α, β, δ, and ω, according to the fitness value from small to large. There is one α, one β, and one δ wolf, representing the elite group in the population, and the remaining group is ω. ω is further divided into two parts, ω1 and ω2, representing roaming wolves (ω1) and sprinting wolves (ω2), respectively. The number of roaming wolves is p1, and the number of sprinting wolves is p2.
[0015] (3) The algorithm search steps are executed as follows: In each iteration, the wandering wolf first engages in wandering behavior, and after each wandering, it is immediately determined whether the replacement of the α, β, δ elite groups has occurred; after the wandering behavior ends, the sprinting wolf engages in sprinting behavior, and after each sprint, it is immediately determined whether the replacement of the α, β, δ elite groups has occurred.
[0016] The roaming behavior of the roaming wolf is as follows:
[0017] Let t represent the current iteration number, This represents the position of the i-th gray wolf in the t-th iteration. Let represent the position of the i-th gray wolf in the (t+1)-th iteration. The traversal behavior is based on the following formula:
[0018]
[0019] Where a1 is the natural coefficient, taking the value 1 or -1 with a certain random probability, k∈(0,0.2] represents the deflection coefficient, and b∈(0,1) represents the light source influence coefficient. Simulate changes in light intensity:
[0020]
[0021] in, This indicates the position with the worst global fitness.
[0022] The method for determining whether the replacement of α, β, δ elite groups has occurred is as follows:
[0023] Each time a gray wolf changes position, its fitness value is immediately calculated. When the fitness value is less than any of the α, β, or δ elite groups, a replacement of the elite group occurs, specifically as follows:
[0024] When the new fitness value of the gray wolf is less than that of the α wolf, the gray wolf replaces the α wolf, the α wolf replaces the β wolf, and the β wolf replaces the δ wolf.
[0025] When the fitness value is greater than α wolf and less than β wolf, the gray wolf replaces β wolf, and β wolf replaces δ wolf;
[0026] When the fitness value is greater than β wolf and less than δ wolf, the gray wolf replaces δ wolf;
[0027] The wolf's attack behavior is described as follows:
[0028] The known gray wolf position vectors of the elite group are represented as follows: The attacking wolf's attack position is updated according to the following formula:
[0029]
[0030]
[0031]
[0032] in, This represents the position of the i-th attacking wolf in round t. Indicates its position in the next round; Represent The offset positions relative to α wolf, β wolf, and δ wolf, where A1, A2, A3 and C1, C2, C3 are coefficient vectors that play a certain role in random adjustment:
[0033] A i =2a2r1–a2
[0034]
[0035] C i =2r2
[0036] Among them, a2 decreases linearly with the number of iterations, and r1 and r2 are floating-point numbers randomly generated in the range (0,1);
[0037] (4) The population is subject to natural selection. The specific method is as follows: all gray wolf individuals are reordered according to their fitness values from smallest to largest, and the top p1 with the best fitness values are retained as the wandering wolves in the next round. p2 running wolves are randomly generated again.
[0038] (5) Repeatedly execute the gray wolf search to find the global optimal solution. The specific method is as follows:
[0039] After completing the MaxIter round of iterations, output the position vector of the α wolf. That is, the solution with the best fitness after MaxIter rounds of iteration, and output its corresponding fitness value. Step 4: Based on the optimal solution, determine the best combination scheme based on the QoS objective. The specific method is as follows:
[0040] Based on the vector elements of the optimal solution vector, we obtain m microservice instances of microservice modules. These m instances represent the optimal combination scheme of Web microservices based on the GWO-DBO algorithm, which is used to determine and optimize the optimal combination of Web microservices under the microservice architecture during software development.
[0041] Beneficial effects
[0042] (1) The method of the present invention constructs a computable model S for Web microservice composition optimization;
[0043] (2) The method of this invention proposes a Web microservice composition optimization method based on the GWO-DBO algorithm.
[0044] (3) Based on the traditional gray wolf algorithm, the method of the present invention combines the behavior of the rolling dung beetle in the dung beetle algorithm, adds the role of the wandering wolf, increases the influence of historical information and environmental factors, expands the search range, and improves the global search capability of the algorithm.
[0045] (4) The method of this invention provides a method for updating the positions of wandering wolves and raiding wolves during the iteration process, and improves the convergence speed and local search capability of the algorithm by immediately replacing the elite group.
[0046] (5) The method of this invention provides specific operations for the survival of the fittest, eliminating individuals with poor fitness, randomly generating new individuals, optimizing the quality of the population, and improving the global search capability of the algorithm.
[0047] (5) The method of this invention clarifies the termination condition of the algorithm optimization and obtains the execution result of the GWO-DBO algorithm, that is, the optimal solution vector is obtained.
[0048] (6) The method of the present invention clarifies how to obtain the optimal combination scheme through the optimal solution vector.
[0049] (7) The GWO-DBO algorithm proposed in this invention improves the shortcomings of the GWO algorithm and can automatically generate Web microservice composition schemes based on QoS targets, effectively solving the problems of low accuracy and low efficiency of existing schemes. Attached Figure Description
[0050] Figure 1 Here is the flowchart for the GWO-DBO algorithm;
[0051] Figure 2 Optimize the microservice composition model;
[0052] Figure 3 A pyramid structure was created to categorize the gray wolves into different ranks.
[0053] Figure 4 This is a diagram illustrating the direction of the wolf's attack. Detailed Implementation
[0054] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0055] like Figure 1As shown in the flowchart of the GWO-DBO algorithm, the specific implementation of the Web microservice composition optimization method based on the GWO-DBO algorithm includes:
[0056] I. Encoding of Solution Vectors
[0057] The microservice composition model is represented as: S = {MS1, MS2, ..., MS...} k MS m},k∈{1,2,...,m}
[0058] The microservice composition model includes m microservice modules, such as... Figure 2 As shown. We assume m = 4, meaning there are 4 microservice modules, and each microservice module has 10 candidate microservice instances. Then the solution vector... The length is 4, and the vector elements correspond to the discrete encoding of the candidate microservice instances. In this embodiment, decimal discrete encoding is used.
[0059] II. Optimization using the GWO-DBO algorithm
[0060] (1) Initialize the gray wolf population and parameters. The specific method is as follows: use uniform distribution to randomly generate an initial gray wolf population of size popNum=33, set the algorithm parameters, including the maximum number of iterations MaxIter=1000, the offset coefficient k=0.1, the reverse probability threshold λ=0.5, the light source influence coefficient b=0.3, the number of wandering wolves p1=15 and the number of running wolves p2=15;
[0061] (2) Divide the gray wolf population. The specific method is as follows: calculate the fitness value of each individual gray wolf, and divide the gray wolf population into four levels, α, β, δ, and ω, according to the fitness value from smallest to largest. Figure 3 As shown, α, β, and δ each represent one elite group in the population, and the remaining group is ω. ω is further divided into two parts, ω1 and ω2, according to the fitness value from small to large, representing the wandering wolves ω1 and the running wolves ω2, respectively. The number of wandering wolves is p1 and the number of running wolves is p2.
[0062] (3) Perform iterative search. The specific method is as follows: In each iteration, the wandering wolf first performs wandering behavior. After each wandering, it is immediately determined whether the replacement of the α, β, δ elite groups has occurred. After the wandering behavior ends, the sprinting wolf performs sprinting behavior. After each sprint, it is immediately determined whether the replacement of the α, β, δ elite groups has occurred.
[0063] The roaming behavior of the roaming wolf is as follows:
[0064] Let t represent the current iteration number, This represents the position of the i-th gray wolf in the t-th iteration. This represents the position of the i-th gray wolf in the (t+1)-th iteration, and its roaming behavior is determined by the following formula:
[0065]
[0066] Where a1 is the natural coefficient, taking the value 1 or -1 with random probability, k = 0.2 represents the deflection coefficient, and b = 0.3 represents the light source influence coefficient. Simulate changes in light intensity:
[0067]
[0068] in, This indicates the position with the worst global fitness.
[0069] The method for determining whether the replacement of α, β, δ elite groups has occurred is as follows:
[0070] Each time a gray wolf changes position, its fitness value is immediately calculated. When the fitness value is less than any of the α, β, or δ elite groups, a replacement of the elite group occurs. In this embodiment, it is assumed that the gray wolf's fitness value is greater than that of the α wolf and less than that of the β wolf. In this case, the replacement is as follows: the gray wolf replaces the β wolf, and the original β wolf replaces the δ wolf.
[0071] The wolf's attack behavior is described as follows:
[0072] The known gray wolf position vectors of the elite group are represented as follows: The attacking wolf's attack position is updated according to the following formula:
[0073]
[0074]
[0075]
[0076] in, This represents the position of the i-th attacking wolf in round t. Indicates its position in the next round; Represent The offset positions relative to α wolf, β wolf, and δ wolf, where A1, A2, A3 and C1, C2, C3 are coefficient vectors that play a role in random adjustment:
[0077] A i =2a2r1–a2
[0078]
[0079] C i =2r2
[0080] Among them, a2 decreases linearly with the number of iterations, and r1 and r2 are floating-point numbers randomly generated in the range (0,1);
[0081] (4) The population is subject to natural selection. The specific method is as follows: all gray wolf individuals are reordered according to their fitness values from smallest to largest, and the top p1 with the best fitness values are retained as the wandering wolves in the next round. p2 running wolves are randomly generated again.
[0082] (5) Repeat steps (3)-(4) to find the global optimal solution. The specific method is as follows:
[0083] After completing the MaxIter round of iterations, output the position vector of the α wolf. That is, the solution with the best fitness after MaxIter rounds of iteration, and output its corresponding fitness value.
[0084] Based on the optimal solution vector, four microservice instances of microservice modules are obtained. Assuming the optimal solution vector... This means that {MS1,3,MS2,5,MS3,1,MS4,7} is selected as a solution obtained by the optimization algorithm. That is, the microservice instance with the first microservice module number 3, the second microservice module number 5, the third microservice module number 1, and the fourth microservice module number 7 are selected as the optimal combination scheme. This scheme is used to determine and optimize the optimal combination of Web microservices under the microservice architecture during the software development process.
[0085] In summary, the above are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A Web microservice composition optimization method based on the GWO-DBO algorithm, the steps of which include: Step 1: Establish a microservice composition model; Step 2: Set the optimization goals for the microservice composition model established in Step 1; Step 3: Use the GWO-DBO algorithm to optimize the combination result of the microservice composition model established in Step 1 according to the optimization objective in Step 2 to obtain the optimal solution; Step 4: Based on the optimal solution obtained in Step 3, establish a Web microservice composition scheme based on the GWO-DBO algorithm; In step 3, the specific method for optimization is as follows: (1) Initialize the gray wolf population and parameters; (2) Classify gray wolf populations; (3) Perform iterative search; (4) Survival of the fittest occurs within the population; (5) Repeat steps (3)-(4) to find the global optimal solution; In step (3), the specific method for iterative search is as follows: In each iteration, the wandering wolf first engages in wandering behavior, and immediately after each wandering, it is determined whether an iterative search has occurred. α , β , δ Replacement of elite groups; after the roaming behavior ends, the wolves begin to attack, and after each attack, an immediate assessment is made as to whether an attack has occurred. α , β , δ Replacement of the elite group; The roaming behavior of the roaming wolf is described as follows: make t Indicates the current iteration number. Indicates the first t During the nth iteration i The location of the gray wolf Indicates the first t+ In the 1st iteration, the first i The gray wolf's location is determined by the following formula, which governs its movement behavior: in a 1 is the natural coefficient, which takes the value 1 or -1 with random probability; k∈(0,0.2] represents the deflection coefficient; and b∈(0,1) represents the light source influence coefficient. Simulate changes in light intensity: in, This indicates the position with the worst global fitness. The aforementioned judgment whether it has occurred α , β , δ The replacement method for the elite group is as follows: Every time a gray wolf changes position, its fitness value is immediately calculated. If the fitness value is less than [a certain value], [the wolf is considered to have a higher fitness value]. α , β , δ When any member of the elite group is involved, a replacement of the elite group occurs, specifically as follows: When the gray wolf's new fitness value is less than α When the wolf's fitness value is reached, the gray wolf replaces... α Wolf, α Wolf replacement β Wolf, β Wolf replacement δ Wolf; When fitness is greater than α Wolf and smaller β When the wolf is present, the gray wolf replaces it. β Wolf, β Wolf replacement δ Wolf; When fitness is greater than β Wolf and smaller δ When the wolf is present, the gray wolf replaces it. δ Wolf; The wolf's attack behavior is described as follows: The known gray wolf position vectors of the elite group are represented as follows: , , The attacking wolf's attack position is updated according to the following formula: in, Representing the i Only the wolf was running away t Position during the turn, Indicates its position in the next round; , , Represent Compared to α Wolf, β Wolf, δ The wolf's offset position, where A 1, A 2, A 3 and C 1, C 2, C 3 is the coefficient vector, which plays a role in random adjustment: in, a 2. Decreases linearly with increasing iteration number. r 1 and r 2 is a randomly generated floating-point number within the range (0,1). MaxIter This represents the maximum number of iterations.
2. The Web microservice composition optimization method based on the GWO-DBO algorithm according to claim 1, characterized in that: In step 1, the established microservice composition model is as follows: The microservice composition model includes m Each microservice module , MS k Indicates the first k Each microservice module has [number] microservice modules, and each microservice module has [number] microservice modules. n One candidate microservice instance, , MS ki Indicates the first k The first microservice module i One candidate microservice instance.
3. The Web microservice composition optimization method based on the GWO-DBO algorithm according to claim 1, characterized in that: In step 2, the optimization objective is: fun ( = w t × Q t + w c × Q c + w re × Q re + w av × Q av ; in, Q t It is a response time metric for evaluating the quality of microservice composition services; Q c It is an execution cost metric for evaluating the quality of microservice composition services; Q re It is a reliability metric for evaluating the quality of microservice composition services; Q av It is an availability metric for evaluating the quality of microservice composition services; w t It is the weight of the response time metric; w c It is the weight of the execution cost indicator; w re It is the weight of the reliability index; w av It is the weight of the availability metric.
4. The Web microservice composition optimization method based on the GWO-DBO algorithm according to claim 1, characterized in that: In step (1), the specific method for initializing the gray wolf population and parameters is as follows: A uniformly distributed random generator of size [value missing] is used. popNum The initial gray wolf population is determined, and algorithm parameters are set, including the maximum number of iterations. MaxIter Offset coefficient k Reverse probability threshold λ Light source influence coefficient b Number of roaming wolves p 1 and the number of raiding wolves p 2.
5. The Web microservice composition optimization method based on the GWO-DBO algorithm according to claim 1, characterized in that: In step (2), the specific method for dividing the gray wolf population is as follows: calculate the fitness value of each individual gray wolf, and divide the gray wolf population into groups according to the fitness value from smallest to largest. α , β , δ , ω Four levels, among which α , β , δ One of each, representing the elite group within the population; the remaining groups are... ω, Will ω Further divide according to fitness value from smallest to largest into ω 1 ω The two parts represent the wandering wolf. ω 1. Running Wolf ω 2, of which the number of wandering wolves is p 1. The number of wolves attacking is p 2.
6. The Web microservice composition optimization method based on the GWO-DBO algorithm according to claim 1, characterized in that: In step (4), the specific method for survival of the fittest within the population is as follows: all gray wolf individuals are reordered according to their fitness values from smallest to largest, and the individuals with the best fitness values are retained. p One wolf will be randomly generated for the next round of roaming wolves. p Two wolves on a running attack; In step (5), the specific method for finding the global optimal solution is as follows: [Complete...] MaxIter Round iteration, output α Wolf's position vector ,Right now MaxIter After rounds of iterations, output the solution with the optimal fitness and its corresponding fitness value. fun ( ).
7. The Web microservice composition optimization method based on the GWO-DBO algorithm according to claim 1, characterized in that: In step 4, the specific method for determining the combination scheme based on the optimal solution is as follows: Based on the corresponding vector elements of the optimal solution vector, we obtain m Each microservice module consists of microservice instances, which are then combined into a complete system.
Citation Information
Patent Citations
A cloud service composition method
CN109344953A
