Micro-service combination method based on MultiEE-RL algorithm
The Markov decision process model is constructed through the MultiEE-RL algorithm, combined with reinforcement learning and confidence interval strategies, to optimize the scheduling of the microservice system, solve the adaptability and scalability issues in microservice combination optimization, and achieve efficient service quality. Management and Scheduling Portfolio.
Patent Information
- Application Number
- CN202410682609.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-08-27
AI Technical Summary
It is difficult for existing technologies to balance algorithm adaptability and scalability in microservice portfolio optimization, especially when user needs are updated and the Internet environment changes. Moreover, traditional methods are highly dependent on stable service architectures and face a surge in the number of candidate services. It is difficult to schedule effectively.
Adopting a microservice combination method based on the MultiEE-RL algorithm, by constructing a Markov decision process model, using reinforcement learning algorithms such as Q-Learning and Boltzmann distribution strategy, combined with the upper confidence interval UCB strategy, to optimize the scheduling of the microservice system To achieve the best service quality.
It achieves efficient and accurate service quality scheduling optimization in the microservice system, improves the adaptability and scalability of the system, and can generate stable reward values and optimal service combination solutions in multi-objective optimization scenarios.
Smart Images

Figure CN118550700A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software engineering technology in a cloud computing environment, and in particular to a microservice composition method based on a MultiEE-RL algorithm. Background Art
[0002] With the rapid development of information technology and distributed technology, traditional monolithic applications have been difficult to adapt to the rapidly changing user needs due to the large amount of computing resources wasted during the expansion process. However, small software development teams can analyze and disassemble the overall needs of users in advance, so as to construct microservice modules that can meet the independent needs of users in advance and have the same interface. However, the overall construction process involves the combinatorial optimization problem of microservice modules with different non-functional attributes. In traditional operations research problems, the objective function and constraints are generally determined for practical problems, and then a solvable model is established. When it comes to combinatorial optimization problems of discrete microservice modules, the Quality of Service (QoS) function is often introduced as the input value of the relevant optimization algorithm and the fitting index to determine the final optimization effect. The service quality function often includes reference indicators such as software availability, software reliability and software module response time. It is a quantitative description of the non-functional attributes of the software architecture and an important basis for users to evaluate the service quality of the software architecture. With the development of the information industry, the number of single microservice modules with similar service functions has increased. How users use service quality functions to combine design and optimize the overall software architecture has gradually become a hot research direction in academia and industry.
[0003] In the actual process of building a large-scale microservice software architecture, user needs are generally decomposed and combined with the functional attributes of the candidate microservices available for selection, and the corresponding abstract task workflow diagram is constructed as input. Next, based on the determined workflow diagram and the functional attributes of different microservice modules, the corresponding candidate software services for each functional block are determined, and finally the corresponding combinatorial optimization algorithm and the QoS function values of different software candidate services are used to select services based on service quality.
[0004] How to optimize the non-functional attributes of a single node in the network architecture and improve the overall software service quality has gradually become a research hotspot in academia and industry. For the optimization problem of atomic service composition in the service composition architecture, there are currently traditional research methods such as exact methods, approximate methods, and traditional heuristic methods, as well as new optimization methods such as meta-heuristic algorithms and reinforcement learning methods.
[0005] The random dual gradient method starts from the network link allocation and the placement of VNF instances of different services under the fixed link delay, and minimizes the delay-aware cost problem of arriving service requests from the underlying architecture, thereby improving the service quality. The method of combining binary integer programming (BIP) to minimize the end-to-end (E2E) delay and then using the output of the restricted Boltzmann machine (RBM) to determine the next desired node in the software architecture communication network is also applicable. However, these two methods only consider the combinatorial optimization of transmission network nodes, and do not consider the scheduling problem of candidate services. At present, there is also a stochastic gradient descent (SGD) method in academia to achieve combinatorial optimization of discrete atomic services. By ignoring the out-of-line services, the step size decreases as the algorithm progresses, so that SGD converges to the optimal value to achieve service combination optimization. However, a smaller step size will reduce the convergence speed of the model itself, and the reasonable rate of reducing the step size is difficult to be accurately determined. The multi-objective planning method assumes that the service access point is a participant in a game theory problem, thereby minimizing the average response time of the software architecture. The direct deployment of deep reinforcement learning (DRL) method can provide interconnection in the communication network between software architectures, thereby optimizing service combinations through autonomous communication. This DRL method reduces the total communication delay by 3 times. However, these two methods are highly dependent on stable service architectures and are not highly adaptable to changes in user needs.
[0006] From the previous work of scholars, it can be seen that how to balance the algorithm model's adaptability required when facing user demand updates and changes in the Internet environment, while maintaining the feasibility of the algorithm in solving combinatorial optimization problems; and the algorithm's scalability required when facing software architecture expansion and a surge in the number of candidate services, has become a research difficulty in the microservice composition optimization algorithm problem. Summary of the invention
[0007] In view of this, the present invention provides a microservice combination method based on the MultiEE-RL algorithm, which can more efficiently and accurately solve the microservice system scheduling optimization problem based on QoS objectives.
[0008] To achieve the above object, the technical solution of the present invention comprises the following steps:
[0009] The microservice composition architecture is abstractly constructed as a microservice composition model based on Markov decision process, and the non-functional service quality (QoS) attributes of microservices are used to model the uncertainty of the microservice composition model; the system scheduling goal is set to optimize the system QoS.
[0010] An optimization is performed for the system scheduling target to obtain an optimal decision vector.
[0011] The optimal scheduling solution based on QoS of the microservice system scheduling model is obtained according to the optimal decision vector.
[0012] Furthermore, the microservice composition architecture is abstractly constructed as a microservice composition model based on the Markov decision process. The specific process is as follows:
[0013] Constructing a quadruple suitable for microservice system scheduling based on the MDP model of reinforcement learning<S,A,P,R> , which is a microservice composition model based on Markov decision process.
[0014] Where S is the finite state set of the agent in the Markov decision process, and the corresponding microservice module selected in each round of iteration is abstracted into a state node; A is the corresponding action set in the Markov decision process, representing the corresponding action of the agent when the agent selects the next microservice module from the current microservice module; P represents the state transition probability, then P(s'|s) represents the probability of adopting the next microservice represented by state s' under the existing microservice state s; R represents the preset reward value obtained by the agent from state s to state s', corresponding to the QoS aggregation value of the selected new microservice combination.
[0015] Furthermore, the uncertainty of the microservice composition model is modeled using the non-functional service quality (QoS) attributes of the microservices, which specifically includes the following steps:
[0016] The first step is the standardization stage, which is as follows: the non-functional service quality (QoS) attributes of microservices include cost attributes and benefit attributes, among which cost attributes include response time and execution price; benefit attributes include reliability and availability; standardize the QoS attribute data to map it to the range of [0,1].
[0017] The second step is the empowerment stage, which is to calculate the service quality score of the single microservice by designing a service quality function. The service quality function is specifically:
[0018]
[0019] Among them, QoS is the score value of the overall service quality, w j represents the weight corresponding to the jth QoS attribute, where j ranges from 1 to 9. The size of the weight indicates the importance of different attributes. j is the normalized value of the jth QoS attribute, and n is the number of QoS attributes.
[0020] The system scheduling goal is to optimize the system QoS, that is, to maximize the QoS value.
[0021] Furthermore, the optimization is performed for the system scheduling target to obtain the optimal decision vector, which is specifically:
[0022] The MDP-WSC diagram is generated by modeling the abstractly generated microservice software architecture flowchart and applied to the Q-Learning algorithm model based on epsilon-greedy exploration. The corresponding state nodes and the action sets generated by the candidate service sets are set to explore the best combination scheme in the application problem, and then the learning rate parameter alpha and strategy selection parameter gamma with better adaptation scheme are obtained.
[0023] The optimization algorithm is then applied to the generated simulation model.
[0024] The optimization algorithms include three algorithms: a Q-Learning algorithm based on an epsilon-greedy strategy, a Q-Learning algorithm based on a Boltzmann distribution, and a Q-Learning algorithm based on an upper confidence interval UCB strategy.
[0025] Furthermore, the Q-Learning algorithm of the elipsion-greedy strategy has the following specific steps:
[0026] S1: According to the MDP-WSC graph, determine the state node set and action set; the corresponding microservice module selected in each round of iteration is a state node, and each selected microservice module is recorded as an action; according to the state node set and action set, select the initial state node, take the initial state node as the current state node, and start executing the following steps:
[0027] S2: Determine whether the preset maximum number of iterations has been reached. If so, end this process. Otherwise, execute S3. The maximum number of iterations is determined according to the size of the action set and the state node set.
[0028] S3: Determine whether the final state node is reached. If so, the iteration round increases by 1 and returns to S2. Otherwise, execute S4.
[0029] S4: Get a number n with any value between 0 and 1, and determine whether the arbitrary value is less than the strategy selection parameter epsilon. If so, randomly select an action, and use the microservice module corresponding to the randomly selected action as the candidate microservice module, obtain the next state node and reward return, and execute S6; if the arbitrary value is not less than the strategy selection parameter epsilon, execute S5;
[0030] S5: Select the action with the largest Q value in the current state, and use the microservice module corresponding to the action as the candidate microservice module, obtain the next state node and reward return, and execute S6;
[0031] S6: Calculate the existing Q function value selected by each microservice module and accumulate them. For the action of the currently selected microservice module, use the Bellman equation to calculate and update the Q function value, and use the Bellman equation to update the Q table. Finally, update the state, take the next state node, and return to S3.
[0032] Furthermore, the Q-Learning algorithm based on Boltzmann distribution is specifically:
[0033] SS1: According to the MDP-WSC graph, determine the state node set and action set; the corresponding microservice module selected in each iteration is a state node, and each selected microservice module is recorded as an action; according to the state node set and action set, set the initial state node as the current state node, and start executing the following steps:
[0034] SS2: Determine whether the preset maximum number of iterations has been reached. If so, end this process. Otherwise, execute SS3. The maximum number of iterations is determined based on the size of the action set and the state node set.
[0035] SS3: Determine whether the final state node is reached. If so, the iteration round increases by 1 and returns to SS2. Otherwise, execute SS4.
[0036] SS4: Determine whether it is the initial state. If so, randomly select an action and use the microservice module corresponding to the randomly selected action as the candidate microservice module to obtain the next state node and reward return, and execute SS6; if it is not the initial state, execute SS5;
[0037] SS5: Use the Boltzmann distribution probability to calculate the probability distribution position of each microservice module selection, obtain a number n with any value between 0 and 1, select the microservice module at the distribution position corresponding to the arbitrary number, use the microservice module as the candidate microservice module, obtain the next state node and reward return; execute SS6;
[0038] SS6: Calculate the existing Q function value selected by each microservice module and accumulate them. For the action of the currently selected microservice module, use the Bellman equation to calculate and update the Q function value, and use the Bellman equation to update the Q table. Finally, update the state, take the next state node, and return to SS3.
[0039] Furthermore, the Q-Learning algorithm based on the upper confidence interval UCB strategy is as follows:
[0040] SSS1: According to the MDP-WSC graph, determine the state node set and action set; the corresponding microservice module selected in each iteration is a state node, and each selected microservice module is recorded as an action; according to the state node set and action set, start with the initial state node as the current state node and execute the following steps:
[0041] SSS2: Determine whether the preset maximum iteration round is reached. If so, end this process, otherwise execute SSS3; the maximum iteration round is determined according to the size of the action set and the state node set;
[0042] SSS3: Determine whether the final state node is reached. If so, the iteration round increases by 1 and returns to SSS2. Otherwise, execute SSS4.
[0043] SSS4: Determine whether it is the initial state. If it is the initial state, randomly select an action and use the microservice module corresponding to the randomly selected action as the candidate microservice module to obtain the next state node and reward return, and execute SSS6; if it is not the initial state, execute SSS5;
[0044] SSS5: Set the corresponding confidence index beta, store the ratio of each microservice module’s Q value to the number of selections in the ratio table; calculate the confidence upper limit for selecting each microservice module and store it in the max table; sum the ratio table of each microservice module and the max table elements and store them in the ucb table, select the microservice module with the largest ucb value as the candidate microservice module, and obtain the next state node and reward return;
[0045] Execute SSS6;
[0046] SSS6: Calculate the existing Q function value selected by each microservice module and accumulate it. For the action of the currently selected microservice module, use the Bellman equation to calculate and update the Q function value, and use the Bellman equation to update the Q table. Finally, update the state, take the next state node, and return to SSS3.
[0047] Beneficial effects:
[0048] (1) The method of the present invention clarifies a microservice combination method based on the MultiEE-RL algorithm, and builds a computable model for microservice quality scheduling optimization; the method of the present invention provides an optimizable target through the construction of a Markov quadruple, clarifies the calculation method of the optimization target, and proposes a Q-Learning algorithm based on the Boltzmann distribution and a Q-Learning algorithm based on the upper confidence bound (UCB) strategy, and gives specific implementation steps. The Q-Learning algorithm based on the Boltzmann distribution of the present invention sets the number of particles in state i and the total number of particles in the system. Thus, the Boltzmann distribution is used to find the distribution that maximizes the entropy, thereby determining the selection probability.
[0049] (4) The Q-Learning algorithm based on the upper confidence bound (UCB) strategy of the present invention is based on the principle of optimistic selection through the upper confidence interval strategy, that is, selecting the action-state pair with the highest Q function value at present. The second half of the equation adds an exploration strategy for unknown candidate services, and the degree of exploration is controlled by the confidence parameter c, which provides a measure of uncertainty for the reward estimation of selecting new services. In this way, the Q-Learning algorithm based on the upper confidence bound (UCB) strategy is realized.
[0050] (5) The method of the present invention clarifies the iteration and termination conditions of the algorithm optimization, and obtains a stable reward value result after multiple rounds of iterations, that is, the optimal service combination.
[0051] (6) The method of the present invention illustrates how to obtain the optimal scheduling solution by constructing a corresponding service quality function.
[0052] (7) The method of the present invention combines some literature methods and the application characteristics of microservice combination scenarios, improves the existing Q-Learning algorithm of the epsilon-greedy strategy, and applies the Q-Learning algorithm based on the Boltzmann distribution and the Q-Learning algorithm based on the upper confidence bound (UCB) strategy to this scenario. The latter two improved algorithms are applied for the first time to the combinatorial optimization problem of large-scale microservice architecture. The specific implementation steps of the algorithm in solving the service combination optimization are described in detail, which can realize the automatic generation of scheduling schemes based on QoS targets for common microservice systems, and effectively solve the problems of lack of quality management schemes and inefficient scheduling combinations in microservice systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 Generate an MDP-WSC diagram for modeling the abstractly generated microservice software architecture flow chart;
[0054] Figure 2 This is a flowchart of the optimization algorithm based on the epsilon-greedy() strategy;
[0055] Figure 3 It is the flow chart of Q-Learning algorithm based on Boltzmann distribution strategy;
[0056] Figure 4 It is the flow chart of Q-Learning algorithm based on upper confidence interval strategy;
[0057] Figure 5 The present invention is specifically implemented in a flowchart of a microservice combination method based on the MultiEE-RL algorithm. DETAILED DESCRIPTION
[0058] The present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0059] like Figure 5 As shown, a microservice combination method based on the MultiEE-RL algorithm specifically implemented by the present invention includes the following:
[0060] Step 1: Abstract the microservice composition architecture into a microservice composition model based on the Markov decision process, and use the non-functional service quality (QOS) attributes of microservices to model the uncertainty of the microservice composition model; set the system scheduling goal to optimize the system QoS.
[0061] Constructing a quadruple suitable for microservice system scheduling based on the MDP model of reinforcement learning<S,A,P,R> , which is a microservice composition model based on Markov decision process;
[0062] Where S is the finite state set of the agent in the Markov decision process, and the corresponding microservice module selected in each round of iteration is abstracted into a state node; A is the corresponding action set in the Markov decision process, representing the corresponding action of the agent when the agent selects the next microservice module from the current microservice module; P represents the state transition probability, then P(s'|s) represents the probability of adopting the next microservice represented by state s' under the existing microservice state s; R represents the preset reward value obtained by the agent from state s to state s', corresponding to the QoS aggregation value of the selected new microservice combination.
[0063] The present invention adopts the Simple Additive Weighting (SAW) method to evaluate the microservice architecture and then select the best microservice combination execution scheme, that is, by assigning each objective function a corresponding weight to linearly weight multiple objective functions, thereby converting the multi-objective optimization problem into a single-objective optimization problem, and finally deriving a new target service quality function.
[0064] The simple addition weighting method is divided into two steps. The first step is the standardization stage. Because the types, units and value ranges of microservice service quality indicators in the existing data sets are different, it is impossible to directly use the service quality values of each type to calculate and compare the advantages and disadvantages of service combination solutions. It is necessary to standardize the service quality data to map it to the range of [0,1], and then use the normalized value to participate in subsequent calculations. Among them, cost-type attributes are calculated using formula (1), such as response time, execution price, etc.; benefit-type attributes are calculated using formula (2), such as reliability, availability, etc.
[0065]
[0066]
[0067] Among them, q j is the jth QoS attribute value before normalization, q' j is the jth QoS attribute after normalization, and are the maximum and minimum values of the QoS attributes of the jth candidate microservice.
[0068] The second step is the weighting stage, which calculates the service quality score of the single microservice by designing a service quality function. This objective function is used to evaluate the quality of each potential solution. In this paper, the larger the value of the objective function, the better the overall quality of the service. The formula is shown in formula (3).
[0069]
[0070] Among them, QoS is the score value of the overall service quality, w j Indicates the weight corresponding to the jth QoS attribute. The value of j ranges from 1 to 9. The size of the weight indicates the importance of different attributes. j is the standardized value of the jth attribute, n is the number of QoS attributes, n=9, and the system scheduling goal is to optimize the system QoS.
[0071] Step 2: Optimize the system scheduling target to obtain the optimal decision vector. Specifically, the MDP-WSC diagram (such as Figure 1 As shown in the figure, it is applied to the Q-Learning algorithm model based on epsilon-greedy exploration, setting the corresponding state nodes and the action sets generated by the candidate service sets to explore the best combination scheme in the application problem, and then obtaining the learning rate parameter alpha and strategy selection parameter gamma with better adaptation scheme;
[0072] The optimization algorithm is then applied to the generated simulation model;
[0073] The optimization algorithm used in the present invention is the MultiEE-RL algorithm, which includes three algorithms: the Q-Learning algorithm based on the epsilon-greedy strategy, the Q-Learning algorithm based on the Boltzmann distribution, and the Q-Learning algorithm based on the upper confidence interval UCB strategy. In the present invention, MultiEE refers to a variety of "exploration-exploitation" trade-off strategies, and RL refers to the reinforcement learning algorithm (Reinforcement Learning), where Exploration refers to the process in which the agent takes actions in an unknown environment to obtain more information. It helps the agent discover new states and actions, so as to better understand the dynamics of the environment; Exploitation refers to the agent using existing knowledge to choose the best action to obtain the maximum reward. Thereby helping the agent to maximize the reward in a known environment.
[0074] The optimization algorithm based on the epsilon-greedy() strategy is as follows:
[0075] In the action selection based on the epsilon-greedy() strategy, the agent uses two actions, exploration and exploitation, to leverage prior knowledge and exploration to transform to the next state. The epsilon-greedy method selects the action with the highest estimated reward in most cases. The goal is to strike a balance between exploration and exploitation. Exploration gives the agent room to try new things, but sometimes it contradicts what has been learned. The epsilon-greedy method selects exploration with a small probability epsilon, that is, it does not exploit the knowledge currently learned. In this case, the action is selected randomly and has nothing to do with the estimated Q value of the state-action pair.
[0076] The Q-Learning algorithm of the elipsion-greedy strategy has the following process: Figure 2 As shown, the specific steps are as follows:
[0077] S1: According to the MDP-WSC graph, determine the state node set and action set; the corresponding microservice module selected in each round of iteration is a state node, and each selected microservice module is recorded as an action; according to the state node set and action set, select the initial state node, take the initial state node as the current state node, and start executing the following steps:
[0078] S2: Determine whether the preset maximum number of iterations has been reached. If so, end this process. Otherwise, execute S3. The maximum number of iterations is determined according to the size of the action set and the state node set.
[0079] S3: Determine whether the final state node is reached. If so, the iteration round increases by 1 and returns to S2. Otherwise, execute S4.
[0080] S4: Get a number n with any value between 0 and 1, and determine whether the arbitrary value is less than the strategy selection parameter epsilon. If so, randomly select an action, and use the microservice module corresponding to the randomly selected action as the candidate microservice module, obtain the next state node and reward return, and execute S6; if the arbitrary value is not less than the strategy selection parameter epsilon, execute S5;
[0081] S5: Select the action with the largest Q value in the current state, and use the microservice module corresponding to the action as the candidate microservice module, obtain the next state node and reward return, and execute S6;
[0082] S6: Calculate the existing Q function value selected by each microservice module and accumulate them. For the action of the currently selected microservice module, use the Bellman equation to calculate and update the Q function value, and use the Bellman equation to update the Q table. Finally, update the state, take the next state node, and return to S3.
[0083] The Q-Learning algorithm based on Boltzmann distribution is as follows:
[0084] When applying the policy-based Q-Learning algorithm (reinforcement learning algorithm) to the microservice composition optimization problem, although the algorithm can adjust the selection strategy between exploring new candidate microservices and using existing high-quality microservices by adjusting the two parameters of the learning rate and the greedy strategy selection ratio, it is still impossible to dynamically adjust the balance strategy in a single iteration to make the model fit as quickly as possible. Therefore, we can draw on the relevant knowledge of statistics. The Boltzmann distribution is a probability distribution or probability measure that gives the distribution probability of a system being in a certain state as a function of the energy and temperature of the state. In statistics, the Boltzmann distribution is a probability distribution that gives the probability of a particle being in a certain state. The formula is shown in formula (4).
[0085]
[0086] where p i represents the probability of state i, represents the energy of state i, k is the Boltzmann constant, T is the absolute temperature of the distribution system, and M represents the number of accessible states of the system. The normalized denominator Q represents the canonical partition function. It represents the sum of the probabilities of all accessible states under the constraints. ε i
[0087] The Boltzmann distribution is a distribution that maximizes entropy and is often used to describe the distribution of particles over their accessible bound states. If there is a system consisting of many particles, select a random particle from the system and check what state it is in, the probability that it is in state i is equal to the number of particles in state i divided by the total number of particles in the system, that is, the proportion of particles occupying state i. The formula is shown in equation (5).
[0088] p i =N i / N (5)
[0089] represents the number of particles in state i, and N represents the total number of particles in the system. This probability can be found using the Boltzmann distribution, and it is equal to the fraction of particles in state i. Therefore, the equation for the fraction of particles in state i as a function of the energy of that state is shown in Equation (6).
[0090]
[0091] Boltzmann distribution is commonly used in the softmax function of machine learning. Here, the present invention migrates it to the original Q-Learning algorithm as the selection strategy algorithm for the agent action. In the actual application of microservice combination, we set M to correspond to the number of alternative microservice modules, K to be the Boltzmann constant, T to correspond to the difference between the total iteration round limit and the current iteration round number, ε i Corresponding to the customized fitting speed parameter, as T gradually approaches 0, the action selection of the agent will gradually become closer to the existing experience, thus converging to the best service combination.
[0092] Figure 3 The flowchart of the Q-Learning algorithm based on the Boltzmann distribution strategy is shown as Figure 3 As shown:
[0093] SS1: According to the MDP-WSC graph, determine the state node set and action set; the corresponding microservice module selected in each iteration is a state node, and each selected microservice module is recorded as an action; according to the state node set and action set, set the initial state node as the current state node, and start executing the following steps:
[0094] SS2: Determine whether the preset maximum number of iterations has been reached. If so, end this process. Otherwise, execute SS3. The maximum number of iterations is determined based on the size of the action set and the state node set.
[0095] SS3: Determine whether the final state node is reached. If so, the iteration round increases by 1 and returns to SS2. Otherwise, execute SS4.
[0096] SS4: Determine whether it is the initial state. If so, randomly select an action and use the microservice module corresponding to the randomly selected action as the candidate microservice module to obtain the next state node and reward return, and execute SS6; if it is not the initial state, execute SS5;
[0097] SS5: Use the Boltzmann distribution probability to calculate the probability distribution position of each microservice module selection, obtain a number n with any value between 0 and 1, select the microservice module at the distribution position corresponding to the arbitrary number, use the microservice module as the candidate microservice module, obtain the next state node and reward return; execute SS6;
[0098] SS6: Calculate the existing Q function value selected by each microservice module and accumulate them. For the action of the currently selected microservice module, use the Bellman equation to calculate and update the Q function value, and use the Bellman equation to update the Q table. Finally, update the state, take the next state node, and return to SS3.
[0099] The Q-Learning algorithm based on the upper confidence interval UCB strategy is as follows:
[0100] The Q-Learning algorithm based on the UCB strategy does not perform exploration by selecting arbitrary actions with a constant probability or simple spatial distribution, but changes its exploration-exploitation balance while collecting more environmental knowledge. Its action prior is mainly reflected in the shift from exploration to focusing on development, and then selecting the action with the highest estimated reward. Assuming that the reward sequence is an independent and identically distributed random variable with values between [0,1], and μ represents the mean of the distribution, then there is formula (7), denoted as the Chernoff-Hoeffding Bound, and when the sub-Gaussian value is 1 (1-subGaussian), it is shown in formula (8). n is the total number of state nodes, i is the i-th action, and reward i The corresponding reward for the i-th action, μ is the mean of the distribution means of all rewards before the current round.
[0101]
[0102]
[0103] Substituting the original formula into the Chernoff-Hoffding bound, we can get the distribution limit as shown in formula (9), which is transformed into formula (10), and then into formula (11).
[0104]
[0105]
[0106]
[0107] μ is the mean value of the distribution calculated in the current round, N is the total number of rounds, n is the number of times the agent selects the corresponding candidate service in the previous iteration round when it is in the current state, and The upper confidence bound is the UCB algorithm As the number of rounds N increases, the confidence level is high. When N tends to infinity, the n value of the microservice module corresponding to the high confidence level will also increase, and the confidence interval width As it approaches 0, the prediction of the aggregated service quality value also approaches accuracy. Thus, the corresponding microservice option with the smallest confidence interval width and the highest reward distribution value is selected.
[0108] Since then, a microservice combination method based on the MultiEE-RL algorithm has been completed / implemented. It can automatically and efficiently provide a set of microservice scheduling combination solutions, and effectively optimize the unstable performance of random scheduling quality of microservice systems.
[0109] The Q-Learning algorithm based on the upper confidence interval UCB strategy has the following process: Figure 4 As shown:
[0110] SSS1: According to the MDP-WSC graph, determine the state node set and action set; the corresponding microservice module selected in each iteration is a state node, and each selected microservice module is recorded as an action; according to the state node set and action set, start with the initial state node as the current state node and execute the following steps:
[0111] SSS2: Determine whether the preset maximum iteration round is reached. If so, end this process, otherwise execute SSS3; the maximum iteration round is determined according to the size of the action set and the state node set;
[0112] SSS3: Determine whether the final state node is reached. If so, the iteration round increases by 1 and returns to SSS2. Otherwise, execute SSS4.
[0113] SSS4: Determine whether it is the initial state. If it is the initial state, randomly select an action and use the microservice module corresponding to the randomly selected action as the candidate microservice module to obtain the next state node and reward return, and execute SSS6; if it is not the initial state, execute SSS5;
[0114] SSS5: Set the corresponding confidence index beta, store the ratio of each microservice module’s Q value to the number of selections in the ratio table; calculate the confidence upper limit for selecting each microservice module and store it in the max table; sum the ratio table of each microservice module and the max table elements and store them in the ucb table, select the microservice module with the largest ucb value as the candidate microservice module, and obtain the next state node and reward return;
[0115] Execute SSS6;
[0116] SSS6: Calculate the existing Q function value selected by each microservice module and accumulate it. For the action of the currently selected microservice module, use the Bellman equation to calculate and update the Q function value, and use the Bellman equation to update the Q table. Finally, update the state, take the next state node, and return to SSS3.
[0117] In summary, the above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A microservice composition method based on MultiEE-RL algorithm, It is characterized in that The method comprises the following steps: Abstracting the microservice composition architecture into a microservice composition model based on Markov decision process, and using the non-functional quality of service (QoS) attributes of microservices to model the uncertainty of the microservice composition model; The system scheduling goal is to achieve the best system QoS; Optimizing the system scheduling target to obtain an optimal decision vector; The optimal scheduling solution based on QoS of the microservice system scheduling model is obtained according to the optimal decision vector.
2. A microservice composition method based on the MultiEE-RL algorithm according to claim 1 It is characterized in that The microservice composition architecture is abstractly constructed as a microservice composition model based on the Markov decision process. The specific process is as follows: Constructing a quadruple suitable for microservice system scheduling based on the MDP model of reinforcement learning<S,A,P,R> , which is a microservice composition model based on Markov decision process; Where S is the finite state set of the agent in the Markov decision process. The corresponding microservice module selected in each iteration is abstracted into a state node. A is the corresponding action set in the Markov decision process, representing the corresponding action of the agent when the agent selects the next microservice module from the current microservice module. P represents the state transition probability, then P(s'|s) represents the probability of the next microservice to adopt state s' under the current microservice state s; R represents the preset reward value obtained by the agent from state s to state s', which corresponds to the QoS aggregation value of the selected new microservice combination.
3. According to the microservice composition method based on the MultiEE-RL algorithm according to claim 2, It is characterized in that The method of using the non-functional quality of service (QoS) attributes of microservices to model the uncertainty of the microservice composition model specifically includes the following steps: The first step is the standardization stage, which is as follows: the non-functional service quality QoS attributes of microservices include cost attributes and benefit attributes, among which cost attributes include response time and execution price; benefit attributes include reliability and availability; standardize the QoS attribute data to map it to the range of [0,1]; The second step is the empowerment stage, which is to calculate the service quality score of the single microservice by designing a service quality function. The service quality function is specifically: Among them, QoS is the score value of the overall service quality, w j represents the weight corresponding to the jth QoS attribute, where j ranges from 1 to 9. The size of the weight indicates the importance of different attributes. j is the normalized value of the jth QoS attribute, and n is the number of QoS attributes; The system scheduling goal is to optimize the system QoS, that is, to maximize the QoS value.
4. According to the microservice composition method based on the MultiEE-RL algorithm according to claim 3, It is characterized in that The optimization is performed for the system scheduling target to obtain the optimal decision vector, specifically: The MDP-WSC diagram is generated based on the abstract microservice software architecture flow chart modeling, and applied to the Q-Learning algorithm model based on epsilon-greedy exploration. The corresponding state nodes and action sets generated by the candidate service set are set to explore the best combination scheme in the application problem, and then the learning rate parameter alpha and strategy selection parameter gamma with better adaptation scheme are obtained. The optimization algorithm is then applied to the generated simulation model; The optimization algorithms include three algorithms: a Q-Learning algorithm based on an epsilon-greedy strategy, a Q-Learning algorithm based on a Boltzmann distribution, and a Q-Learning algorithm based on an upper confidence interval UCB strategy.
5. According to the microservice composition method based on the MultiEE-RL algorithm according to claim 4, It is characterized in that The Q-Learning algorithm of the elipsion-greedy strategy has the following specific steps: S1: According to the MDP-WSC graph, determine the state node set and action set; the corresponding microservice module selected in each round of iteration is a state node, and each selected microservice module is recorded as an action; according to the state node set and action set, select the initial state node, take the initial state node as the current state node, and start executing the following steps: S2: Determine whether the preset maximum number of iterations has been reached. If so, end this process. Otherwise, execute S3. The maximum number of iterations is determined according to the size of the action set and the state node set. S3: Determine whether the final state node is reached. If so, the iteration round increases by 1 and returns to S2. Otherwise, execute S4. S4: Get a number n with any value between 0 and 1, and determine whether the arbitrary value is less than the strategy selection parameter epsilon. If so, randomly select an action, and use the microservice module corresponding to the randomly selected action as the candidate microservice module, obtain the next state node and reward return, and execute S6; if the arbitrary value is not less than the strategy selection parameter epsilon, execute S5; S5: Select the action with the largest Q value in the current state, and use the microservice module corresponding to the action as the candidate microservice module, obtain the next state node and reward return, and execute S6; S6: Calculate the existing Q function value selected by each microservice module and accumulate them. For the action of the currently selected microservice module, use the Bellman equation to calculate and update the Q function value, and use the Bellman equation to update the Q table. Finally, update the state, take the next state node, and return to S3.
6. According to the microservice composition method based on the MultiEE-RL algorithm of claim 4, It is characterized in that The Q-Learning algorithm based on Boltzmann distribution is specifically: SS1: According to the MDP-WSC graph, determine the state node set and action set; the corresponding microservice module selected in each iteration is a state node, and each selected microservice module is recorded as an action; according to the state node set and action set, set the initial state node as the current state node, and start executing the following steps: SS2: Determine whether the preset maximum number of iterations has been reached. If so, end this process. Otherwise, execute SS3. The maximum number of iterations is determined based on the size of the action set and the state node set. SS3: Determine whether the final state node is reached. If so, the iteration round increases by 1 and returns to SS2. Otherwise, execute SS4. SS4: Determine whether it is the initial state. If so, randomly select an action and use the microservice module corresponding to the randomly selected action as the candidate microservice module to obtain the next state node and reward return, and execute SS6; if it is not the initial state, execute SS5; SS5: Use the Boltzmann distribution probability to calculate the probability distribution position of each microservice module selection, obtain a number n with any value between 0 and 1, select the microservice module at the distribution position corresponding to the arbitrary number, use the microservice module as the candidate microservice module, obtain the next state node and reward return; execute SS6; SS6: Calculate the existing Q function value selected by each microservice module and accumulate them. For the action of the currently selected microservice module, use the Bellman equation to calculate and update the Q function value, and use the Bellman equation to update the Q table. Finally, update the state, take the next state node, and return to SS3.
7. According to the microservice composition method based on the MultiEE-RL algorithm according to claim 4, It is characterized in that The Q-Learning algorithm based on the upper confidence interval UCB strategy is specifically: SSS1: According to the MDP-WSC graph, determine the state node set and action set; the corresponding microservice module selected in each round of iteration is a state node, and each selected microservice module is recorded as an action; According to the state node set and action set, starting from the initial state node as the current state node, the following steps are executed: SSS2: Determine whether the preset maximum iteration round is reached. If so, end this process, otherwise execute SSS3; the maximum iteration round is determined according to the size of the action set and the state node set; SSS3: Determine whether the final state node is reached. If so, the iteration round increases by 1 and returns to SSS2. Otherwise, execute SSS4. SSS4: Determine whether it is the initial state. If it is the initial state, randomly select an action and use the microservice module corresponding to the randomly selected action as the candidate microservice module to obtain the next state node and reward return, and execute SSS6; if it is not the initial state, execute SSS5; SSS5: Set the corresponding confidence index beta and store the ratio of the Q value of each microservice module to the number of selections in the ratio table; Calculate and select the confidence upper limit of each microservice module and store it in the max table; sum the ratio table of each microservice module and the elements of the max table and store them in the ucb table, select the microservice module with the largest ucb value as the candidate microservice module, and obtain the next state node and reward return; Execute SSS6; SSS6: Calculate the existing Q function value selected by each microservice module and accumulate it. For the action of the currently selected microservice module, use the Bellman equation to calculate and update the Q function value, and use the Bellman equation to update the Q table. Finally, update the state, take the next state node, and return to SSS3.
