A cloud platform service load prediction method based on time series convolutional neural network
Patent Information
- Application Number
- CN202210084802.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2042-01-25
AI Technical Summary
[0004]为了解决现有技术中容器云平台响应式自动伸缩策略滞后性所带来服务的质量下降问题,本发明提供一种能够用于预测式自动伸缩的基于时序卷积神经网络的云平台服务负载预测方法,本方法具有较高的预测精度
[0045]本发明从容器云平台传统的响应式自动伸缩机制弊端出发,突破时间序列预测分析、周期引导和峰值引导注意力向量生成的关键技术,形成预测精度高的预测算法,在云平台预测式自动伸缩机制中具有重要用途,有利于解决响应式自动伸缩可能带来的滞后性和服务质量下降的问题,在大规模容器微服务系统中具有广泛的应用价值。
Smart Images

Figure CN114528097B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud platform resources, and in particular to a cloud platform service load prediction method based on a temporal convolutional neural network. Background Art
[0002] In recent years, more and more services have been deployed to the cloud, and virtualization technology has become an important guarantee for the stable and efficient operation of cloud platforms. As a lightweight operating system virtualization technology, Docker has excellent isolation performance and agile deployment. More and more microservices are being built based on Docker containers, and cloud platforms based on Docker containers have gradually become the standard architecture of modern cloud platforms.
[0003] Due to the diversity of cloud platform services and the dynamic changes in user load, clusters are prone to overload or underload. Therefore, dynamically adjusting the number of containers based on application load has become an important way to automate the operation and maintenance of cloud platforms. Traditional cloud platforms generally adopt responsive automatic scaling. When the load peak arrives, the service quality often declines due to the lag in container expansion. In recent years, predictive automatic scaling based on load prediction has gradually become a feasible solution to the lag of responsive automatic scaling due to its advanced and preemptive characteristics, and has achieved remarkable results. Since the CPU load of a service often directly determines the task response time, service quality, and energy consumption, it is one of the most important workloads of a service. Therefore, automatic scaling based on the predicted value of the service CPU load has gradually become a research hotspot and is widely used in predictive automatic scaling scenarios. Summary of the invention
[0004] In order to solve the problem of service quality degradation caused by the lag of the responsive automatic scaling strategy of the container cloud platform in the prior art, the present invention provides a cloud platform service load prediction method based on a time series convolutional neural network that can be used for predictive automatic scaling. The method has high prediction accuracy.
[0005] The present invention adopts the following technical solution:
[0006] A cloud platform service load prediction method based on a time series convolutional neural network, comprising:
[0007] S1 collects CPU load timing data to form a training sample set;
[0008] S2 performs preprocessing and feature extraction on the training sample, wherein the feature extraction includes a periodic attention vector and a peak attention vector, and performs weighted summation of the training sample, the periodic attention vector and the peak attention vector to obtain a final training sample;
[0009] S3 builds a time series convolutional neural network, and the final training sample is used as the input signal;
[0010] S4 trains temporal convolutional neural networks;
[0011] The S5 test sample data is input into the trained time series convolutional neural network to obtain the CPU load prediction result of the test sample.
[0012] Further, the S1 collects CPU load timing data, specifically:
[0013] S1.1 Set the sampling period Δt, and the time range of the CPU load of the collection service is set to T M , collect CPU load timing data;
[0014] S1.2 uses a fixed step size and fixed length sliding window to scan the CPU load timing data. Specifically, the CPU load data collected by the sliding window is scanned from the earliest time data, and a fixed length L is intercepted each time. M The data points are taken as training samples. After the interception is completed, the sliding window is shifted backward by Δs points, and training samples are continued to be intercepted to form a training sample set.
[0015] Furthermore, the preprocessing includes data normalization and introducing Gaussian white noise for data augmentation.
[0016] Further, the feature extraction includes:
[0017] The autocorrelation coefficient is used to discover the periodicity of the data and generate a periodic attention vector to guide the model to focus on periodic features.
[0018] The peak data is discovered through the first-order difference method, and the peak attention vector is generated to guide the model to focus on the peak features.
[0019] Furthermore, the data periodicity is explored through the autocorrelation coefficient to generate a periodic attention vector for guiding the model to pay attention to the periodic features, specifically:
[0020] For an input length of L M The time series data of the data points is intercepted by L M -1 length data points are processed, and the autocorrelation vector of the time series data is calculated by the autocorrelation coefficient formula. The subscript of the maximum autocorrelation value with a non-0 subscript is taken as the period T of the time series data through the autocorrelation vector:
[0021] Assume that L M Point is the prediction point t0, find the periodic repetition subscript t′=t0-n*T, n=0,1,2… corresponding to the prediction point t0, generate a normally distributed periodic attention vector at t′, the periodic attention vector atten SeaSon The generation method is
[0022]
[0023] And t≠t0;
[0024] where t is an integer, The length of the highlighted interval of the control cycle attention vector is 8% of the total length, σ 2 is the discreteness of the periodic attention vector distribution. Considering the 3σ principle of normal distribution, At least greater than 3σ length, so as to ensure that the attention vector The interval includes possible values of the attention value.
[0025] Furthermore, the peak data is mined by first-order difference to generate a peak attention vector for guiding the model to focus on the peak features, specifically:
[0026] For an input length of L M The time series data of the data point data, intercept L M -1 length data points are processed and L M The -1 length data points are divided into two sub-vectors arr1, arr2, where:
[0027]
[0028]
[0029] Each subvector has a length of L M -2, then use arr2 and arr1 to subtract bit by bit to get the peak vector, and finally get the normalized peak attention vector atten peak for
[0030]
[0031] Among them, when t = 1 and t = L M When peak It is supplemented by 0 value, and S is a normalization operation, the purpose of which is to prevent the value of the peak vector from being too high or too low.
[0032] Furthermore, in S2, the training sample, the periodic attention vector and the peak attention vector are weighted and summed to obtain the final training sample, specifically:
[0033]
[0034] Among them, α=1, β=0.4, γ=0.4.
[0035] Furthermore, the data normalization is performed at a ratio of 0.75, and the introduction of Gaussian white noise for data augmentation specifically has a mean of 0 and a variance of 0.01, and generates new training samples of the same number as the original training sample set by adding them bit by bit to the original training samples.
[0036] Further, the test sample in S5 needs to be processed as follows:
[0037] S5.1 Sampling period Δt, obtain the CPU load value as a test sample, the test sample length is L M -1, by using 0 value to supplement the end, the test sample length is expanded to L M ;
[0038] S5.2 performs preprocessing and feature extraction, and performs weighted summation of the test sample and the feature to obtain the final test sample, which is input into the trained time series convolutional neural network.
[0039] A cloud platform service load prediction method system, comprising:
[0040] Obtain training sample set module: collect CPU load timing data to form a training sample set;
[0041] Preprocessing and feature extraction module: Process the training sample set and test sample;
[0042] Build and train a time series convolutional neural network module: used to build and train a time series convolutional neural network module;
[0043] Testing module: Input the test samples processed by the preprocessing and feature extraction modules into the trained time series convolutional neural network module to obtain the prediction results.
[0044] Beneficial effects of the present invention:
[0045] Starting from the drawbacks of the traditional responsive automatic scaling mechanism of the container cloud platform, the present invention breaks through the key technologies of time series prediction analysis, cycle guidance and peak guidance attention vector generation, and forms a prediction algorithm with high prediction accuracy. It has important uses in the predictive automatic scaling mechanism of the cloud platform, is conducive to solving the problems of lag and service quality degradation that may be caused by responsive automatic scaling, and has wide application value in large-scale container microservice systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a work flow chart of the present invention;
[0047] Figure 2 is a structural diagram of the input layer residual block of the present invention;
[0048] Figure 3It is a structural diagram of the hidden layer residual block of the present invention. DETAILED DESCRIPTION
[0049] The present invention will be further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0050] Example
[0051] like Figure 1-Figure 3 As shown, a cloud platform service load prediction method based on a time series convolutional neural network includes the following steps:
[0052] S1 collects the CPU load time series data of the cloud platform service within a period of time at a certain sampling period to form a training sample set, where the training sample set contains continuous subsequence data generated by scanning the collected CPU load time series data with a fixed step size and fixed length sliding window, and the last data value of each training sample is set as the training label.
[0053] Specifically:
[0054] Step S1-1, the sampling period is set to Δt, and the time range for collecting service CPU load is set to T M .
[0055] Δt is the time difference between the sampling moments before and after the CPU load value is calculated, that is, the sampling period of the CPU load. In reality, the commonly used sampling periods of the CPU load of mainstream cloud platforms are 1 minute, 5 minutes, and 15 minutes. Without loss of generality, the sampling period Δt of the present invention is set to one of the commonly used sampling periods.
[0056] The time range T of collecting service CPU load M It directly affects the number of training samples. To ensure that there are enough training samples, T M It is approximately the longest storage time of CPU load timing data of a general cloud platform under the Δt sampling period.
[0057] In this embodiment, Δt is 5 min, T M Set to 3 months.
[0058] Step S1-2: The fixed length is L M , the fixed step size is set to Δs. Considering that users request services regularly in actual scenarios, many users habitually request services at the same time every day. Therefore, in order to facilitate the discovery of the periodicity of user service requests, L M The value of should be such that the training sample time span can cover one day under the Δt sampling period, that is:
[0059]
[0060] Where ΔD is the time of a day, which has the same unit as Δt, which is 1440 minutes.
[0061] Step S1-3: Sliding window scans from the earliest time of the collected CPU load data, and each time L M The data points of length are used as training samples. After the interception is completed, the sliding window is shifted backward by Δs points to continue intercepting training samples.
[0062] S2 performs preprocessing and feature extraction on the training sample, wherein the feature extraction includes a periodic attention vector and a peak attention vector, and performs weighted summation of the training sample, the periodic attention vector and the peak attention vector to obtain a final training sample;
[0063] Specifically:
[0064] The preprocessing in S2-1 includes normalizing the data by dividing by a certain percentage of the maximum CPU load of the training sample set, and introducing Gaussian white noise into the original training samples for data augmentation.
[0065] Furthermore, in this embodiment, a ratio of 0.75 is used for data normalization, so that while ensuring that enough data is distributed in the interval [0,1], the smaller CPU load data will not be overwhelmed. The introduced Gaussian white noise has a mean of 0 and a variance of 0.01, and is added bit by bit to the original training samples to generate new training samples of the same number as the original training sample set.
[0066] The feature extraction method described in S2-2 is as follows:
[0067] The autocorrelation coefficient is used to explore the periodicity of the data and generate a periodic attention vector to guide the model to focus on periodic features.
[0068] Furthermore, for the input L M Time series data of data points of length data, intercept the first L M -1 length data points are processed, and the autocorrelation vector of the time series data is calculated by the autocorrelation coefficient formula. The subscript of the maximum autocorrelation value with a non-0 subscript is taken as the period T of the time series data through the autocorrelation vector:
[0069]
[0070] Where N is the sequence length, equal to L M , is the mean of the time series data, k is the lag order, in this embodiment, L M Set to 300.
[0071] For the autocorrelation vector generated by the above autocorrelation coefficient formula, all values of the autocorrelation vector are traversed in turn, and the maximum value of the non-zero subscript is taken as the period T.
[0072] For the period T obtained in the previous step, assume that the Lth M Point is the prediction point t0, find the periodic repetition subscript t′=t0-n*T, n=0,1,2… corresponding to the prediction point t0, generate a normally distributed periodic attention vector at t′, the periodic attention vector atten SeaSon The generation method is
[0073]
[0074] And t≠t0;
[0075] where t is an integer, The length of the highlighted interval of the control cycle attention vector is 8% of the total length, σ 2 is the discreteness of the periodic attention vector distribution. Considering the 3σ principle of normal distribution, At least greater than 3σ length, so as to ensure that the attention vector The interval includes enough possible values of attention value.
[0076] In this embodiment, σ 2 Set to 9.
[0077] The peak data is discovered through the first-order difference method, and the peak attention vector is generated to guide the model to focus on the peak features.
[0078] Furthermore, for the input L M Time series data of length data points, intercept the first L M -1 length data points are processed and L M The -1 length data points are divided into two sub-vectors arr1, arr2, where:
[0079]
[0080]
[0081] Each subvector has a length of L M -2, then use arr2 and arr1 to subtract bit by bit to get the peak vector, and finally get the normalized peak attention vector atten peak for
[0082]
[0083] Among them, when t = 1 and t = L M Whenpeak It is supplemented by 0 value, S is a normalization operation, the purpose is to avoid the peak vector value being too high or too low:
[0084]
[0085] S2-3 performs weighted summation of the original training sample, the periodic attention vector and the peak attention vector to obtain the final training sample.
[0086] Furthermore, the original training sample, the periodic attention vector, and the peak attention vector are weighted and summed to obtain the final training sample as the input of the temporal neural network:
[0087]
[0088] Among them, α=1, β=0.4, γ=0.4.
[0089] S3 builds a time series convolutional neural network, and the final training sample is used as the input signal;
[0090] Furthermore, the temporal convolutional neural network includes an input layer, a hidden layer and an output layer.
[0091] like Figure 1 As shown, the input layer is Residual-Block1, and a 1×3 convolution kernel is used to construct a residual block to receive the time series data input to the neural network. The structure of Residual-Block1 is as follows Figure 2 As shown;
[0092] The hidden layer includes three Residual-Block2 residual blocks. The specific structure of Residual-Block2 is as follows: Figure 3 As shown in the figure, as the depth increases, the residual block of the hidden layer uses dilation coefficients of 2, 4, and 8, respectively. The input / output feature dimensions of each residual block of the hidden layer are set to 150; the output layer is a fully connected layer, which can further integrate all feature information of the hidden layer and fit samples with labels greater than 1. For the input layer and hidden layer, the residual block is composed of two groups of identical structures connected in series, each of which is a convolution, weight normalization, linear correction unit, and a dropout layer with a dropout rate of 0.2.
[0093] S4 training temporal convolutional neural network
[0094] The S5 test sample data is input into the trained time series convolutional neural network to obtain the CPU load prediction result of the test sample.
[0095] The test samples are obtained from the cloud platform at the sampling period described in step S1. The test samples are first preprocessed and feature extracted, and then input into the time series convolutional neural network. The predicted value of the test sample is obtained through the trained time series convolutional neural network model, and the CPU load prediction value of the test sample is obtained by denormalization. The specific processing flow is as follows:
[0096] S5-1 The sampling period is set to Δt the same as step S1, and the CPU load value of each Δt time interval before the current moment is obtained as a test sample. The test sample length is L M -1, by using 0 value to supplement the end, the test sample length is expanded to L M In this embodiment, L M Set to 300 and Δt to 5min.
[0097] The preprocessing described in S5-2 adopts the preprocessing of the above-mentioned step S2-1, and the feature extraction adopts the feature extraction method of the periodic attention vector and the peak attention vector in step S2-2.
[0098] The denormalization operation described in S5-3 is to multiply the predicted value of the output of the trained time series neural network processing of the test sample by a certain percentage of the maximum value of the CPU load of the training sample set. Furthermore, the percentage is 0.75. Multiplying by a certain percentage of the maximum value of the CPU load of the training sample set. Furthermore, the certain percentage is 0.75. In this embodiment, the certain percentage of the maximum value of the CPU load of the training sample set is 30.
[0099] S5-4 inputs the trained convolutional neural network to obtain the prediction result.
[0100] Example 2
[0101] A cloud platform service load prediction method system, comprising:
[0102] Obtain training sample set module: collect CPU load timing data to form a training sample set;
[0103] Preprocessing and feature extraction module: Process the training sample set and test sample;
[0104] Build and train a time series convolutional neural network module: used to build and train a time series convolutional neural network module;
[0105] Testing module: Input the test samples processed by the preprocessing and feature extraction modules into the trained time series convolutional neural network module to obtain the prediction results.
[0106] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A cloud platform service load prediction method based on time series convolutional neural network, characterized in that: include: S1 collects CPU load timing data to form a training sample set; S2 performs preprocessing and feature extraction on the training sample, wherein the feature extraction includes a periodic attention vector and a peak attention vector, and performs weighted summation of the training sample, the periodic attention vector and the peak attention vector to obtain a final training sample; S3 builds a time series convolutional neural network, and the final training sample is used as the input signal; S4 trains temporal convolutional neural networks; The S5 test sample data is input into the trained time series convolutional neural network to obtain the CPU load prediction result of the test sample; The feature extraction comprises: The autocorrelation coefficient is used to discover the periodicity of the data and generate a periodic attention vector to guide the model to focus on periodic features. The peak data is discovered through the first-order difference method, and the peak attention vector is generated to guide the model to focus on the peak features; The method of exploring the periodicity of data through the autocorrelation coefficient and generating a periodic attention vector for guiding the model to pay attention to periodic features is specifically: For an input length of L M The time series data of the data points is intercepted by L M -1 length data points are processed, and the autocorrelation vector of the time series data is calculated by the autocorrelation coefficient formula. The subscript of the maximum autocorrelation value with a non-0 subscript is taken as the period T of the time series data through the autocorrelation vector: Assume that L M Point is the prediction point t0, find the periodic repetition subscript t′=t0-n*T, n=0,1,2… corresponding to the prediction point t0, generate the normally distributed periodic attention vector at t′, the periodic attention vector atten season The generation method is And t≠t0; where t is an integer, The length of the highlighted interval of the control cycle attention vector is 8% of the total length, σ 2 is the discreteness of the periodic attention vector distribution. Considering the 3σ principle of normal distribution, At least greater than 3σ length, so as to ensure that the attention vector The interval includes possible values of attention value; The peak data is discovered by first-order difference to generate a peak attention vector for guiding the model to focus on the peak features, specifically: For an input length of L M The time series data of the data point data, intercept L M -1 length data points are processed and L M The -1 length data points are divided into two sub-vectors arr1, arr2, where: Each subvector has a length of L M -2, then use arr2 and arr1 to subtract bit by bit to get the peak vector, and finally get the normalized peak attention vector atten peak for Among them, when t = 1 and t = L M When peak It is supplemented by 0 value, and S is a normalization operation, the purpose of which is to prevent the value of the peak vector from being too high or too low.
2. The cloud platform service load prediction method according to claim 1, characterized in that: The S1 collects CPU load timing data, specifically: S1.1 Set the sampling period Δt, and the time range of the CPU load of the collection service is set to T M , collect CPU load timing data; S1.2 uses a fixed step size and fixed length sliding window to scan the CPU load timing data. Specifically, the CPU load data collected by the sliding window is scanned from the earliest time data, and a fixed length L is intercepted each time. M The data points are taken as training samples. After the interception is completed, the sliding window is shifted backward by Δs points, and training samples are continued to be intercepted to form a training sample set.
3. The cloud platform service load prediction method according to claim 1, characterized in that: The preprocessing includes data normalization and introducing Gaussian white noise for data augmentation.
4. The cloud platform service load prediction method according to claim 1, characterized in that: In S2, the training sample, the periodic attention vector and the peak attention vector are weighted and summed to obtain the final training sample, specifically: Among them, α=1, β=0.4, and γ=0.
4.
5. The cloud platform service load prediction method according to claim 3, characterized in that: The data normalization is performed at a ratio of 0.75, and the Gaussian white noise is introduced for data augmentation. Specifically, the introduced Gaussian white noise has a mean of 0 and a variance of 0.01, and new training samples of the same number as the original training sample set are generated by adding them bit by bit to the original training samples.
6. The cloud platform service load prediction method according to any one of claims 1 to 5, characterized in that: The test sample in S5 needs to be processed as follows: S5.1 Sampling period Δt, obtain the CPU load value as a test sample, the test sample length is L M -1, by adding 0 value at the end, the test sample length is expanded to L M ; S5.2 performs preprocessing and feature extraction, and performs weighted summation of the test sample and the feature to obtain the final test sample, which is input into the trained time series convolutional neural network.
7. A system for implementing the cloud platform service load prediction method according to any one of claims 1 to 6, characterized in that: include Obtain training sample set module: collect CPU load timing data to form a training sample set; Preprocessing and feature extraction module: Process the training sample set and test sample; Build and train a time series convolutional neural network module: used to build and train a time series convolutional neural network module; Testing module: Input the test samples processed by the preprocessing and feature extraction modules into the trained time series convolutional neural network module to obtain the prediction results.
Citation Information
Patent Citations
Periodic multivariate time sequence anomaly detection method and system
CN112685476A
Improved Elman neural network prediction method based on a noise reduction algorithm
CN112988548A
Cited By
TCN-PatchTST-based cloud computing resource load prediction method
CN121029379A