A method for microservice node performance prediction and resource adaptive adjustment based on convolutional neural network

By applying a combination method of convolutional neural network and deep reinforcement learning on microservice nodes, the response time is predicted and resources are dynamically adjusted, and the problem of low prediction accuracy of response time and resource management in the existing technology is solved, and efficient resource utilization and service quality assurance is achieved.

CN119127512BActive Publication Date: 2025-02-28YUNNAN NORMAL UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411607748.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-02-28
Estimated Expiration
2044-11-12

AI Technical Summary

Technical Problem

The prior art has low accuracy when predicting the response time of microservice nodes, and it is difficult to effectively consider global resource scheduling during resource management, resulting in difficulty in ensuring end-to-end service quality.

Method used

The microservice node performance prediction model (CNNRPM) based on convolutional neural network is adopted, combined with the resource allocation model of deep reinforcement learning, and predict the response time and dynamically adjust the CPU, memory and I/O resources through simulation application benchmarking and performance monitoring.

Benefits of technology

It achieves the maximization of resource usage efficiency while meeting the end-to-end service quality, and improves the accuracy of resource prediction and the global nature of resource scheduling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The present invention relates to a method for predicting the performance of microservice nodes and adaptively adjusting resources based on convolutional neural networks, and belongs to the field of resource allocation under cloud native. First, a benchmark tool is used to simulate actual applications, and resources are pre-allocated according to task requirements. Secondly, a performance monitoring tool is used to collect microservice node resource performance data. Then, a resource prediction model (CNNRPM) based on a convolutional neural network is constructed in combination with the acquired microservice node resource performance data to predict the response time of the microservice node. Then, according to the response time of the microservice node, a resource allocation model based on deep reinforcement learning is constructed to implement an adaptive resource adjustment strategy. Finally, a resource management tool is used to implement the adjustment of various types of resources according to the adaptive resource adjustment strategy. The present invention uses the response time of the application as a Qos indicator, so that the user application can maximize the resource utilization efficiency while meeting the Qos indicator.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a microservice node performance prediction and resource adaptive adjustment method based on convolutional neural network, belonging to the field of cloud native resource allocation. Background Art

[0002] Cloud native is a new development architecture that supports building and running applications in distributed servers. This architecture enables highly automated, elastic, scalable, and easy-to-maintain application development. Compared with traditional monolithic clouds, cloud native decouples complex, multifunctional applications into multiple independent, modular microservice nodes, each of which focuses on performing specific business functions and interacts with other nodes through communication mechanisms such as message queues and remote calls. This approach allows application developers to develop and deploy multiple functional modules in parallel, greatly shortening the software development cycle.

[0003] However, due to the loose coupling and fine-grained nature of microservices, the execution of a task (such as e-commerce transactions, streaming media services, etc.) may require the participation of hundreds or even thousands of microservice units, and the serial, parallel, remote call and other cooperative and competitive relationships between these massive nodes may make it difficult to effectively guarantee the end-to-end quality of service (QoS) of the task. If it is possible to track the resource usage of each microservice node in real time, and timely predict the performance of each node on the critical path, and finally adjust the node resources that may cause QoS violations in real time based on the prediction results, it can guarantee the QoS of end-to-end services to a certain extent, while improving the overall resource utilization of the server. The current work still has the following two limitations when ensuring the end-to-end QoS of the task.

[0004] In terms of predicting microservice node performance, the resource usage and performance data collected by service providers are in tabular form, but the current methods have low accuracy when building prediction models based on these tabular data. Traditional machine learning models usually need to manually select, convert, and combine resource features when processing such "resource-performance" tabular data, which increases the workload of data processing; on the other hand, the tabular data reflecting the resource usage of microservice nodes usually contains a large number of high-dimensional sparse resource features (for example: when a node frequently communicates with other nodes, the CPU idle time collected on the node through the profiling tool is mostly 0), and processing these features requires a lot of memory and computing resources.

[0005] In terms of resource management of microservice nodes, since the application is composed of multiple microservice nodes, there is a mutual calling relationship between the nodes. A microservice node can call multiple microservices and may also be called by multiple microservices. Therefore, when adjusting the microservice node resources, the global resources of the server must be considered, and not just a single node.

[0006] In the prior art, there are two main ways to manage microservice resources. One is to allocate resources to target users based on user needs; the other is to adjust resources according to priority based on task data volume requirements and request response time.

[0007] "Cloud Computing Resource Management Method, Device, Equipment and Computer Storage Medium", Chinese Invention Patent, (CN116915572A), 2023, determines the target tenant's cloud platform usage capability and cloud resource usage efficiency based on tenant behavior data to adjust resource allocation for the target tenant. However, they do not consider the usage of various resources.

[0008] "A Data Processing Method and System Based on Cloud Computing", Chinese Invention Patent, (CN118152124A), 2024, uses a time series prediction model based on the LSTM model and a cloud computing resource allocation formula, combined with a real-time monitoring system to dynamically adjust the amount of allocated cloud computing resources in real time. However, although this invention performs well in processing time series data, its training process may require a lot of computing resources and time.

[0009] "Resource Adjustment Method, Cloud Computing Resource Adjustment Method, Computing Device", Chinese Invention Patent, (CN118277104A), 2024, This invention uses the correlation between data volume and request response time for task data to determine the expected response time of calling a data processing service to process the task data, and calculates the target response time and target computing resources based on existing computing resources, thereby adjusting existing resources. This method relies on the correlation between data volume and request response time for prediction. If this correlation is unstable or difficult to accurately model, the accuracy of the prediction may be affected, thereby affecting the effect of resource adjustment.

[0010] Therefore, the present invention takes the response time of the application as QoS and proposes a microservice node performance prediction and resource adaptive adjustment method based on convolutional neural network, so that user applications can maximize resource utilization efficiency while meeting QoS indicators. Summary of the invention

[0011] The technical problem to be solved by the present invention is to provide a microservice node performance prediction and resource adaptive adjustment method based on convolutional neural network, so as to solve the problem that when the traditional resource prediction model predicts that the response time of the microservice node is abnormal, the CPU, memory, I / O and other resources of the microservice node can be dynamically adjusted, thereby achieving maximum resource utilization efficiency while meeting end-to-end QoS.

[0012] The technical solution of the present invention is: a method for predicting microservice node performance and adaptively adjusting resources based on a convolutional neural network, the specific steps of which are:

[0013] Step 1: Use benchmark tools to simulate actual applications and pre-allocate resources based on task requirements;

[0014] Step 2: Use performance monitoring tools to collect microservice node resource performance data and build a data set;

[0015] Step 3: Build a CNNRPM model based on the data set to predict the response time of microservice nodes;

[0016] Step 4: According to the response time of microservice nodes, a resource allocation model based on deep reinforcement learning is constructed to implement adaptive resource adjustment strategy;

[0017] Step 5: Use resource management tools to adjust server CPU, memory, and I / O resources according to the adaptive resource adjustment strategy.

[0018] The Step 1 is specifically as follows:

[0019] Interference is injected using a benchmark tool to simulate actual application scenarios, so that each microservice node competes for the server CPU, memory, and I / O resources, thereby pre-allocating resources for each microservice. The interference is CPU-intensive interference, I / O-intensive interference, and memory-intensive interference.

[0020] The Step 2 is specifically as follows:

[0021] Step 2.1: Use the physical resource isolation mechanism provided by the performance monitoring tool to initialize the resource allocation of each microservice node, use the distributed tracking system to collect the response time of the microservice node, and complete the collection of resource performance data in a non-interference state;

[0022] Step 2.2: Run the interference program on each microservice node. By running the test suite, the test suite continuously emits light, traces the light path, and interacts with objects in the scene to seize CPU resources and complete the competition for server CPU, memory, and I / O resources among each node.

[0023] Step 2.3: Collect the resource usage and response time data of the microservice nodes under interference conditions, process the collected data with and without interference, complete data preparation, and build a "resource-performance" data set.

[0024] The Step 3 is specifically as follows:

[0025] Step 3.1: Initialize the CNNRPM model , all "resource-performance" data is collected Indicates that there are a total of Data instances, each of which contains microservice node resource demand data and response time ; Each piece of data is represented as , ; The nth data is ,in Indicates the value of the CPU for the nth data. Indicates the value of the nth data memory. Indicates the value of the nth data IO, Indicates the actual response time of the nth data; Step 3.2: Each data Convert to a two-dimensional embedding, map each resource feature in the table data to a pixel value in a two-dimensional space, and then arrange these pixel values ​​in a two-dimensional matrix from left to right and from top to bottom, so that each feature is in the correct position in the two-dimensional matrix, and perform filling and alignment operations to generate a feature image , the generated feature image is used as the input of the initial CNNRPM model, and it passes through the convolution layer in sequence to perform convolution operations on the data, and uses the convolution kernel of the custom size to extract the features of the input data, and then passes through the pooling layer to reduce the dimension of the features. After repeated multiple times, it enters the fully connected layer to learn the relationship between the features, and finally classifies and outputs them to complete the construction of the CNNRPM prediction model;

[0026] Step 3.3: Predict the data sets one by one Response time of all resource-performance data in The response time prediction result of the data is , and then calculate the The actual response time of the data and prediction results The error between them is as follows:

[0027]

[0028] in, Every piece of data, The real time of the nth data, , Represents the total number of samples. When the error between the true value and the predicted value is smaller, the actual output probability is closer to the expected output probability, and the predicted result is closer to the true result, the real time can be directly reflected by the predicted time. The CNNRPM prediction model is used to predict the response time of all microservice nodes. If the end-to-end response service quality Qos is not met, a resource allocation model based on deep reinforcement learning is constructed to make a resource adjustment strategy.

[0029] The Step 4 is specifically as follows:

[0030] Step 4.1: After receiving the feedback information from the CNNRPM model that the end-to-end service quality Qos exceeds the threshold range, in the resource allocation model based on deep reinforcement learning, the experience pool is first initialized , Actor network, Critic network and microservice node collection Status , is the actual number of CPU cores used, is the actual memory capacity used. is the I / O throughput, the Actor network performs actions based on the state ={ , , }, Indicates the CPU resources used by the microservice node at time i. Indicates the memory resources used by the microservice node at time i. Represents the I / O resources used by the microservice node at time i. The set ,in Indicates microservice nodes;

[0031] Step 4.2: Calculation The reward value at the time and the state value at the next moment ;

[0032] Step 4.3: The Online network in the Critic network outputs according to the Actor network The state-action at the moment uses the following formula to update the Q value function and store the Q value function:

[0033]

[0034] in, is the critic network parameter, yes The state of the moment, is based on The action value taken according to the state at the moment, is the reward value obtained. At the same time, the Target network of the Critic network adds a Gaussian noise function, estimates the Q value function of the state-action at the next moment using the following formula, and stores the Q value function as the target Q value function:

[0035]

[0036] in, are the parameters of the critic online network, yes The state of the moment, is based on The action value taken according to the state at the moment, is the reward value obtained, The function obeys the Bellman equation, which is The sum of the Q value function updated by the state-action value at the moment and the Q value function updated by obtaining the next state value is The target Q-value function at the moment;

[0037] Step 4.4: Update the network parameters by minimizing the mean square error between the current Q value and the target Q value, and use As the update parameter, the error function is:

[0038]

[0039] is the discount factor, and , already obtained The Q-value function at time The Q value function at the moment determines the update range of the network parameters of the Q value function through the value of the error function, thereby updating the network parameters;

[0040] Update the Actor network parameters and Critic network parameters at the same time;

[0041] Step4.5: Repeat Step4.2-Step4.4. When the reward value in Step4.2 When it is close to 1 and the result does not change, the Online network in the Critic network calculates The maximum value indicates that the resource utilization of this microservice node is the highest, which satisfies the end-to-end service quality Qos. The strategy is used as the microservice resource adjustment strategy.

[0042] The Step 4.2 is specifically as follows:

[0043] The Markov game model is used as the basis of the resource allocation model of deep reinforcement learning, and the resource allocation model of deep reinforcement learning is composed of the tuple ,in represents the state space, represents the action space, represents the reward set, represents the state transition probability, in each At this moment, each microservice node According to your current status , take appropriate action , through the state transition probability function Generate the next state , each microservice node agent Obtain rewards through state and action functions , the goal of each microservice node is to maximize the reward function:

[0044]

[0045] in, is the discount factor and , It measures the impact of future rewards on current actions. It is Microservice nodes in Always take action The rewards you get when It is the ratio of the actual usage share of microservice node resources to the allocated share, which can be calculated according to the formula:

[0046]

[0047] in, , and represents the weight, yes The actual number of CPU cores used at the moment, yes The actual memory capacity used at all times, yes I / O throughput at the moment, Indicated in Time is allocated to microservice nodes The resource quota set, that is, { , , },when , , The larger the ratio, the closer the resource allocation share allocated to the microservice node is to the actual demand.

[0048] The beneficial effect of the present invention is that when the response time of the microservice node predicted by the CNNRPM model is abnormal, the present invention dynamically adjusts the CPU, memory, I / O and other resources of the microservice node, thereby achieving end-to-end QoS while maximizing the efficiency of resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 is a flow chart of the steps of the present invention;

[0050] Figure 2 It is the overall architecture diagram of the present invention;

[0051] Figure 3 It is a resource prediction model diagram improved by the present invention based on convolutional neural network;

[0052] Figure 4 This is a resource allocation model diagram based on deep reinforcement learning in the present invention. DETAILED DESCRIPTION

[0053] The present invention will be further described below in conjunction with the accompanying drawings and specific implementation methods.

[0054] Example 1: Figure 1 As shown, a method for predicting microservice node performance and adaptively adjusting resources based on a convolutional neural network is described, and the specific steps are as follows:

[0055] Step 1: Use benchmark tools to simulate actual applications and pre-allocate resources based on task requirements.

[0056] The present invention first simulates the operation of applications in real scenarios based on the container engine Docker and the benchmark tool DeathStarBench. DeathStarBench is an open source toolset for cloud-native environments. It builds six interactive and delay-sensitive services (such as social networks, video streaming, e-commerce, and cluster control services) based on the microservice architecture, covering currently popular cloud and edge applications. First, establish a local cluster based on Docker where DeathStarBench is deployed. Then, interference is injected through the Phoronix Test Suite test suite to simulate the competition of each microservice node for server CPU, memory, I / O and other resources in actual application scenarios. The interference details are as follows:

[0057] CPU-intensive interference: Interference is performed through the smallpt test suite in the Phoronix Test Suite. The Smallpt test suite simulates the CPU calculation process in the ray tracing algorithm by continuously emitting rays and tracing their paths, as well as interacting with objects in the scene. This process requires a lot of computing resources to complete, so it can be used to achieve CPU resource preemption.

[0058] I / O intensive interference: Use tiobench in the Phoronix Test Suite to implement I / O interference. Tiobench can simulate a series of file system operations, including read, write, random read, and random write, to achieve I / O resource preemption.

[0059] Memory-intensive interference: Memory resources are preempted by writing a script file in Linux. First, a temporary directory is created and mounted as a memory-based temporary file system tmpfs. The size is specified for it, and then data is written to the block file under the directory, thereby consuming system memory resources and preempting memory resources.

[0060] Step 2: Use performance monitoring tools to collect microservice node resource performance data and build a data set.

[0061] Step 2.1: Use the physical resource isolation mechanism provided by the performance monitoring tool to initialize the resource allocation of each microservice node, use the distributed tracking system to collect the response time of the microservice node, and complete the collection of resource performance data in a non-interference state;

[0062] Step 2.2: Run the interference program on each microservice node. By running the test suite, the test suite continuously emits light, traces the light path, and interacts with objects in the scene to seize CPU resources and complete the competition for server CPU, memory, and I / O resources among each node.

[0063] Step 2.3: Collect the resource usage and response time data of the microservice nodes under interference conditions, process the collected data with and without interference, complete data preparation, and build a "resource-performance" data set.

[0064] Specifically, we use the Linux analysis tool vmstat to collect the resource usage of microservices from each application within a given time interval, including CPU and memory usage and I / O read / write rates. Next, we use the physical resource isolation mechanism Cgroups provided by the Linux kernel to initialize the resource allocation of each node, and use the distributed tracking system Jaeger to collect the response time of the microservice nodes to complete the collection of "resource-performance" data in a non-interference state. The detailed information of the data characteristics is shown in Table 1:

[0065] Table 1 Resource characteristics and performance collection

[0066]

[0067] The “resource-performance” data is shown in Table 2:

[0068] Table 2 “Resource-Performance” data

[0069]

[0070] Among them, cpu.shares sets the relative proportion of the available CPU for each task; cpuset.cpus specifies the CPU that the task is allowed to access; swap refers to the computer virtual memory; free indicates the size of free memory; si indicates the size of memory written from the swap area per second, in kb / s; so indicates the size of memory written to the swap area per second; bi indicates the number of blocks read from the disk per second; bo indicates the number of blocks written to the disk per second; us indicates the CPU time consumed by the user process execution; sy indicates the CPU time consumed by the system process; id indicates the idle time, including IO waiting time;

[0071] Specifically, the interference program is run on each node. By running the CPU resource competition command under the Phoronix Test Suite test suite, that is, running the Smallpt test suite to continuously emit light and trace its path and interact with objects in the scene, this process requires a large amount of computing resources to complete, realizing the preemption of CPU resources, thereby simulating the competition of each node for the server CPU, memory and I / O resources in actual application scenarios;

[0072] Step 3: Build the CNNRPM model based on the data set to predict the response time of microservice nodes.

[0073] Step 3.1: Initialize the CNNRPM model , all "resource-performance" data is collected Indicates that there are a total of Data instances, each of which contains microservice node resource demand data and response time ; Each piece of data is represented as , ; The nth data is ,in Indicates the value of the CPU for the nth data. Indicates the value of the nth data memory. Indicates the value of the nth data IO, Indicates the actual response time of the nth piece of data.

[0074] Step 3.2: Each piece of data Convert to a two-dimensional embedding, map each resource feature in the table data to a pixel value in a two-dimensional space, and then arrange these pixel values ​​in a two-dimensional matrix from left to right and from top to bottom, so that each feature is in the correct position in the two-dimensional matrix, and perform filling and alignment operations to generate a feature image , the generated feature image is used as the input of the initial CNNRPM model, and it passes through the convolution layer in sequence to perform convolution operations on the data, and uses the convolution kernel of the custom size to extract the features of the input data, and then passes through the pooling layer to reduce the dimension of the features. After repeated multiple times, it enters the fully connected layer to learn the relationship between the features, and finally classifies and outputs them to complete the construction of the CNNRPM prediction model;

[0075] Step 3.3: Predict the data sets one by one Response time of all resource-performance data in The response time prediction result of the data is , and then calculate the The actual response time of the data and prediction results The error between them is as follows:

[0076]

[0077] in, Every piece of data, The real time of the nth data, , Represents the total number of samples. When the error between the true value and the predicted value is smaller, the actual output probability is closer to the expected output probability, and the predicted result is closer to the true result, the real time can be directly reflected by the predicted time. The CNNRPM prediction model is used to predict the response time of all microservice nodes. If the end-to-end response service quality Qos is not met, a resource allocation model based on deep reinforcement learning is constructed to make a resource adjustment strategy.

[0078] The model is used to predict the response time of all microservice nodes. The response time is the time it takes for a microservice node to obtain a task and respond. When the node has few resources, the time to process a task will increase; and when the microservice node has sufficient resources, the task will be processed very quickly. By allocating resources to microservice nodes to allow them to process tasks, and then using Jaeger to collect response times, the data shows that when the allocated resources match the amount of resources required for the task, that is, when the end-to-end response service quality Qos is met, the response time is in the range of 0.5-10ms. Therefore, this study will use the response time as a label and divide the response time into three categories according to the duration: When the response time is in the range of 0~0.5ms, it means that the current microservice node has sufficient resources and there is a waste of resources. The resource allocation of the microservice node needs to be reduced to avoid resource waste; when the response time is in the range of 0.5~10.0ms, This means that the current resources can just meet the normal operation of the microservice node and there is no need to adjust the resources. When the response time is greater than 10.0ms, it means that the currently allocated resources of the microservice node cannot meet its normal operation and more resources need to be allocated to it. When the prediction result of the CNNRPM model shows that the response time exceeds the threshold, it indicates that the amount of resources allocated to the microservice node is insufficient, and the resource allocation model will increase the amount of resources allocated to the node. When the response time is lower than the threshold, it indicates that the resources are over-allocated and the resource allocation model needs to reduce the amount of resources allocated to the node. The deep reinforcement learning algorithm described in Step 4 is used to make a resource adjustment strategy.

[0079] Specifically, the collected resource-performance data is input into the resource prediction model based on convolutional neural network, and the predicted response time is output. The above 10 sets of data are predicted. The response time range determined by the end-to-end service quality is greater than 1 or less than 5. When the response time is less than 1ms, the prediction result is 0, indicating that the allocated resources cannot meet the operation of the current task and more resources need to be allocated; when the response time is in the range of 1-5ms, the prediction result is 1, which indicates that the allocated resources meet the operation of the current task and the resource allocation is reasonable; when the response time is greater than 5ms, the prediction result is 2, indicating that too many resources are allocated, there is a waste of resources, and the resources need to be adjusted reasonably. The resource prediction model proposed in this study predicts the response time in a way that is consistent with the range of the true value. As can be seen in Table 3, based on The data instance 6 of the predicted response time 2 exceeds the specified range of QoS, so Step 4 is executed to perform adaptive adjustment of resources.

[0080] Table 3 Data for building the CNNRPM model

[0081]

[0082] Step 4: According to the response time of microservice nodes, build a resource allocation model based on deep reinforcement learning to implement adaptive resource adjustment strategy.

[0083] The present invention first models the resource allocation problem based on deep reinforcement learning as a Markov game model, and then solves the model. In a cloud-native architecture, an application usually consists of multiple microservice nodes, each of which runs a specific business function. An application consisting of 3 microservice nodes runs specific business functions. Represents a collection of microservice node agents, where Indicates microservice nodes. The Markov game model can be represented as a tuple ,in represents the state space, represents the action space, represents the reward set, Represents the state transition probability. Each microservice node intelligent The local state All are status In each At this moment, each microservice node According to their current status , take corresponding actions based on specific strategies , and then through the state transition probability function Generate the next state Each microservice node agent Get instant rewards through state and action functions . The basic components are described in detail below.

[0084] Represents the state space, which is the collection of all microservice nodes The state you are in. Indicates Nodes in The actual resource usage share at the time, yes The actual number of CPU cores used at the moment, yes The actual memory capacity used at all times, yes I / O throughput at a given moment.

[0085] Represents the action space, which is a set of executable actions, where ={ , , } indicates the first A resource allocation plan.

[0086] The reward is that the environment is based on the current microservice node The feedback obtained for the actions taken indicates the current state Next microservice node Take Action The reward is the value obtained after the scheduling. There are two types of rewards: positive feedback and negative feedback. When the scheduled resources can meet the needs of the microservice node and are below a certain threshold, the reward is positive, otherwise it will be a negative reward. The goal of each microservice node is to maximize the reward function:

[0087] (2)

[0088] in, is the discount factor and , It measures the impact of future rewards on current actions. It is Microservice nodes in Always take action The rewards you get when It is the ratio of the actual usage share of microservice node resources to the allocated share, which can be calculated according to formula (3):

[0089] (3)

[0090] in, , and represents the weight, yes The actual number of CPU cores used at the moment, yes The actual memory capacity used at all times, yes I / O throughput at the moment, Indicated in Time is allocated to microservice nodes The resource quota set, that is, { , , },when , , The larger the ratio, the closer the resource allocation share allocated to the microservice node is to the actual demand.

[0091] The state value of each training , Action Value , Reward Value And the state value at the next moment Stored as a tuple:

[0092] (4)

[0093] And store all training samples in the experience pool:

[0094] (5)

[0095] and is the training sample;

[0096] Step 4.1: After receiving the feedback information from the CNNRPM model that the end-to-end service quality Qos exceeds a specific threshold range, in the resource allocation model based on deep reinforcement learning, the experience pool is first initialized , Actor network, Critic network and microservice node collection Status , is the actual number of CPU cores used, is the actual memory capacity used. is the I / O throughput, and the Actor network performs specific actions based on the state ={ , , }, Indicates the CPU resources used by the microservice node at time i. Indicates the memory resources used by the microservice node at time i. Represents the I / O resources used by the microservice node at time i. The set ,in Indicates microservice nodes, .

[0097] Step 4.2: Calculation The reward value at the time and the state value at the next moment .

[0098] Step 4.3: The Online network in the Critic network outputs according to the Actor network The state-action at the moment, use the following formula to update the Q value function, and store the Q value function.

[0099] (6)

[0100] in, is the critic network parameter, yes The state of the moment, is based on The action value taken according to the state at the moment, is the reward value obtained. At the same time, the Target network of the Critic network adds a Gaussian noise function, uses the following formula to estimate the Q value function of the state-action at the next moment, and stores the value as the target Q value function.

[0101] (7)

[0102] in, are the parameters of the critic online network, yes The state of the moment, is based on The action value taken according to the state at the moment, is the reward value obtained, The function obeys the Bellman equation, which is The sum of the Q value function updated by the state-action value at the moment and the Q value function updated by obtaining the next state value is The target Q-value function at time .

[0103] Step 4.4: Update the network parameters by minimizing the mean square error between the current Q value and the target Q value, and use As the update parameter. The error function is:

[0104] (8)

[0105] is the discount factor, and , already obtained The Q-value function at time The Q value function at the moment determines the update range of the network parameters of the Q value function through the value of the error function, thereby updating the network parameters.

[0106] Update the Actor network parameters and Critic network parameters at the same time.

[0107] Step4.5: Repeat Step4.2-Step4.4. When the reward value in Step4.2 When it is close to 1 and the result does not change, the Online network in the Critic network calculates The maximum value indicates that the resource utilization of this microservice node is the highest, and the end-to-end service quality Qos can also be met. The strategy is used as the microservice resource adjustment strategy.

[0108] Specifically, according to the prediction result of Step 3, the microservice node resources of data instance 6 are adjusted. The resource amount of this microservice node is , according to the physical resources of the local server, the adjustment range of various resources of the microservice node is determined as follows: Set up three resource adjustment plans as follows:

[0109]

[0110]

[0111]

[0112] Next, set the , and use this formula to calculate the corresponding reward values ​​when adopting the above three resource adjustment plans The results are as follows.

[0113] (1) Adoption plan hour, The value of each element in is Therefore, the reward value .

[0114] (2) Adoption plan hour, The value of each element in is Therefore, the reward value .

[0115] (3) Adoption plan hour, The value of each element in is Therefore, the reward value .

[0116] Then, set the , and use this formula to calculate the target value of the value function obtained when the above resource adjustment schemes are adopted. The results are as follows.

[0117]

[0118]

[0119]

[0120] Through the above calculation, we can get the resource allocation plan The value function obtained when Therefore, Option 1 is finally selected as the resource adjustment strategy.

[0121] Step 5: Use resource management tools to adjust server CPU, memory, and I / O resources according to the adaptive resource adjustment strategy.

[0122] Through Step 4, the optimal adjustment strategy for various resources can be obtained. This strategy needs to be implemented using various resource management tools.

[0123] For CPU adjustment, the present invention uses the CPU subsystem commands cpu.cfs_period_us and cpu.cfs_quota_us in the Linux kernel management tool Cgroups to achieve it; for memory and LLC adjustment, Intel's CAT tool is used to achieve it; for I / O adjustment, the blkio subsystem in Cgroups is used to adjust the hard disk throughput.

[0124] Specifically, using the corresponding instructions, adjust the number of CPUs to 8, the memory capacity to 1024MB, and the I / O capacity to 1G.

[0125] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.

Claims

1. A method for predicting microservice node performance and adaptively adjusting resources based on convolutional neural networks, characterized in that: Step 1: Use benchmark tools to simulate actual applications and pre-allocate resources based on task requirements; Step 2: Use performance monitoring tools to collect microservice node resource performance data and build a data set; Step 3: Build a CNNRPM model based on the data set to predict the response time of microservice nodes; Step 4: According to the response time of microservice nodes, a resource allocation model based on deep reinforcement learning is constructed to implement adaptive resource adjustment strategy; Step 5: Use resource management tools to adjust server CPU, memory, and I / O resources according to the adaptive resource adjustment strategy; Step 1 specifically includes: injecting interference using a benchmark tool to simulate actual application scenarios, so as to realize competition among microservice nodes for server CPU, memory, and I / O resources, thereby pre-allocating resources for each microservice, wherein the interference is CPU-intensive interference, I / O-intensive interference, and memory-intensive interference; The Step 2 is specifically as follows: Step 2.1: Use the physical resource isolation mechanism provided by the performance monitoring tool to initialize the resource allocation of each microservice node, use the distributed tracking system to collect the response time of the microservice node, and complete the collection of resource performance data in a non-interference state; Step 2.2: Run the interference program on each microservice node. By running the CPU resource competition command under the Phoronix Test Suite test suite, that is, running the Smallpt test suite to continuously emit light and trace its path and interact with objects in the scene to simulate the CPU calculation process in the ray tracing algorithm. This process requires a large amount of computing resources to complete, realizing the preemption of CPU resources, thereby simulating the competition of each node for the server CPU, memory and I / O resources in actual application scenarios; Step 2.3: Collect the resource usage and response time data of the microservice nodes under interference conditions, process the collected data with and without interference, complete data preparation, and build a "resource-performance" data set; The Step 3 is specifically as follows: Step 3.1: Initialize the CNNRPM model , all "resource-performance" datasets are collected Indicates that there are a total of Data instances, each of which contains microservice node resource demand data and response time ; Each piece of data is represented as , ; The nth data is ,in Indicates the value of the CPU for the nth data. Indicates the value of the nth data memory. Indicates the value of the nth data IO, Indicates the actual response time of the nth data; Step 3.2: Each piece of data Convert to a two-dimensional embedding, map each resource feature in the table data to a pixel value in a two-dimensional space, and then arrange these pixel values ​​in a two-dimensional matrix from left to right and from top to bottom, so that each feature is in the correct position in the two-dimensional matrix, and perform filling and alignment operations to generate a feature image , the generated feature image is used as the input of the initial CNNRPM model, and it passes through the convolution layer in sequence to perform convolution operations on the data, and uses the convolution kernel of the custom size to extract the features of the input data, and then passes through the pooling layer to reduce the dimension of the features. After repeated multiple times, it enters the fully connected layer to learn the relationship between the features, and finally classifies and outputs them to complete the construction of the CNNRPM prediction model; Step 3.3: Predict the response time of all "resource-performance" data in data set D in turn. The response time prediction result of the data is , and then calculate the The actual response time of the data and prediction results The error between them is as follows: ; in, Represents each piece of data, Indicates the real time of the nth data. Represents the predicted output , Represents the total number of samples. When the error between the true value and the predicted value is smaller, the actual output probability is closer to the expected output probability, and the predicted result is closer to the true result, the real time can be directly reflected by the predicted time. The CNNRPM prediction model is used to predict the response time of all microservice nodes. If the end-to-end response service quality Qos is not met, a resource allocation model based on deep reinforcement learning is constructed to make a resource adjustment strategy. The Step 4 is specifically as follows: Step 4.1: After receiving the feedback information from the CNNRPM model that the end-to-end service quality Qos exceeds the threshold range, in the resource allocation model based on deep reinforcement learning, the experience pool is first initialized , Actor network, Critic network and microservice node collection Status , is the actual number of CPU cores used, is the actual memory capacity used. is the I / O throughput, the Actor network performs actions based on the state ={ , , }, Indicates the CPU resources used by the microservice node at time i. Indicates the memory resources used by the microservice node at time i. Represents the I / O resources used by the microservice node at time i. The set ,in Indicates microservice nodes; Step 4.2: Calculation The reward value at the time and the state value at the next moment ; Step 4.3: The Online network in the Critic network outputs according to the Actor network The state-action at the moment uses the following formula to update the Q value function and store the Q value function: ; in, is the Critic network parameter, yes The state of the moment, is based on The action value taken according to the state at the moment, is the reward value obtained. At the same time, the Target network of the Critic network adds a Gaussian noise function, estimates the Q value function of the state-action at the next moment using the following formula, and stores the Q value function as the target Q value function: ; in, are the parameters of the critic online network, yes The state of the moment, is based on The action value taken according to the state at the moment, is the reward value obtained, The function obeys the Bellman equation, which is The sum of the Q value function updated by the state-action value at the moment and the Q value function updated by obtaining the next state value is The target Q-value function at the moment; Step 4.4: Update the network parameters by minimizing the mean square error between the current Q value and the target Q value, and use As the update parameter, the error function is: ; is the discount factor, and , already obtained The Q-value function at time The Q value function at the moment determines the update range of the network parameters of the Q value function through the value of the error function, thereby updating the network parameters; Update the Actor network parameters and Critic network parameters at the same time; Step4.5: Repeat Step4.2-Step4.

4. When the reward value in Step4.2 When it is close to 1 and the result does not change, the Online network in the Critic network calculates The maximum value indicates that the resource utilization of this microservice node is the highest, which satisfies the end-to-end service quality Qos. The strategy is used as the microservice resource adjustment strategy; The Step 4.2 is specifically as follows: The Markov game model is used as the basis of the resource allocation model of deep reinforcement learning, and the resource allocation model of deep reinforcement learning is composed of the tuple ,in represents the state space, represents the action space, represents the reward set, represents the state transition probability, in each At this moment, each microservice node According to your current status , take appropriate action , through the state transition probability function Generate the next state , each microservice node agent Obtain rewards through state and action functions , the goal of each microservice node is to maximize the reward function: ; in, is the discount factor and , It measures the impact of future rewards on current actions. It is Microservice nodes in Always take action The rewards you get when It is the ratio of the actual usage share of microservice node resources to the allocated share, which can be calculated according to the formula: ; in, , and represents the weight, yes The actual number of CPU cores used at the moment, yes The actual memory capacity used at all times, yes I / O throughput at the moment, Indicated in Time is allocated to microservice nodes The resource quota set, that is, { , , },when , , The larger the ratio, the closer the resource allocation share allocated to the microservice node is to the actual demand.

Citation Information

Patent Citations

  • Cloud computing resource management method, device and equipment and computer storage medium

    CN116915572A

  • Data processing method and system based on cloud computing

    CN118152124A

  • Resource adjustment method, cloud computing resource adjustment method and computing device

    CN118277104A

  • Performance-aware large-scale micro-service intelligent multi-resource cooperative scheduling method and system

    CN115037749A

  • Intelligent micro-service resource scheduling strategy based on container cloud platform

    CN117459477A