A load prediction method and device based on a hybrid model in a container cloud environment

By adopting a hybrid model architecture in a container cloud environment and combining multiple models and data preprocessing, the accuracy and robustness problems of load prediction in the container cloud environment are solved, and the service quality and resource management efficiency are improved.

CN119440977BActive Publication Date: 2025-10-17ZHEJIANG UNIV
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In container cloud environments, existing load prediction methods are difficult to accurately capture nonlinear relationships and mutations, resulting in degraded service quality, and the prediction performance of a single model is easily affected.

Method used

A hybrid model architecture is adopted, combining the NeuralProphet model, the CNN-LSTM-Attention combination model and the artificial neural network. Through data preprocessing, outliers are corrected and missing values ​​are filled. The load forecasting model is iteratively trained, and the hybrid model is used to capture the multi-level features of time series data.

Benefits of technology

It improves the accuracy and robustness of load forecasting, ensures service quality, reduces resource waste, lowers enterprise costs, and achieves high availability with elastic expansion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440977B_ABST
    Figure CN119440977B_ABST
Patent Text Reader

Abstract

The application discloses a load prediction method and device based on a hybrid model in a container cloud environment, which comprises the following steps: collecting historical load data of a container application in real time from the container cloud environment and saving the historical load data into a time sequence database Prometheus; preprocessing the historical load data, correcting abnormal values and filling in missing values; designing a load prediction model based on a hybrid model architecture, training the load prediction model using the preprocessed historical load data, adjusting network parameters of the load prediction model according to evaluation indexes of the load prediction model during the training process, and obtaining a trained load prediction model; and obtaining load data at a future time using the trained load prediction model. The application can learn the trend and periodicity of load changes from historical load data, accurately predict the load at the future time, fully capture multi-level features of time sequence data, and greatly improve the accuracy and robustness of the prediction.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

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

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

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

[0004] In the container cloud environment, the load data change mode is diverse, and the volatility and multi-periodicity are significant. At the same time, the container is ready for a long time, so in order to ensure service quality, the container needs to be started in advance according to the load prediction result, which has higher requirements for the accuracy of load prediction.

[0005] The above schemes have their own advantages and disadvantages. Among them, the traditional statistical method is mostly difficult to handle nonlinear relationship and mutation, and the parameter tuning is relatively complex. Machine learning methods have stronger learning ability, but 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 prediction, so it is not suitable for cloud scenarios with rapid and diverse time series features. 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, it is easy to have inaccurate and lagged prediction, resulting in reduced service quality. SUMMARY

[0006] The present application aims at the deficiencies of the prior art and provides a load prediction method and device based on a hybrid model in a container cloud environment.

[0007] The application aims to realize the following technical solutions: the first aspect of the embodiment of the application provides a load prediction method based on a hybrid model in a container cloud environment, comprising the following steps:

[0008] (1) collecting historical load data of a container application in real time from a container cloud environment and saving the historical load data into a time sequence database Prometheus; wherein the load data comprises resource usage index data and business related data;

[0009] (2) pre-processing the historical load data collected in step (1) to correct abnormal values and fill in missing values;

[0010] (3) designing a load prediction model based on a hybrid model architecture, and iteratively training the load prediction model using the pre-processed historical load data; during the training process, adjusting network parameters of the load prediction model according to evaluation indexes of the load prediction model to obtain a trained load prediction model;

[0011] (4) using the trained load prediction model to obtain load data at a future time.

[0012] Further, the resource usage index data comprises CPU utilization, memory usage, network throughput and disk I / O; and the business related data comprises user behavior data and external environment data.

[0013] Further, the pre-processing of the historical load data collected in step (1) to correct abnormal values and fill in missing values specifically comprises:

[0014] For the historical load data collected in step (1), an isolated forest algorithm is used to detect abnormal values, and a neighboring value filling method is used to correct the abnormal values, i.e. using the average value of the data at the adjacent positions before and after the current time point to replace the abnormal value;

[0015] A linear interpolation method is used to fill in the missing values, specifically: the data at the K previous time points of the current time point is linearly fitted, and the value at the current time point is predicted to fill in the missing values.

[0016] Further, the load prediction model comprises a NeuralProphet model, a CNN-LSTM-Attention combined model and an artificial neural network; the input sequence data is input into the load prediction model, and is subjected to the NeuralProphet model and the CNN-LSTM-Attention combined model respectively to obtain first predicted output sequence data and third predicted output sequence data; the first predicted output sequence data is subtracted from the true output sequence data to obtain a residual sequence; the residual sequence is input into the CNN-LSTM-Attention combined model to obtain 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 a final prediction result.

[0017] Further, 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 is subjected to 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 the modules is the first predicted output sequence data output by the NeuralProphet model.

[0018] Further, the CNN-LSTM-Attention combined model comprises 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, first enters the convolutional neural network module to obtain sequence local feature representation; the sequence local feature representation is subjected to the long short-term memory network module again to capture long-term dependence in the sequence to obtain final global time sequence features; the global time sequence features pass through the attention mechanism module to obtain corresponding attention weights, and the attention weights and the global time sequence features output by the long short-term memory network module at the corresponding time step are weighted and summed to obtain the third predicted output sequence data or the second predicted output sequence data output by the CNN-LSTM-Attention combined model.

[0019] Further, the historical load data after preprocessing is used to iteratively train the load prediction model, and the network parameters of the load prediction model are adjusted according to the evaluation index of the load prediction model during the training process to obtain a trained load prediction model, and the method specifically comprises:

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

[0021] Then, based on the pre-processed historical load data, taking the load data of the container application at T-L+1 to T total L time points as input sequence data, and taking the load data of the container application at T+1 to T+Q total Q time points as real output sequence data;

[0022] Secondly, the input sequence data is input into the load prediction model, and the first prediction output sequence data and the third prediction output sequence data are obtained by respectively passing through the Neural Prophet model and the CNN-LSTM-Attention combined model; 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 combined 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 an artificial neural network to obtain a final prediction result;

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

[0024] Finally, the network parameters of the load prediction model are adjusted with the optimization target of minimizing the mean absolute percentage error, the mean absolute error and the mean square root error and maximizing the average accuracy until a preset training round is reached, and a trained load prediction model is obtained.

[0025] Further, after the step (4), further comprising:

[0026] In combination with the load data of the future time predicted by the load prediction model, the container demand of the future time is calculated, and a specified number of elastic instances are prepared in advance to realize the elastic expansion of the elastic instances; wherein the number of elastic instances is determined according to the container demand of the future time in a certain proportion.

[0027] The second aspect of the embodiment of the application provides a load prediction device based on a hybrid model in a container cloud environment, comprising one or more processors and a memory, the memory being coupled with the processor; wherein the memory is used for storing program data, and the processor is used for executing the program data to realize the load prediction method based on the hybrid model in the container cloud environment.

[0028] The third aspect of the embodiment of the application provides a computer readable storage medium, which stores a program, and the program is executed by a processor to realize the load prediction method based on the hybrid model in the container cloud environment.

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

[0030] (1) The application is based on a deep learning algorithm and a hybrid model architecture, learns the trend and periodicity of load changes from historical load data, and accurately predicts the load situation at future time.

[0031] (2) The application designs a data extraction strategy and an abnormal value detection and correction method, a missing value filling method, pre-processes the container historical data, and can provide data support for the subsequent load prediction module.

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

[0033] (4) The application can make up for the problems of single model in load prediction, such as unable to fully capture data features, prediction performance easily affected, etc., greatly improving the accuracy and robustness of model prediction.

[0034] (5) In addition, the application also proposes an elastic scheme based on proportional expansion of load prediction results to replace the traditional scheme of setting quantitative 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 prepared are dynamically adjusted in advance to cope with scenarios such as load burst traffic, guaranteeing the high availability of engineering, improving the intelligent degree of resource management, ensuring the service quality, saving instance resources, and reducing enterprise cost. BRIEF DESCRIPTION OF DRAWINGS

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

[0036] Figure 2 is an architecture diagram of the load prediction model designed based on a hybrid model architecture of the application;

[0037] Figure 3 is an output result schematic diagram of the elastic scheme based on proportional expansion of load prediction results of the application;

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

[0039] The exemplary embodiments will be described in detail herein with reference to the attached drawings. In the following description, like reference numerals refer to like elements unless the context clearly dictates otherwise. The following exemplary embodiments described therein can represent only a detailed description of the application. Rather, they should be understood to describe and cover all possible embodiments following the principles of the application as set forth in the appended claims. It is understood that the above general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.

[0040] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0041] It is to be understood that the singular forms "a", "an", and "the" include plural referents unless the context clearly dictates otherwise. It is to be understood that the term "and / or" as used herein encompasses all possible combinations of one or more of the associated listed items and can be abbreviated as "or". It is to be understood that the term "includes" or "including", where used herein, specifies the presence of stated features, integers, steps, or components but does not preclude the presence or addition of one or more other features, integers, steps, components, or groups thereof.

[0042] The application will be described in detail herein with reference to the attached drawings. The features of the embodiments and implementation described below can be combined with each other, if not in conflict.

[0043] Referring to Figure 1 The container cloud environment-based load prediction method based on a hybrid model of the application specifically includes the following steps:

[0044] (1) Real-time collection of historical load data of container applications from the container cloud environment and saving the same to a 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 starting stage of load prediction, which aims to collect and integrate time series data and business-related data from the container cloud environment for subsequent analysis and modeling.

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

[0047] It should be understood that Prometheus is a commonly used time series database. In the container cloud environment, some resource usage indicator data and business-related data are stored in the time series database Prometheus. Therefore, when needed, the data 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 can affect the prediction performance of the load prediction model. Therefore, data preprocessing is needed to improve data quality and thus improve the prediction performance of the load prediction model.

[0050] Further, the historical load data collected in step (1) is preprocessed to correct outliers and fill in missing values, specifically including: for the historical load data collected in step (1), the Isolation Forest algorithm is used to detect outliers, and the adjacent value filling method is used to correct outliers, i.e. the average value of the adjacent position data before and after the current time point is used to replace the outliers; the linear interpolation method is used to fill in the missing values, specifically: the data of the previous K (such as 10, 20, etc., the specific number can be selected according to actual needs) time points of the current time point are linearly fitted, and the value of the current time point is predicted to fill in the missing values.

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

[0052] Further, the isolation forest algorithm is a random-based anomaly detection algorithm that detects abnormal samples by the isolation of normal samples relative to abnormal samples. The core idea is to isolate data points by randomly selecting features and split points to identify abnormal points. The specific implementation steps are as follows:

[0053] ① According to the historical load data of the collected container application, an original data set is constructed, a feature and a split point are randomly selected, and the original data set is divided into two subsets. Among them, each category of attribute is regarded as a feature, and the random selection of a feature is the process of building a tree by the isolation forest algorithm; the split point is a randomly selected data point, and the purpose is to divide the original data set into different subsets through the data point, and finally to screen out abnormal values.

[0054] ② Repeat step ① for each subset to build a split 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, and the greater the depth of the tree, the more complex the tree, the slower the training process, and the more likely to overfit. Therefore, the depth of the tree usually needs to be controlled, which can be set according to actual needs.

[0055] ③ Repeat steps ① and ② to build multiple random binary trees, which constitute a random forest.

[0056] ④ For a new sample, start from the root node of the tree and find the leaf node that meets the split point requirement or reach the maximum depth of the tree, stop the search, and calculate the path length in the tree according to the current leaf node position; 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 of the new sample in all trees according to the path length; calculate the anomaly score of the sample according to the average path length, and the calculation formula is:

[0057]

[0058] Where 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 the sample is greater than the preset anomaly score threshold, the sample is an abnormal value.

[0059] (3) Based on the mixed model architecture, a load prediction model is designed, and the preprocessed historical load data is used to iteratively train the load prediction model. 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.

[0060] It should be noted that a single model can only handle certain features and may not be able to fully capture all important patterns in time series; at the same time, in the face of complex time series data or noise, a single model may encounter bottlenecks, resulting in decreased prediction accuracy. Therefore, in consideration of the accuracy and robustness of the prediction, a hybrid model architecture is designed to load the prediction model to improve the above problems, as shown in Figure 2

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

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

[0063] It should be understood that the load prediction model can capture the time series pattern and correlation of the historical load data of the container application, capture the regularity in the time series load data, and predict the load of the container application at a future time.

[0064] In this embodiment, the core idea of the NeuralProphet model is the composability of the modules, and the NeuralProphet model is composed of multiple modules in parallel, such as a trend module, a periodicity 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, and the output of each module is used as a component. The sum of the components output by each module is the first prediction output sequence data output by the NeuralProphet model, which is represented as:

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

[0066] where y(t) represents the first predicted output sequence data at time t, T(t) represents the trend component, S(t) represents the seasonality component, E(t) represents the holiday component, A(t) represents the autoregressive effect based on observations of historical autoregressive effect values, and L(t) represents the regression effect of external variable lag observations.

[0067] Further, the trend module is modeled as a continuous piecewise linear sequence, defining a time-varying growth rate and a time-varying offset to generalize this non-linear trend, which can be represented as:

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

[0069] where δ0represents the growth rate of the first piecewise linear sequence, ρ0represents the offset of the first piecewise 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 transpose operation.

[0070] Further, the periodicity module approximates the periodic component by employing a Fourier series, and the sum of all periodic components is the output of the periodicity module, which can be represented as:

[0071]

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

[0073]

[0074] where 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 annual periodicity. At time t, the influence of all periodic factors considered by the NeuralProphet model is represented by S(t), which is the output of the periodicity module.

[0076] Further, the autoregressive effect (AR) module refers to the process of regressing future values of a variable with historical values, and the number of historical values is usually referred to as the d order of the AR module. Therefore, a coefficient θ g, which is used to control the direction (numerical increase or decrease) and size of a certain specific historical value to the predicted value. The formula for calculating the autoregressive effect value output by the autoregressive effect module is represented as:

[0077]

[0078] where A(t) represents the autoregressive effect value output by the autoregressive effect module at time t, representing the predicted value; A(t-1) represents the historical autoregressive effect value at time t-1, representing the historical value; c represents the intercept, and ε t is a 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 observed autoregressive effect value based on the historical autoregressive effect value A(t-1).

[0080] Further, the lag regression effect module is used to associate external observed lag variables with the target time series, the future values of which are unknown to the NeuralProphet model, i.e. at the predicted time t, the NeuralProphet model can only access the values observed at time t-1 and before. Each lag regression effect module is functionally identical to the AR module, and the input to the lag regression effect module is the last m observations of that variable, and the formula is:

[0081]

[0082] where, represents the h regression effect prediction values output by the lag regression effect module, AR-Net represents the lag regression effect module, and h represents the prediction time step.

[0083] It should be understood that for the lag regression effect module, the meaning in the above formula is that x t-1 ,x t-2 ,...,x t-m , the predicted future h time steps, so there are h output values on the left side.

[0084] Further, the holiday factor module represents the impact of all events at time t by taking each event as a binary variable, represented as:

[0085]

[0086] where E(t) represents the impact value of the event output by the holiday factor module, z eis a binary variable, indicating whether the event occurs on a specific day.

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

[0088] In this embodiment, the CNN-LSTM-Attention combined model includes a convolutional neural network (CNN) module, a long short-term memory (LSTM) network module, and an attention mechanism module. The input sequence data or residual sequence is input into the CNN-LSTM-Attention combined model, first enters the CNN module, and obtains sequence local feature representation; the sequence local feature representation is further input into the LSTM network module to capture long-term dependencies in the sequence and obtain final global time series features; the global time series features are input into the attention mechanism module to obtain corresponding attention weights, and the attention weights and the global time series features output by the LSTM network module at the corresponding time step are weighted and summed to obtain the third prediction output sequence data or the second prediction output sequence data output by the CNN-LSTM-Attention combined 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-time dependencies, and this combination can generate more powerful feature representation, fully utilize local patterns and global dependencies to improve prediction performance. The addition of the attention mechanism module enables the CNN-LSTM-Attention combined 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 combined model, and improve the perception ability of the CNN-LSTM-Attention combined model to the importance of different time steps.

[0090] Further, the CNN module can efficiently extract feature information, and its basic structure includes a convolution layer, a pooling layer, and a full connection layer. The input sequence data or residual sequence sequentially passes through the convolution layer, the pooling layer, and the full connection layer to obtain sequence local feature representation. Among them, the convolution layer performs convolution calculation on all input information to effectively extract local features of time series data; the pooling layer performs down-sampling on the input features to extract main features and improve the noise resistance of the CNN module; the full connection layer is responsible for flattening the output of the convolution layer and the pooling layer into a one-dimensional vector, and classifying or regressing through the neurons of the full connection layer, so as to obtain the sequence local feature representation output by the CNN module.

[0091] Further, the LSTM network module is a special recurrent neural network (RNN) model. By increasing the gate mechanism in the hidden layer to control the loss of information, and through the dynamic adjustment of 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 composed of a memory cell c t and an output state h t , and its calculation process is as follows:

[0092] a. Input gate: by calculating the output vector i t of the input gate, the influence of the current time step input is controlled:

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

[0094] Where W i , U i and b i are parameters that can be learned in the input gate, σ() is the sigmod function, and x t represents the input of the current time step.

[0095] b. Forget gate: by calculating the output vector f t of the forget gate, the degree of reservation of the previous memory is controlled:

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

[0097] Where W t , U t and b t are parameters that can be learned in the forget gate.

[0098] c. Memory update: by computing a new memory cell 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] where W c , U c and b c are parameters that can be learned during memory update, ⊙ denotes element-wise multiplication, and tanh() is the tanh activation function.

[0101] d. Output gate: by computing an output vector o t that controls the influence of the current time step output:

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

[0103] where W o , U o and b o are parameters that can be learned in the output gate.

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

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

[0106] Further, the attention mechanism module can assign different weights to different parts of the input sequence, paying more attention to key information in the input data, which is conducive to improving the accuracy and efficiency of the CNN-LSTM-Attention combined model. The calculation formula of the attention mechanism module is:

[0107]

[0108] where Attention(Q, K, V) represents the attention weight output by the attention mechanism module, Q, K and V are the query matrix, key-value matrix and value matrix respectively, d kQ, K is the number of columns of the matrix, i.e., the dimension of the vector, and softmax represents a softmax function.

[0109] In summary, the load prediction model based on the hybrid model architecture design can extract features at multiple levels. Based on the NeuralProphet model, the characteristics of the time series can be decomposed to process trend, periodicity and other components. Based on the CNN-LSTM-Attention combined model, local dependence and global dependence can be fully captured. This multi-level feature extraction method can more comprehensively depict the complexity of time series data and improve the prediction accuracy. The load prediction model can adjust the prediction results accordingly. The load prediction model includes fitting and predicting the residual sequence, which can optimize the prediction output of each sub-model. At the same time, it has stronger fault tolerance when processing abnormal values and noise. Each sub-model can compensate for each other, thereby improving the overall robustness.

[0110] In this embodiment, the historical load data after preprocessing is used to iteratively train the load prediction model, and the network parameters of the load prediction model are adjusted according to the evaluation index of the load prediction model during the training process to obtain the trained load prediction model, which specifically includes: the input sequence and the output sequence of the load prediction model are both historical load data (i.e. time series data and business related data) of multiple container applications at multiple time points, 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 historical load data after preprocessing, take the load data of the container application at [T-L+1, T] as the input sequence data, and take the load data of the container application at [T+1, T+Q] as the true output sequence data. For example, if the length of the input sequence L is 120 minutes and the length of the output sequence Q is 30 minutes, the input sequence is divided into a training set and a test set in chronological order, 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 of the load prediction model. Secondly, the input sequence data is input into the load prediction 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 combined model respectively; the first prediction output sequence data is subtracted from the true output sequence data to obtain a residual sequence; the residual sequence is input into the CNN-LSTM-Attention combined 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 an artificial neural network to obtain the final prediction result. Then, the evaluation index of the load prediction model is calculated according to the final prediction result and the true output sequence data, wherein the evaluation index of the load prediction model includes Mean Absolute Percentage Error (MAPE), Accuracy, Mean Absolute Error (MAE) and Root Mean Square Error (RMSE). Finally, the network parameters of the load prediction model are adjusted to minimize the Mean Absolute Percentage Error, the Mean Absolute Error and the Root Mean Square Error and to maximize the Accuracy as the optimization goal until the preset training round is reached, and the trained load prediction model is obtained.

[0111] Further, the calculation formulas of the evaluation indexes of the load prediction model are as follows:

[0112]

[0113] Accuracy = 1 - MAPE

[0114]

[0115] wherein MAPE is the mean absolute percentage error, Accuracy is the mean accuracy, MAE is the mean absolute error, RMSE is the mean square root error, y i represents the real output sequence data, represents the final prediction result output by the load prediction model, i represents the ith data sample, and n represents the total amount of data samples. The load prediction model is trained and tested by using the above evaluation indexes, so as to verify the fitting effect and the prediction effect of the load prediction model.

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

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

[0118] (5) Combining the load data at the future time predicted by the load prediction model, calculating the container demand at the future time, and preparing a specified number of elastic instances in advance to realize the elastic expansion of the elastic instances; wherein the number of the elastic instances is determined according to the container demand at the future time by a fixed proportion P.

[0119] It should be understood that the cloud load in the real scene has fluctuation and trend mutation, and in order to ensure the quality of service, a certain amount of elastic instances need to be prepared in advance to make up for the insufficient predicted resources or the situation that the number of users accessing the game increases sharply, so as to meet the user demand to the greatest extent and ensure the high availability of the service.

[0120] Specifically, combining the load data at the future time predicted by the load prediction model, taking the maximum value in the load data sequence as the benchmark, and performing elastic expansion according to the fixed proportion P as the elastic instance to prepare the resources in advance. Based on the prediction result, the instances are elastically expanded by the fixed proportion P, which is 20% in this embodiment, and the result of the elastic expansion is as shown in FIG. 4. Figure 3 The following evaluation indexes are used to verify the effect of the elastic expansion:

[0121] Instance sufficiency rate = number of time points with sufficient instances / total time points

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

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

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

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

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

[0127] Referring to Figure 4 , the embodiment of the application provides a load prediction device based on a hybrid model in a container cloud environment, which comprises one or more processors and a memory, and the memory is coupled with the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to realize the load prediction method based on the hybrid model in the container cloud environment in the foregoing embodiment.

[0128] The embodiment of the load prediction device based on the hybrid model in the container cloud environment of the application can be applied to any device with data processing capability, which can be a device or apparatus such as a computer. The device embodiment can be realized by software, or by hardware or a combination of software and hardware. Taking software realization as an example, as a logical device, it is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory for execution by the processor of the device with data processing capability. From the hardware level, as shown in Figure 4 , it is a hardware structure diagram of the device with data processing capability where the load prediction device based on the hybrid model in the container cloud environment of the application is located. In addition to the processor, the memory, the network interface, and the non-volatile memory shown in Figure 4 , the device with data processing capability where the device is located in the embodiment usually includes other hardware according to the actual functions of the device with data processing capability, and details are not described herein.

[0129] The implementation process of the functions and roles of each unit in the above device is specifically described in the implementation process of the corresponding steps in the above method, and details are not described herein.

[0130] For the device embodiment, since it basically corresponds to the method embodiment, the relevant part can be seen from the part of the method embodiment. The device embodiment described above is only illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present application according to actual needs. Those skilled in the art can understand and implement it without creative labor.

[0131] The embodiment of the present application also provides a computer readable storage medium, which stores a program, and the program is executed by a processor to realize the load prediction method based on a hybrid model in a container cloud environment in the above embodiment.

[0132] The computer readable storage medium can be an internal storage unit of any data processing device in the above embodiment, such as a hard disk or a memory. The computer readable storage medium can also be any data processing device, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. Further, the computer readable storage medium can also include an internal storage unit of any data processing device and an external storage device. The computer readable storage medium is used to store the computer program and other programs and data required by the data processing device, and can also be used to temporarily store data that has been output or will be output.

[0133] The above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions recorded in the above embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

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; the load data includes resource usage indicator data and business-related data; (2) Preprocess the historical load data collected in step (1) to correct outliers and fill missing values; (3) Designing a load prediction model based on a hybrid model architecture, and iteratively training the load prediction model using pre-processed 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; 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; The NeuralProphet model is composed of a trend module, a periodic 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 periodic module, the holiday factor module, the autoregressive effect module, and the lagged regression effect module respectively. The sum of the components output by all modules is the first predicted output sequence data output by the NeuralProphet model; The CNN-LSTM-Attention combination model includes a convolutional neural network module, a long short-term memory network module, and an attention mechanism module. Input sequence data or a residual sequence is input into the CNN-LSTM-Attention combination model, first entering 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 temporal features. The global temporal features are subjected to the attention mechanism module to obtain corresponding attention weights. The attention weights are weighted and summed with the global temporal features output by the long short-term memory network module at 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. (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), the isolation forest algorithm is used to detect outliers, and then the neighboring 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 using the 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 method of iteratively training the load prediction model using the pre-processed 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, we take the load data of the container application at L moments [T-L+1, T] as the input sequence data, and take the load data of the container application at Q moments [T+1, T+Q] as the actual output sequence data. Secondly, the input sequence data is fed into the load forecasting model, and passed through the Neural Prophet 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 actual output sequence data to obtain a residual sequence. The residual sequence is fed into the CNN-LSTM-Attention combined model to obtain the second predicted output sequence data. The first, second, and third predicted output sequence data are simultaneously fed into the artificial neural network to obtain the final prediction result. Then, the evaluation indicators of the load forecasting model are calculated based on the final prediction results and the actual output sequence data. The evaluation indicators of the load forecasting model include mean absolute percentage error, average accuracy, mean absolute error, and 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.

5. 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 predicted by the load forecasting model at future times, 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.

6. 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-5.

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

Citation Information

Patent Citations

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

    CN117389824A