A method for locating microservice resource bottlenecks

By parsing the logs and indicator information of microservices and optimizing the prompt format with a reinforcement learning model, the problem of inaccurate microservice resource management is solved, precise resource regulation is achieved, and resource waste is avoided.

CN119782017BActive Publication Date: 2025-09-26ANHUI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411828358.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-09-26
Estimated Expiration
2044-12-12

AI Technical Summary

Technical Problem

Existing technologies cannot accurately locate the causes of microservice resource anomalies, resulting in inaccurate resource management and waste of resources.

Method used

By using the target prompt format to parse the log information and indicator information of the microservice runtime, combining it with a large language model for analysis and decision-making, and using a reinforcement learning model to optimize the prompt format, we can find the resource bottlenecks that affect the performance of microservices.

Benefits of technology

It achieves precise control of microservice resources, avoids resource waste, and improves the accuracy of resource management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782017B_ABST
    Figure CN119782017B_ABST
Patent Text Reader

Abstract

The present application relates to a method for locating microservice resource bottlenecks based on reinforcement learning and a large language model, and relates to the field of software engineering microservices. The method comprises parsing the log information and indicator information of the microservice runtime using a target prompt format, analyzing and making decisions on the parsed results of the log information and indicator information using a large language model, and finding the resource bottleneck that affects the performance of the microservice. The present invention combines the log information and indicator information into a prompt format through an intelligent agent, and transmits the prompt format to a large language model. The current task response time and current task processing accuracy of the prompt format are obtained through the decision-making processing of the large language model, and the information of the specific resource item is obtained, so as to schedule resources in a targeted manner. For example, if it is determined that the CPU resources are insufficient, the CPU resources will be scheduled in a targeted manner, rather than simultaneously improving the scheduling of all resources, so as to achieve precise regulation of the resources of each microservice and avoid resource waste.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software engineering microservices, and in particular to a method for locating microservice resource bottlenecks. Background Art

[0002] The microservices architecture breaks down large, monolithic applications into multiple independent services that communicate through lightweight mechanisms. Each microservice focuses on a specific business function and can be independently developed, deployed, and iterated upon. These microservices communicate with each other via HTTP or RPC protocols. However, due to the unpredictability of external loads and the complex interactions between microservices, cloud providers often overprovision microservices with excessive resources (such as CPU cores and memory capacity) to ensure service reliability, which often results in wasted resources.

[0003] The current approach to addressing resource waste is to identify the root cause of end-to-end microservice performance anomalies from the call chain and metric data during microservice runtime, and then adjust the resource parameters of that service using an optimization algorithm. However, this approach only manages resources at the service level, locating only service-level resource anomalies and failing to identify specific issues with insufficient CPU or memory resources. To address this issue, the processor increases the allocation of all relevant resources for that service, even increasing the allocation of already sufficient resources. This makes it impossible to precisely regulate the resources of each microservice, leading to resource waste.

[0004] There is currently no effective solution to the problem that existing service solutions cannot accurately locate the causes of resource anomalies. Summary of the Invention

[0005] The present invention provides a microservice resource bottleneck locating method to solve the problem that existing service solutions cannot accurately locate the cause of resource anomalies.

[0006] The present invention provides a method for locating a microservice resource bottleneck, the method comprising:

[0007] Use the target prompt format to parse the log information and indicator information of the microservice runtime. Use the large language model to analyze and make decisions based on the parsed log information and indicator information to find the resource bottlenecks that affect the performance of the microservice.

[0008] The target prompt format is determined by a reinforcement learning model, which includes an agent, state, action, reward, and strategy. The state includes the current task response time, current task processing accuracy, and current prompt format of the large language model. The action includes updating the current prompt format based on the current strategy. The steps for determining the target prompt format include:

[0009] The S100 agent sends the current Prompt format to the large language model;

[0010] S200 determines the large language model based on the current task response time and the current task processing accuracy in the current prompt format, and calculates the current reward through the reward function. The reward function is:

[0011] r t =λ1*ResTScore t +λ2*PrefScore t

[0012] Among them, r t is the current reward, λ1 is the weight of the resource consumption score, and λ2 is the weight of the delay change score;

[0013] ResTScore t PrefScore is the resource consumption score of the large language model at time t, which is determined according to the current task response time of the large language model. t is the delay change score of the large language model at time t, determined according to the current task processing accuracy of the large language model.

[0014] The S300 agent updates the current strategy with the current state and current reward, and updates the current Prompt format based on the updated current strategy;

[0015] S400 loops through the actions of S100, S200, and S300 until the maximum cumulative reward appears, and uses the prompt format corresponding to the last non-zero reward as the target prompt format;

[0016] The function for accumulating rewards is:

[0017]

[0018] Among them, γ∈(0,1] represents the discount factor and E is the mathematical expectation.

[0019] Furthermore, the grammatical format is defined as B n (A1,…,A n ,c)=A1cA2c…cA n ;

[0020] Among them B n (A1,…,A n ,c) represents the whole sentence of Prompt, c represents the separator between fields, and the basic field is A(d,s,t), where d represents the first symbol, s represents the second symbol, and t represents text data;

[0021] Different prompt formats have different first and second symbols.

[0022] Furthermore, the first symbol is a descriptor.

[0023] Furthermore, the second symbol is a separator.

[0024] Furthermore, the ResTScore t is defined as

[0025] Among them, ResT t is the current task response time of the large language model at time t, ResTScore t Determined based on the current task response time of the large language model.

[0026] Furthermore, the PerfScore t is defined as

[0027] Among them, Acc t is the current task processing accuracy of the large language model at time t, PerfSocre t Determined by the current task processing accuracy of the large language model.

[0028] Furthermore, the agent updates the current strategy based on the current state and current reward, including:

[0029] Based on the actor-critic network architecture, the objective function L is maximized. CLIP (θ) is used to update the current policy.

[0030] Furthermore, the maximization objective function L CLIP (θ) is defined as:

[0031] L CLIP (θ)=E[min(α t (θ)A t, clip(α t (θ),1-∈,1+∈)A t )];

[0032] Where ∈ represents the cropping parameter and At represents the advantage function at time step t.

[0033] Furthermore, the α t (θ) is defined as

[0034] Among them, α t (θ) represents the probability ratio of the new and old strategies.

[0035] The present invention provides a method for locating microservice resource bottlenecks, which has the following beneficial effects:

[0036] 1. The present invention combines log information and indicator information into a prompt format through an intelligent agent, and transmits the prompt format to a large language model. Through the decision-making of the large language model, the information of specific resource items is obtained to infer resource bottlenecks, thereby scheduling resources in a targeted manner. For example, if it is determined that the CPU resources are insufficient, the CPU resources will be scheduled in a targeted manner instead of simultaneously improving the scheduling of all resources, thereby achieving precise control of the resources of various microservices and avoiding resource waste. The details of one or more embodiments of the present application are presented in the following figures and descriptions to make the other features, purposes and advantages of the present application more concise and easy to understand. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a schematic diagram of the resource bottleneck location architecture;

[0038] Figure 2 It is a flowchart of reinforcement learning optimization Prompt;

[0039] Figure 3 This is a flowchart for Prompt root cause location. DETAILED DESCRIPTION

[0040] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.

[0041] Unless otherwise defined, the technical terms or scientific terms involved in this application should have the general meaning understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "an", "a", "the", "these" and the like in this application do not indicate quantitative restrictions, and they can be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "plurality" involved in this application refers to two or more. "And / or" describes the relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, and B exists alone. Generally, the character " / " indicates that the related objects are in an "or" relationship. The terms "first," "second," "third," etc. used in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0042] Note that "Prompt" stands for prompt project, and "LLM" stands for large language model. The prompt format refers to a complete sentence composed of a combination of prompt fields. The current prompt format refers to a complete sentence composed of a specific combination of prompt fields.

[0043] See also Figures 1 to 3 The present invention provides a method for locating a microservice resource bottleneck, the method comprising step S000:

[0044] Step S000 uses the target prompt format to parse the log information and indicator information of the microservice runtime, analyzes and makes decisions on the parsed results of the log information and indicator information through a large language model, and finds the key resource bottlenecks that affect the performance of the microservice.

[0045] It should be noted that for the text input into LLM, a grammar needs to be defined to express the specific prompt format. The prompt format is for example {Question: <text>|Answer: <text>}. Among them, Question and Answer are descriptors, colons are separators, and vertical bars are segmentation characters. Both descriptors and separators can be replaced with other symbols or empty symbols. Since the large language model is very sensitive to the prompt format, different prompt formats will affect the accuracy of the large language model in task processing. Therefore, finding the prompt format that best suits the large language model (i.e., the target prompt format in step S000) is the key for the large language model to find resource bottlenecks that affect microservice performance.

[0046] In some embodiments, a complete corpus is B n (A1,…,A n ,c)=A1cA2c…cA n .

[0047] Among them B n (A1,…,A n ,c) represents the entire Prompt sentence, c represents the separator between fields, and the basic field is A(d,s,t), where d represents the first symbol, s represents the second symbol, and t represents text data.

[0048] Different prompt formats have different first and second symbols.

[0049] The first symbol can be a descriptor or a blank character. The second symbol can be a separator or a blank character.

[0050] Specifically, each group A i cA j are all fragments of question-answer corpus, and c is used to split fields. i is the input problem description, the latter A j It is the result of the answer based on the description. For example, if the input question is {[2023-10-05 14:23:45]ERROR:Out of Memory Error-Unable to allocate additional memory.}, the large language model can analyze it to know that this log describes that the microservice had a performance abnormality due to insufficient memory at a certain moment. Based on this question, the large language model can derive the answer: {increase memory}, solving the problem by increasing memory. Multiple sets of question and answer corpus fragments are provided to the large language model, and finally, through its powerful analysis capabilities, it gives the answer to the last question, namely A n The output result is:

[0051] For example, some microservices don't output many memory-related logs, so LLM might not provide accurate results. However, high memory usage or high memory fragmentation rates in metric data clearly indicate insufficient memory resources and require additional memory. Designing and training a model isn't necessary; simply using prompts to help LLM understand the meaning of the input text is sufficient.

[0052] The target prompt format is determined by a reinforcement learning model. The reinforcement learning model includes an agent, state, action, reward, and strategy. The state (environment) includes the current task response time, current task processing accuracy, and current prompt format of the large language model. The action includes updating the current prompt format according to the current strategy. The steps for determining the target prompt format include S100, S200, and S300:

[0053] The S100 agent sends the current Prompt format to the large language model.

[0054] S200 determines the large language model based on the current task response time and the current task processing accuracy in the current prompt format, and calculates the current reward through the reward function. The reward function is:

[0055] r t =λ1*ResTScore t +λ2*PrefScore t

[0056] Among them, r t is the current reward, λ1 is the weight of the resource consumption score, and λ2 is the weight of the delay change score.

[0057] ResTScore t is defined as

[0058] Among them, ResT t is the current task response time of the large language model at time t, ResTScore t Determined based on the current task response time of the large language model.

[0059] PerfScore t is defined as

[0060] Among them, Acc t is the current task processing accuracy of the large language model at time t, PerfSocre t Determined based on the current task processing accuracy of the large language model. Substitute the current task response time and current task processing accuracy into the resource consumption score function and the delay change score function, respectively, and substitute the resulting data into the reward function to obtain the reward score corresponding to the current prompt format.

[0061] The S300 agent updates the current strategy with the current state and current reward points, and updates the current Prompt format based on the updated current strategy.

[0062] Among them, the agent updates the current strategy with the current state and current reward, including:

[0063] Based on the actor-critic network architecture, the objective function L is maximized. CLIP (θ) is used to update the current policy.

[0064] The optimization process of Prompt is performed using the reinforcement learning PPO algorithm. PPO is an online policy optimization algorithm based on the actor-critic network architecture. Here, the critic network refers to the state-value equation used to evaluate the current policy, while the actor network updates the policy according to the recommendations of the critic network. Specifically, the reward score r is set to t Substitute the state value function V ω (s), we can get the expected reward that can be obtained by following the current strategy in a given state s, and update the parameters by minimizing the loss function.

[0065] V ω (s)=E[R(s t ,a t )+γV ω (s t+1 )|s t =s]

[0066] Advantage function A t Measuring the expected reward advantage of taking an action in a given state compared to the average action helps the policy network understand which actions are more likely to lead to higher rewards, thereby guiding the policy to improve towards these actions. In order to measure the difference between the actual reward obtained and the current estimated state value, the residual function is defined as:

[0067] δ t =r t +γ*V ω (s t+1 )-V ω (s t )

[0068] Substitute the expected return into the residual function δ t Get reward score r t The difference between the expected return and the expected return.

[0069] Then we can use the residual function δ t Substitute into the advantage function A t , we can use Generalized Advantage Estimation (GAE) to calculate the advantage of the strategy at time step t:

[0070]

[0071] where k represents the offset from time step t and λ∈[0,1] is a hyperparameter used to balance bias and variance.

[0072] Finally, the advantage function A t Substitute the maximized objective function L CLIP (θ), when maximizing the objective function L CLIP When the value of (θ) is the largest, it means that the strategy is the better strategy.

[0073] Maximize the objective function L CLIP (θ) is defined as:

[0074] L CLIP (θ)=E[min(α t (θ)A t ,clip(α t (θ),1-∈,1+∈)A t )].

[0075] Where ∈ represents the cropping parameter and At represents the advantage function at time step t.

[0076] α t (θ) is defined as

[0077] Among them, α t (θ) represents the probability ratio of the new and old strategies.

[0078] S400 loops through the actions of S100, S200, and S300 until the maximum cumulative reward appears, and uses the Prompt format corresponding to the last non-zero reward as the target Prompt format.

[0079] The function for accumulating rewards is:

[0080]

[0081] Among them, γ∈(0,1] represents the discount factor and E is the mathematical expectation.

[0082] The current reward can be calculated based on the resource consumption score and the delay change score. The principle is that the current prompt format is better than the previous prompt format, so the current reward is a positive value greater than zero. Therefore, when the cumulative reward is at its maximum value, it proves that the current reward of the subsequent prompt format is not greater than zero compared to the current prompt format, that is, it is not better than the current prompt format. Therefore, it can be concluded that the current prompt format is the optimal prompt format, that is, the target prompt format.

[0083] The present invention combines log information and indicator information into a prompt format through an intelligent agent, and transmits the prompt format to a large language model. Through decision-making processing by the large language model, it obtains information about specific resource items to infer resource bottlenecks, thereby scheduling resources in a targeted manner. For example, if it is determined that CPU resources are insufficient, the CPU resources will be scheduled in a targeted manner instead of simultaneously improving the scheduling of all resources, thereby achieving precise regulation of the resources of various microservices and avoiding resource waste.

[0084] See also Figure 2 In the Markov decision process, the agent combines the prompt fields in the prompt space (prompt engineering space) according to the initial strategy to form a certain prompt format. The agent transmits the prompt format to the large language model for processing to obtain the current task response time and the current task processing accuracy. The current task response time and the current task processing accuracy data are filled into the reward function to obtain the reward score r t , the reward score r t Substitute the state value function V ω (s), we can get the expected return that can be obtained by following the current strategy in a given state s, and substitute the expected return into the residual function δ t Get reward score r t The difference between the expected return and the residual function δ t Substitute into the advantage function A t We can use Generalized Advantage Estimation (GAE) to calculate the advantage of the strategy at time step t, and finally use the advantage function A t Substitute the maximized objective function L CLIP (θ), when maximizing the objective function L CLIP When the value of (θ) is the largest, it means that the strategy is the better strategy.

[0085] Among them, the initial strategy is a random data, which is randomly selected by the agent.

[0086] In addition, a microservice resource allocation method is provided, including:

[0087] Identify resource bottlenecks that affect microservice performance through microservice resource bottleneck location methods;

[0088] Determine whether there is a target resource item that has reached a resource bottleneck. If so, allocate resources corresponding to the target resource item to the microservice.

[0089] As described above, at least one embodiment of each part of the microservice resource bottleneck location method provided by the present invention has been described separately. It should be noted that the various parts of the microservice resource bottleneck location method can be combined using different embodiments to form different embodiments of the microservice resource bottleneck location method.

[0090] For example, in a specific overall embodiment, the microservice resource bottleneck location method is divided into two stages:

[0091] In the first phase, reinforcement learning was used to explore the impact of different prompt formats on the accuracy of LLM processing tasks and identify the optimal prompt (target prompt format). The second phase used the optimal prompt to parse microservice runtime logs and metrics. By analyzing these two source data types, key resource bottlenecks affecting microservice performance were identified.

[0092] 1Stage 1 Prompt format optimization based on reinforcement learning

[0093] 1.1Prompt format and definition

[0094] For the text input into LLM, we define a grammar to express the specific prompt format. <text>|Answer: <text>For example, before asking an LLM a question, we need to provide a certain amount of corpus data as a prerequisite for the LLM's understanding task. Each corpus contains (descriptor, delimiter, data text, segmentation, descriptor, delimiter, data text). The information before the delimiter is the information we provide, also known as the input, and the answer after the delimiter is based on this information, also known as the output. The LLM understands the task by analyzing the given input and output, and then generates the output based on the final input, thus completing the task.

[0095] LLM is sensitive to the format of prompts. Any change to any character will affect the result. Therefore, we abstract the above expectations. We define a basic field as A(d,s,t), where d represents the descriptor, s represents the separator, and t represents the text data. A complete corpus is defined as B n (A1,…,A n ,c) where c represents the separator between fields, i.e. the end of the previous field. Therefore, our input can be expressed as:

[0096] B n (A1,…,A n ,c)=A1cA2c…cA n

[0097] In the prompt field, except for the fixed data field, other descriptors and separators can be replaced with other symbols, and even the space character can be used to replace the original character. Therefore, we can generate a variety of prompt combinations to test the LLM's processing accuracy for the task.

[0098] Specifically, each group A i cA j Both are question-answer predictions, and c is used to separate fields. The former is the input question description, and the latter is the answer based on the description. Let's take an error log when the microservice is running as an example: {[2023-10-05 14:23:45]ERROR:Out of Memory Error-Unable to allocate additional memory.} This log describes that the microservice has a performance abnormality due to insufficient memory at a certain moment. We will use this log as A i Input, then A j The output should be {increase memory}. We provide similar multiple sets of questions and answers to LLM, and finally, through its powerful analytical ability, it gives the answer to the last question, namely A n The output result is:

[0099] This method of inputting question-and-answer data shares similarities with deep learning technology in computing models. However, LLM's computational analysis is much faster, eliminating the need for manual model design and training. Deep learning technology can be used to complete tasks. However, the challenge with LLM lies in choosing the right prompt to ensure accuracy.

[0100] 1.2 Prompt Selection Based on Reinforcement Learning

[0101] Different prompts will lead to different LLM task processing performance. Therefore, there is a mapping relationship, and task processing performance will change with the choice of prompt. Therefore, we need an optimization algorithm to explore the prompt format space and select the optimal prompt format.

[0102] Reinforcement learning formalizes the decision-making task as a Markov decision process. At any discrete time step t, the reinforcement learning agent will make a decision based on the observed environment state s. t ∈S, and based on the current policy π θ (parameterized as θ) given an action a t ∈A. At the next time step s t+1 , the agent will observe a new state s t+1 , and through the given reward function R(s t ,a t ) gets an immediate reward r t Here we call the tuple (s t ,a t ,r t ,s t+1 ) is a transition and will be stored in the replay buffer for model update. The agent's goal is to optimize the strategy to maximize the expected cumulative reward J in the decision-making process. R (π):

[0103]

[0104] where γ∈(0,1] represents the discount factor. For our Prompt format exploration problem, we will make specific definitions of these state actions.

[0105] Status: s t Indicates the status indicators of the current LLM processing task, such as response speed, task processing accuracy, and prompt format.

[0106] Action: a t Indicates the behavior of selecting a format in the Prompt space. It represents an array, where each value in the array represents a replaceable character in the Prompt field. Therefore, the policy determines a Prompt format by giving a set of action arrays.

[0107] Reward: r t This represents the reward gained from transitioning from the old state to the new state after executing an action. We hope to make the LLM more responsive and accurate by changing the action, so the reward design can be divided into two parts.

[0108] In terms of response speed, the LLM task response time ResT of two adjacent time steps can be used t The ratio of quantifies the change in speed. We define ResTScore t Score the resource consumption at time step t:

[0109]

[0110] Similarly, the task processing accuracy at time step t is Acc t , we can also calculate the latency variation score PerfScore in a similar way t :

[0111]

[0112] Finally, the reward function can be expressed as:

[0113] r t =λ1*ResTScore t +λ2*PrefScore t

[0114] Furthermore, we use the reinforcement learning PPO algorithm to perform the optimization process of Prompt. PPO is an online policy optimization algorithm based on the actor-critic network architecture. Here, the critic network refers to the state-value equation used to evaluate the current policy, while the actor network updates the policy according to the critic network's recommendations. Specifically, the state-value function V ω (s) is defined as the expected reward that can be obtained by following the current policy in a given state s and can be obtained by minimizing the loss function Update the parameters.

[0115] V ω (s)=E[R(s t ,a t )+γV ω (s t+1 )|s t =s]

[0116] The advantage function measures the expected reward advantage of taking an action in a given state compared to the average action, which helps the policy network understand which actions are more likely to lead to higher rewards, thereby guiding the policy to improve towards these actions. In order to measure the difference between the actual reward and the current estimated state value, the Temporal Difference (TD) residual is defined as:

[0117] δ t =r t +γ*V ω (s t+1 )-V ω (s t )

[0118] We can then use Generalized Advantage Estimation (GAE) to calculate the advantage at time step t:

[0119]

[0120] Where k represents the offset from time step t, and λ∈[0,1] is a hyperparameter used to balance bias and variance. At the same time, the actor network can maximize the objective function L CLIP (θ) to update the strategy:

[0121] L CLIP (θ)=E[min(α t (θ)A t ,clip(α t (θ),1-∈,1+∈)A t )]

[0122] in represents the probability ratio of the new and old strategies, and ∈ represents the clipping parameter, which controls the distance between the new strategy and the old strategy, which can limit the update amplitude and make the training more stable.

[0123] Stage 2 root cause location based on the optimal prompt

[0124] 2.1 Prompt locates resource bottlenecks

[0125] First, we categorize and label microservice runtime data anomalies, such as insufficient CPU, insufficient memory, insufficient network bandwidth, and insufficient storage space. Each type of input data can have multiple labels. We then feed the pre-processed corpus data into the LLM for analysis. We then collect new log and metric data during microservice operation, feed it into the LLM, and generate resource location results.

[0126] However, microservice operational data is dispersed and multi-dimensional, often requiring simultaneous analysis of logs and metrics data to pinpoint the cause. Therefore, LLM analysis of logs may not yield direct inference results, but indirect secondary inference is possible. That is, after LLM provides log results, the final results from the two data sources can be unified by analyzing LLM's metrics data.

[0127] For example, some microservices don't output many memory-related logs, so LLM might not provide accurate results. However, metrics-related data clearly show persistently high memory usage or high memory fragmentation, indicating insufficient memory resources and the need to increase them. This multi-source data analysis approach to performing tasks is somewhat similar to multimodal technology. However, designing and training a model isn't necessary here; simply enabling LLM to understand the meaning of the input text based on prompts can accomplish the task.

[0128] 2.2 Microservice Resource Allocation and Performance Recovery

[0129] Once the critical resource bottleneck is located, performance can be restored by adjusting the microservice's resource parameters. Resource bottlenecks can be pinpointed to specific resource shortages, such as insufficient memory, disk space, or CPU processing power.

[0130] In addition to using Bayesian optimization or reinforcement learning to explore resources, we can also use LLM to make recommendations on how much resources to add.

[0131] It should be understood that the specific embodiments described herein are only used to explain this application and are not used to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0132] Obviously, the accompanying drawings are merely examples or embodiments of the present application. A person skilled in the art can also apply the present application to other similar situations based on these drawings without inventive effort. Furthermore, it is understandable that, although the work involved in this development process may be complex and lengthy, certain design, manufacturing, or production changes based on the technical content disclosed in this application are merely routine technical means for a person skilled in the art and should not be considered to constitute a deficiency in the disclosure of the present application.< / text> < / text> < / text> < / text>

Claims

1. A method for locating microservice resource bottlenecks, characterized in that: The method comprises: Use the target prompt format to parse the log information and indicator information of the microservice runtime. Use the large language model to analyze and make decisions based on the parsed log information and indicator information to find the resource bottlenecks that affect the performance of the microservice. The target prompt format is determined by a reinforcement learning model, which includes an agent, state, action, reward, and strategy. The state includes the current task response time, current task processing accuracy, and current prompt format of the large language model. The action includes updating the current prompt format based on the current strategy. The steps for determining the target prompt format include: The S100 agent sends the current Prompt format to the large language model; S200 determines that the large language model is based on the current task response time and the current task processing accuracy in the current prompt format, and calculates the current reward through the reward function. The reward function is: r t =λ1*ResTScore t +λ2*PrefScore t Among them, r t is the current reward, λ1 is the weight of the resource consumption score, and λ2 is the weight of the delay change score; ResTScore t PrefScore is the resource consumption score of the large language model at time t, which is determined according to the current task response time of the large language model. t is the delay change score of the large language model at time t, determined by the current task processing accuracy of the large language model; The S300 agent updates the current strategy with the current state and current reward, and updates the current Prompt format based on the updated current strategy; S400 loops through the actions of S100, S200, and S300 until the maximum cumulative reward appears, and uses the prompt format corresponding to the last non-zero reward as the target prompt format; The function for accumulating rewards is: Among them, γ∈(0,1] represents the discount factor and E is the mathematical expectation.

2. The microservice resource bottleneck location method according to claim 1, characterized in that: The syntax format is defined as Prompt format B n (A1,…,A n ,c)=A1cA2c…cA n ; Among them B n (A1,…,A n ,c) represents the whole sentence of Prompt, c represents the separator between fields, and the basic field is A(d,s,t), where d represents the first symbol, s represents the second symbol, and t represents text data; Different prompt formats have different first and second symbols.

3. The microservice resource bottleneck location method according to claim 2, characterized in that: The first symbol is a descriptor.

4. The microservice resource bottleneck location method according to claim 2, characterized in that: The second symbol is a separator.

5. The microservice resource bottleneck location method according to claim 1, characterized in that: The ResTScore t is defined as Among them, ResT t is the current task response time of the large language model at time t, ResTScore t Determined based on the current task response time of the large language model.

6. The microservice resource bottleneck location method according to claim 1, characterized in that: The PerfScore t is defined as Among them, Acc t is the current task processing accuracy of the large language model at time t, PerfSocre t Determined by the current task processing accuracy of the large language model.

7. The microservice resource bottleneck location method according to claim 1, characterized in that: The agent updates the current strategy with the current state and current reward, including: Based on the actor-critic network architecture, the objective function L is maximized. CLIP (θ) is used to update the current policy.

8. The microservice resource bottleneck location method according to claim 7, characterized in that: The maximized objective function L CLIP (θ) is defined as: L CLIP (θ)=E[min(α t (i)A t ,clip(a t (θ),1-∈,1+∈)A t )]; Where ∈ represents the cropping parameter and At represents the advantage function at time step t.

9. The microservice resource bottleneck location method according to claim 8, characterized in that: The α t (θ) is defined as Among them, α t (θ) represents the probability ratio of the new and old strategies.

10. A microservice resource allocation method, characterized in that: include: Determine various resource bottlenecks that affect microservice performance using the microservice resource bottleneck location method described in any one of claims 1 to 9; Determine whether there is a target resource item that has reached a resource bottleneck. If so, allocate resources corresponding to the target resource item to the microservice.

Citation Information

Patent Citations

  • Heterogeneous multi-edge cloud collaborative micro-service deployment and routing joint optimization method and system

    CN116915686A

  • Apparatus and method for monitoring optimization performance of deep learning compiler

    WO2024143588A1