Load prediction method and device based on hybrid model in container cloud environment

By adopting a hybrid model-based load prediction method in the container cloud environment, combining the NeuralProphet model, CNN-LSTM-Attention combined model and artificial neural network, the problem of inaccurate load prediction in the existing technology is solved and higher predictions are achieved Accuracy and robustness improve service quality.

CN119440977AActive Publication Date: 2025-02-14ZHEJIANG UNIV

Patent Information

Application Number
CN202411341986.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2025-02-14
Estimated Expiration
2044-09-25

AI Technical Summary

Technical Problem

In container cloud environments, existing load prediction methods are difficult to accurately capture complex changing patterns of load data, especially in the face of nonlinear relationships and mutations, resulting in a decline in service quality.

Method used

Using a load prediction method based on hybrid model, the historical load data of container applications is collected in real time, and preprocessed to correct outliers and fill missing values. Combination models such as NeuralProphet model, CNN-LSTM-Attention combined model and artificial neural network are used. Perform iterative training to obtain the trained load prediction model for load prediction at future moments.

Benefits of technology

It improves the accuracy and robustness of load prediction, can capture the multi-level characteristics of time series data more comprehensively, reduces the phenomenon of inaccurate prediction and lag, and improves the overall service quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440977A_ABST
    Figure CN119440977A_ABST
Patent Text Reader

Abstract

The invention discloses a load prediction method and device based on a hybrid model in a container cloud environment, and the method comprises the steps: collecting the historical load data of a container application from the container cloud environment in real time, and storing the historical load data in a time sequence database Prometheus; preprocessing the historical load data, correcting abnormal values and filling missing values; designing a load prediction model based on the hybrid model architecture, training the load prediction model by using the preprocessed historical load data, adjusting network parameters of the load prediction model according to evaluation indexes of the load prediction model in the training process, and obtaining a trained load prediction model; and using the trained load prediction model to obtain load data at a future moment. According to the invention, the trend and periodicity of load change can be learned from the historical data of the load, and the load condition at the future moment can be accurately predicted; the multi-level features of the time series data can be fully captured, and the accuracy and robustness of prediction are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of elastic expansion technology in a container cloud environment, and in particular to a load prediction method and device based on a hybrid model in a container cloud environment. Background Art

[0002] In recent years, with the development and increasing maturity of cloud computing technology, load prediction technology in cloud environments has become a key technology to ensure system stability and optimize resource utilization. Load prediction technology analyzes historical load data and predicts resource requirements in advance, thereby achieving refined resource management. Accurate load prediction can improve the efficiency of resource scheduling, reduce resource waste, and improve the overall service quality.

[0003] The currently widely used load forecasting methods can be roughly divided into three categories: traditional statistical methods, machine learning methods, and deep learning methods. Traditional statistical methods represented by the ARIMA (autoregressive moving average) model can well capture the trend and seasonal components of data, are suitable for linear time series data, and have strong interpretability. Machine learning methods such as XGBoost are good at capturing complex nonlinear relationships, have strong robustness to missing values ​​and outliers, and are not easily affected by data noise. Mainstream deep learning methods such as LSTM (long short-term memory network) can remember long-term historical information and capture long-term dependencies in time series. As the data scale increases, the performance of deep learning can be continuously improved.

[0004] In the container cloud environment, load data has various change patterns, with significant volatility and multi-periodicity. At the same time, the preparation time for container readiness is relatively long, so in order to ensure service quality, it is necessary to start the container in advance based on the load prediction results, which requires a high accuracy of load prediction.

[0005] Each of the above solutions has its own advantages and disadvantages. Among them, most traditional statistical methods have difficulty in dealing with nonlinear relationships and mutations, and parameter tuning is relatively complex. Machine learning methods have more powerful learning capabilities, but they need to capture time series dependencies through feature engineering (such as adding lag features, etc.); the quality of feature engineering greatly affects the accuracy of model predictions, so it is not suitable for cloud scenarios where time series features change rapidly and diversely. Deep learning methods can automatically learn and extract features from raw data, reducing human intervention and errors; but using only one method for training and prediction is prone to inaccurate predictions and delayed predictions, resulting in reduced service quality. Summary of the invention

[0006] The purpose of the present invention is to address the deficiencies in the prior art and to propose a load prediction method and device based on a hybrid model in a container cloud environment.

[0007] The objective of the present invention is achieved through the following technical solutions: In a first aspect, an embodiment of the present invention provides a load prediction method based on a hybrid model in a container cloud environment, comprising the following steps:

[0008] (1) Collect historical load data of container applications in real time from the container cloud environment and save it to the time series database Prometheus; the load data includes resource usage indicator data and business-related data;

[0009] (2) preprocessing the historical load data collected in step (1) to correct outliers and fill in missing values;

[0010] (3) Designing a load prediction model based on the hybrid model architecture, and iteratively training the load prediction model using preprocessed historical load data. During the training process, the network parameters of the load prediction model are adjusted according to the evaluation index of the load prediction model to obtain a trained load prediction model;

[0011] (4) Use the trained load prediction model to obtain load data at future times.

[0012] Furthermore, the resource usage indicator data includes CPU utilization, memory utilization, network throughput, and disk I / O; the business-related data includes user behavior data and external environment data.

[0013] Furthermore, the historical load data collected in step (1) is preprocessed to correct abnormal values ​​and fill missing values, specifically including:

[0014] For the historical load data collected in step (1), an isolation forest algorithm is used to detect outliers, and then a neighbor value filling method is used to correct the outliers, that is, the average value of the adjacent position data before and after the current time point is used to replace the outliers;

[0015] The missing values ​​are filled by linear interpolation method, specifically: the data of the K time points before the current time point are linearly fitted, and the value of the current time point is predicted to fill the missing values.

[0016] Furthermore, the load prediction model includes a NeuralProphet model, a CNN-LSTM-Attention combination model and an artificial neural network; the input sequence data is input into the load prediction model, and passes through the NeuralProphet model and the CNN-LSTM-Attention combination model respectively to obtain a first prediction output sequence data and a third prediction output sequence data; the first prediction output sequence data is subtracted from the actual output sequence data to obtain a residual sequence; the residual sequence is input into the CNN-LSTM-Attention combination model to obtain a second prediction output sequence data; the first prediction output sequence data, the second prediction output sequence data and the third prediction output sequence data are simultaneously input into the artificial neural network to obtain a final prediction result.

[0017] Furthermore, the NeuralProphet model is composed of a trend module, a periodicity module, a holiday factor module, an autoregressive effect module and a lagged regression effect module in parallel; the input sequence data is input into the NeuralProphet model, passing through the trend module, the periodicity module, the holiday factor module, the autoregressive effect module and the lagged regression effect module respectively, and the sum of the components output by all modules is the first predicted output sequence data output by the NeuralProphet model.

[0018] Furthermore, the CNN-LSTM-Attention combined model includes a convolutional neural network module, a long short-term memory network module and an attention mechanism module; the input sequence data or the residual sequence is input into the CNN-LSTM-Attention combined model, and first enters the convolutional neural network module to obtain a local feature representation of the sequence; the local feature representation of the sequence then passes through the long short-term memory network module to capture the long-term dependencies in the sequence and obtain the final global time series features; the global time series features obtain the corresponding attention weights through the attention mechanism module, and the attention weights are weighted and summed with the global time series features output by the long short-term memory network module of the corresponding time step to obtain the third predicted output sequence data or the second predicted output sequence data output by the CNN-LSTM-Attention combined model.

[0019] Furthermore, the use of the preprocessed historical load data to iteratively train the load prediction model, during which the network parameters of the load prediction model are adjusted according to the evaluation index of the load prediction model to obtain a trained load prediction model, specifically includes:

[0020] First, define the length of the input sequence as L, the current time point as T, and the length of the output sequence as Q;

[0021] Then, based on the preprocessed historical load data, the load data of the container application at L moments [T-L+1, T] is taken as the input sequence data, and the load data of the container application at Q moments [T+1, T+Q] is taken as the real output sequence data;

[0022] Secondly, the input sequence data is input into the load forecasting model, and is passed through the NeuralProphet model and the CNN-LSTM-Attention combined model respectively to obtain the first predicted output sequence data and the third predicted output sequence data; the first predicted output sequence data is subtracted from the real output sequence data to obtain the residual sequence; the residual sequence is input into the CNN-LSTM-Attention combined model to obtain the second predicted output sequence data; the first predicted output sequence data, the second predicted output sequence data and the third predicted output sequence data are simultaneously input into the artificial neural network to obtain the final prediction result;

[0023] Then, the evaluation index of the load forecasting model is calculated according to the final forecast result and the real output sequence data, wherein the evaluation index of the load forecasting model includes the mean absolute percentage error, the average accuracy, the mean absolute error and the mean square root error;

[0024] Finally, with the optimization objectives of minimizing the mean absolute percentage error, mean absolute error and mean square root error and maximizing the average accuracy, the network parameters of the load forecasting model are adjusted until the preset training rounds are reached to obtain a trained load forecasting model.

[0025] Furthermore, after step (4), the method further comprises:

[0026] Combined with the load data at future times predicted by the load prediction model, the container demand at future times is calculated, and a specified number of elastic instances are prepared in advance to achieve elastic expansion of elastic instances; the number of elastic instances is determined in proportion to the container demand at future times.

[0027] A second aspect of an embodiment of the present invention provides a load prediction device based on a hybrid model in a container cloud environment, comprising one or more processors and a memory, wherein the memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the above-mentioned load prediction method based on a hybrid model in the container cloud environment.

[0028] A third aspect of an embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, it is used to implement the load prediction method based on the hybrid model in the above-mentioned container cloud environment.

[0029] Compared with the prior art, the present invention has the following beneficial effects:

[0030] (1) Based on a deep learning algorithm and a hybrid model architecture, the present invention learns the trend and periodicity of load changes from historical load data and makes accurate predictions of load conditions at future times.

[0031] (2) The present invention designs a data extraction strategy, anomaly detection and correction, and missing value filling method to pre-process container historical data and provide data support for the subsequent load prediction module.

[0032] (3) The present invention designs a load prediction method based on a hybrid model, which can fully capture the multi-level characteristics of time series data based on the container historical data and ensure the accuracy and robustness of the model prediction.

[0033] (4) The present invention can make up for the problems that a single model cannot fully capture data features in load forecasting and the prediction performance is easily affected, thereby greatly improving the accuracy and robustness of model prediction.

[0034] (5) In addition, the present invention also proposes an elastic solution for proportional expansion based on load prediction results to replace the traditional solution of setting a fixed number of instances; according to the load prediction results, the resource demand is predicted in advance, the number of elastic instances is calculated, and the instance resources that need to be ready are dynamically adjusted in advance to cope with scenarios such as load bursts, thereby ensuring high availability of the project, improving the intelligence of resource management, ensuring service quality, saving instance resources, and reducing enterprise costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is a flow chart of the load prediction method based on the hybrid model in the container cloud environment of the present invention;

[0036] Figure 2 An architectural diagram of a load prediction model designed based on a hybrid model architecture of the present invention;

[0037] Figure 3 It is a schematic diagram of the output result of the elastic solution of proportional expansion based on load prediction results of the present invention;

[0038] Figure 4 A structural schematic diagram of a load prediction device based on a hybrid model in a container cloud environment of the present invention. DETAILED DESCRIPTION

[0039] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims. It should be understood that the above general description and the detailed description that follows are merely exemplary and explanatory and cannot limit the present application.

[0040] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0041] It should be understood that, although the term first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of..." or "when..." or "in response to determination". Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process and method including a series of elements include not only those elements, but also include other elements not clearly listed, or also include elements inherent to such process and method. In the absence of more restrictions, the elements limited by the statement "including one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements.

[0042] The present invention is described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the features of the following embodiments and implementations can be combined with each other.

[0043] See also Figure 1 The load prediction method based on the hybrid model in the container cloud environment of the present invention specifically includes the following steps:

[0044] (1) Collect historical load data of container applications in real time from the container cloud environment and save it to the time series database Prometheus. The load data includes resource usage indicator data and business-related data.

[0045] It should be noted that the current step is the initial stage of load forecasting, which aims to collect and integrate time series data and business-related data from the container cloud environment for subsequent analysis and modeling.

[0046] Furthermore, resource usage indicator data includes but is not limited to key indicator data such as CPU utilization, memory utilization, network throughput, and disk I / O. The collected resource usage indicator data is summarized and saved in the time series database Prometheus, thus ensuring the integrity and accuracy of the data. In addition, in order to make the load forecast more accurate and comprehensive, it is also necessary to extract other business-related data, such as user behavior data such as user session duration, external environment data such as promotional activities, etc.

[0047] It should be understood that Prometheus is a commonly used time series database. In a container cloud environment, some resource usage indicator data and business-related data will be stored in the time series database Prometheus. Therefore, when needed, they can be directly extracted from the time series database Prometheus.

[0048] (2) Preprocess the historical load data collected in step (1) to correct outliers and fill in missing values.

[0049] It should be understood that the collected raw data often has problems such as noise, missing values, and outliers, which will affect the prediction performance of the load prediction model. Therefore, it is necessary to improve the data quality through data preprocessing, thereby improving the prediction performance of the load prediction model.

[0050] Furthermore, the historical load data collected in step (1) is preprocessed to correct outliers and fill missing values, specifically including: for the historical load data collected in step (1), an isolation forest algorithm is used to detect outliers, and then a neighbor value filling method is used to correct the outliers, that is, the outliers are replaced by the average value of the adjacent position data before and after the current time point; a linear interpolation method is used to fill missing values, specifically: the data of the first K (such as 10, 20, etc., which can be selected according to actual needs) time points before the current time point are taken for linear fitting, and the value of the current time point is predicted to fill the missing values.

[0051] It should be understood that after the outliers are detected by the isolation forest algorithm, the neighbor value filling method is used to correct the outliers, which can maximize the continuity of the data trend. In addition, the load forecasting model is sensitive to missing values. In order to improve the forecasting accuracy, the linear interpolation method is used to fill the missing values, which can capture the long-term laws of data trends, ensure the consistency of time frequency, and is not easily affected by mutation data. Preprocessing the original data can ensure the continuity of the time column in the data sequence.

[0052] Furthermore, the Isolation Forest Algorithm is a randomized anomaly detection algorithm that uses the isolation of normal samples relative to abnormal samples to detect abnormal samples. Its core idea is to isolate data points by randomly selecting features and segmentation points to identify abnormal points. The specific implementation steps are as follows:

[0053] ① Build the original data set based on the collected historical load data of container applications, randomly select a feature and a split point, and divide the original data set into two subsets. Among them, each type of attribute is regarded as a feature, and randomly selecting a feature is the process of building a tree by the isolation forest algorithm; the split point is a randomly selected data point, the purpose of which is to divide the original data set into different subsets through this data point, and finally filter out outliers.

[0054] ② Repeat step ① for each subset to build a segmentation tree until all data points are completely isolated or the maximum depth of the tree is reached. The depth of the tree refers to the number of layers. A large tree depth means that the tree is complex, the training process will be slower, and it is easy to overfit. Therefore, it is usually necessary to control the depth of the tree, which can be set according to actual needs.

[0055] ③ Repeat steps ① and ② to construct multiple random binary trees. These random binary trees constitute a random forest.

[0056] ④ For new samples, start searching from the root node of the tree until a leaf node that meets the split point requirements is found or the maximum depth of the tree is reached, stop searching, and calculate the path length in the tree based on the current position of the leaf node; repeat the above process until the path length of the new sample in all trees of the random forest is calculated; then calculate the average path length based on the path length of the new sample in all trees; calculate the abnormal score of the sample based on the average path length, and the calculation formula is:

[0057]

[0058] Among them, s(x,n) represents the anomaly score; c(n) represents the average path length required to completely isolate a data point in a random binary tree; E(h(x)) is the average path length of sample x in all trees; n is the sample size of the training data. The closer the anomaly score is to 1, the more abnormal it is. Here, if the anomaly score of a sample is greater than the preset anomaly score threshold, the sample is an outlier.

[0059] (3) A load prediction model is designed based on the hybrid model architecture, and the load prediction model is iteratively trained using the preprocessed historical load data. During the training process, the network parameters of the load prediction model are adjusted according to the evaluation indicators of the load prediction model to obtain a trained load prediction model.

[0060] It should be noted that a single model can only process certain features and may not be able to fully capture all important patterns in the time series. At the same time, when faced with complex time series data or noise, a single model may encounter bottlenecks, resulting in reduced prediction accuracy. Therefore, considering the accuracy and robustness of the prediction, based on Figure 2 The hybrid model architecture shown designs a load prediction model to improve the above problems.

[0061] In this embodiment, the load prediction model includes a NeuralProphet model, a CNN-LSTM-Attention combination model, and an artificial neural network. Figure 2 As shown, the input sequence data is input into the load prediction model, and passes through the NeuralProphet model and the CNN-LSTM-Attention combination model respectively to obtain the first predicted output sequence data y1 and the third predicted output sequence data y3; the first predicted output sequence data y1 is subtracted from the actual output sequence data to obtain the residual sequence; the residual sequence is input into the CNN-LSTM-Attention combination model to obtain the second predicted output sequence data y2; the first predicted output sequence data y1, the second predicted output sequence data y2 and the third predicted output sequence data y3 are simultaneously input into the artificial neural network to obtain the final prediction result.

[0062] It should be noted that the first predicted output sequence data y1 initially predicted by the NeuralProphet model will have certain errors, so a set of residual sequences is obtained by subtracting it from the actual output sequence data; then the CNN-LSTM-Attention combined model is used to fit the residual sequence and output the second predicted output sequence data y2 to correct the prediction error.

[0063] It should be understood that the load prediction model can capture the time series patterns and correlations of the load based on the historical load data of the container application, capture the regularity within the time series load data, and predict the load of the container application at future times.

[0064] In this embodiment, the core idea of ​​the NeuralProphet model is the composability of modules. The NeuralProphet model is composed of multiple modules in parallel, such as a trend module, a periodic module, a holiday factor module, an autoregressive effect module, and a lagged regression effect module. The input sequence data is input into each of the above modules respectively, and the output of each module is used as a component. The sum of the components output by each module is the first predicted output sequence data output by the NeuralProphet model, which is expressed as:

[0065] y(t)=T(t)+S(t)+E(t)+A(t)+L(t)

[0066] Among them, y(t) represents the first predicted output sequence data at time t, T(t) represents the trend term, S(t) represents the cycle term, E(t) represents the holiday factor, A(t) represents the autoregressive effect based on the historical autoregressive effect value observation, and L(t) represents the regression effect of the lagged observation of the external variable.

[0067] Furthermore, the trend module is modeled as a continuous piecewise linear sequence, and the growth rate and offset over time are defined to summarize this nonlinear trend, which can be expressed as:

[0068] T(t)=(δ0+Γ(t) T δ)·t+(ρ0+Γ(t) T ρ)

[0069] Among them, δ0 represents the growth rate of the first linear sequence, ρ0 represents the offset of the first linear sequence, δ and ρ represent the growth rate and offset, Γ(t) represents whether each change point is exceeded at time t, and the superscript T represents the transposition operation.

[0070] Furthermore, the periodic module approximates the periodic components by using Fourier series, and the sum of all periodic components is the output of the periodic module, which can be expressed as:

[0071]

[0072] Where S(t) represents the periodic term output by the periodic module, p is the periodicity, P is the set of all periodicities, S p (t) represents the Fourier term corresponding to the periodicity p, and its expression is:

[0073]

[0074] Among them, a j represents the cosine coefficient of the jth Fourier term, b j represents the sine coefficient of the jth Fourier term, and k is the number of Fourier terms defined by the periodicity p.

[0075] It should be understood that Fourier terms of different frequencies allow the NeuralProphet model to adapt to more complex periodic patterns, such as daily, weekly, or yearly periodicity. At time t, the impact of all periodic factors considered by the NeuralProphet model is represented by S(t), which is the output of the periodic module.

[0076] Furthermore, the autoregressive effect (AR) module refers to the process of regressing the future value of a variable with its historical value. The number of historical values ​​is usually called the d-order of the AR module. Therefore, a coefficient θ is fitted to each historical value. g, which is used to control the direction (increase or decrease) and size of a specific historical value on the predicted value. The calculation formula of the autoregressive effect value output by the autoregressive effect module is expressed as:

[0077]

[0078] Among them, A(t) represents the autoregressive effect value output by the autoregressive effect module at time t, which represents the predicted value; A(t-1) represents the historical autoregressive effect value at time t-1, which represents the historical value; c represents the intercept, ε t is the white noise term, θ g represents the fitting coefficient of the historical autoregressive effect value A(t-1), and d represents the total number of historical autoregressive effect values.

[0079] It should be understood that A(t) represents the autoregressive effect value output by the autoregressive effect module at time t, which is the autoregressive effect value observed based on the historical autoregressive effect value A(t-1).

[0080] Furthermore, the lagged regression effect module is used to associate the externally observed lagged variables with the target time series, whose future values ​​are unknown to the NeuralProphet model, that is, at the predicted time t, the NeuralProphet model can only access the observed values ​​at time t-1 and before. Each lagged regression effect module is functionally the same as the AR module. The input of the lagged regression effect module is the most recent m observed values ​​of the variable, and the calculation formula is:

[0081]

[0082] in, It represents the h regression effect prediction values ​​output by the lagged regression effect module, AR-Net represents the lagged regression effect module, and h represents the prediction time step.

[0083] It should be understood that for the lagged regression effect module, the meaning of the above formula is: input m observations x t-1 ,x t-2 ,...,x t-m , predicting the value of h time steps in the future, so there are h output values ​​on the left.

[0084] Furthermore, the holiday factor module treats each event as a binary variable to represent the impact of all events at time t, expressed as:

[0085]

[0086] Among them, E(t) represents the impact value of the event output by the holiday factor module, z eis the holiday factor coefficient corresponding to event e, e∈[0,1] is a binary variable used to indicate whether the event occurs on a specific day.

[0087] It should be understood that special events or holidays may affect the trend of the time series, therefore, each event needs to be treated as a binary variable e(e∈[0,1]) indicating whether the event occurred on a specific day.

[0088] In this embodiment, the CNN-LSTM-Attention combination model includes a convolutional neural network (CNN) module, a long short-term memory (LSTM) network module and an attention mechanism (Attention) module. Input sequence data or residual sequence is input into the CNN-LSTM-Attention combination model, first enters the CNN module, and obtains the local feature representation of the sequence; the local feature representation of the sequence then passes through the LSTM network module to capture the long-term dependency in the sequence and obtain the final global time series feature; the global time series feature obtains the corresponding attention weight through the attention mechanism module, and the attention weight is weighted and summed with the global time series feature output by the LSTM network module of the corresponding time step to obtain the third predicted output sequence data or the second predicted output sequence data output by the CNN-LSTM-Attention combination model.

[0089] It should be understood that CNN is good at extracting local features of time series, and LSTM network is good at capturing long-term dependencies. This combination can generate more powerful feature representations and make full use of local patterns and global dependencies to improve prediction performance. The addition of the attention mechanism module allows the CNN-LSTM-Attention combination model to dynamically adjust the weights according to the importance of different parts of the input sequence data or residual sequence, so that it can more flexibly adapt to changes in the input sequence data or residual sequence, further enhance the prediction ability and interpretability of the CNN-LSTM-Attention combination model, and improve the CNN-LSTM-Attention combination model's ability to perceive the importance of different time steps.

[0090] Furthermore, the CNN module can efficiently extract feature information. Its basic structure includes convolutional layers, pooling layers, and fully connected layers. The input sequence data or residual sequence passes through the convolutional layers, pooling layers, and fully connected layers in sequence to obtain the local feature representation of the sequence. Among them, the convolutional layer performs convolution calculations on all input information to effectively extract the local features of the time series data; the input features are downsampled through the pooling layer to extract the main features and improve the noise resistance of the CNN module; the fully connected layer is responsible for flattening the output of the convolutional layer and the pooling layer into a one-dimensional vector, and the neurons of the fully connected layer are used for classification or regression to obtain the local feature representation of the sequence output by the CNN module.

[0091] Furthermore, the LSTM network module is a special recurrent neural network (RNN) model that controls the loss of information by adding a gate mechanism in the hidden layer. After dynamic adjustment during the back propagation process, the LSTM network module can learn long-distance time series data. In the LSTM network module, the hidden state of each time step is represented by the memory unit c t and output state h t The calculation process is as follows:

[0092] a. Input gate: By calculating the output vector i of the input gate t , controls the influence of the input at the current time step:

[0093] i t =σ(W i x t +U i h t-1 +b i )

[0094] Among them, W i , U i and b i is the learnable parameter in the input gate, σ() is the sigmoid function, x t Represents the input at the current time step.

[0095] b. Forget gate: By calculating the output vector f of the forget gate t , controls the degree of retention of previous memories:

[0096] f t =σ(W f x t +U f h t-1 +b f )

[0097] Among them, W t , U t and b t are learnable parameters in the forget gate.

[0098] c. Memory update: by calculating the new memory unit c t Update memory:

[0099] c t =f t ⊙c t-1 +i t ⊙tanh(W c x t +U c h t-1 +b c )

[0100] Among them, W c , U c and b c It is a parameter that can be learned during memory update, ⊙ represents element-by-element multiplication, and tanh() is the tanh activation function.

[0101] d. Output gate: The output vector o is calculated by the output gate. t Controls the influence of the output at the current time step:

[0102] o t =σ(W o x t +U o h t-1 +b o )

[0103] Among them, W o , U o and b o are learnable parameters in the output gate.

[0104] e. Finally, the output state h of the LSTM network module is calculated t :

[0105] h t =o t ☉tanh(c t )

[0106] Furthermore, the attention mechanism module can assign different weights to different parts of the input sequence, pay more attention to the key information in the input data, and help improve the accuracy and efficiency of the CNN-LSTM-Attention combination model. The calculation formula of the attention mechanism module is:

[0107]

[0108] Among them, Attention(Q,K,V) represents the attention weight output by the attention mechanism module, Q, K and V are query matrix, key value matrix and value matrix respectively, d kis the number of columns of the Q and K matrices, that is, the vector dimension, and softmax represents the softmax function.

[0109] In summary, the load forecasting model designed based on the hybrid model architecture can extract features at multiple levels. The NeuralProphet model can decompose the characteristics of the time series to process trends, periodicity and other components, and the CNN-LSTM-Attention combined model can fully capture local dependencies and global dependencies. This multi-level feature extraction method can more comprehensively characterize the complexity of time series data and improve prediction accuracy. The load forecasting model can adjust the prediction results in a targeted manner. The load forecasting model includes the fitting and prediction of the residual sequence, and can optimize the prediction output of each sub-model in a targeted manner; at the same time, it has stronger fault tolerance when dealing with outliers and noise, and each sub-model can complement each other, thereby improving the overall robustness.

[0110] In this embodiment, the load prediction model is iteratively trained using the preprocessed historical load data. During the training process, the network parameters of the load prediction model are adjusted according to the evaluation index of the load prediction model to obtain a trained load prediction model, which specifically includes: the input sequence and output sequence of the load prediction model are both historical load data of multiple container applications at multiple moments (i.e., time series data and business-related data). The length of the input sequence is first defined as L, the current time point is T, and the length of the output sequence is Q. Then, based on the preprocessed historical load data, the load data of the container application at L moments [T-L+1, T] is taken as the input sequence data, and the load data of the container application at Q moments [T+1, T+Q] is taken as the real output sequence data. For example, the input sequence length L is 120 minutes, and the output sequence length Q is 30 minutes. The input sequence is divided into a training set and a test set in chronological order, and the first 80% of the data is used as the training set, and the last 20% of the data is used as the test set for training and testing the load prediction model. Secondly, the input sequence data is input into the load forecasting model, and the first prediction output sequence data and the third prediction output sequence data are obtained by passing through the NeuralProphet model and the CNN-LSTM-Attention combination model respectively; the first prediction output sequence data is subtracted from the real output sequence data to obtain the residual sequence; the residual sequence is input into the CNN-LSTM-Attention combination model to obtain the second prediction output sequence data; the first prediction output sequence data, the second prediction output sequence data and the third prediction output sequence data are simultaneously input into the artificial neural network to obtain the final prediction result. Then, the evaluation index of the load forecasting model is calculated according to the final prediction result and the real output sequence data, wherein the evaluation index of the load forecasting model includes the mean absolute percentage error (MAPE), the average accuracy (Accuracy), the mean absolute error (MAE) and the mean square root error (RMSE). Finally, with the optimization objectives of minimizing the mean absolute percentage error, the mean absolute error and the mean square root error and maximizing the average accuracy, the network parameters of the load forecasting model are adjusted until the preset training rounds are reached to obtain the trained load forecasting model.

[0111] Furthermore, the calculation formulas of the evaluation indicators of the load forecasting model are:

[0112]

[0113] Accuracy=1-MAPE

[0114]

[0115] Among them, MAPE is the mean absolute percentage error, Accuracy is the average accuracy, MAE is the mean absolute error, RMSE is the mean square root error, y i Represents the real output sequence data, It represents the final prediction result output by the load prediction model, i represents the i-th data sample, and n represents the total number of data samples. The load prediction model is trained and tested using the above evaluation indicators to verify the fitting effect and prediction effect of the load prediction model.

[0116] (4) Use the trained load prediction model to obtain load data at future times.

[0117] In some embodiments, after step (4), the method further includes:

[0118] (5) The load data at the future time predicted by the load prediction model is combined to calculate the container demand at the future time, and a specified number of elastic instances are prepared in advance to achieve elastic expansion of the elastic instances; the number of elastic instances is determined according to a fixed ratio P of the container demand at the future time.

[0119] It should be understood that cloud loads in real scenarios are volatile and have sudden changes in trends. To ensure service quality, a certain number of elastic instances need to be prepared in advance to make up for the predicted lack of resources or the surge in the number of users accessing games, to meet user needs to the greatest extent possible, and to ensure high availability of services.

[0120] Specifically, combined with the load data predicted by the load prediction model at the future moment, the predicted maximum value in the load data sequence is used as the benchmark, and elastic expansion is performed according to a fixed ratio P as an elastic instance to prepare resources in advance. Based on the prediction results, the fixed ratio P is set to 20%, and the results of the elastic expansion are as follows: Figure 3 The following evaluation indicators are used to test the effect of elastic expansion:

[0121] Instance sufficiency rate = number of times when instances are sufficient / total time

[0122] Instance saving rate = 1-predicted number of instances / total number of instances

[0123] The greater the instance sufficiency rate and instance saving rate, the better the elastic expansion effect.

[0124] In some other embodiments, during the experiment, the prediction results of the load prediction model are evaluated and necessary iterative optimization is performed to achieve the expected effect.

[0125] Exemplarily, in this embodiment, based on a container load data set in a real scenario provided by an Internet company, the average accuracy of the load prediction module exceeds 95%, the elastic instance is ready through the elastic module, the average instance sufficiency rate exceeds 99.85%, and the average instance saving rate exceeds 40%.

[0126] Corresponding to the embodiment of the load prediction method based on the hybrid model in the aforementioned container cloud environment, the present invention also provides an embodiment of the load prediction device based on the hybrid model in the container cloud environment.

[0127] See also Figure 4 An embodiment of the present invention provides a load prediction device based on a hybrid model in a container cloud environment, including one or more processors and a memory, and the memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the load prediction method based on the hybrid model in the container cloud environment in the above embodiment.

[0128] The embodiment of the load prediction device based on the hybrid model in the container cloud environment of the present invention can be applied to any device with data processing capabilities, and the any device with data processing capabilities can be a device or apparatus such as a computer. The device embodiment can be implemented through software, or through hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of any device with data processing capabilities in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory for execution. From the hardware level, if Figure 4 As shown, it is a hardware structure diagram of any device with data processing capability where the load prediction device based on the hybrid model in the container cloud environment of the present invention is located, except Figure 4 In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiments is located may also include other hardware, generally based on the actual functions of the device with data processing capabilities, which will not be described in detail.

[0129] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0130] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.

[0131] An embodiment of the present invention also provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the load prediction method based on a hybrid model in a container cloud environment in the above embodiment is implemented.

[0132] The computer-readable storage medium may be an internal storage unit of any device with data processing capability described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium may also be any device with data processing capability, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of any device with data processing capability and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capability, and may also be used to temporarily store data that has been output or is to be output.

[0133] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A load prediction method based on a hybrid model in a container cloud environment, characterized in that: The following steps are involved: (1) Collect historical load data of container applications in real time from the container cloud environment and save it to the time series database Prometheus; wherein the load data includes resource usage indicator data and business-related data; (2) preprocessing the historical load data collected in step (1) to correct outliers and fill in missing values; (3) Designing a load prediction model based on the hybrid model architecture, and iteratively training the load prediction model using preprocessed historical load data. During the training process, the network parameters of the load prediction model are adjusted according to the evaluation index of the load prediction model to obtain a trained load prediction model; (4) Use the trained load prediction model to obtain load data at future times.

2. The load prediction method based on a hybrid model in a container cloud environment according to claim 1 is characterized in that: The resource usage indicator data includes CPU utilization, memory utilization, network throughput, and disk I / O; the business-related data includes user behavior data and external environment data.

3. The load prediction method based on a hybrid model in a container cloud environment according to claim 1 is characterized in that: The historical load data collected in step (1) is preprocessed to correct abnormal values ​​and fill missing values, specifically including: For the historical load data collected in step (1), an isolation forest algorithm is used to detect outliers, and then a neighbor value filling method is used to correct the outliers, that is, the average value of the adjacent position data before and after the current time point is used to replace the outliers; The missing values ​​are filled by linear interpolation method, specifically: the data of the K time points before the current time point are linearly fitted, and the value of the current time point is predicted to fill the missing values.

4. The load prediction method based on a hybrid model in a container cloud environment according to claim 1 is characterized in that: The load prediction model includes a NeuralProphet model, a CNN-LSTM-Attention combination model and an artificial neural network; input sequence data is input into the load prediction model, and passes through the NeuralProphet model and the CNN-LSTM-Attention combination model respectively to obtain first prediction output sequence data and third prediction output sequence data; the first prediction output sequence data is subtracted from the real output sequence data to obtain a residual sequence; the residual sequence is input into the CNN-LSTM-Attention combination model to obtain second prediction output sequence data; the first prediction output sequence data, the second prediction output sequence data and the third prediction output sequence data are simultaneously input into the artificial neural network to obtain a final prediction result.

5. The load prediction method based on a hybrid model in a container cloud environment according to claim 4 is characterized in that: The NeuralProphet model is composed of a trend module, a periodicity module, a holiday factor module, an autoregressive effect module and a lagged regression effect module in parallel; the input sequence data is input into the NeuralProphet model, and passes through the trend module, the periodicity module, the holiday factor module, the autoregressive effect module and the lagged regression effect module respectively, and the sum of the components output by all modules is the first predicted output sequence data output by the NeuralProphet model.

6. The load prediction method based on a hybrid model in a container cloud environment according to claim 4 is characterized in that: The CNN-LSTM-Attention combination model includes a convolutional neural network module, a long short-term memory network module and an attention mechanism module; the input sequence data or the residual sequence is input into the CNN-LSTM-Attention combination model, firstly enters the convolutional neural network module to obtain the local feature representation of the sequence; the local feature representation of the sequence then passes through the long short-term memory network module to capture the long-term dependency in the sequence and obtain the final global time series feature; The global time series features obtain the corresponding attention weights through the attention mechanism module, and the attention weights are weighted and summed with the global time series features output by the long short-term memory network module of the corresponding time step to obtain the third prediction output sequence data or the second prediction output sequence data output by the CNN-LSTM-Attention combination model.

7. The load prediction method based on a hybrid model in a container cloud environment according to claim 1 is characterized in that: The method of iteratively training the load prediction model using the preprocessed historical load data, and adjusting the network parameters of the load prediction model according to the evaluation index of the load prediction model during the training process to obtain a trained load prediction model, specifically includes: First, define the length of the input sequence as L, the current time point as T, and the length of the output sequence as Q; Then, based on the preprocessed historical load data, the load data of the container application at L moments [T-L+1, T] is taken as the input sequence data, and the load data of the container application at Q moments [T+1, T+Q] is taken as the real output sequence data; Secondly, the input sequence data is input into the load forecasting model, and is passed through the NeuralProphet model and the CNN-LSTM-Attention combined model respectively to obtain the first predicted output sequence data and the third predicted output sequence data; the first predicted output sequence data is subtracted from the real output sequence data to obtain the residual sequence; the residual sequence is input into the CNN-LSTM-Attention combined model to obtain the second predicted output sequence data; the first predicted output sequence data, the second predicted output sequence data and the third predicted output sequence data are simultaneously input into the artificial neural network to obtain the final prediction result; Then, the evaluation index of the load forecasting model is calculated according to the final forecast result and the real output sequence data, wherein the evaluation index of the load forecasting model includes the mean absolute percentage error, the average accuracy, the mean absolute error and the mean square root error; Finally, with the optimization objectives of minimizing the mean absolute percentage error, mean absolute error and mean square root error and maximizing the average accuracy, the network parameters of the load forecasting model are adjusted until the preset training rounds are reached to obtain a trained load forecasting model.

8. The load prediction method based on a hybrid model in a container cloud environment according to claim 1 is characterized in that: After step (4), the method further includes: Combined with the load data at future times predicted by the load prediction model, the container demand at future times is calculated, and a specified number of elastic instances are prepared in advance to achieve elastic expansion of elastic instances; the number of elastic instances is determined in proportion to the container demand at future times.

9. A load prediction device based on a hybrid model in a container cloud environment, comprising one or more processors and a memory, characterized in that: The memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the load prediction method based on a hybrid model in a container cloud environment according to any one of claims 1-8.

10. A computer-readable storage medium, characterized in that: A program is stored thereon, which, when executed by a processor, is used to implement a load prediction method based on a hybrid model in a container cloud environment according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Service load fine-grained prediction method based on AKX hybrid model

    CN111913803A

  • CPU load trend prediction method based on IF-EMD-LSTM

    CN112162860A

  • Load prediction method and device and resource scheduling method and device for multiple cloud data centers

    CN113220450A

  • CPU load prediction method based on LSTM-Attention model and related equipment

    CN117331684A

  • Cloud server load prediction method based on signal decomposition and hybrid model

    CN117389824A

Cited By

  • New energy storage optimization system and method, storage medium and electronic equipment

    CN119834332A

  • Method and system for repairing abnormal data of power distribution network based on deep learning

    CN120386990A

  • Server resource allocation method and device, storage medium and electronic equipment

    CN120407197A

  • Roadside equipment remote upgrading method under vehicle-road cloud integrated architecture and related device

    CN120880906A

  • Roadside device remote upgrading method under vehicle-road-cloud integrated architecture and related device

    CN120880906B