Transform-based micro-service resource adaptive management method under cloud native architecture
By using the combination of Transformer and DDPG algorithms in the cloud-native architecture, the microservice node resources are dynamically adjusted, and the problem of low service quality and resource utilization under the cloud-native architecture is solved, and efficient resource management and performance improvement is achieved.
Patent Information
- Application Number
- CN202411607742.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2024-12-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The complex call relationship between microservice nodes under the cloud native architecture makes it difficult to ensure the end-to-end service quality of tasks and the resource utilization rate is low.
Adaptive management method of microservice resource based on Transformer is adopted, and the performance prediction model is constructed by collecting microservice resource-performance data, and the resource adjustment strategy is generated using the DDPG algorithm to dynamically adjust the CPU, memory and I/O resources of the microservice nodes to Meet preset service quality requirements.
It realizes that while meeting the end-to-end service quality, it maximizes the utilization rate of microservice node resources and improves system performance and efficiency.
Smart Images

Figure CN119149242A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic digital data processing technology, and in particular to a Transformer-based microservice resource adaptive management method under a cloud native architecture. Background Art
[0002] Cloud-native applications usually require the participation of hundreds or even thousands of microservice nodes. A downstream node may be called by multiple upstream nodes at the same time, and an upstream node may need to call multiple downstream nodes at the same time to complete a specific function. Therefore, the calls between these microservice nodes form a complex call topology. When users deploy their applications, this complex call relationship may make it difficult to ensure the end-to-end service quality of the task.
[0003] Traditional cloud computing originated from distributed networks and has the characteristics of high reliability, elastic expansion, and rapid deployment. However, with the increasing complexity and uncertainty of business types, traditional cloud computing can no longer meet the needs of enterprises, and cloud native has emerged. Cloud native refers to a technical system that is conducive to the elastic scalability and deployment of applications in dynamic environments such as public clouds, private clouds, or hybrid clouds. The main features are reflected in two aspects: containerization and microservices. It splits traditional monolithic cloud applications into multiple single-function, fine-grained, and loosely coupled microservices. After each microservice runs a specific function independently, it relies on lightweight container technology to package it and deploy it to the corresponding server.
[0004] Cloud-native applications usually require the participation of hundreds or even thousands of microservice nodes. A downstream node may be called by multiple upstream nodes at the same time, and an upstream node may need to call multiple downstream nodes at the same time to complete a specific function. Therefore, the calls between these microservice nodes form a complex call topology. When users deploy their applications, this complex call relationship may make it difficult to ensure the end-to-end quality of service (QoS) of the task.
[0005] Therefore, if the resources of each microservice node can be effectively managed and the microservice node resources on the critical path can be adjusted in real time and dynamically, on the one hand, the end-to-end QoS of the task can be effectively guaranteed, and on the other hand, the efficient use of resources can be promoted, thereby improving the overall performance and efficiency of the system.
[0006] However, since the applications under the cloud native architecture are composed of multiple microservices, some of these microservices are CPU-sensitive, some are memory-sensitive, and different microservices are independent of each other and complete very different tasks. Therefore, the demand for resources such as CPU, memory, cache, and I / O cannot be generalized. To improve the overall utilization of system resources, it is necessary to clarify the key demand resources of each microservice. In addition, since the functions implemented by microservice nodes are relatively simple, they need to complete the tasks through the interactive collaboration mode of calling. The two parties of the call are called upstream microservices and downstream microservices respectively. Since the application implements many functions, an upstream microservice can call different downstream microservices, and a downstream microservice can also be called by multiple upstream microservices. Usually when a request is called to the database, it will not generate further calls, so the microservice call graph tends to branch quickly like a tree. And a small number of microservices are hot spots in the call graph, shared by multiple online services. These hot microservices appear in nearly 90% of the call graphs.
[0007] In summary, since the applications under the cloud-native architecture are composed of multiple microservices, it is difficult to effectively ensure the end-to-end QoS of the task and improve the resource utilization of the microservice nodes. Summary of the invention
[0008] The main purpose of this application is to provide a Transformer-based microservice resource adaptive management method under a cloud-native architecture, aiming to solve the technical problem that it is difficult to ensure the end-to-end service quality of tasks when users deploy cloud-native applications.
[0009] To achieve the above objectives, the present application proposes a Transformer-based microservice resource adaptive management method under a cloud native architecture, wherein the method comprises:
[0010] Collect microservice resource-performance data for cloud-native applications;
[0011] Based on the Transformer mechanism, the performance prediction result of the microservice node is obtained according to the microservice resource-performance data;
[0012] When the performance prediction result does not meet the preset service quality requirement, based on the DDPG algorithm, a microservice resource adjustment strategy is generated according to the microservice resource-performance data corresponding to the performance prediction result;
[0013] The microservice resource adjustment strategy is transmitted to a microservice resource management system, and a microservice resource adjustment action is performed on the cloud native application.
[0014] The step of obtaining the performance prediction result of each microservice node based on the Transformer mechanism and the microservice resource-performance data includes:
[0015] Combining the microservice resource-performance data, a Transformer-based performance prediction model is constructed;
[0016] Input the microservice resource-performance data into the performance prediction model to obtain the predicted response time corresponding to each microservice node;
[0017] The predicted response time corresponding to each microservice node is output as the performance prediction result of each microservice node.
[0018] The step of building a Transformer-based performance prediction model in combination with the microservice resource-performance data includes:
[0019] Batch normalizing the microservice resource-performance data to obtain batch normalized data;
[0020] Based on the first Transformer model, feature selection is performed on the batch normalized data to obtain significant features of the decision step;
[0021] Based on the second Transformer model, feature processing is performed on the significant features of the decision step to obtain decision data;
[0022] The Transformer-based performance prediction model is generated according to the decision data.
[0023] When the performance prediction result does not meet the preset service quality requirement, based on the DDPG algorithm, according to the microservice resource-performance data corresponding to the performance prediction result, the step of generating a microservice resource adjustment strategy includes:
[0024] Based on the Actor Online network, execute corresponding resource scheduling actions according to the microservice resource-performance data corresponding to the performance prediction result;
[0025] Based on the Actor Target network, determining the corresponding next resource scheduling action according to the next state after the corresponding resource scheduling action is executed;
[0026] Based on the Critic Online network, the value parameter is updated to obtain the next value parameter;
[0027] Input the next resource scheduling action and the next value parameter into the Critic Target network to obtain the state-action Q value function at the next moment;
[0028] Based on the Critic Online network, the Q value function of the state-action at the current moment is calculated, and according to the state-action Q value function at the next moment and the state-action Q value function at the current moment, the microservice resource adjustment strategy corresponding to the microservice resource-performance data is determined.
[0029] The microservice resource adjustment strategy includes a CPU adjustment strategy, a memory adjustment strategy, and an I / O adjustment strategy. The microservice resource management system includes a CPU management system, a memory management system, and an I / O management system. The step of transmitting the microservice resource adjustment strategy to the microservice resource management system and executing the microservice resource adjustment action on the cloud native application includes:
[0030] After transmitting the microservice resource adjustment policy to the microservice resource management system, the microservice resource management system controls the CPU management system, the memory management system, and the I / O management system according to the CPU adjustment policy, the memory adjustment policy, and the I / O adjustment policy to adjust the microservice resources of the cloud native application.
[0031] The microservice resource-performance data includes container CPU usage parameters, container memory parameters, memory space parameters, memory read and write parameters, process execution data, and microservice node response time information. The step of collecting microservice resource-performance data of cloud native applications includes:
[0032] Based on the control group mechanism, collect container CPU usage parameters and container memory parameters in the cloud native application;
[0033] Based on the performance detection tool, collect memory space parameters, memory read and write parameters, and process execution data in the cloud native application;
[0034] Based on the distributed tracing system, the response time information of the microservice nodes in the cloud native application is collected.
[0035] Before the step of generating a microservice resource adjustment strategy based on the DDPG algorithm and the microservice resource-performance data corresponding to the performance prediction result when the performance prediction result does not meet the preset service quality requirement, the step further includes:
[0036] When the performance prediction result meets the preset service quality requirement, an action of collecting microservice resource-performance data of the cloud native application is executed.
[0037] In addition, to achieve the above purpose, the present application also proposes a microservice resource adaptive management system, the microservice resource adaptive management system comprising:
[0038] Data collection module, used to collect microservice resource-performance data of cloud-native applications;
[0039] A performance prediction module is used to obtain a performance prediction result of a microservice node based on the microservice resource-performance data based on a Transformer mechanism;
[0040] A strategy generation module, for generating a microservice resource adjustment strategy based on the DDPG algorithm and the microservice resource-performance data corresponding to the performance prediction result when the performance prediction result does not meet the preset service quality requirement;
[0041] The resource adjustment module is used to transmit the microservice resource adjustment strategy to the microservice resource management system and perform microservice resource adjustment actions on the cloud native application.
[0042] In addition, to achieve the above-mentioned purpose, the present application also proposes a microservice resource adaptive management device, the device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of a Transformer-based microservice resource adaptive management method under a cloud native architecture as described above.
[0043] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the Transformer-based microservice resource adaptive management method under a cloud native architecture as described above are implemented.
[0044] One or more technical solutions proposed in this application obtain the performance prediction results of microservice nodes based on the collected microservice resource-performance data of cloud-native applications through the Transformer mechanism; then, when the performance prediction results do not meet the preset service quality requirements, based on the DDPG algorithm, a microservice resource adjustment strategy is generated according to the microservice resource-performance data, and then the microservice resource adjustment action is performed on the cloud-native application according to the microservice resource adjustment strategy. When the microservice node does not meet the preset service quality requirements, the resources of the microservice node are dynamically adjusted in combination with DDPG, so as to achieve the purpose of maximizing the utilization of various fine-grained resources while meeting the end-to-end QoS. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0047] Figure 1 A flowchart of an embodiment of a Transformer-based microservice resource adaptive management method under a cloud native architecture provided by this application;
[0048] Figure 2 A detailed flow chart of step S200 in an embodiment of a Transformer-based microservice resource adaptive management method under a cloud native architecture provided by the present application;
[0049] Figure 3 A detailed flow chart of step S300 in an embodiment of a Transformer-based microservice resource adaptive management method under a cloud native architecture provided by the present application;
[0050] Figure 4 A brief flowchart of another embodiment of the Transformer-based microservice resource adaptive management method under the cloud native architecture provided by this application;
[0051] Figure 5 This is a schematic diagram of the module structure of the microservice resource adaptive management system according to an embodiment of the present application;
[0052] Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the Transformer-based microservice resource adaptive management method under the cloud native architecture in an embodiment of the present application.
[0053] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0054] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0055] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0056] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. The following embodiments and features in the embodiments may be combined with each other without conflict.
[0057] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0058] The embodiment of the present application uses the response time of service requests as QoS (quality of service) and proposes a method for adaptive management of microservice resources. First, collect the "resource-performance" data of the application in the absence of interference and in the face of various interferences. Next, based on the Transformer mechanism, quickly and efficiently process the resource characteristics of the microservice nodes, and accurately predict the performance of the microservice nodes. Subsequently, the deterministic policy gradient (DDPG) in the deep reinforcement learning algorithm is used to complete the dynamic and adaptive scheduling of resources such as CPU, memory, cache, and I / O. Maximize the utilization of various fine-grained resources while meeting end-to-end QoS.
[0059] In this embodiment, for ease of description, the following description is made with the microservice resource adaptive management system as the execution entity.
[0060] The present application embodiment provides a Transformer-based microservice resource adaptive management method under a cloud native architecture, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the Transformer-based microservice resource adaptive management method under the cloud native architecture of this application.
[0061] In this embodiment, the Transformer-based microservice resource adaptive management method under the cloud native architecture includes steps S100 to S400:
[0062] Step S100: Collect microservice resource-performance data of cloud-native applications.
[0063] In this embodiment, the resource-performance data includes but is not limited to container CPU usage parameters and container memory parameters in cloud-native applications, memory space parameters, memory read and write parameters and process execution data in cloud-native applications, and microservice node response time information in cloud-native applications.
[0064] Among them, the container CPU usage parameters in cloud-native applications include the priority of the container's use of the CPU, the reallocation of the container's CPU usage time, and the CPU cores used by the container; the container memory parameters in cloud-native applications include the container's memory limit and the swap threshold of the container's memory swap area.
[0065] The memory space parameters in cloud-native applications include virtual memory size, available memory size, memory size used as buffer, and memory size used as cache; memory read and write parameters include the size of memory written to and read from the swap area per second and the number of blocks read and written per second; process execution data includes user process execution time, system process execution time, idle time, waiting IO time, the number of processes in the running queue, and the number of processes waiting IO.
[0066] Optionally, based on the control group mechanism, the container CPU usage parameters and container memory parameters in the cloud native application are collected; based on the performance detection tool, the memory space parameters, memory read and write parameters and process execution data in the cloud native application are collected; based on the distributed tracing system, the microservice node response time information in the cloud native application is collected.
[0067] Specifically, the control group mechanism may be the Cgroups mechanism of Docker; the performance detection tool may be the vmstat performance detection tool of Linux; and the distributed tracing system may be the Jaeger distributed tracing system of Linux.
[0068] Furthermore, before step S100, the application running scenario of the cloud-native application is simulated through a cloud-native benchmark framework.
[0069] Optionally, based on a cloud-native benchmark framework, interactive and delay-sensitive services based on a microservice architecture are constructed. Among them, DeathStarBench can be used as a benchmark framework; interactive and delay-sensitive services can include social network services, hotel reservation services, media services, etc.
[0070] Furthermore, different types of interference such as CPU, memory, and I / O are simulated on each microservice node.
[0071] Specifically, the CPU performance test suite smallpt is used to create interference. As you can understand, Smallpt is a global illumination renderer that generates images by simulating the interaction between light and objects. The entire process requires calculating the position, behavior, and color of the points where light collides with objects. Therefore, when the CPU performance test suite smallpt is running, it will consume a lot of computing resources, thereby competing with the running microservice nodes for CPU resources.
[0072] The memory performance test suite ramspeed is used for testing. As you can understand, the memory performance test suite ramspeed runs a series of test scripts to continuously read and write memory, thereby consuming system memory resources, thereby causing memory resource interference to microservice nodes.
[0073] The test suite tiobench is used to simulate I / O interference. As can be understood, the test suite tiobench simulates different I / O operations, including reading, writing, random access, etc., through a series of test scripts to achieve I / O resource preemption.
[0074] The purpose of this is to simulate the competition for server resources among various applications in real application running scenarios, so as to further restore the actual application running scenarios of cloud-native applications.
[0075] Step S200: Based on the Transformer mechanism, the performance prediction result of the microservice node is obtained according to the microservice resource-performance data.
[0076] In this embodiment, before obtaining the performance prediction result of the microservice node, a performance prediction model is first constructed based on the Transformer mechanism. It should be noted that the performance prediction model is used to obtain the performance prediction result of the microservice node based on the microservice resource-performance data.
[0077] Optionally, if the response time of a microservice node is used as an evaluation indicator of service quality, the performance prediction result corresponds to the predicted response time of the microservice node, that is, the constructed performance prediction model is a microservice node response time prediction model.
[0078] like Figure 2 As shown, in one embodiment, step S200 includes:
[0079] Step S210: Building a Transformer-based performance prediction model based on the microservice resource-performance data;
[0080] Step S220: input the microservice resource-performance data into the performance prediction model to obtain the predicted response time corresponding to each microservice node;
[0081] Step S230: outputting the predicted response time corresponding to each microservice node as the performance prediction result of each microservice node.
[0082] Optionally, in step S210, the microservice resource-performance data is first batch normalized to obtain batch normalized data; then, based on the first Transformer model, feature selection is performed on the batch normalized data to obtain significant features of the decision step; and, based on the second Transformer model, feature processing is performed on the significant features of the decision step to obtain decision data; finally, the Transformer-based performance prediction model is generated according to the decision data. It should be noted that the first Transformer model here is Attentive Transformer, and the second Transformer model is Feature Transformer.
[0083] Furthermore, for the performance prediction model used to predict the response time of microservice nodes, the first step is to construct the encoding module and decoding module of the performance prediction model separately. The encoding module is composed of a sequential multi-step process of N decision steps, which is used to process microservice resource-performance data and output the corresponding microservice node response time; the decoding module can reconstruct the missing values in the original data according to the encoding results through self-supervised learning. Specifically, all collected microservice resource-performance data are represented by the set RT, and a specific feature is represented by To express, that is . The batch normalized data f after RT is processed by BN (batch normalization) is passed to each decision step to ensure that the features have the same dimension. Here, shares represents the priority of the container to use the CPU, cpus represents the CPU core used by the container, swap represents the virtual memory size, free represents the available memory size, and buff represents the memory size used as cache.
[0084] Then, in the second step, feature selection is performed on the batch normalized data f based on the Attentive Transformer. Specifically, a learnable Mask matrix M[i] is used to select more significant features in each decision step, and obtain significant features of the decision step, so that the performance prediction model can pay more attention to relevant features, thereby improving the overall learning efficiency of the performance prediction model. Implement Mask and get the result , It is based on the processing result of the previous step. The obtained formula can be expressed as: It should be noted that the sparsemax function is a normalization function that maps a set of real arrays to a probability distribution to generate a sparse probability distribution. Sparsemax normalization can make the result sparse, even if Sparseness also makes feature selection sparse. It is a trainable function composed of FC (Fully Connected) + BN. It represents the prior scale item, which represents the degree to which a feature in RT is used in the model training process, and can be expressed as: .in, is a relaxation parameter, The value of represents the number of times a feature can be used. Initialized to all 1, indicating that There is nothing a priori.
[0085] The third step is to process the significant features of the decision step based on Feature Transformer. Specifically, each decision step completes feature selection based on Attentive Transformer. After obtaining the significant features of the decision step, the selected significant features of the decision step are processed by Feature Transformer, and then the processing results are split into two parts, one of which is fed into the overall decision output, and the other is input into the next decision step, that is, .in, represents the part that feeds into the overall decision, Represents the input of the Attentive Transformer in the next decision step, It is necessary to explain that Feature Transformer contains feature sharing layer and feature independent layer. The former calculates feature commonality and shares parameters in all decision steps, while the latter calculates feature characteristics without parameter sharing. Furthermore, Feature Transformer is constructed by connecting every two shared layers with two independent layers. Each layer consists of FC layer + BN + GLU (linear gating unit), and multiplication is performed between each layer. Perform residual connections to stabilize model learning and reduce network variance fluctuations.
[0086] Step 4: Repeat steps 2 and 3 N times, that is, execute N decision steps, and you can get a complete performance prediction model for predicting the response time of microservice nodes. When all decision steps are executed in sequence, they will be integrated into an overall decision model. .
[0087] Finally, the output of the performance prediction model is obtained through a FC layer linear mapping .here, That is, the microservice node response time predicted by the performance prediction model represents the QoS of the node, thereby realizing the prediction of the microservice node performance.
[0088] Please continue to refer to Figure 1 , Step S300: When the performance prediction result does not meet the preset service quality requirement, based on the DDPG algorithm, a microservice resource adjustment strategy is generated according to the microservice resource-performance data corresponding to the performance prediction result.
[0089] In this embodiment, when the performance prediction result does not meet the preset service quality requirements, the microservice resource-performance data corresponding to the performance prediction result is input into the resource adaptive allocation model constructed based on the DDPG algorithm to obtain a microservice resource adjustment strategy.
[0090] It should be noted that the DDPG (Deep Deterministic Policy Gradient) algorithm is an algorithm that combines deep learning and reinforcement learning. It achieves efficient learning in continuous action space by combining deep neural networks and deterministic policy gradient algorithms. DDPG uses deep neural networks to approximate policy functions and action-value functions to directly output continuous action values. Specifically, DDPG uses a deterministic strategy and always outputs the same action in a given state to reduce the policy search space and improve learning efficiency; it uses an experience replay mechanism to store the experience generated by the interaction between the agent and the environment in a replay buffer, and randomly extracts a batch of experience for learning during training; in addition, when updating the value network, DDPG uses the target network to calculate the target Q value to reduce fluctuations during training and improve learning stability.
[0091] like Figure 3 As shown, in one embodiment, step S300 includes steps S310 to S350:
[0092] Step S310: Based on the Actor Online network, execute corresponding resource scheduling actions according to the microservice resource-performance data corresponding to the performance prediction result.
[0093] In this embodiment, the microservice resource-performance data corresponding to the performance prediction result includes the CPU, memory and I / O resource usage status of the current microservice node.
[0094] Optionally, the Actor Online network schedules resources based on the CPU, memory, and I / O resource usage status of the current microservice node, that is, based on the current status at time t. Perform a specific action , and interact with the microservice environment to generate rewards With next state , and use deterministic policy gradients to update policy parameters in the direction that increases the Q value function .in, Indicates the CPU resources used by the microservice node at time t, Represents the memory resources used by the node at time t, Indicates the I / O resources used by the node at time t, Indicates action Reallocate CPU resources to nodes. Indicates action Reallocate memory resources to nodes, Indicates action Redistribute I / O resources to nodes. Here, reward and the next moment state It can be expressed as: and ,in, , and Respectively represent the relative importance of the three resources.
[0095] It should be noted that represents the state space of the resource adaptive allocation model, where , Indicates the CPU resources used by the microservice node at time i. Indicates the memory resources used by the microservice node at time i. It represents the I / O resources used by the microservice node at time i, and n represents different times.
[0096] use represents the action space of the adaptive resource allocation model, where Indicates the first There are two resource allocation schemes: , Indicates execution of The CPU resources allocated to the microservice nodes in this resource allocation scheme are: Indicates execution of The memory resources allocated to the microservice nodes in this resource allocation scheme are: Indicates execution of The I / O resources allocated to the microservice nodes in this resource allocation scheme are: Indicates the number of resource allocation options.
[0097] use represents the total expected reward obtained by the resource adaptive allocation model, where is a discount factor, Represents the execution of an action The instant reward obtained after the invention defines is the ratio of the actual usage share of microservice node resources to the allocated share, that is: , and Indicates the relative importance of the CPU, memory, and I / O resource usage information of the microservice node.
[0098] use represents the target state-action Q value function of the resource adaptive allocation model based on DDPG, that is, the Q value obtained by executing the current resource adjustment plan. The Q value obtained to execute the next resource adjustment plan is calculated through the target Q network. Indicates the next state, Indicates the next action. Periodically from the Q value network parameters The entire resource adaptive allocation model is regarded as an agent. Indicates the strategy executed by the agent, namely: ,in is the policy network parameter. represents the experience replay pool, where , and They represent the state at time t, the action performed, and the reward obtained, respectively. Represents the state at the next moment. The interaction sequence between the agent and the environment is replayed through experience replay technology. Deposit into experience pool.
[0099] Step S320: Based on the Actor Target network, a corresponding next resource scheduling action is determined according to the next state at the next moment after the corresponding resource scheduling action is executed.
[0100] Optionally, the Actor Target network determines the next resource scheduling action based on the next state S' sampled in the experience playback pool , which provides the strategy for the next state, and its parameters Depend on Soft update: .
[0101] in, , which means that the parameters of the Target network are restricted to change slowly, improving the stability of learning.
[0102] Step S330: Based on the Critic Online network, the value parameters Update to get the next value parameter . It can be expressed as: .
[0103] Step S340: input the next resource scheduling action and the next value parameter into the Critic Target network to obtain the state-action Q value function at the next moment.
[0104] Optionally, use the Critic Target network to calculate the state-action Q value function at the next moment ,in Represents the next resource scheduling action obtained by the Actor Target network .
[0105] Step S350: Based on the Critic Online network, the Q value function of the current state-action is calculated, and according to the state-action Q value function at the next moment and the state-action Q value function at the current moment, the microservice resource adjustment strategy corresponding to the microservice resource-performance data is determined.
[0106] Optionally, the Q-value function of the current state-action is calculated through the Critic Online network Used to evaluate the current strategy. Therefore, the target value of the Q value function in the current state is calculated through the Critic Online network for: .
[0107] Furthermore, the Critic Online network value parameters are updated by minimizing the mean square error , and its loss function is: .
[0108] Repeat steps S310 to S350 until the target value calculated by the Critic Online network is Maximum, representing the reward value corresponding to the resource adaptive allocation model at this time Maximum, that is, the resource utilization of the microservice node is the largest, select this time Corresponding strategy parameters As the microservice resource adjustment strategy corresponding to the microservice resource-performance data, action A is selected in the face of state S, that is: .
[0109] Please continue to refer to Figure 1 , step S400: passing the microservice resource adjustment policy to the microservice resource management system, and executing the microservice resource adjustment action on the cloud native application.
[0110] In this embodiment, the microservice resource adjustment strategy includes a CPU adjustment strategy, a memory adjustment strategy and an I / O adjustment strategy, and the microservice resource management system includes a CPU management system, a memory management system and an I / O management system.
[0111] Optionally, after transmitting the microservice resource adjustment policy to the microservice resource management system, the microservice resource management system controls the CPU management system, memory management system and I / O management system according to the CPU adjustment policy, memory adjustment policy and I / O adjustment policy to adjust the microservice resources of the cloud native application.
[0112] Specifically, the CPU management system can use the CPU subsystem commands cpu.cfs_period_us and cpu.cfs_quota_us in the Linux kernel management tool Cgroups to adjust the CPU of the microservice node according to the CPU adjustment policy. The memory management system can use Intel's CAT tool to adjust the memory and LLC of the microservice node according to the memory adjustment policy. The I / O management system can use the blkio subsystem in Cgroups to adjust the hard disk throughput according to the I / O adjustment policy to adjust the I / O of the microservice node.
[0113] In the technical solution provided in this embodiment, the performance prediction results of the microservice nodes are obtained based on the collected microservice resource-performance data of the cloud native application based on the Transformer mechanism; then when the performance prediction results do not meet the preset service quality requirements, based on the DDPG algorithm, a microservice resource adjustment strategy is generated according to the microservice resource-performance data, and then according to the microservice resource adjustment strategy, the microservice resource adjustment action is performed on the cloud native application. When the microservice node does not meet the preset service quality requirements, the resources of the microservice node are dynamically adjusted in combination with DDPG, so as to achieve the purpose of maximizing the utilization of various fine-grained resources while meeting the end-to-end QoS.
[0114] Further, in order to help understand the implementation process of the Transformer-based microservice resource adaptive management method under the cloud native architecture obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 4 , Figure 4 This paper provides a brief flow chart of the Transformer-based microservice resource adaptive management method in a cloud-native architecture. Specifically:
[0115] First, collect the microservice resource-performance data of the cloud native application. Then, based on the Transformer mechanism, obtain the performance prediction results of the microservice node according to the microservice resource-performance data. Then determine whether the performance prediction results meet the preset service quality requirements. For example, determine whether the predicted response time corresponding to the microservice node exceeds the response time range specified by QoS.
[0116] When the performance prediction result does not meet the preset service quality requirements, for example, when the predicted response time corresponding to the microservice node exceeds the response time range specified by QoS, based on the DDPG algorithm, a microservice resource adjustment strategy is generated according to the microservice resource-performance data corresponding to the performance prediction result; and the microservice resource adjustment strategy is transmitted to the microservice resource management system to execute the microservice resource adjustment action on the cloud native application.
[0117] When the performance prediction result meets the preset service quality requirements, for example, when the predicted response time corresponding to the microservice node is within the response time range specified by QoS, return to the step of executing the microservice resource-performance data of the cloud native application.
[0118] For example, DeathStarBench is run to simulate a real application running scenario, and social network and media service applications are deployed on a local server.
[0119] Then, we use Docker's Cgroups mechanism and Linux performance detection tool vmstat to obtain microservice resource-performance data of microservices in social network and media service applications, including CPU priority shares, CPU core number cpus, memory swap threshold swappiness, virtual memory size swap, available memory size free, swap read and write memory size si and so, user process execution time us, system process execution time sy. At the same time, we use the distributed tracking system Jaeger to collect microservice performance data, that is, the response time t of the corresponding node. Assume that we get the microservice resource-performance data of 10 microservice nodes as shown in Table 1, that is, 10 data instances.
[0120] Table 1 Microservice resource-performance data example
[0121] Then, initialize the performance prediction model for predicting the response time of microservice nodes. , based on the performance prediction model, the response time of the 10 data instances in Table 1 is predicted. After the performance prediction model performs feature selection and feature calculation on shares, cpus, swappiness and other features in all decision steps, it uses the formula With formula Calculate the output of the performance prediction model, that is, the performance prediction result. And record the prediction result in Table 2 middle.
[0122] Table 2 Prediction results of performance prediction model output
[0123] Assume that the response time specified by QoS should be less than 14, and based on The data instance 4 and data instance 8 with predicted response times of 19 and 15 are beyond the specified range of QoS, so adaptive resource management is required.
[0124] According to the physical resources of the local server, the adjustment range of various resources of the microservice node is determined as follows: , and initialize the value function to The three resource adjustment schemes are as follows:
[0125]
[0126]
[0127]
[0128] Then, set the formula In , and use this formula to calculate the corresponding reward value r when adopting the above three resource adjustment schemes. The results are as follows.
[0129] Adoption plan When , the value of each element in S is , the value of each element in A is Therefore, the reward value .
[0130] Adoption plan When , the value of each element in S is , the value of each element in A is Therefore, the reward value .
[0131] Adoption plan When , the value of each element in S is , the value of each element in A is Therefore, the reward value .
[0132] Then, set the formula In The formula is used to calculate the value function obtained when the above three resource adjustment schemes are adopted Target value , and the results are as follows.
[0133]
[0134]
[0135]
[0136] Through the above calculation, we can get the resource adjustment plan The target value of the value function Q obtained when is the largest, therefore, Option 2 is finally selected as the resource adjustment strategy.
[0137] Finally, through the corresponding Cgroups and Intel CAT instructions, the number of CPUs is adjusted to 8, the memory capacity is 1GB, and the I / O capacity is 1GB.
[0138] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the Transformer-based adaptive management method of microservice resources under the cloud native architecture of the present application. More forms of simple transformations based on this technical concept are all within the scope of protection of the present application.
[0139] In addition, refer to Figure 5 This embodiment also proposes a microservice resource adaptive management system, and the microservice resource adaptive management system includes:
[0140] The data collection module 10 is used to collect microservice resource-performance data of cloud native applications;
[0141] The performance prediction module 20 is used to obtain the performance prediction result of the microservice node based on the microservice resource-performance data based on the Transformer mechanism;
[0142] A strategy generation module 30, for generating a microservice resource adjustment strategy based on the DDPG algorithm and the microservice resource-performance data corresponding to the performance prediction result when the performance prediction result does not meet the preset service quality requirement;
[0143] The resource adjustment module 40 is used to transmit the microservice resource adjustment policy to the microservice resource management system and perform microservice resource adjustment actions on the cloud native application.
[0144] The microservice resource adaptive management system provided by the present application adopts the Transformer-based microservice resource adaptive management method under the cloud native architecture in the above-mentioned embodiment, which can solve the technical problem that it is difficult to ensure the end-to-end service quality of the task when the user deploys a cloud native application. Compared with the prior art, the beneficial effects of the microservice resource adaptive management system provided by the present application are the same as the beneficial effects of the Transformer-based microservice resource adaptive management method under the cloud native architecture provided by the above-mentioned embodiment, and the other technical features in the microservice resource adaptive management system are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here.
[0145] The present application provides a microservice resource adaptive management device, which includes: at least one processor; and a memory in communication with the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the Transformer-based microservice resource adaptive management method under the cloud native architecture in the above-mentioned embodiment 1.
[0146] Reference below Figure 6 , which shows a schematic diagram of the structure of a microservice resource adaptive management device suitable for implementing the embodiment of the present application. The microservice resource adaptive management device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The microservice resource adaptive management device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0147] like Figure 6As shown, the microservice resource adaptive management device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the microservice resource adaptive management device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the microservice resource adaptive management device to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a microservice resource adaptive management device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided instead.
[0148] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0149] The microservice resource adaptive management device provided by the present application adopts the Transformer-based microservice resource adaptive management method under the cloud native architecture in the above-mentioned embodiment, which can solve the technical problem that it is difficult to ensure the end-to-end service quality of the task when the user deploys a cloud native application. Compared with the prior art, the beneficial effects of the microservice resource adaptive management device provided by the present application are the same as the beneficial effects of the Transformer-based microservice resource adaptive management method under the cloud native architecture provided by the above-mentioned embodiment, and the other technical features in the microservice resource adaptive management device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0150] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0151] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0152] The present application provides a computer-readable storage medium having computer-readable program instructions (i.e., computer programs) stored thereon, and the computer-readable program instructions are used to execute the Transformer-based microservice resource adaptive management method under the cloud native architecture in the above-mentioned embodiment.
[0153] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0154] The computer-readable storage medium may be included in the microservice resource adaptive management device; or may exist independently without being assembled into the microservice resource adaptive management device.
[0155] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the microservice resource adaptive management device, the microservice resource adaptive management device: collects microservice resource-performance data of the cloud native application; based on the Transformer mechanism, obtains the performance prediction result of the microservice node according to the microservice resource-performance data; when the performance prediction result does not meet the preset service quality requirement, based on the DDPG algorithm, generates a microservice resource adjustment strategy according to the microservice resource-performance data corresponding to the performance prediction result; transmits the microservice resource adjustment strategy to the microservice resource management system, and executes the microservice resource adjustment action on the cloud native application.
[0156] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0157] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0158] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0159] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the Transformer-based adaptive microservice resource management method under the above-mentioned cloud native architecture, and can solve the technical problem that it is difficult to ensure the end-to-end service quality of tasks when users deploy cloud native applications. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the Transformer-based adaptive microservice resource management method under the cloud native architecture provided in the above-mentioned embodiments, and will not be repeated here.
[0160] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A Transformer-based microservice resource adaptive management method under a cloud native architecture, characterized in that: The method includes: Collect microservice resource-performance data for cloud-native applications; Based on the Transformer mechanism, the performance prediction result of the microservice node is obtained according to the microservice resource-performance data; When the performance prediction result does not meet the preset service quality requirement, based on the DDPG algorithm, a microservice resource adjustment strategy is generated according to the microservice resource-performance data corresponding to the performance prediction result; The microservice resource adjustment strategy is transmitted to a microservice resource management system, and a microservice resource adjustment action is performed on the cloud native application.
2. The method according to claim 1, characterized in that The step of obtaining the performance prediction result of each microservice node based on the Transformer mechanism and the microservice resource-performance data includes: Combining the microservice resource-performance data, a Transformer-based performance prediction model is constructed; Input the microservice resource-performance data into the performance prediction model to obtain the predicted response time corresponding to each microservice node; The predicted response time corresponding to each microservice node is output as the performance prediction result of each microservice node.
3. The method according to claim 2, characterized in that The step of building a Transformer-based performance prediction model in combination with the microservice resource-performance data includes: Batch normalizing the microservice resource-performance data to obtain batch normalized data; Based on the first Transformer model, feature selection is performed on the batch normalized data to obtain significant features of the decision step; Based on the second Transformer model, feature processing is performed on the significant features of the decision step to obtain decision data; The Transformer-based performance prediction model is generated according to the decision data.
4. The method according to claim 1, characterized in that When the performance prediction result does not meet the preset service quality requirement, based on the DDPG algorithm, according to the microservice resource-performance data corresponding to the performance prediction result, the step of generating a microservice resource adjustment strategy includes: Based on the Actor Online network, execute corresponding resource scheduling actions according to the microservice resource-performance data corresponding to the performance prediction result; Based on the Actor Target network, determining the corresponding next resource scheduling action according to the next state after the corresponding resource scheduling action is executed; Based on the Critic Online network, the value parameter is updated to obtain the next value parameter; Input the next resource scheduling action and the next value parameter into the Critic Target network to obtain the state-action Q value function at the next moment; Based on the Critic Online network, the Q value function of the state-action at the current moment is calculated, and according to the state-action Q value function at the next moment and the state-action Q value function at the current moment, the microservice resource adjustment strategy corresponding to the microservice resource-performance data is determined.
5. The method according to claim 1, characterized in that The microservice resource adjustment strategy includes a CPU adjustment strategy, a memory adjustment strategy, and an I / O adjustment strategy. The microservice resource management system includes a CPU management system, a memory management system, and an I / O management system. The step of transmitting the microservice resource adjustment strategy to the microservice resource management system and executing the microservice resource adjustment action on the cloud native application includes: After transmitting the microservice resource adjustment policy to the microservice resource management system, the microservice resource management system controls the CPU management system, the memory management system, and the I / O management system according to the CPU adjustment policy, the memory adjustment policy, and the I / O adjustment policy to adjust the microservice resources of the cloud native application.
6. The method according to claim 1, characterized in that The microservice resource-performance data includes container CPU usage parameters, container memory parameters, memory space parameters, memory read and write parameters, process execution data, and microservice node response time information. The step of collecting microservice resource-performance data of cloud native applications includes: Based on the control group mechanism, collect container CPU usage parameters and container memory parameters in the cloud native application; Based on the performance detection tool, collect memory space parameters, memory read and write parameters, and process execution data in the cloud native application; Based on the distributed tracing system, the response time information of the microservice nodes in the cloud native application is collected.
7. The method according to claim 1, characterized in that Before the step of generating a microservice resource adjustment strategy based on the DDPG algorithm and the microservice resource-performance data corresponding to the performance prediction result when the performance prediction result does not meet the preset service quality requirement, the step further includes: When the performance prediction result meets the preset service quality requirement, an action of collecting microservice resource-performance data of the cloud native application is executed.
8. A microservice resource adaptive management system, characterized in that: The system comprises: Data collection module, used to collect microservice resource-performance data of cloud-native applications; A performance prediction module is used to obtain a performance prediction result of a microservice node based on the microservice resource-performance data based on a Transformer mechanism; A strategy generation module, for generating a microservice resource adjustment strategy based on the DDPG algorithm and the microservice resource-performance data corresponding to the performance prediction result when the performance prediction result does not meet the preset service quality requirement; The resource adjustment module is used to transmit the microservice resource adjustment strategy to the microservice resource management system and perform microservice resource adjustment actions on the cloud native application.
9. A microservice resource adaptive management device, characterized in that: The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of a Transformer-based microservice resource adaptive management method under a cloud native architecture as described in any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the Transformer-based microservice resource adaptive management method under a cloud native architecture are implemented as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Rainfall prediction method based on feature engineering and TabNet network
CN114021789A
Micro-service active scaling method based on time-space diagram neural network load prediction
CN115499511A
Distributed micro-service scheduling optimization method
CN115714820A
Resource scheduling method and device, equipment and storage medium
CN116257363A
Systems, methods, kits, and apparatuses for edge-distributed storage and querying in value chain networks
WO2022240906A1
