Kubernetes-based cloud work elastic expansion method
By combining multi-scale time series decomposition and frequency domain analysis with adaptive clustering and data augmentation techniques, a load prediction model is constructed, which solves the problems of accuracy and resource allocation efficiency in cloud load prediction, realizes proactive resource scheduling of Kubernetes clusters, and improves the system's scalability and resource utilization.
Patent Information
- Application Number
- CN202511253087.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-03
- Publication Date
- 2025-11-07
AI Technical Summary
Existing cloud load forecasting methods are not accurate enough when faced with multi-scale load fluctuations. Traditional static resource configuration leads to resource overload or idleness, and Kubernetes' passive and responsive elastic scaling mechanism is difficult to cope with rapidly changing cloud computing needs.
Feature modeling is performed using multi-scale temporal decomposition, adaptive threshold denoising, and frequency domain analysis. Combined with adaptive clustering and Mixup data augmentation techniques, a load prediction model is constructed. The prediction is performed using the PM-SGRUs-DTW framework, and proactive scaling decisions are made using Kubernetes' HPA mechanism.
It improves the accuracy of load forecasting and resource utilization efficiency, reduces response latency, and enhances the scalability and service quality of Kubernetes clusters.
Smart Images

Figure CN120909707A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of inter-cloud workload prediction, in particular to a Kubernetes-based inter-cloud workload elastic scaling method. BACKGROUND
[0002] With the development of cloud computing technology, the dynamic adaptation of resource supply end faces great challenges. The rapid growth of user scale and the diversification of application scenarios make the cloud workload present multi-scale fluctuation characteristics: there are minute-level burst loads in the micro level, and there are obvious periodic fluctuations in the macro level. For example, the cluster data analysis of Ali Cloud shows that the CPU utilization rate fluctuates greatly in the hourly window, and shows obvious periodic changes in the daily window. This multi-scale time-varying characteristic makes the balance between resource configuration and service quality more complex.
[0003] The existing research has obvious limitations in dealing with multi-scale load prediction problems. Through empirical research, it is shown that the cloud load data has significant non-stationary characteristics, but the mainstream prediction method is still directly based on the original time series data for modeling, mainly focusing on trend fitting, and ignoring the explicit mining of multi-time scale implicit patterns. This pattern loss leads to difficulties in capturing load fluctuation characteristics, affecting the accuracy of the prediction results.
[0004] In addition, the traditional static resource configuration lacks elastic scheduling, which easily leads to resource overload or idling, thereby causing performance degradation and cost waste. For this reason, containerization technology has been gradually introduced into the cloud computing environment. The elastic scheduling mechanism of containerization, such as the native elastic scaling mechanism of Kubernetes, adopts a passive response method, that is, when the resource utilization rate reaches the preset threshold, the expansion or contraction operation is triggered. However, this passive response method often fails to cope with the rapid changes in real-time demand in the cloud computing environment, and cannot timely adjust the resource configuration in the initial stage of load fluctuation, affecting the overall performance. SUMMARY
[0005] In view of this, the present application proposes a Kubernetes-based inter-cloud workload elastic scaling method to solve the above problems existing in the prior art.
[0006] To achieve the above purpose, the present application proposes a Kubernetes-based inter-cloud workload elastic scaling method, characterized in that it comprises:
[0007] Multi-scale time series decomposition, adaptive threshold denoising and frequency domain analysis method are used to model and extract the multi-scale space-time characteristics of inter-cloud work, and obtain inter-cloud workload characteristic data;
[0008] Adopt the adaptive clustering method to construct the multi-time scale load mode, carry out the mode division of the inter-cloud work load characteristic data based on the multi-time scale load mode, and adopt the Mixup data enhancement technology to expand the sample quantity;
[0009] Adopt the multi-mode stacked GRU training method to construct the load prediction model, and adopt the time sequence similarity measurement method to obtain the load prediction result of different load modes of the inter-cloud work.
[0010] The load state of the Kubernetes cluster system is predicted based on the load prediction model, and whether to perform the expansion or contraction operation is judged based on the prediction result.
[0011] Compared with the prior art, the beneficial effects of the present application are that:
[0012] The present application constructs a multi-scale decomposition framework integrating time-frequency domain analysis, which constructs multi-scale training samples through sliding window technology, realizes adaptive noise reduction by combining wavelet transform, and extracts frequency domain features by using Fourier transform. Before pattern mining, through time-frequency domain joint analysis, the load fluctuation characteristics under multi-time scale are separated, providing clear feature representation for subsequent pattern recognition and prediction modeling, and improving the model's ability to capture multi-scale load patterns.
[0013] The present application designs a data enhancement and training method based on pattern clustering, and realizes integrated prediction combined with the Dynamic Time Warping (DTW) algorithm. First, the DBA K-Means algorithm is used to cluster multi-scale time series data, and the load patterns of multiple time scales such as seconds, minutes and hours are mined. Second, the Mixup technology is introduced for data enhancement, and mixed samples within the mode are generated to improve the model's generalization ability. Finally, through parallel training of stacked GRU weak learners, the similarity of each sequence and the mode center is calculated based on DTW, and the prediction results are adaptively fused by using exponential normalization weight, constructing an efficient integrated prediction framework.
[0014] The present application proposes a load prediction type elastic scaling mechanism based on the Kubernetes platform. The mechanism combines the prediction results of the PM-SGRUs-DTW model with the original HPA mechanism of Kubernetes, accurately predicts the load trend, predicts the resource demand, realizes the expansion and contraction decision at the initial stage of load fluctuation, reduces the response delay of the elastic scaling mechanism, and improves the resource utilization efficiency and service quality. BRIEF DESCRIPTION OF DRAWINGS
[0015] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments with reference made to the accompanying drawings. The drawings are for purposes of illustration only and are not intended to limit the present application thereto. In the drawings:
[0016] Figure 1 A Kubernetes-based inter-cloud job elasticity scaling method flowchart in an embodiment of the present application;
[0017] Figure 2 is a PM-SGRUs-DTW framework diagram in an embodiment of the present application, wherein (a) is a multi-scale time series decomposition and feature extraction part, (b) is an adaptive mode clustering and data enhancement part, and (c) is a dynamic ensemble prediction part based on similarity alignment;
[0018] Figure 3 A multi-scale time series decomposition and feature extraction framework in an embodiment of the present application;
[0019] Figure 4 A dynamic ensemble prediction diagram based on similarity alignment in an embodiment of the present application;
[0020] Figure 5 A Kubernetes-based HPA elasticity scaling mechanism diagram in an embodiment of the present application;
[0021] Figure 6 A CPA automatic scaling logic diagram in an embodiment of the present application;
[0022] Figure 7 An optimized evaluator algorithm flowchart in an embodiment of the present application;
[0023] Figure 8 HPA and CPA scaling effects under dynamic load in an embodiment of the present application. DETAILED DESCRIPTION
[0024] Exemplary embodiments of the present disclosure will be described below in greater detail with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be accurately conveyed to those skilled in the art. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
[0025] The present embodiment proposes a Kubernetes-based inter-cloud job elasticity scaling method, as shown in Figure 1 , comprising:
[0026] The PM-SGRUs-DTW framework is constructed, which includes the following three parts:
[0027] The first part: multi-scale spatiotemporal feature modeling and extraction of inter-cloud work is carried out by using multi-scale temporal decomposition, adaptive threshold denoising and frequency domain analysis method, and the inter-cloud work load feature data is obtained;
[0028] The second part: a multi-time scale load mode is constructed by using an adaptive clustering method, the mode division of the inter-cloud work load feature data is carried out based on the multi-time scale load mode, and the sample number is expanded by using the Mixup data enhancement technology;
[0029] The third part: a load prediction model is constructed by using a multi-mode stacked GRU training method, and the load prediction result of different load modes of inter-cloud work is obtained by using a time series similarity measurement method;
[0030] Finally, the prediction model constructed by using the PM-SGRUs-DTW framework is used to predict the load state of the Kubernetes cluster system, and whether to perform expansion or contraction operation is determined based on the prediction result.
[0031] The PM-SGRUs-DTW framework proposed in this embodiment is shown in FIG. 2, which mainly includes three modules: multi-scale temporal decomposition and feature extraction, adaptive mode clustering and data enhancement, and dynamic integrated prediction based on similarity alignment.
[0032] Multi-scale temporal decomposition and feature extraction
[0033] In view of the complex dynamic characteristics of cloud work load on different time scales, an innovative three-level processing framework of decomposition-denoising-extraction is designed in this embodiment, through the collaborative optimization of temporal decomposition, noise suppression and frequency domain analysis, the accurate modeling and extraction of multi-scale spatiotemporal features are realized. The framework is shown in FIG. 2. Through multi-scale spatiotemporal feature modeling, not only the short-time burst characteristics and long-time periodicity of cloud work load can be accurately captured, but also rich feature information is provided for subsequent mode clustering, further improving the accuracy of load analysis and prediction. Figure 3
[0034] (1) Multi-scale temporal decomposition and sample generation
[0035] Let the cloud data center work load sequence be . Wherein, represents the time load values, including CPU utilization, memory utilization, and other indicators. To effectively capture the dynamic characteristics of cloud workloads at different time scales, the embodiment proposes a sample division method based on sliding windows. For different prediction scales at the second, minute, and hour levels, the adaptive input sample set is generated.
[0036] A unified multi-scale mapping rule is defined to address the differences in data collection granularity between Aliyun and Google Cloud. For the Aliyun dataset with a collection interval of 10 seconds, the time scale parameters for seconds, minutes, and hours are set to For the Google Cloud dataset with a collection interval of 1 second, the corresponding parameters are set to , ensuring consistency in time span.
[0037] In the sliding window sample generation phase, for each time scale (second, minute, hour), the corresponding window parameters are set. The input window length represents the historical observation period, and the prediction window length represents the future prediction period, then the total window span . Starting from time , with a step size , the subsequence is intercepted by sliding window, as shown in formula (1).
[0038] (1)
[0039] where is the step unit corresponding to the time scale , i.e. the actual time span of each time scale.
[0040] If there are missing values in the window, the adjacent window mean interpolation method is used for processing, as shown in formula (2).
[0041] (2)
[0042] where and are the mean values of the previous window and the next window, respectively.
[0043] To eliminate the interference of local fluctuations in the window on model training, the mean and standard deviation are calculated independently for each window , and Z-score standardization is performed, as shown in formula (3). If If the load within the window is fluctuating, the sample is discarded to avoid introducing invalid information. Finally, the normalized dataset is divided into training and testing sets in chronological order, and random shuffling is prohibited to maintain the causal structure of the time series, ensuring that the model only relies on historical observation data when predicting future periods.
[0044] (3)
[0045] Through these steps, workload data of different time scales can be obtained, providing high-quality input samples for subsequent analysis and prediction.
[0046] (2) Adaptive threshold denoising based on wavelet decomposition
[0047] Cloud workload time series data often contains high-frequency noise, which can interfere with the identification of load patterns, leading to reduced clustering purity and increased prediction error. To address this, the embodiment proposes an adaptive threshold denoising method based on wavelet multi-scale decomposition, which effectively separates noise and signal components, suppressing interference while preserving the overall trend and local mutation characteristics of the load.
[0048] First, the workload sequence is processed by wavelet decomposition to obtain detail coefficients and approximation coefficients , where denotes the number of wavelet decomposition layers, i.e., the number of scales into which the signal is decomposed. The detail coefficients of each layer capture the changes in the signal at different frequency ranges, while the finest-scale detail coefficient mainly contains high-frequency noise.
[0049] Then, the optimal threshold is dynamically calculated based on the Stein Unbiased Risk Estimation (SURE) criterion, allowing for more accurate identification and removal of noise components. The adaptive threshold calculation formula of the SURE criterion is shown in (4).
[0050] (4)
[0051] where denotes the noise standard deviation, is the length of the detail coefficient. The noise standard deviation is estimated based on the finest-scale detail coefficient , as shown in equation (5). The constant 0.6745 is a Gaussian distribution standard deviation correction factor.
[0052] (5)
[0053] With this threshold, combined with the soft threshold processing method, the detail coefficients after wavelet decomposition are thresholded, as shown in equation (6). In this way, the noise component is effectively removed while the main features of the signal are preserved.
[0054] (6)
[0055] Finally, the processed coefficients are combined into the denoised signal through wavelet reconstruction. Since wavelet transform may cause changes in signal length, length alignment processing is needed for the output signal to ensure that the denoised signal remains consistent with the original signal.
[0056] (3) Fourier transform frequency domain feature extraction
[0057] Cloud workload data often exhibits complex time dependence, with specific frequency domain feature patterns at different time scales. To extract these frequency domain features, this embodiment uses Fourier transform to convert time domain signals to frequency domain to reveal multi-time scale frequency domain feature information. Fourier transform effectively identifies the correlation between high-frequency fluctuations such as instantaneous load changes and low-frequency fluctuations such as long-term trends and seasonal changes by decomposing the signal into different frequencies of sinusoidal waves.
[0058] First, the denoised load data is subjected to Fourier transform to generate the corresponding frequency spectrum analysis results. Then, based on the frequency spectrum analysis results, a threshold segmentation method is used to selectively retain the effective components within a specific frequency range. In this process, the threshold is set to 80% of the maximum amplitude of the frequency spectrum, and the amplitudes of non-primary frequency components are set to zero, effectively extracting frequency domain features with significant information content. Finally, the processed frequency domain data is converted back to the time domain by inverse Fourier transform, resulting in workload data that has both denoising and frequency domain feature extraction.
[0059] Adaptive pattern clustering and data augmentation
[0060] After multi-scale time series decomposition and feature extraction, the time-frequency features of cloud workloads have been effectively characterized. To further mine potential multi-scale load patterns, this embodiment proposes an adaptive pattern clustering and data augmentation framework that uses adaptive clustering methods to mine load patterns at multiple time scales such as seconds, minutes, and hours, and divides the training data set based on these load patterns. Considering the overfitting problem that may occur in small sample patterns, combined with Mixup data augmentation technology, the model's generalization ability is enhanced by expanding the number of samples.
[0061] (1) Adaptive pattern clustering
[0062] In the clustering analysis process of workload data, for its time series characteristics, the embodiment adopts DTW as the core index to measure the similarity of workload sequences. Compared with the traditional Euclidean distance metric, DTW can align different sequences on the time axis and more accurately reflect the similarity characteristics between time series, as shown in formula (7).
[0063] (7)
[0064] wherein, denotes the observation value of the i-th sample at time point t, denotes the observation value of the i-th sample at time point t, denotes the alignment path composed of a series of points , and denotes the correspondence relationship between the two time series on the time axis. DTW finds the optimal alignment path by dynamic programming, so that the cumulative distance is minimized. To calculate the average shape of a set of time series, the embodiment adopts the dynamic time warping barycenter averaging (DTWBarycenter Averaging, DBA) algorithm to extract the common features of the sample set. The DBA algorithm is a time series averaging method based on DTW distance measurement, which can effectively extract the common features of time series and generate their average shape. Unlike the traditional simple averaging method, the DBA algorithm fully considers the local alignment characteristics of time series, can more accurately capture the time variability between sequences, and avoids the deviation on the time axis. In addition, the DBA algorithm can still calculate a representative center trajectory when dealing with time series with different time series changes. Therefore, the DBA algorithm can better reflect the overall trend and local features when dealing with time series data of multi-scale load patterns. The DBA algorithm formula is shown in (8).
[0065] (8)
[0066] wherein,
[0067] denotes the average shape, is a set of time series, denotes the DTW distance between the average shape and the i-th time series. The DBA algorithm finds the average shape
[0068] that minimizes the total DTW distance through an iterative optimization process, thereby effectively describing the average mode of a set of time series.
[0069] For the clustering method, K-Means clustering was chosen because of its simplicity, efficiency, fast convergence, and suitability for processing large-scale datasets. Combining the DBA algorithm with K-Means clustering can effectively uncover potential multi-scale workload patterns and classify samples according to these patterns.
[0070] The adaptive pattern clustering process, as shown in Algorithm 1, details the entire process from determining the initial cluster centers to the final sample assignment. The algorithm's steps are as follows: First, initial cluster centers are randomly selected; then, the DTW similarity between each workload sample and each cluster center is calculated, and each sample is assigned to the load pattern represented by its most similar cluster center; next, the cluster centers are updated according to the DBA algorithm, and this process is repeated until the cluster centers stabilize. Finally, the algorithm divides the samples into multiple subsets, each corresponding to a specific load pattern. These subsets will serve as training data for different weak learners.
[0071]
[0072] (2) Pattern-driven Mixup data augmentation
[0073] To improve the generalization ability of the model and effectively alleviate the overfitting problem that may occur under small sample conditions, this section proposes a pattern-driven Mixup data augmentation method. Mixup is a data augmentation technique that generates virtual samples through linear interpolation, thereby effectively expanding the dataset while preserving the original data distribution characteristics. The pattern-driven Mixup data augmentation method expands the coverage of the data distribution by generating mixed samples within the load pattern, and dynamically adjusts the mixing weights by combining DTW distance to enhance the rationality and diversity of sample generation, thereby effectively improving the model's generalization ability during training.
[0074] The specific process of the algorithm is shown in Algorithm 2 in the table below, including: First, for each pattern dataset... Calculate the number of mixed samples to be generated based on the preset ratio. Then, from the pattern dataset Two samples were randomly selected from the samples. and Mixing is performed. This is done by generating mixing coefficients. This allows for smooth interpolation between two samples. Next, the relationship between these two samples and the current load pattern is calculated. DTW distance and The mixing coefficient is dynamically adjusted based on the difference in DTW distance. This ensures the reasonable mixing of samples. When Greater than The smaller value between will tend to with , and vice versa, the larger value will tend to. Finally, the hybrid samples are generated and added to the pattern dataset .
[0075]
[0076] Dynamic ensemble prediction with similarity alignment
[0077] This embodiment is based on adaptive pattern clustering algorithm and data augmentation technology, and constructs a complete workload pattern and its extended dataset. On this basis, this embodiment proposes a dynamic ensemble prediction method with similarity alignment. This method aims to improve the prediction accuracy and enhance the robustness of the model through multi-pattern load prediction and adaptive weight adjustment mechanism.
[0078] Especially in dealing with complex and variable workload patterns, this method can optimize the prediction results and adaptively adjust the similarity changes between different load patterns by combining multi-model prediction and dynamic integration strategy. This dynamic adjustment mechanism enables the model to better cope with frequent switching and uncertainty of load patterns, thus showing stronger adaptability. Figure 4 The overall design of the method is shown, and the core technologies include multi-mode stacked GRU training and dynamic temporal alignment integration of two key implementation stages.
[0079] (1) Multi-mode stacked GRU training
[0080] The first stage is the training of multi-mode stacked GRU weak learners. In this stage, the weak learners use stacked GRU model to learn through multiple time steps, fully mining the long-term dependencies in time series data. Each weak learner independently predicts the load of different modes, building a multi-mode learning framework to provide basic prediction results for the subsequent integration stage.
[0081] Given the input workload sequence as , the goal of the model is to predict the future workload sequence . By minimizing the error function between the predicted value and the true value through the backpropagation algorithm, the network parameter optimization is achieved. A deep network is constructed through multi-layer stacked GRU structure to enhance the modeling ability of long-time dependence.
[0082] Algorithm 3 details the training process of the multi-modal stacked GRU. For each modal data subset, a stacked GRU sub-model is trained independently; these sub-models collectively form a multi-modal set of weak learners. During the training process, each modal data subset is divided into a training set and a validation set to ensure that the model does not directly access the test data during the training phase.
[0083] To prevent overfitting, an early stopping strategy is introduced during training: the validation loss is continuously monitored, and a stopping condition is triggered when the validation loss fails to decrease for several consecutive rounds, thereby terminating the training process of the current sub-model and saving the model parameters at the point of optimal performance. This mechanism effectively balances the model's fit and generalization ability.
[0084] Finally, an ensemble model containing multiple weak learners is constructed through parallel training of multiple models. Each sub-model is independently optimized based on an enhanced subset of pattern data, and the models achieve efficient resource utilization through a parallel computing framework. This design not only improves the generalization performance of the overall prediction system but also effectively reduces the prediction bias of a single model and enhances the robustness of the prediction results by integrating diverse weak learners.
[0085]
[0086] (2) Dynamic timing alignment integration
[0087] The second stage achieves dynamic temporal alignment and fusion. In this stage, the similarity between the load to be predicted and the load pattern is dynamically evaluated using a temporal similarity metric, and adaptive weights are assigned to each weak learner. These weights reflect the prediction credibility of the prediction models for different load patterns at the current time step. Subsequently, the prediction results of each weak learner are weighted and fused based on these weights, ultimately generating a more accurate and stable prediction result. The specific steps are as follows:
[0088] First, calculate the DTW distance between the workload data to be predicted and each workload pattern. The data to be predicted and the... DTW distance of each mode The calculation is shown in formula (9). Wherein, For the workload data to be predicted, For the first Cluster centers of each pattern.
[0089] (9)
[0090] Secondly, dynamic weights are generated and normalized based on the calculated DTW distance. This involves converting the distance into weights. The process uses an exponential function. Distance is taken as input, and weights are generated through exponential operations. The smaller the distance, the larger the weight. That is, the closer the distance to a certain workload pattern, the more significant the contribution of the weak learner's prediction to the final result. The weights of the weak learners The calculation formula is shown in (10). Wherein, This represents the number of workload modes. The weights are normalized to ensure that the sum of all weights is 1, allowing them to be interpreted as probabilities or normalized weights.
[0091] (10)
[0092] Finally, weighted ensemble prediction is implemented. The prediction results from multiple weak learners are combined using a weighted average method to obtain the final prediction result. As shown in formula (11). Wherein, It is the first The prediction results of a weak learner.
[0093] (11)
[0094] Kubernetes-based load predictive elastic scaling mechanism
[0095] HPA, a native horizontal Pod autoscaler for Kubernetes, periodically collects load metrics such as CPU utilization and memory utilization, and calculates the target number of Pod replicas based on a preset algorithm and static thresholds.
[0096] HPA elastic stretching mechanism, such as Figure 5As shown, it includes three stages: indicator collection, decision calculation, and replica control. In the indicator collection stage, the system collects real-time underlying container resource indicators through cAdvisor, and aggregates them into a cluster-level view by Metrics Server. Business indicators are scraped from application monitoring endpoints by Prometheus and converted into a format recognizable by Kubernetes. The two types of indicators are integrated in Metrics Aggregator to form a composite load view. In the decision calculation stage, the HPA controller periodically pulls data from Metrics Aggregator and generates scaling decisions based on the elasticity algorithm. In the replica control stage, HPA writes the decision results to the spec.replicas field of the target Deployment, triggering the ReplicaSet controller to adjust the number of replicas. ReplicaSet creates or terminates Pods based on the difference between the desired number of replicas and the current number of Pods, and follows the rolling update strategy of Deployment to ensure service continuity. The resource data of new Pods is re-injected into the monitoring closed loop, forming a positive feedback mechanism.
[0097] The elastic scaling mechanism of HPA has some limitations in practical application: first, it uses a reactive strategy and only triggers scaling operations when resource utilization exceeds the set threshold. This delayed response mechanism often leads to significant lag, especially in the face of sudden loads or complex fluctuations. The system may not respond in time, leading to resource overload or idle waste. In addition, HPA has weak load prediction capabilities and is difficult to make predictions before load changes, lacking the ability to actively adjust future resource needs.
[0098] To optimize the above problems and improve the scaling efficiency and response speed of Kubernetes clusters, this embodiment proposes an elastic scaling mechanism based on load prediction. This mechanism integrates the PM-SGRUs-DTW load prediction model and combines future load prediction to achieve proactive scaling decisions. This approach can preprocess before significant load changes, predict and adjust resource needs in advance, effectively reducing resource overload and idle problems caused by reaction lag, and improving resource utilization.
[0099] To achieve more flexible and refined scaling logic, this mechanism is based on the CPA framework. CPA is a customizable Kubernetes autoscaler that can interact with the Kubernetes system and support more complex scaling control logic. Compared to the original HPA, the CPA framework has better extensibility and flexibility.
[0100] As Figure 6As shown, the elasticity logic of the CPA framework contains two core stages.
[0101] Stage 1: Indicator collection and preprocessing stage. The system collects relevant running indicators from the Kubernetes cluster and converts the raw data into standardized JSON format, passing it to the next stage.
[0102] Stage 2: Evaluation and dynamic decision-making stage. The system inputs the collected indicators into the pre-defined expansion logic, evaluates the current system load state, and decides whether to perform scaling up or down operations according to the evaluation results to achieve the predetermined target number of replicas.
[0103] In the evaluation stage, the original design is optimized by this mechanism. For example Figure 7 As shown, based on the PM-SGRUs-DTW load prediction model, a load prediction step is added to optimize the decision logic of scaling up and down, thereby improving the elasticity and scalability of the system.
[0104] First, the system receives real-time CPU utilization and average utilization indicators passed by Metrics Gatherer. At the same time, it obtains historical time series data and pre-trained load prediction model from storage, and initializes the target number of replicas .
[0105] Next, the system checks whether the length of the historical time series meets the input size required by the prediction model . If it does, input for prediction, calculate the future average CPU utilization , and get the target number of replicas according to and HPA algorithm. If it does not, use the original HPA logic to calculate the target number of replicas according to and .
[0106] Finally, the system converts the target number of replicas into JSON format and sends it to the Deployment controller to complete the automatic elasticity and scalability operation.
[0107] Experiment and result analysis
[0108] The effectiveness of the model is verified through experiments and analysis. First, the experimental environment, data set, evaluation index, baseline model and parameter setting are introduced; then, a large number of comparative experiments are carried out on the public data set and other four baseline models. Finally, in order to verify the necessity of each module of the model, the corresponding ablation experiment is designed. The experimental results fully prove the superiority of the model and the effectiveness of each module.
[0109] Experimental setup
[0110] Data set: Two widely recognized public benchmark data sets in the field of cloud computing are used in the experiment: Alibaba cluster-trace-v2018 and Google cluster-trace-v2011. These two data sets are widely used as benchmark data sets in cloud workload prediction research due to their authenticity and scale.
[0111] In the experiment, CPU utilization and memory utilization are selected as core load indicators, and second-level, minute-level and hour-level time series data sets are constructed to verify the prediction ability of the model at different time scales.
[0112] Evaluation index: This embodiment adopts the classical evaluation index of mean absolute error (MAE) to measure the accuracy of cloud workload prediction. MAE is the standard evaluation system in cloud workload prediction research.
[0113] Parameter setting: The PM-SGRUs-DTW model uses a stacked GRU model as a weak learner to perform workload prediction. According to the results of experimental verification and hyperparameter tuning, the following experimental parameter configurations are determined: in terms of model structure, the number of modes is set to 3, the input sequence length is 12, the maximum prediction step number is 10, the hidden layer size is 128, the number of stacked layers is 2, and the training round number is 100; in terms of hyperparameter setting, the Ray Tune framework is used for hyperparameter tuning, the learning rate is 0.001, the weight decay is 0.01, and the optimizer uses the Adam algorithm.
[0114] Comparative experiment and result analysis
[0115] (1) Workload mode analysis
[0116] Based on the Alibaba cluster-trace-v2018 dataset, the multi-time scale load patterns mined by the PM-SGRUs-DTW model were analyzed. After wavelet denoising and frequency domain feature extraction, the load sequence clustering was realized through DBA K-Means algorithm, and the Calinski-Harabasz index (CHI) was used to quantitatively evaluate the clustering quality. The larger the CHI value, the higher the intra-class sample tightness and the more significant the inter-class separation, the better the clustering effect.
[0117] To balance the pattern representation ability and computational efficiency, the optimal number of clusters was determined within the range through grid search. The experimental results show that the CHI values of CPU utilization and memory utilization at the second, minute and hour scales reach the global maximum, indicating that the clustering effect is optimal at this time. However, the CHI value of CPU utilization at the hour scale is the highest. Considering the consistency of multiple scales and the complexity of the algorithm, the final choice is as the unified cluster number.
[0118] Through the analysis of CPU utilization and memory utilization patterns, the following conclusions are drawn:
[0119] In terms of CPU utilization, pattern A presents a convex curve, the second-level pattern reflects the instantaneous task surge, the resource demand rises rapidly and then falls; the minute-level pattern shows the phased resource demand caused by batch task scheduling; the hour-level pattern reflects the resource reservation of long-term service. Pattern B presents a concave curve, the second-level pattern embodies short-term resource release and preemption, the minute-level pattern shows gradual resource release, and the hour-level pattern is the steady-state adjustment of resource pooling management. Pattern C shows a continuous decrease, the second-level pattern corresponds to the rapid completion of lightweight tasks, the minute-level pattern reflects the resource recovery of medium-scale tasks, and the hour-level pattern shows the batch offline strategy of large-scale services.
[0120] In terms of memory utilization, the same three characteristics are shown. Pattern A presents a convex curve, pattern B presents a concave curve, and pattern C presents high-frequency dynamic fluctuations, indicating that the memory load has strong irregularity and fluctuation amplitude under this mode. Through these analyses, we can more deeply understand the dynamic characteristics and laws of system resources under multiple scales.
[0121] (2) Comparative result analysis
[0122] This experiment verifies the prediction performance of the PM-SGRUs-DTW model, and compares it with four baseline models on the Alibaba dataset at multiple time scales, including second-level (10s), minute-level (5min) and hour-level (3h). The experimental results are evaluated by MAE, and Table 1 and Table 2 show the MAE results of CPU utilization and memory utilization prediction, respectively.
[0123] Table 1
[0124]
[0125] Table 2
[0126]
[0127] The experimental results show that the PM-SGRUs-DTW model performs well in the multi-time scale resource prediction task. In CPU utilization prediction, PM-SGRUs-DTW achieves optimal MAE values of 0.4487, 0.5484 and 0.3950 in second-level, minute-level and hour-level prediction, respectively. Compared with the optimal baseline model APM, the prediction error is reduced by 0.09%, 0.56% and 4.12%, respectively; compared with the worst baseline model SWARIMA, it is reduced by 13.98%, 12.18% and 52.80%, respectively. In memory utilization prediction task, PM-SGRUs-DTW also performs well, and achieves optimal MAE values of 0.3678, 0.4264 and 0.6846 in second-level, minute-level and hour-level prediction, respectively. Compared with the optimal baseline model APM, the prediction error is reduced by 6.03%, 9.06% and 5.49%, respectively; compared with the worst baseline model SWARIMA, it is reduced by 23.65%, 34.27% and 24.79%, respectively.
[0128] Compared with the baseline model, PM-SGRUs-DTW combines time-frequency analysis and adaptive pattern mining, customizes weak learners for each load pattern, and overcomes the shortcomings of APM and other ensemble methods in dynamic adaptation of patterns. On the other hand, PM-SGRUs-DTW predicts by stacking GRU models, solving the problem that SWARIMA and other statistical analysis methods cannot adapt to nonlinear mutations. In addition, PM-SGRUs-DTW analyzes time-frequency domain features through wavelet denoising and Fourier transform, making up for the shortcomings of L-PAW, esDNN and other RNN models that only focus on load trends and ignore frequency domain features, and improving the recognition ability of complex load patterns.
[0129] In summary, the PM-SGRUs-DTW model effectively balances the modeling needs of short-term fluctuations and long-term trends by combining time-frequency domain analysis and load pattern mining, providing a more robust cloud workload resource prediction solution.
[0130] (3) Experimental analysis of load prediction type elastic scaling mechanism based on Kubernetes
[0131] To verify the effectiveness of the load prediction-based elastic scaling mechanism, the embodiment carries out a container-level experiment based on the CPU utilization index in the Google dataset. The experiment compares the performance of the native horizontal Pod autoscaler HPA and the customizable Pod autoscaler CPA with the introduction of a load prediction model under dynamic load. The experiment uses the PM-SGRUs-DTW model as the load prediction model, and realizes the simulation of the two mechanisms through a multi-thread parallel computing framework.
[0132] The experiment takes 15 seconds as the sampling interval, inputs the load data into the prediction model to generate the prediction curve. The multi-thread parallel computing framework ThreadPoolExecutor executes the scaling logic of HPA and CPA respectively. To ensure consistency of experimental conditions, HPA and CPA run in independent threads, and Simu-HPA and Simu-CPA methods are called respectively for simulation. Figure 8 The real load, predicted load and change curve of the number of Pod replicas under the two scaling mechanisms are shown.
[0133] The experimental results show that, in the burst load response stage (0s to 5s), The CPA-based load prediction-based pre-scaling mechanism makes the number of Pod replicas increase rapidly from 0 to 5; while the HPA lacks prediction ability and the response is delayed by 35 seconds. In the highly fluctuating stage (5s to 10s), The HPA frequently over-scales, resulting in idle resources, while the CPA realizes smooth scaling through the prediction mechanism, more accurately tracks load changes, and effectively balances resource utilization efficiency and system stability. The experimental results verify the significant advantages of the CPA mechanism based on load prediction in terms of scaling stability and load adaptability, especially in the case of highly fluctuating load, the CPA can provide better elastic scaling effect, effectively avoiding the over-scaling or response lag phenomenon commonly seen in HPA.
[0134] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application and not to limit it, although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that: the specific embodiments of the present application can be modified or replaced, without departing from the spirit and scope of the present application, any modification or equivalent replacement, which should be covered within the protection scope of the claims of the present application.
Claims
1. A Kubernetes-based inter-cloud job elasticity scaling method, characterized in that, The method comprises the following steps: Multi-scale time-space feature modeling and extraction of inter-cloud work is performed by using multi-scale time series decomposition, adaptive threshold denoising and frequency domain analysis method to obtain inter-cloud work load feature data; An adaptive clustering method is used to construct a multi-time scale load pattern, and the mode division of the inter-cloud work load feature data is performed based on the multi-time scale load pattern, and the sample number is expanded by using the Mixup data enhancement technology; A multi-mode stacked GRU training method is used to construct a load prediction model, and a time series similarity measurement method is used to obtain the load prediction result of different load modes of inter-cloud work; The load state of the Kubernetes cluster system is predicted based on the load prediction model, and it is determined whether to perform expansion or contraction operation based on the prediction result.
2. The Kubernetes-based inter-cloud job elasticity scaling method according to claim 1, characterized in that, The implementation process of the multi-scale time series decomposition comprises: The time scale parameters are set respectively for the collection granularity differences of different types of data sets; Window parameters are set respectively for different time scale data sets; Based on the window parameters, a sliding window is generated, missing values are completed by using the adjacent window mean interpolation method, each sliding window is standardized by Z-score, a data set subsequence is intercepted based on the sliding window, and inter-cloud work load data is constructed.
3. The Kubernetes-based inter-cloud job elasticity scaling method of claim 1, wherein, The implementation process of the adaptive threshold denoising comprises: The inter-cloud work load data is decomposed into detail coefficients of different scales based on wavelet decomposition; The optimal threshold is calculated based on the Stein unbiased risk estimation criterion, and the noise of the detail coefficients is identified and removed based on the optimal threshold; The processed detail coefficient groups are combined and aligned based on wavelet reconstruction to obtain a denoised signal.
4. The Kubernetes-based inter-cloud job elasticity scaling method of claim 1, wherein, The implementation process of the frequency domain analysis comprises: Fourier transform is used to generate frequency spectrum analysis results for the denoised signal, and a threshold segmentation method is used to retain the effective components in the frequency spectrum analysis results to obtain frequency domain feature data; Inverse Fourier transform is performed on the frequency domain feature data to obtain inter-cloud work load feature data.
5. The Kubernetes-based inter-cloud job elasticity scaling method according to claim 1, wherein, The process of constructing a multi-time scale load pattern by using an adaptive clustering method comprises: The similarity features of the inter-cloud work load feature data are reflected by calculating the DTW distance, the clustering centers of the inter-cloud work load feature data are calculated and updated in real time based on the DTW distance by using the dynamic time warping centroid average algorithm until the clustering centers are stable, and the inter-cloud work load feature data is divided into a plurality of training data sets corresponding to specific load patterns.
6. The Kubernetes-based inter-cloud job elasticity scaling method according to claim 1, wherein, The process of expanding the sample number by using the Mixup data enhancement technology comprises: The number of mixed samples to be generated is calculated for each load pattern training data set; The samples in the training data set are randomly selected and mixed to generate a mixing coefficient; The DTW distance between the sample and the current load pattern is calculated, the mixing coefficient is adjusted based on the DTW distance, and a mixed sample is generated based on the adjusted mixing coefficient, and the mixed sample is added to the training data set of the load pattern.
7. The Kubernetes-based inter-cloud job elasticity scaling method according to claim 1, wherein, The process of constructing a load prediction model by using a multi-mode stacked GRU training method comprises: The stacked GRU model is used as a weak learner, and each weak learner is independently used to predict the training data set of different load modes through several time step recursive learning. Real-time monitoring of the change of the verification loss is performed, and the model training process is terminated when the verification loss no longer decreases, the model parameters are saved, and the load prediction model is constructed. 8.The Kubernetes-based inter-cloud job elasticity scaling method of claim 1, wherein, The process of obtaining the load prediction result of the inter-cloud work in different load modes by using the time series similarity measurement method includes: The DTW distance between the to-be-predicted data and the corresponding load mode is calculated, the dynamic weight is generated based on the calculated DTW distance, and the contribution degree of the prediction result of each load mode to the final result is represented based on the dynamic weight. Based on the dynamic weight, the prediction results of the multiple weak learners are integrated by using the weighted average method to generate the load prediction result. 9.The Kubernetes-based inter-cloud job elasticity and scalability method of claim 1, wherein, The process of predicting the load state of the Kubernetes cluster system based on the load prediction model includes: The relevant running indicators of the Kubernetes cluster system are reacquired and converted into JSON format running data, and the relevant running indicators include real-time CPU utilization and average utilization indicators. It is judged whether the length of the running data meets the input size of the prediction load model, if yes, the next step CPU usage is obtained based on the prediction load model, and the real-time CPU utilization and the next step CPU usage are input into the original HPA algorithm to calculate the target number of replicas, if not, the original HPA is directly used to calculate the target number of replicas, and the target number of replicas is converted into JSON format running data and sent to the Deployment controller to complete the automatic elastic scaling operation.