Container resource allocation method and device, computer equipment and readable storage medium

By using a combination of long and short-term memory networks, autoencoders or deep belief networks and support vector regression models in container resource provisioning, accurate prediction and dynamic adjustment of container resource usage information is achieved, the problem of inaccurate resource provisioning is solved, and system performance and resource utilization are improved.

CN120353538APending Publication Date: 2025-07-22ELECTRIC POWER RES INST CHINA SOUTHERN POWER GRID CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510445725.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

The existing container resource provisioning methods have the problem of insufficient resource provisioning, which leads to insufficient or excessive resource allocation, affecting system performance and cost efficiency.

Method used

By obtaining container resource usage information for the current period, using the pre-constructed target prediction model for feature extraction and prediction, adjusting the resource allocation for the next period. The model includes a long and short-term memory network and an autoencoder or a deep belief network and a support vector regression combination, capturing the correlation between resource usage, and making accurate predictions and dynamic adjustments.

Benefits of technology

Improve the accuracy of resource allocation, avoid insufficient or over-allocation, ensure that the system always maintains the optimal resource allocation, improves system performance and resource utilization, and reduces operation and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120353538A_ABST
    Figure CN120353538A_ABST
Patent Text Reader

Abstract

The invention relates to a container resource allocation method and device, computer equipment and a readable storage medium. The method comprises the following steps: acquiring container resource use information of a current time period, inputting the container resource use information of the current time period into a pre-constructed target prediction model, obtaining container resource use potential features of the current time period through a feature extraction module in the target prediction model, and inputting the container resource use potential features into a prediction model in the target prediction model to obtain predicted container resource use information of the next time period, and finally adjusting allocation of the container resources of the next time period according to the predicted container resource use information. According to the method, the container resource use information of the current time period is acquired, the prediction model is input to extract the potential features among the resource use information, and the container resource use information of the next time period is predicted according to the extracted potential features, so that the prediction accuracy is improved, and the allocation accuracy of resource allocation is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of container resource scheduling, and particularly to a method, device, computer device, computer-readable storage medium, and computer program product for allocating container resources. Background Art

[0002] Currently, more and more application programs are deployed in containers. Generally, in order to enable the hosted application programs to run stably, sufficient resources are allocated in advance for them. The allocation of resources mainly depends on the experience of operation and maintenance personnel and some established rules to judge the capacity requirements of microservices, and manually adjust the number of containers or resource configurations according to factors such as historical traffic peaks and business growth trends.

[0003] However, the current method for allocating container resources has the problem of inaccurate resource allocation. Summary of the Invention

[0004] Based on this, in view of the above technical problems, it is necessary to provide a method, device, computer device, computer-readable storage medium, and computer program product for allocating container resources that can improve the accuracy of resource allocation.

[0005] In a first aspect, this application provides a method for allocating container resources, including:

[0006] Obtain the container resource usage information for the current period; the container resource usage information includes CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate;

[0007] Input the container resource usage information for the current period into a pre-constructed target prediction model, and through the feature extraction module in the target prediction model, obtain the potential features of the container resource usage for the current period. Input the potential features of the container resource usage into the prediction module in the target prediction model to obtain the predicted container resource usage information for the next period; the potential features of the container resource usage at least include features characterizing the correlation relationship between the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate;

[0008] Adjust the allocation of container resources for the next period according to the predicted container resource usage information.

[0009] In one of the embodiments, if the feature extraction module represents a long short-term memory network layer and an autoencoder layer;

[0010] Obtaining the potential features of the container resource usage for the current period through the feature extraction module in the target prediction model includes:

[0011] Input the container usage information for the current period into the long short-term memory network layer, and obtain the hidden state information for the current period through the long short-term memory network layer;

[0012] Input the hidden state information into the autoencoder layer, and obtain the potential features of the container resource usage at the current time period through the autoencoder layer.

[0013] In one embodiment, if the feature extraction module represents a deep belief network and the prediction module represents a support vector regression model;

[0014] Through the feature extraction module in the target prediction model, obtain the potential features of the container resource usage at the current time period, including:

[0015] Input the container usage information at the current time period into the deep belief network, and sequentially pass through the multiple layers of restricted Boltzmann machines included in the deep belief network to obtain the potential features of the container resource usage at the current time period;

[0016] Input the potential features of the container resource usage into the prediction module in the target prediction model to obtain the predicted container resource usage information for the next time period, including:

[0017] Input the potential features of the container resource usage into the support vector regression model to obtain the predicted container resource usage information for the next time period.

[0018] In one embodiment, the target prediction model is trained through the following steps:

[0019] Collect the container resource usage information for multiple time periods, and generate a training data set and a validation data set according to the container resource usage information;

[0020] Fix the parameters of the deep belief network to be trained, and use the training data set to train the parameters of the support vector regression model to be trained to obtain a candidate support vector regression model;

[0021] Through the training data set, train the parameters of the deep belief network to be trained and the parameters of the candidate support vector regression model to obtain a deep belief network and a support vector regression model;

[0022] Generate a prediction model to be evaluated according to the deep belief network and the support vector regression model;

[0023] Evaluate the performance of the prediction model to be evaluated through the validation data set, and adjust the model hyperparameters of the prediction model to be evaluated according to the results of the performance evaluation to obtain the target prediction model.

[0024] In an exemplary embodiment, obtain the container resource usage information at the current time period, including:

[0025] Collect the original container resource usage information at the current time period, and obtain the information mean and information standard deviation of the original container resource usage information;

[0026] Using the information mean and information standard deviation, perform outlier processing on the original container resource usage information to obtain the processed container resource usage information;

[0027] Perform normalization processing on the processed container resource usage information to obtain the container resource usage information.

[0028] In one embodiment, using the information mean and information standard deviation, performing outlier processing on the original container resource usage information to obtain the processed container resource usage information includes:

[0029] Using the information mean and information standard deviation, construct the normal container resource usage information interval;

[0030] Determine the original container resource usage information that does not belong to the normal container resource usage information interval as the abnormal original container resource usage information;

[0031] Obtain the adjacent original container resource usage information of the abnormal original container resource usage information, and use the mean value of the adjacent original container resource usage information to replace the abnormal original container resource usage information to obtain the processed container resource usage information.

[0032] In a second aspect, the present application also provides a container resource allocation device, including:

[0033] An acquisition module, configured to acquire the container resource usage information of the current period; the container resource usage information includes CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate;

[0034] A prediction module, configured to input the container resource usage information of the current period into a pre-constructed target prediction model, and through the feature extraction module in the target prediction model, obtain the potential features of the container resource usage in the current period, and input the potential features of the container resource usage into the prediction module in the target prediction model to obtain the predicted container resource usage information of the next period; the potential features of the container resource usage at least include features characterizing the correlation relationship between the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate;

[0035] An allocation module, configured to adjust the allocation of the container resources in the next period according to the predicted container resource usage information.

[0036] In a third aspect, the present application also provides a computer device, including a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0037] Acquire the container resource usage information of the current period; the container resource usage information includes CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate;

[0038] Input the container resource usage information of the current period into a pre-constructed target prediction model. Through the feature extraction module in the target prediction model, obtain the potential features of the container resource usage in the current period. Input the potential features of the container resource usage into the prediction module in the target prediction model to obtain the predicted container resource usage information for the next period. The potential features of the container resource usage at least include features characterizing the correlation relationships among the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate.

[0039] Adjust the allocation of the container resources for the next period according to the predicted container resource usage information.

[0040] In a fourth aspect, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0041] Obtain the container resource usage information of the current period. The container resource usage information includes the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate.

[0042] Input the container resource usage information of the current period into a pre-constructed target prediction model. Through the feature extraction module in the target prediction model, obtain the potential features of the container resource usage in the current period. Input the potential features of the container resource usage into the prediction module in the target prediction model to obtain the predicted container resource usage information for the next period. The potential features of the container resource usage at least include features characterizing the correlation relationships among the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate.

[0043] Adjust the allocation of the container resources for the next period according to the predicted container resource usage information.

[0044] In a fifth aspect, the present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the following steps are implemented:

[0045] Obtain the container resource usage information of the current period. The container resource usage information includes the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate.

[0046] Input the container resource usage information of the current period into a pre-constructed target prediction model. Through the feature extraction module in the target prediction model, obtain the potential features of the container resource usage in the current period. Input the potential features of the container resource usage into the prediction module in the target prediction model to obtain the predicted container resource usage information for the next period. The potential features of the container resource usage at least include features characterizing the correlation relationships among the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate.

[0047] Adjust the allocation of container resources in the next time period according to the predicted container resource usage information.

[0048] For the above-mentioned method, device, computer equipment, computer-readable storage medium, and computer program product for allocating container resources, obtain the container resource usage information in the current time period. The container resource usage information includes CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate. Input the container resource usage information in the current time period into a pre-constructed target prediction model. Through the feature extraction module in the target prediction model, obtain the potential features of the container resource usage in the current time period. Input the potential features of the container resource usage into the prediction model in the target prediction model to obtain the predicted container resource usage information in the next time period. The potential features of the container resource usage at least include features representing the correlation relationships existing among the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate. Finally, adjust the allocation of container resources in the next time period according to the predicted container resource usage information. By obtaining the container resource usage information in the current time period, inputting it into the prediction model to extract the potential features among the resource usage information, and predicting the container resource usage information in the next time period based on the extracted potential features, the prediction accuracy is improved through the above method, and further the accuracy of resource allocation is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] To more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.

[0050] Figure 1 It is an application environment diagram of the method for allocating container resources in an embodiment;

[0051] Figure 2 It is a flowchart of the method for allocating container resources in an embodiment;

[0052] Figure 3 It is a flowchart of prediction using a deep neural network model formed by a long short-term memory network and an autoencoder in an embodiment;

[0053] Figure 4 It is a flowchart of prediction using a deep neural network model formed by a deep belief network and support vector regression in another embodiment;

[0054] Figure 5 It is a structural block diagram of the device for allocating container resources in an embodiment;

[0055] Figure 6 The internal structure diagram of a computer device in an embodiment. Detailed implementation manners

[0056] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0057] The method for allocating container resources provided by the embodiments of the present application can be applied to an application environment as Figure 1 shown. Among them, the terminal 102 communicates with the server 104 through a network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or can be placed in the cloud or on other network servers. The server 104 obtains the container resource usage information of itself and the terminal 102 in the current period. Among them, the container resource usage information includes CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate. Then, the container resource usage information in the current period is input into a pre-constructed target prediction model. Through the feature extraction module in the target prediction model, the potential features of the container resource usage in the current period are obtained. The potential features of the container resource usage are input into the prediction module in the target prediction model to obtain the predicted container resource usage information in the next period. Among them, the potential features of the container resource usage at least include features representing the association relationship between the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate. Finally, according to the predicted container resource usage information, the allocation of the container resources in the next period is adjusted. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0058] In an exemplary embodiment, as Figure 2 shown, a method for allocating container resources is provided. Taking the method applied to the Figure 1 server 104 in it as an example, it includes the following steps S201 to S203. Among them:

[0059] Step S201: Obtain the container resource usage information for the current period; the container resource usage information includes CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate.

[0060] Among them, the CPU (Central Processing Unit) usage rate can be understood as the percentage occupied within a period of time. Similarly, the memory usage rate, storage usage rate, and network bandwidth usage rate can be obtained in the same way.

[0061] Exemplarily, the server 104 obtains the original container resource usage information for the current period, calculates the information mean and information standard deviation corresponding to the container resource usage information, uses the information mean and information standard deviation to perform outlier processing on the original container resource usage information, obtains the processed container resource usage information, and then performs normalization processing on the processed container resource usage information to obtain the container resource usage information for the current period. By performing outlier processing according to the actual situation of the current data, the data availability is enhanced. Secondly, normalizing the data speeds up the prediction speed for subsequent resource prediction.

[0062] Step S202: Input the container resource usage information for the current period into the pre-constructed target prediction model. Through the feature extraction module in the target prediction model, obtain the potential features of the container resource usage for the current period. Input the potential features of the container resource usage into the prediction module in the target prediction model to obtain the predicted container resource usage information for the next period; the potential features of the container resource usage at least include features representing the correlation relationships among the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate.

[0063] Step S203: Adjust the allocation of the container resources for the next period according to the predicted container resource usage information.

[0064] Among them, the target prediction model can be understood as a deep neural network model capable of realizing prediction, and the feature extraction module can be understood as a model with the ability to extract features and the ability to mine potential relationships.

[0065] Optionally, the server 104 inputs the container resource usage information of the current period into a pre-constructed target prediction model, performs deep feature extraction through the feature extraction module in the target prediction model, learns the implicit association relationship between features, and obtains the potential features of container resource usage in the current period. Then, the potential features of container resource usage are input into the prediction module in the target prediction model to obtain the predicted container resource usage information for the next period. Among them, the potential features of container resource usage at least include features representing the association relationship existing among CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate. Finally, the predicted container resource usage information is used to correspondingly adjust the allocation of container resources in the next period:

[0066] If it is predicted that the future resource demand will increase, for example, it is predicted that indicators such as CPU usage rate and memory usage rate will rise, the corresponding resources of the container can be increased in advance. Specifically, the container orchestration tool can be used to adjust parameters such as the CPU and memory limits and requests of the container.

[0067] If it is predicted that the resource demand will decrease, the resource allocation can be appropriately reduced to release the excess resources for other services to use. Similarly, the container orchestration tool is used for resource adjustment to reduce the resource configuration of the container to improve resource utilization.

[0068] When performing resource adjustment, the availability and cost of resources need to be considered. If the resources are insufficient, consider adding servers or using the elastic resources of cloud service providers; if the resources are excessive, consider releasing the excess resources to reduce costs.

[0069] Through the above method, features representing at least the association relationship existing among multiple usage rates can be extracted, thereby improving the prediction accuracy of container resource usage information. Secondly, dynamic resource adjustment can keep the system in the optimal resource configuration state all the time and improve the overall performance of the system. By meeting the resource demand in a timely manner, it can avoid performance degradation caused by insufficient resources and also avoid waste caused by excessive resource allocation. For example, for services with high real-time requirements, insufficient resources may lead to an extended response time and affect the user experience. By accurately predicting the resource demand and performing dynamic adjustment, it can ensure that the service always has good performance.

[0070] In the above method for allocating container resources, obtain the container resource usage information for the current period. The container resource usage information includes CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate. Input the container resource usage information for the current period into a pre-constructed target prediction model. Through the feature extraction module in the target prediction model, obtain the potential features of the container resource usage for the current period. Input the potential features of the container resource usage into the prediction model in the target prediction model to obtain the predicted container resource usage information for the next period. The potential features of the container resource usage at least include features representing the correlation relationships among the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate. Finally, adjust the allocation of the container resources for the next period according to the predicted container resource usage information. By obtaining the container resource usage information for the current period, inputting it into the prediction model to extract the potential features among the resource usage information, and predicting the container resource usage information for the next period based on the extracted potential features, the prediction accuracy is improved through the above method, and further the allocation accuracy of the resource allocation is improved.

[0071] In one embodiment, if the feature extraction module represents a long short-term memory network layer and an autoencoder layer;

[0072] Through the feature extraction module in the target prediction model, obtain the potential features of the container resource usage for the current period, including: input the container usage information for the current period into the long short-term memory network layer, and obtain the hidden state information for the current period through the long short-term memory network layer; input the hidden state information into the autoencoder layer, and obtain the potential features of the container resource usage for the current period through the autoencoder layer.

[0073] Among them, the autoencoder layer includes an encoder and a decoder, and the long short-term memory (LSTM, Long Short-Term Memory) network layer:

[0074] LSTM cell structure:

[0075] Forget gate: , where , is the weight matrix, is the bias term, is the sigmoid function. During specific calculation, first calculate , obtain a vector with the same dimension as the cell state, and then compress its value to the interval [0, 1] through the sigmoid function to determine which information is forgotten from the cell state.

[0076] Input gate: , with the same calculation method, determine which new information needs to be added to the cell state.

[0077] Candidate cell state: , compress the value to the interval [-1, 1] through the hyperbolic tangent function to generate the candidate cell state.

[0078] Cell state: , where is the cell state at the previous moment. The forgetting gate and the input gate are used to control the forgetting of old information and the addition of new information respectively. After element-wise multiplication, the cell state at the current moment is obtained.

[0079] Output gate: , which determines which information is output from the cell state.

[0080] Hidden state: , and finally the hidden state at the current moment is obtained as the output of the LSTM cell.

[0081] Exemplarily, the server 104 inputs the preprocessed time series data into the LSTM layer. After calculations for multiple time steps, the output sequence of the LSTM layer is obtained , the encoder takes the output of the LSTM layer as the input. Let the input of the encoder be , and it is compressed into a low-dimensional representation through a series of fully connected layers , and the calculation formula is , where is the weight matrix, is the bias term, and s is the activation function, usually the sigmoid function or the ReLU function. For the input , it contains the comprehensive information of the CPU, memory, storage, and network bandwidth utilization rates after being processed by the LSTM. Through the encoder, features are further extracted. The decoder reconstructs the low-dimensional representation into an output similar to the input. Let the input of the decoder be , and the reconstructed output is obtained through the calculation of the decoder, and the calculation formula is , where is the weight matrix, is the bias term, and s is the activation function. The decoder attempts to recover the features of the original input from the low-dimensional representation, and determines the features output by the decoder as the potential features of the container resource usage in the current period.

[0082] LSTM can effectively process time - series data and capture long - term dependencies in the data. For the resource usage metrics of containerized microservices, these metrics show certain trends and periodicities over time. LSTM can learn these patterns, thereby improving the prediction accuracy of future resource requirements. For example, for some periodic services, such as the significant increase in resource requirements during promotional activities on an e - commerce platform, LSTM can accurately predict the resource requirements during future promotional activities by learning the resource usage during historical promotional activities.

[0083] The auto - encoder further extracts the features of the LSTM output and can learn the latent representation of the data. This latent representation can capture the complex relationships between resource usage metrics and improve the prediction accuracy. For example, there may be some associations between CPU usage, memory usage, storage usage, and network bandwidth usage. The auto - encoder can discover these associations and use them for prediction, thereby obtaining more accurate latent features of container resource usage in the current period, and further improving the prediction accuracy.

[0084] In one of the embodiments, if the feature extraction module represents a deep belief network and the prediction module represents a support vector regression model;

[0085] Through the feature extraction module in the target prediction model, the latent features of container resource usage in the current period are obtained, including: inputting the container usage information in the current period into the deep belief network, and successively passing through the multiple layers of restricted Boltzmann machines included in the deep belief network to obtain the latent features of container resource usage in the current period;

[0086] Inputting the latent features of container resource usage into the prediction module in the target prediction model, the predicted container resource usage information for the next period is obtained, including: inputting the latent features of container resource usage into the support vector regression model to obtain the predicted container resource usage information for the next period.

[0087] Among them, the deep belief network (DBN, Deep Belief Network) is composed of multiple layers of restricted Boltzmann machines (RBM, Restricted Boltzmann Machine), and the support vector regression (SVR, Support Vector Regression) model can be understood as a regression analysis tool.

[0088] Optionally, the server 104 inputs the pre - processed data into the trained DBN, and through layer - by - layer feature extraction, a high - level abstract feature representation is obtained. These features capture the complex patterns and relationships in the data and contribute to subsequent capacity prediction. Let the features extracted by the DBN be . With the features extracted by the DBN As input, an SVR model is constructed for capacity prediction. The optimization problem of SVR is expressed as:

[0089] , and 、 and , where is the normal vector of the hyperplane, b is the bias term, and are slack variables, C is the penalty parameter, is the insensitive loss parameter. By using the Lagrange multiplier method, the above optimization problem is transformed into a dual problem for solution, and the prediction model of SVR is obtained: , where and are Lagrange multipliers. Accurate capacity prediction is achieved.

[0090] Through the stacking of multiple restricted Boltzmann machines, DBN can effectively learn the complex patterns and potential features in the historical performance data of containerized microservices. After unsupervised learning layer by layer, the original data is transformed into a high-level abstract feature representation, capturing the non-linear relationships and long-term dependencies in the data. And SVR takes these features as input and uses its powerful regression ability for capacity prediction, and can accurately predict the resource requirements of containerized microservices in the future for a period of time, such as CPU usage, memory usage, storage usage, and network bandwidth usage, etc.

[0091] In an exemplary embodiment, the target prediction model is trained through the following steps:

[0092] Collect the container resource usage information for multiple time periods, and generate a training data set and a validation data set according to the container resource usage information; fix the parameters of the deep belief network to be trained, and use the training data set to train the parameters of the support vector regression model to be trained, and obtain a candidate support vector regression model; through the training data set, train the parameters of the deep belief network to be trained and the parameters of the candidate support vector regression model, and obtain a deep belief network and a support vector regression model; generate a prediction model to be evaluated according to the deep belief network and the support vector regression model; perform performance evaluation on the prediction model to be evaluated through the validation data set, and adjust the model hyperparameters of the prediction model to be evaluated according to the results of the performance evaluation, and obtain the target prediction model.

[0093] Exemplarily, the server 104 collects the container resource usage information for multiple time periods, and generates a training data set and a validation data set according to the container resource usage information, and uses the training data set to train the deep neural network model composed of DBN and SVR. First, fix the parameters of DBN and train the SVR model. The feature vectors obtained after extracting features by DBN from the training data set As the input of SVR. The goal of SVR is to learn a function that can predict the resource requirements of containerized microservices based on the input feature vectors. The parameters of SVR are continuously adjusted using the data in the training dataset to minimize the error between the predicted value and the true value. Parameter updates are performed through methods such as gradient descent.

[0094] Then, the parameters of the entire model are fine-tuned. After training SVR with fixed DBN parameters, the entire deep neural network model is fine-tuned. The backpropagation algorithm is used to adjust the parameters of DBN and SVR. Starting from the output layer of SVR, the prediction error is calculated and the error is backpropagated to each layer of DBN. According to the error signal, the weights and biases of DBN and SVR are adjusted to improve the prediction accuracy of the model. This process is repeated until the performance of the model on the training dataset reaches a satisfactory level or the preset number of iterations is reached. The prediction model at this time is used as the prediction model to be evaluated, and then the performance of the prediction model to be evaluated is evaluated through the validation dataset, and the model hyperparameters of the prediction model to be evaluated are adjusted according to the results of the performance evaluation to obtain the target prediction model.

[0095] After fixing the DBN parameters, first train the SVR model independently to enable it to have a certain basic prediction ability, and then fine-tune the entire model to further improve the overall performance of the cooperation between DBN and SVR. This process enables the model to continuously adapt to the new data distribution.

[0096] Secondly, by evaluating the performance of the prediction model to be evaluated through the validation dataset, the generalization ability of the model can be effectively monitored, and the model hyperparameters can be adjusted according to the evaluation results to ensure the best performance of the final target model.

[0097] In one embodiment, the container resource usage information for the current period is obtained, including: collecting the original container resource usage information for the current period, and obtaining the information mean and information standard deviation of the original container resource usage information; using the information mean and information standard deviation to perform outlier processing on the original container resource usage information to obtain the processed container resource usage information; performing normalization processing on the processed container resource usage information to obtain the container resource usage information.

[0098] Optionally, the server 104 collects the original container resource usage information for the current period and obtains the information mean and information standard deviation of the original container resource usage information. For example, for the CPU usage rate, let the set of CPU usage rates at all time steps be , calculate its mean and standard deviation , and use the mean and standard deviation to perform Perform outlier processing to obtain the processed container resource information, and scale the data of each metric to the interval [0, 1] through the Min-Max normalization method. For CPU utilization rate, the calculation formula is , where CPU represents the set of CPU utilization rates at all time steps. Memory utilization rate normalization: Let the set of memory utilization rates be , then . Storage utilization rate normalization: Let the set of storage utilization rates be:

[0099]

[0100] Then .

[0101] Network bandwidth utilization rate normalization: Let the set of network bandwidth utilization rates be , then . By performing outlier processing and normalization on the original container resource usage information collected in the current period, the effectiveness and availability of the data are enhanced, thereby accelerating the prediction speed of the container resource usage information.

[0102] In one embodiment, using the information mean and information standard deviation, perform outlier processing on the original container resource usage information to obtain the processed container resource usage information, including: using the information mean and information standard deviation to construct a normal container resource usage information interval; determining the original container resource usage information that does not belong to the normal container resource usage information interval as abnormal original container resource usage information; obtaining the adjacent original container resource usage information of the abnormal original container resource usage information, and using the mean of the adjacent original container resource usage information to replace the abnormal original container resource usage information to obtain the processed container resource usage information.

[0103] Exemplarily, taking the CPU utilization rate as an example for illustration, the server 104 uses the mean and standard deviation of the CPU utilization rate to construct a normal container resource usage information interval , and the that exceeds the range The original container resource usage information is regarded as abnormal. The adjacent original container resource usage information of the abnormal original container resource usage information is obtained, and the abnormal original container resource usage information is replaced with the mean value of the adjacent original container resource usage information to obtain the processed container resource usage information. The same outlier processing is performed on the memory usage rate, storage usage rate, and network bandwidth usage rate. By calculating the mean and standard deviation of the CPU usage rate, a normal resource usage range can be effectively constructed, and the outliers outside the normal range can be identified and replaced, which can prevent these abnormal data from interfering with subsequent analysis, thereby improving the overall quality and accuracy of the data set. In addition, using the mean value of adjacent original resource usage information to replace the outliers can ensure the continuity and rationality of the data.

[0104] In an exemplary embodiment, as Figure 3 shown, a schematic flowchart of prediction by a deep neural network model formed by a long short-term memory network and an autoencoder is provided, where:

[0105] I. Data collection and preprocessing:

[0106] 1. Data collection:

[0107] Continuously collect time series data such as CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate within a period of time from the containerized microservice system, and record auxiliary information such as service type and deployment environment at the same time. Let the collected data be , where respectively represent the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate at time step t.

[0108] 2. Data preprocessing:

[0109] 2.1. Outlier processing:

[0110] For the CPU usage rate: Let the set of CPU usage rates at all time steps be , calculate its mean and standard deviation . If exceeds the range , it is regarded as an outlier and processed, such as replacing it with the mean of adjacent values. The same outlier processing is performed on the memory usage rate, storage usage rate, and network bandwidth usage rate.

[0111] 2.2. Normalization:

[0112] CPU usage rate normalization: ;

[0113] Memory usage rate normalization: Let the set of memory usage rates be , then 。

[0114] The normalization of storage utilization rate and network bandwidth utilization rate follows the same principle as above.

[0115] II. Constructing a Long Short-Term Memory (LSTM) layer:

[0116] 1. Structure of the LSTM cell:

[0117] Forget gate: , where , is the weight matrix, is the bias term, is the sigmoid function. During specific calculations, first calculate to obtain a vector with the same dimension as the cell state, and then compress its value to the interval [0, 1] through the sigmoid function to determine which information is forgotten from the cell state.

[0118] Input gate: , with the same calculation method, to determine which new information needs to be added to the cell state.

[0119] Candidate cell state: , compress the value to the interval [-1, 1] through the hyperbolic tangent function to generate the candidate cell state.

[0120] Cell state: , where is the cell state at the previous moment. The forgetting of old information and the addition of new information are respectively controlled by the forget gate and the input gate, and the current moment's cell state is obtained after element-wise multiplication.

[0121] Output gate: , to determine which information is output from the cell state.

[0122] Hidden state: , and finally obtain the hidden state at the current moment as the output of the LSTM cell.

[0123] 2. Output of the LSTM layer: Input the preprocessed time series data into the LSTM layer. After calculations over multiple time steps, obtain the output sequence of the LSTM layer.

[0124] III. Constructing an autoencoder layer:

[0125] 1. Encoder: The encoder takes the output of the LSTM layer as input. Let the input of the encoder be , and compress it into a low-dimensional representation through a series of fully connected layers. The calculation formula is , where is the weight matrix, is the bias term, and s is the activation function, usually the sigmoid function or the ReLU function. For the input , it contains the comprehensive information of the CPU, memory, storage, and network bandwidth utilization rates after being processed by the LSTM, and further extracts features through the encoder.

[0126] 2. Decoder: The decoder reconstructs the low-dimensional representation into an output similar to the input. Let the input of the decoder be , and the reconstructed output is obtained through the calculation of the decoder. The calculation formula is , where is the weight matrix, is the bias term, and s is the activation function. The decoder attempts to recover the features of the original input from the low-dimensional representation.

[0127] 3. Training of the autoencoder: The autoencoder is trained by minimizing the reconstruction error. The reconstruction error can be measured using the mean squared error (MSE), and the calculation formula is . Here, is the input of the encoder (i.e., the output of the LSTM), is the output of the decoder. By continuously adjusting the parameters of the autoencoder, the reconstruction error is minimized, thereby learning the latent feature representation of the data.

[0128] IV. Output Layer and Prediction:

[0129] 1. Output Layer: The output layer takes the output of the autoencoder as the input. Let the input of the output layer be , and the output is the predicted resource demand vector . The calculation formula is , where is the weight matrix, is the bias term. The features extracted by the autoencoder are mapped to the predicted values of the future CPU, memory, storage, and network bandwidth utilization rates through the fully connected layer.

[0130] 2. Prediction and Resource Adjustment: Use the trained deep neural network model to predict the resource requirements of containerized microservices in the future for a period of time. According to the prediction results, dynamically adjust the resource allocation of the container. For example, if it is predicted that the future CPU utilization rate will increase, the CPU resources of the container can be increased in advance; if it is predicted that the memory utilization rate will decrease, the memory allocation can be appropriately reduced to improve resource utilization.

[0131] V. Model Training and Optimization:

[0132] 1. Model Training:

[0133] Use the training set to train the deep neural network model. During the training process, continuously adjust the model's parameters through an optimization algorithm to minimize the prediction error. A commonly used optimization algorithm is the Adam optimization algorithm, and its formula for updating parameters is: ; ; ; ; .

[0134] Among them, represents the model parameters, represents the loss function (here it is the mean squared error MSE), represents the gradient of the loss function with respect to the parameters, is the learning rate, , are the exponential decay rates, ε is a very small constant, and are the first moment estimate and the second moment estimate, and are the corrected first moment estimate and the second moment estimate.

[0135] 2. Model Validation and Hyperparameter Tuning:

[0136] During the training process, use the validation set to evaluate the performance of the model. Metrics such as root mean squared error (RMSE), mean absolute error (MAE), etc. can be used to measure the difference between the predicted value and the true value.

[0137] According to the evaluation results of the validation set, adjust the hyperparameters of the model, such as the number of layers of LSTM, the number of hidden units, the number of layers of the autoencoder, the encoding dimension, the learning rate, etc. Methods such as grid search and random search can be used to find the optimal combination of hyperparameters.

[0138] 3. Model Saving and Loading:

[0139] When the model training is completed, save the model's parameters for prediction in actual applications. Tools such as pickle and h5py can be used to save the model as a file.

[0140] Load the saved model parameters in the application to quickly build a prediction model for capacity prediction.

[0141] Compared with the existing technology, the technical advantages of this embodiment are as follows:

[0142] 1. LSTM can effectively process time series data and capture long-term dependencies in the data. For the resource usage metrics of containerized microservices, these metrics exhibit certain trends and periodicities over time. LSTM can learn these patterns, thereby improving the prediction accuracy of future resource requirements. For example, for some periodic services, such as the resource requirements of an e-commerce platform during promotional activities increasing significantly, LSTM can accurately predict the resource requirements during future promotional activities by learning the resource usage during historical promotional activities.

[0143] The autoencoder further extracts the features of the LSTM output and can learn the latent representation of the data. This latent representation can capture the complex relationships between resource usage metrics, improving the prediction accuracy. For example, there may be some correlations between CPU usage, memory usage, storage usage, and network bandwidth usage. The autoencoder can discover these correlations and use them for prediction, thus providing more accurate prediction results.

[0144] 2. Dynamically adjusting the resource allocation of containers according to the prediction results can avoid resource waste. When it is predicted that the resource requirements will decrease, reduce the resource allocation in a timely manner to release the excess resources for other services to use; when it is predicted that the resource requirements will increase, increase the resource allocation in advance to ensure that the performance of the service is not affected. For example, during off-peak hours, the resource requirements of containerized microservices are relatively low, and the CPU and memory resources can be reduced to lower the cost; while during peak hours, increase the resource allocation in advance to ensure the response speed and throughput of the service.

[0145] Dynamic resource adjustment can keep the system in the optimal resource configuration state all the time, improving the overall performance of the system. By meeting the resource requirements in a timely manner, it avoids performance degradation caused by insufficient resources, and at the same time avoids waste caused by over-allocation of resources. For example, for services with high real-time requirements, insufficient resources may lead to an extended response time, affecting the user experience. By accurately predicting resource requirements and making dynamic adjustments, it can ensure that the service always has good performance.

[0146] 3. In a changing microservices architecture, the number, type, and load conditions of services may change at any time. This method can adapt to this change by continuously learning new data and adjusting the prediction model in a timely manner to ensure the prediction accuracy. For example, when a new microservice goes online or an existing service is upgraded, the resource usage pattern may change. The model can quickly adapt to these changes by learning new data and provide accurate capacity predictions.

[0147] Different business scenarios have different resource requirements. This method can be adjusted according to different business scenarios. By collecting and analyzing resource usage data in specific business scenarios, it provides targeted capacity prediction and resource adjustment solutions. For example, for online video services and e-commerce platforms, their resource usage patterns are very different. The model can be trained and adjusted for different business scenarios to meet the needs of different businesses.

[0148] 4. Through automated capacity prediction and resource adjustment, manual intervention can be reduced and operation and maintenance costs can be lowered. Operation and maintenance personnel do not need to constantly monitor resource usage and manually adjust resource allocation, but can rely on the model to automatically make predictions and adjustments. Accurate capacity prediction and dynamic resource adjustment can avoid over-allocation and waste of resources, thereby reducing costs. By reasonably utilizing resources, the number of servers can be reduced, energy consumption can be lowered, and the utilization efficiency of resources can be improved.

[0149] In an exemplary embodiment, as Figure 4 shown, a schematic flowchart of prediction by a deep neural network model formed by a deep belief network and support vector regression is provided, where:

[0150] I. Data collection:

[0151] Collect historical performance data of containerized microservices, including indicators such as CPU usage rate, memory usage rate, storage usage rate, network bandwidth usage rate, etc. At the same time, record relevant information such as service type, deployment environment, business traffic pattern, etc. Let the collected data be where respectively represent the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate at time step t.

[0152] II. Data preprocessing:

[0153] 1. Outlier handling: For each indicator, the 3σ principle is used to detect and handle outliers. For example, for the CPU usage rate, let the set of CPU usage rates at all time steps be calculate its mean and standard deviation , if exceeds the range , it is regarded as an outlier and can be replaced by the mean of adjacent values. The same outlier handling is performed for the memory usage rate, storage usage rate, and network bandwidth usage rate.

[0154] 2. Normalization processing: The data of each indicator is scaled to the [0,1] interval through the Min-Max normalization method. For the CPU usage rate, the calculation formula is , where CPU represents the set of CPU usage rates for all time steps. Memory usage rate normalization: Let the set of memory usage rates be , then .

[0155] Storage usage rate normalization: Let the set of storage usage rates be:

[0156]

[0157] Then

[0158] Network bandwidth usage rate normalization: Let the set of network bandwidth usage rates be , then .

[0159] III. Constructing a Deep Belief Network (DBN, Deep Belief Network):

[0160] 1. Training a Restricted Boltzmann Machine (RBM, Restricted Boltzmann Machine):

[0161] The DBN is composed of multiple stacked RBMs. First, train the first RBM, using the preprocessed data as the input. , where v represents the visible layer (input data), h represents the hidden layer, represents the model parameters, and represent the number of neurons in the visible layer and the hidden layer respectively.

[0162] Train the RBM by maximizing the log-likelihood function , where . Use the Contrastive Divergence algorithm (CD) to approximately calculate the gradient of the log-likelihood function, and then update the model parameters.

[0163] 2. Stacking RBMs to construct a DBN:

[0164] After training the first RBM, use the output of its hidden layer as the input for the next RBM and continue training. Repeat this process until the entire DBN is constructed.

[0165] IV. Feature extraction:

[0166] Input the preprocessed data into the trained DBN, and obtain high-level abstract feature representations by extracting features layer by layer. These features capture the complex patterns and relationships in the data, which helps with subsequent capacity prediction. Let the features extracted by the DBN be .

[0167] V. Building a Support Vector Regression (SVR) model:

[0168] 1. Using the features extracted by DBN as the input, build an SVR model for capacity prediction. The optimization problem of SVR is expressed as:

[0169] , and , and , where is the normal vector of the hyperplane, b is the bias term, and are slack variables, C is the penalty parameter, is the insensitive loss parameter.

[0170] 2. Transform the above optimization problem into a dual problem for solution by the Lagrange multiplier method to obtain the prediction model of SVR: , where and are Lagrange multipliers.

[0171] VI. Model training:

[0172] Use the training set to train the deep neural network model composed of DBN and SVR. First, fix the parameters of DBN and train the SVR model. Use the feature vectors obtained after feature extraction by DBN in the training set as the input of SVR. The goal of SVR is to learn a function that can predict the resource requirements of containerized microservices according to the input feature vectors. Continuously adjust the parameters of SVR using the data in the training set to minimize the error between the predicted value and the true value. Update the parameters by methods such as gradient descent.

[0173] Then, slightly adjust the parameters of the entire model. After training SVR with fixed DBN parameters, fine-tune the entire deep neural network model. Use the backpropagation algorithm to adjust the parameters of DBN and SVR. Starting from the output layer of SVR, calculate the prediction error and backpropagate the error to each layer of DBN. According to the error signal, adjust the weights and biases of DBN and SVR to improve the prediction accuracy of the model. Repeat this process until the performance of the model on the training set reaches a satisfactory level or reaches the preset number of iterations.

[0174] VII. Capacity prediction process:

[0175] When capacity prediction is required, preprocess the current performance data and input it into DBN. DBN extracts features from the data layer by layer to obtain a high-level abstract feature representation is input into the SVR model. The SVR model calculates the predicted resource requirements according to its prediction model and obtains the predicted values of CPU usage, memory usage, storage usage, and network bandwidth usage within a future period of time.

[0176] VIII. Dynamic Resource Adjustment:

[0177] Dynamically adjust the resource allocation of containers according to the prediction results:

[0178] If it is predicted that the future resource requirements will increase, for example, it is predicted that indicators such as CPU usage and memory usage will rise, the corresponding resources of the container can be increased in advance. Specifically, container orchestration tools (such as Kubernetes) can be used to adjust parameters such as CPU and memory limits and requests of the container.

[0179] If it is predicted that the resource requirements will decrease, appropriately reduce the resource allocation and release the excess resources for other services to use. Similarly, use container orchestration tools to adjust resources, reduce the resource configuration of the container, and improve resource utilization.

[0180] When performing resource adjustment, the availability and cost of resources need to be considered. If resources are insufficient, consider adding servers or using elastic resources of cloud service providers; if resources are in excess, consider releasing the excess resources to reduce costs.

[0181] Compared with the prior art, the technical advantages of this embodiment are as follows:

[0182] 1. This model can achieve accurate capacity prediction. Through the stacking of multiple restricted Boltzmann machines, the DBN can effectively learn the complex patterns and potential features in the historical performance data of containerized microservices. After layer-by-layer unsupervised learning, the original data is transformed into a high-level abstract feature representation, capturing the non-linear relationships and long-term dependencies in the data. The SVR then uses these features as input and utilizes its powerful regression ability for capacity prediction, and can accurately predict the resource requirements of containerized microservices within a future period of time, such as CPU usage, memory usage, storage usage, and network bandwidth usage, etc.

[0183] 2. Dynamic resource adjustment improves resource utilization. According to the prediction results of the model, the container resources can be dynamically allocated in a timely and accurate manner. When it is predicted that the resource requirements increase, increase the corresponding resources in advance to ensure that the performance of the microservices is not affected; when it is predicted that the resource requirements decrease, appropriately reduce the resource allocation to avoid resource waste. This dynamic adjustment enables containerized microservices to always run under the optimal resource configuration, improves the overall resource utilization, and reduces costs.

[0184] 3. Adapt to a changing environment. In a distributed architecture, the environment of containerized microservices is complex and ever-changing, and the number, type, and load conditions of services may change at any time. This model can adapt to such changes by continuously learning new data, adjusting model parameters, and maintaining the accuracy of predictions. Whether a new service goes online, an existing service is upgraded, or the business traffic pattern changes, the model can quickly adapt and provide reliable capacity prediction and resource adjustment solutions for containerized microservices.

[0185] 4. Have the advantages of automated operation and maintenance. Through automated capacity prediction and resource adjustment, the need for manual intervention is reduced, and the operation and maintenance costs are lowered. Instead of constantly monitoring resource usage and manually adjusting resource allocation, operation and maintenance personnel can rely on the model to automatically make predictions and adjustments, improving the operation and maintenance efficiency. And it helps to improve system performance. Accurate capacity prediction and reasonable resource allocation can ensure that containerized microservices maintain good performance under different load conditions. It avoids performance degradation caused by insufficient resources and also prevents waste caused by over-allocation of resources, keeping the system in a highly efficient operating state and providing stable and reliable services for users.

[0186] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same moment, but can be executed at different moments. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0187] Based on the same inventive concept, the embodiments of the present application also provide a container resource allocation device for implementing the container resource allocation method described above. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the container resource allocation device provided below can refer to the limitations on the container resource allocation method in the above text and will not be repeated here.

[0188] In an exemplary embodiment, as Figure 5 shown, a container resource allocation device is provided, including: an acquisition module 501, a prediction module 502, and a deployment module 503, where:

[0189] An acquisition module 501, configured to acquire container resource usage information for the current period; the container resource usage information includes CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate;

[0190] A prediction module 502, configured to input the container resource usage information for the current period into a pre-constructed target prediction model, and through a feature extraction module in the target prediction model, obtain potential features of container resource usage for the current period, and input the potential features of container resource usage into a prediction module in the target prediction model to obtain predicted container resource usage information for the next period; the potential features of container resource usage at least include features characterizing the association relationships existing among the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate;

[0191] A deployment module 503, configured to adjust the deployment of container resources for the next period according to the predicted container resource usage information.

[0192] In one embodiment, if the feature extraction module is characterized by a long short-term memory network layer and an autoencoder layer; the prediction module 502 is further configured to input the container usage information for the current period into the long short-term memory network layer, and obtain hidden state information for the current period through the long short-term memory network layer; input the hidden state information into the autoencoder layer, and obtain potential features of container resource usage for the current period through the autoencoder layer.

[0193] In one of the embodiments, if the feature extraction module is characterized by a deep belief network, and the prediction module is characterized by a support vector regression model, the prediction module 502 is further configured to input the container usage information for the current period into the deep belief network, and successively pass through multiple layers of restricted Boltzmann machines included in the deep belief network to obtain potential features of container resource usage for the current period; input the potential features of container resource usage into the support vector regression model to obtain predicted container resource usage information for the next period.

[0194] In an exemplary embodiment, the container resource deployment device further includes a model training module, configured to collect container resource usage information for multiple periods, and generate a training data set and a validation data set according to the container resource usage information; fix the parameters of the to-be-trained deep belief network, and use the training data set to perform parameter training on the to-be-trained support vector regression model to obtain a candidate support vector regression model; through the training data set, perform training on the parameters of the to-be-trained deep belief network and the parameters of the candidate support vector regression model to obtain a deep belief network and a support vector regression model; generate a to-be-evaluated prediction model according to the deep belief network and the support vector regression model; perform performance evaluation on the to-be-evaluated prediction model through the validation data set, and adjust the model hyperparameters of the to-be-evaluated prediction model according to the results of the performance evaluation to obtain a target prediction model.

[0195] In one embodiment, the obtaining module 501 further includes a collection sub-module, an outlier processing sub-module, and a normalization processing sub-module, where:

[0196] The collection sub-module is configured to collect the original container resource usage information of the current period, and obtain the information mean and information standard deviation of the original container resource usage information;

[0197] The outlier processing sub-module is configured to perform outlier processing on the original container resource usage information by using the information mean and information standard deviation to obtain the processed container resource usage information;

[0198] The normalization processing sub-module is configured to perform normalization processing on the processed container resource usage information to obtain the container resource usage information.

[0199] In one of the embodiments, the outlier processing sub-module is further configured to construct a normal container resource usage information interval by using the information mean and information standard deviation; determine the original container resource usage information that does not belong to the normal container resource usage information interval as the abnormal original container resource usage information; obtain the adjacent original container resource usage information of the abnormal original container resource usage information, and use the mean of the adjacent original container resource usage information to replace the abnormal original container resource usage information to obtain the processed container resource usage information.

[0200] Each module in the above container resource allocation device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above respective modules.

[0201] In an exemplary embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 6As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate, as well as predicted container resource usage information. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a method for allocating container resources.

[0202] Those skilled in the art can understand that Figure 6 the structure shown in is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0203] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, it implements the method for allocating container resources in the above embodiment.

[0204] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, it implements the method for allocating container resources in the above embodiment.

[0205] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, it implements the method for allocating container resources in the above embodiment.

[0206] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.

[0207] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., without limitation.

[0208] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope recorded in the present application.

[0209] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation to the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims

1. A method for allocating container resources, characterized in that The method includes: Obtaining the container resource usage information for the current period; the container resource usage information includes CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate; Inputting the container resource usage information for the current period into a pre-constructed target prediction model, and through the feature extraction module in the target prediction model, obtaining the potential features of the container resource usage for the current period. Inputting the potential features of the container resource usage into the prediction module in the target prediction model to obtain the predicted container resource usage information for the next period; the potential features of the container resource usage at least include features characterizing the correlation relationships among the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate; Adjusting the allocation of container resources for the next period according to the predicted container resource usage information.

2. The method according to claim 1, wherein If the feature extraction module represents a long short-term memory network layer and an autoencoder layer; The obtaining of the potential features of the container resource usage for the current period through the feature extraction module in the target prediction model includes: Inputting the container usage information for the current period into the long short-term memory network layer, and obtaining the hidden state information for the current period through the long short-term memory network layer; Inputting the hidden state information into the autoencoder layer, and obtaining the potential features of the container resource usage for the current period through the autoencoder layer.

3. The method according to claim 1, wherein If the feature extraction module represents a deep belief network, and the prediction module represents a support vector regression model; The obtaining of the potential features of the container resource usage for the current period through the feature extraction module in the target prediction model includes: Inputting the container usage information for the current period into the deep belief network, and sequentially passing through multiple layers of restricted Boltzmann machines included in the deep belief network to obtain the potential features of the container resource usage for the current period; The inputting of the potential features of the container resource usage into the prediction module in the target prediction model to obtain the predicted container resource usage information for the next period includes: Inputting the potential features of the container resource usage into the support vector regression model to obtain the predicted container resource usage information for the next period.

4. The method according to claim 3, wherein The target prediction model is trained through the following steps: Collecting the container resource usage information for multiple periods, and generating a training data set and a validation data set according to the container resource usage information; Fixing the parameters of the deep belief network to be trained, and using the training data set to train the parameters of the support vector regression model to be trained to obtain a candidate support vector regression model; Training the parameters of the deep belief network to be trained and the parameters of the candidate support vector regression model through the training data set to obtain the deep belief network and the support vector regression model; Generating a prediction model to be evaluated according to the deep belief network and the support vector regression model; Performing performance evaluation on the prediction model to be evaluated through the validation data set, and adjusting the model hyperparameters of the prediction model to be evaluated according to the results of the performance evaluation to obtain the target prediction model.

5. The method according to claim 1, wherein The obtaining of the container resource usage information for the current period includes: Collect the original container resource usage information for the current period, and obtain the information mean and information standard deviation of the original container resource usage information; Use the information mean and the information standard deviation to perform outlier processing on the original container resource usage information to obtain the processed container resource usage information; Perform normalization processing on the processed container resource usage information to obtain the container resource usage information.

6. The method according to claim 5, wherein The using the information mean and the information standard deviation to perform outlier processing on the original container resource usage information to obtain the processed container resource usage information includes: Use the information mean and the information standard deviation to construct a normal container resource usage information interval; Determine the original container resource usage information that does not belong to the normal container resource usage information interval as abnormal original container resource usage information; Obtain the adjacent original container resource usage information of the abnormal original container resource usage information, and use the mean of the adjacent original container resource usage information to replace the abnormal original container resource usage information to obtain the processed container resource usage information.

7. A device for allocating container resources, characterized in that, The device includes: An acquisition module for acquiring the container resource usage information for the current period; the container resource usage information includes CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate; A prediction module for inputting the container resource usage information for the current period into a pre-constructed target prediction model, obtaining the potential features of the container resource usage for the current period through the feature extraction module in the target prediction model, and inputting the potential features of the container resource usage into the prediction module in the target prediction model to obtain the predicted container resource usage information for the next period; the potential features of the container resource usage at least include features characterizing the correlation relationship existing among the CPU usage rate, memory usage rate, storage usage rate, and network bandwidth usage rate; A deployment module for adjusting the deployment of the container resources for the next period according to the predicted container resource usage information.

8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Cloud resource optimization method and device, computer equipment and storage medium

    CN121125528A