Load prediction method and device for container cluster, equipment and storage medium
By combining adaptive windowing and reinforcement learning, the analysis granularity and feature weights of the load prediction model are dynamically adjusted, which solves the problem of poor adaptability of traditional models in container clusters and achieves efficient load prediction and stable resource scheduling.
Patent Information
- Application Number
- CN202610070151.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-20
- Publication Date
- 2026-02-17
AI Technical Summary
Traditional load forecasting models cannot adapt to the different needs of container cluster load during stable and abrupt periods, resulting in data redundancy or loss of details, and cannot be adjusted in real time to cope with random fluctuations, affecting resource scheduling efficiency and service stability.
An adaptive window mechanism is used to acquire load information. The load prediction model is fine-tuned through target weight decay and reinforcement learning. The analysis granularity and feature weights are dynamically adjusted. Combined with multi-model fusion and confidence calibration, real-time correction is achieved.
It improves the efficiency of container cluster resource scheduling and service stability, and enhances the accuracy and adaptability of load prediction, especially significantly improving prediction accuracy during periods of sudden changes.
Smart Images

Figure CN121542014A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of load forecasting, and in particular to a method, apparatus, device, and storage medium for load forecasting of container clusters. Background Technology
[0002] With the development of cloud computing technology, container clusters (such as Kubernetes) have become the core carrier for microservice deployment. Accurate prediction of their load status (CPU utilization, memory usage, etc.) is crucial for achieving dynamic resource scheduling and avoiding service overload. However, traditional prediction models use fixed-length sliding windows for input data, which cannot adapt to the differentiated needs of stable and abrupt load changes (such as the pulse traffic of e-commerce flash sales). This leads to data redundancy during stable periods or loss of details during abrupt changes, resulting in poor adaptability of static windows. At the same time, the parameters of the load prediction model are fixed after training and cannot be dynamically adjusted according to real-time prediction errors, making it difficult to cope with the random fluctuations in container cluster load.
[0003] Therefore, there is an urgent need for a load prediction method that can dynamically adapt to load changes, optimize feature weights, and have real-time correction capabilities to improve the resource scheduling efficiency and service stability of container clusters. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a method, apparatus, device, and storage medium for load prediction of container clusters, which can dynamically adapt to load changes, optimize feature weights, integrate the advantages of multiple models, and have real-time correction capabilities, thereby improving the resource scheduling efficiency and service stability of container clusters. The specific solution is as follows:
[0005] Firstly, this application discloses a load prediction method for container clusters, including: The raw load information of each target node in the target container cluster is obtained by the acquisition agent corresponding to each target node based on the target adaptive window, and the raw load information is preprocessed to obtain the corresponding target load characteristics; the raw load information includes the CPU utilization, memory usage, network bandwidth utilization, request processing volume and disk input / output read / write rate of the target node. The attention score corresponding to each target load feature is determined based on the target weight decay mechanism, and the pre-acquired target load prediction model is fine-tuned through reinforcement learning based on each target load feature and the corresponding attention score. The fine-tuned target load prediction model is used to predict the load of the target node based on the target load characteristics and the corresponding attention score, so as to obtain the corresponding load prediction results.
[0006] Optionally, before determining the attention score corresponding to each of the target load features based on the target weight decay mechanism, the method further includes: Based on the volatility characteristics in the target load characteristics, determine whether the current target load state of the target node is the same as the previous target load state; If the current target load state of the target node is different from the previous target load state, the target adaptive window is adjusted based on the volatility characteristics corresponding to the current target load state to determine the adjusted target adaptive window, and then the process jumps to the step of using the acquisition agent corresponding to each target node of the target container cluster to obtain the original load information of each target node based on the target adaptive window.
[0007] Optionally, adjusting the target adaptive window based on the volatility characteristics corresponding to the current target load state to determine the adjusted target adaptive window includes: If the volatility feature corresponding to the current target load state of the target node is greater than or equal to a preset volatility threshold, then the load curve in the target load feature is matched with the load mutation pattern in the pre-built load mutation pattern library to determine the target load mutation pattern based on the preset matching threshold, and the target adaptive window is adjusted based on the target window parameters corresponding to the target load mutation pattern to determine the adjusted target adaptive window. If the volatility characteristic corresponding to the current target load state of the target node is less than the preset volatility threshold, the target adaptive window is adjusted based on the target window parameter corresponding to the load stabilization period to determine the adjusted target adaptive window. The load mutation modes include pulsed load mutation, stepped load mutation, and periodic load mutation.
[0008] Optionally, the step of using the fine-tuned target load prediction model to perform load prediction on the corresponding target node based on the target load characteristics and the corresponding attention score to obtain the corresponding load prediction result includes: Using the fine-tuned target load prediction model, load prediction is performed on the corresponding target nodes based on the target load features and the corresponding attention scores to obtain initial load prediction results. Using a preset confidence calibration mechanism, the fusion weights corresponding to each target sub-model are adjusted based on the volatility characteristics corresponding to the current target load state of the target node; The initial load prediction results are fused based on the adjusted fusion weights to obtain the load prediction result corresponding to the target node.
[0009] Optionally, determining the attention score corresponding to each of the target load features based on the target weight decay mechanism includes: The attention weights corresponding to each of the target load features are determined based on the target weight decay mechanism. The dependencies between the target load features are determined using a target correlation matrix; the target correlation matrix is a global correlation matrix determined based on mutual information. The attention score for each target load feature is determined based on the dependencies and the attention weights corresponding to each target load feature.
[0010] Optionally, the step of fine-tuning the pre-acquired target load prediction model through reinforcement learning based on each of the target load features and the corresponding attention scores includes: The target load characteristics of the target container cluster are determined based on all the target load characteristics and the corresponding attention scores. Using the first dataset acquired in advance and the first action space of reinforcement learning, the target weight parameters of the pre-acquired target load prediction model are fine-tuned based on the target load characteristics; The first dataset is a dataset constructed based on the historical load time-series data of the target container cluster, and the first dataset includes a first training set and a first validation set; the target weight parameters include the load prediction weights of the long short-term memory network of the target load prediction model and the load prediction weights corresponding to the attention scores.
[0011] Optionally, the load prediction method for the container cluster further includes: Get the model update request; Based on the model update request, a second dataset is constructed using the historical load time-series data of the target container cluster; the second dataset includes a second training set and a second validation set. The target load prediction model is updated using the second dataset to obtain the updated target load prediction model, so as to use the new target load prediction model to predict the load of the target container cluster.
[0012] Secondly, this application discloses a load prediction device for a container cluster, comprising: The load feature acquisition module is used to acquire the original load information of each target node based on the target adaptive window using the acquisition agent corresponding to each target node of the target container cluster, and to preprocess the original load information to obtain the corresponding target load features; the original load information includes the CPU utilization, memory usage, network bandwidth utilization, request processing volume and disk input / output read / write rate of the target node. The model fine-tuning module is used to determine the attention score corresponding to each of the target load features based on the target weight decay mechanism, and to fine-tune the pre-acquired target load prediction model through reinforcement learning based on each of the target load features and the corresponding attention score. The load prediction module is used to perform load prediction on the corresponding target node based on the target load characteristics and the corresponding attention score using the fine-tuned target load prediction model, so as to obtain the corresponding load prediction result.
[0013] Thirdly, this application discloses an electronic device, including: Memory, used to store computer programs; A processor is used to execute the computer program to implement the aforementioned load prediction method for container clusters.
[0014] Fourthly, this application discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned load prediction method for container clusters.
[0015] In this application, when performing load prediction on a container cluster, the raw load information of each target node in the target container cluster is obtained by the acquisition agent corresponding to each target node based on a target adaptive window. The raw load information is then preprocessed to obtain corresponding target load features. The raw load information includes the CPU utilization, memory usage, network bandwidth utilization, request processing volume, and disk I / O read / write rate of the target node. An attention score corresponding to each target load feature is determined based on a target weight decay mechanism. Based on each target load feature and the corresponding attention score, a pre-obtained target load prediction model is fine-tuned using reinforcement learning. The fine-tuned target load prediction model is then used to perform load prediction on the corresponding target node based on the target load features and the corresponding attention score to obtain the corresponding load prediction result. Therefore, this application utilizes a target adaptive window to obtain the load information of each target node in the target container cluster, achieving dynamic adjustment of the analysis granularity of the load information. Furthermore, by preprocessing the raw load information to extract the corresponding target load features, it provides high-quality input for the target load prediction model. Meanwhile, attention scores for target load features are determined based on the target weight decay mechanism, and the target load prediction model is fine-tuned based on each target load feature and its corresponding attention score through reinforcement learning. This enhances the target load prediction model's ability to dynamically capture key features, making the load prediction results output by the fine-tuned target load prediction model more compatible with the load characteristics of the target container cluster. This allows for dynamic adaptation to load changes, optimization of feature weights, and real-time fine-tuning of the target load prediction model, thereby improving the resource scheduling efficiency and service stability of the container cluster. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0017] Figure 1 This is a flowchart of a load prediction method for a container cluster disclosed in this application; Figure 2 This is a schematic diagram of a specific adaptive window adjustment method disclosed in this application; Figure 3 This is a schematic diagram illustrating the process of load forecasting for a container cluster using a specific load forecasting model disclosed in this application. Figure 4 This is a schematic diagram of a specific load prediction model update process disclosed in this application; Figure 5 This is a schematic diagram of the load prediction device for a container cluster disclosed in this application; Figure 6 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] With the development of cloud computing technology, container clusters (such as Kubernetes) have become the core carrier for microservice deployment. Accurate prediction of their load status (CPU utilization, memory usage, etc.) is crucial for dynamic resource scheduling and avoiding service overload. However, traditional prediction models use fixed-length sliding windows for input data, which cannot adapt to the differentiated needs of stable and abrupt load changes (such as the pulsed traffic of e-commerce flash sales). This leads to data redundancy during stable periods or loss of details during abrupt changes, resulting in poor adaptability of static windows. Furthermore, the parameters of load prediction models are fixed after training and cannot be dynamically adjusted based on real-time prediction errors, making it difficult to cope with the random fluctuations in container cluster load. To address these technical problems, this application discloses a load prediction method for container clusters, which can improve the resource scheduling efficiency and service stability of container clusters.
[0020] See Figure 1 As shown in the figure, an embodiment of the present invention discloses a load prediction method for a container cluster, including:
[0021] Step S11: Use the acquisition agent corresponding to each target node of the target container cluster to obtain the original load information of each target node based on the target adaptive window, and preprocess the original load information to obtain the corresponding target load characteristics; the original load information includes the CPU utilization, memory usage, network bandwidth utilization, request processing volume and disk input / output read / write rate of the target node.
[0022] In this embodiment, a lightweight acquisition agent (Prometheus Exporter) is deployed on each target node of the target container cluster, thereby constructing a fully covered metric acquisition network. These acquisition agents continuously capture and report the core performance metrics of the target nodes at a fixed sampling frequency using a target adaptive window, forming a high-granularity, highly available multi-dimensional time-series data stream (time-series dataset), including CPU utilization, memory usage, network bandwidth utilization, request processing volume, and disk I / O (Input / Output) rate, which is the original load information corresponding to the target node.
[0023] In this embodiment, as Figure 2 As shown, after obtaining the original load information, a series of preprocessing operations are performed to obtain the corresponding target load characteristics, including data cleaning, data normalization, and feature extraction. In one specific implementation, the data cleaning process includes: using a scenario-specific hybrid interpolation algorithm for missing values; for short-period missing values (no more than 5 consecutive missing points, i.e., a missing period of no more than 15 seconds) caused by network jitter, linear interpolation is used, based on the slope calculation method of adjacent valid data points to accurately estimate the missing values; for long-period missing values (more than 5 sampling points) that may be caused by agent restarts, spline interpolation is used, such as using a cubic spline interpolation algorithm to ensure the smoothness of the interpolation curve; for outliers, a method combining statistical discrimination and physical thresholding is used, based on 3 The criteria (Raida Criterion) identify and filter outliers that deviate from the normal statistical distribution, and establish hard physical boundaries (e.g., CPU utilization should theoretically not exceed 100%) to directly remove such invalid or erroneous data. All filtered outliers, along with their detailed timestamps, indicator types, and original values, are synchronously recorded in the anomaly log. During data normalization, to eliminate differences in units and numerical ranges among different monitoring indicators, a min-max algorithm is used to normalize all indicators to the [0, 1] interval, as shown in the formula: ; in, The original value, For the corresponding normalized value, , These are the minimum and maximum values within the sliding window of the indicator, respectively.
[0024] In this embodiment, during feature extraction, the mean, peak value, valley value, and variance within a 1-minute sliding window can be extracted to characterize short-term statistical properties and obtain time-domain features. The time-domain signal is then converted to the frequency domain using a fast Fourier transform (FFT) to extract the main frequency components, capture periodic patterns, and obtain frequency-domain features. Finally, the time-domain and frequency-domain features are concatenated to form a high-dimensional input vector as the target load feature.
[0025] Step S12: Determine the attention score corresponding to each of the target load features based on the target weight decay mechanism, and fine-tune the pre-acquired target load prediction model through reinforcement learning based on each of the target load features and the corresponding attention score.
[0026] In this embodiment, as Figure 2 As shown, before determining the attention score corresponding to each target load feature based on the target weight decay mechanism, the method further includes: determining whether the current target load state of the target node is the same as the previous target load state based on the volatility feature in the target load features; if the current target load state of the target node is different from the previous target load state, then adjusting the target adaptive window based on the volatility feature corresponding to the current target load state to determine the adjusted target adaptive window, and then jumping to the step of using the acquisition agent corresponding to each target node of the target container cluster to obtain the original load information of each target node based on the target adaptive window. In other words, this embodiment does not use a fixed time window for analysis when performing load prediction, but introduces an intelligent adaptive window adjustment mechanism to cope with the load analysis needs under different load states.
[0027] In this embodiment, the target adaptive window is adjusted based on the volatility characteristics corresponding to the current target load state to determine the adjusted target adaptive window. Specifically, this may include: if the volatility characteristics corresponding to the current target load state of the target node are greater than or equal to a preset volatility threshold, the load curve in the target load characteristics is matched with the load mutation patterns in a pre-built load mutation pattern library to determine the target load mutation pattern based on a preset matching threshold, and the target adaptive window is adjusted based on the target window parameters corresponding to the target load mutation pattern to determine the adjusted target adaptive window; if the volatility characteristics corresponding to the current target load state of the target node are less than the preset volatility threshold, the target adaptive window is adjusted based on the target window parameters corresponding to the load stability period to determine the adjusted target adaptive window; wherein, the load mutation patterns include pulsed load mutations, stepped load mutations, and periodic load mutations. It should be noted that, in the mutation response state, if no existing mutation pattern is matched within a certain period of time, a new pattern recognition process is initiated, the current load curve is used as a new mutation pattern sample for analysis and learning, and the mutation pattern library is updated.
[0028] In one specific implementation, volatility can be set as the ratio of the standard deviation to the mean over a continuous 10-minute period. If the volatility of the target node's load is less than 5% (i.e., a preset volatility threshold), the target node's current load status can be determined to be in a stable period. In this state, the strategy for setting the target window parameters focuses on long-term trend learning. Therefore, a large time window of up to 48 hours (containing 46,080 data points) can be used as the target adaptive window for load analysis, with the sampling frequency remaining at the default once every 3 seconds. If the volatility of the target node's load is greater than or equal to 5%, it can be determined that the current period is a load mutation period, entering a mutation response state. At this time, the DTW algorithm can be activated to perform real-time similarity matching between the target node's recent load curve and the load mutation patterns in a mutation pattern library pre-built through historical data analysis. The pattern library contains various typical mutation templates such as "pulse mutations," "step mutations," and "periodic mutations." If the current load curve matches the DTW (Dynamic Time Warping) of a certain template with a similarity of 80% or more (i.e., a preset matching threshold), a successful match is determined. The successfully matched load mutation pattern is identified as the target load mutation pattern for that target node at that time, and the preset target window parameters (including optimal window length and sampling frequency parameters) corresponding to the target load mutation pattern are immediately invoked to adjust the target adaptive window. For example, if a "pulse mutation" is matched, a shorter and denser sampling window is automatically switched, thereby achieving precise and dynamic switching of the analysis strategy and ensuring that details are captured without excessive resource consumption during the load mutation period. This embodiment combines dynamic adjustment of window length and sampling frequency based on load volatility with DTW pattern matching, realizing the synergistic innovation of adaptive window and hybrid preprocessing mechanism, thereby achieving differentiated processing between the load stabilization period and the mutation period.
[0029] In one specific implementation, the construction of the load mutation pattern library may include: classifying historical mutation data using the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) clustering algorithm, with clustering features including load change rate, duration, and peak intensity, and setting a distance threshold. Minimum number of core points This process generates three pattern libraries: pulse-based, ladder-based, and periodic mutation pattern libraries, along with preset target window parameters associated with each load mutation pattern. Parallel computing techniques are employed during clustering to improve efficiency and rapidly generate accurate mutation pattern libraries. A specific example is shown below:
[0030] (1) Pulse-type mutation pattern library: Characteristic features: extremely high load change rate (greater than 5% / s), short duration (<10 minutes), moderate peak intensity (1.5-3 times the average load), and a "peak-shaped" curve (such as sudden flow surges). Clustering logic: DBSCAN clusters such samples into a cluster, with the feature vectors of the core points concentrated in the normalized interval (rate of change: 0.8 to 1.0, duration: 0.1 to 0.3, intensity: 0.4 to 0.6). The associated window parameter is "6-hour window + 1 sample / second".
[0031] (2) Ladder-style mutation pattern library: Characteristics: moderate load change rate (between 1% and 5% / s), long duration (between 30 and 120 minutes), high peak intensity (3 to 5 times the average load), rising in a "step-like" manner and then remaining in a steady state (such as the load jump after service expansion). Clustering logic: The feature vectors of the core clusters are concentrated in (rate of change: 0.3 to 0.7, duration: 0.5 to 0.8, intensity: 0.7 to 0.9), and the average distance from the pulse clusters is greater than 0.3 (significantly distinguishable). The associated window parameter is "24-hour window + 2 samples / second".
[0032] (3) Periodic mutation pattern library: Characteristic features: load change rate (less than 1% / s), periodic repetition of duration (such as occurring at fixed times every day / week), stable peak intensity (1.2 to 2 times the average load), exhibiting a "sine wave" cyclical fluctuation (such as traffic peaks during commuting hours). Clustering logic: Based on the periodic features extracted by Fourier transform, DBSCAN clusters samples with a periodic similarity greater than 0.8 into a cluster, with the core feature vectors concentrated in (rate of change: 0.1 to 0.2, duration: 0.2 to 0.4, intensity: 0.3 to 0.5). The associated window parameter is "7-day window + 3 seconds / sample".
[0033] In this embodiment, determining the attention score corresponding to each target load feature based on the target weight decay mechanism specifically includes: determining the attention weight corresponding to each target load feature based on the target weight decay mechanism; determining the dependency relationship between each target load feature using the target correlation matrix; the target correlation matrix is a global correlation matrix determined based on mutual information; and determining the attention score corresponding to each target load feature based on the dependency relationship and the attention weight corresponding to each target load feature. In a specific implementation, the target weight decay mechanism assigns an autonomously learnable importance weight to each target load feature. As a corresponding attention weight, this weight is not fixed but is continuously updated as the target load prediction model learns. To avoid the target load prediction model developing a long-term dependence on certain short-term active features, this embodiment introduces an exponential time decay coefficient. ( A trainable parameter between 0.01 and 0.1, used to control the decay rate; For load characteristics, continuous high weight ( (The number of prediction periods) Once the attention weight corresponding to a certain load feature is judged as a high weight for 3 consecutive prediction periods, its corresponding decay mechanism... Activate, make Exponential decay is used to avoid over-dependence. Furthermore, to model the non-linear dependencies between features, this embodiment introduces a global correlation matrix based on mutual information. ( For load characteristics The mutual information (the larger the value, the more information the features jointly provide). In other words, the attention score of each load feature is not determined independently by its attention weight, but rather by the weighted sum of its own attention weight and the attention weights of its related load features. Specifically, the calculation of the... Attention score for each load feature The formula is as follows: ; Through the above methods, this embodiment proposes a feature weight adjustment mechanism with a time decay coefficient, and introduces a mutual information matrix to construct an attention score calculation model, thereby realizing the fusion design of dynamic feature weight decay and attention mechanism. It can be understood that the time decay factor can be adjusted in real time according to the changing trend of the model prediction error through an online adaptive algorithm to achieve a better decay effect.
[0034] In this embodiment, based on the target load features and corresponding attention scores, the pre-acquired target load prediction model is fine-tuned through reinforcement learning, including: determining the target load characteristics of the target container cluster based on all target load features and corresponding attention scores; and fine-tuning the target weight parameters of the pre-acquired target load prediction model based on the target load characteristics using the pre-acquired first dataset and the first action space of reinforcement learning. The first dataset is a dataset constructed based on the historical load time-series data of the target container cluster, and includes a first training set and a first validation set. The target weight parameters include the load prediction weights of the long short-term memory network of the target load prediction model and the load prediction weights corresponding to the attention scores.
[0035] In one specific implementation, such as Figure 2As shown, reinforcement learning correction incorporating transfer learning introduces a cross-scenario pre-trained model as the target load prediction model (trained based on 10 types of heterogeneous cluster data, covering different business scenarios such as e-commerce, finance, and government affairs). The underlying feature layers of this target load prediction model are frozen, while retaining the cross-scenario general feature extraction capabilities already learned in the target load prediction model. The target load characteristics of the target container cluster are determined based on all target load features and corresponding attention scores. Using the pre-acquired first dataset and the first action space of reinforcement learning (i.e., online fine-tuning action space), the target weight parameters of the pre-acquired target load prediction model are fine-tuned based on the target load characteristics. During fine-tuning, the top three fully connected layers of the target load prediction model are fine-tuned according to the load characteristics of the target container cluster, and only the weight parameters of the top fully connected layers are updated. The fine-tuning process can be based on the first training set in the first dataset using mini-batch gradient descent (Batch Size=32), with an initial learning rate set to 0.001. The loss of the first validation set in the first dataset is dynamically adjusted to determine whether fine-tuning is complete. For example, when the loss does not decrease for five consecutive rounds and the learning rate decays to 1 / 10 of its current value, the fine-tuning of the target load prediction model can be considered complete. It should be noted that regularization techniques can be introduced during the fine-tuning process to prevent overfitting and improve the generalization ability of the target load prediction model.
[0036] In this embodiment, the framework of reinforcement learning (RL agent) is as follows: State space S: current prediction error rate (MAE, Mean Absolute Error), load trend (rising / falling / stable), recent fine-tuning gains, and time since the last offline training; Online fine-tuning of action space A: The RL Agent performs lightweight real-time actions, including fine-tuning the output weights of the LSTM (Long Short-Term Memory) network (learning rate 0.001) and adjusting attention weights. 10%), to compensate for model output bias; Offline suggestion action space A: The RL Agent can send a trigger signal to request the background system to perform asynchronous retraining or update the pattern library. Reward signal R: Error correction The immediate reduction in error resulting from fine-tuning actions ( The core reward is _____, with minor penalties for triggering high-cost offline tasks.
[0037] like Figure 4As shown, in this embodiment, a model update request can also be obtained. Then, based on the model update request, a second dataset is constructed using historical load time-series data of the target container cluster. The second dataset includes a second training set and a second validation set. Finally, the target load prediction model is updated using the second dataset to obtain the updated target load prediction model, which is then used to predict the load of the target container cluster. Based on this model update method, this embodiment sets up an independently operating asynchronous offline model management system decoupled from the online RL Agent. The asynchronous offline model management system listens for model update requests issued by the RL Agent and uses data from the past three days in a dedicated resource pool to perform offline retraining of the load prediction model or update the load mutation pattern library. After training is completed and validation is passed, the new target load prediction model is hot-loaded into the online system, and the RL Agent is notified, completing the closed loop. During offline retraining, an incremental learning algorithm can be used to quickly integrate new data for training while retaining historical training results, reducing training time. Through the above steps, this embodiment constructs a pulsed, stepped, and periodic mutation pattern library based on DBSCAN clustering, integrates transfer learning and reinforcement learning, and designs a state space, action space, and reward signal. While forming a closed loop of "pre-training-fine-tuning-real-time correction," it also achieves a closed-loop innovation of load mutation pattern library and reinforcement learning correction. It can be understood that in this embodiment, the data in the first and second datasets originate from the historical load time-series data of the target container cluster. Independent subsets are randomly sampled from the historical load time-series data of the target container cluster to serve as the training and validation sets.
[0038] Step S13: Using the fine-tuned target load prediction model, perform load prediction on the corresponding target node based on the target load characteristics and the corresponding attention score to obtain the corresponding load prediction results.
[0039] In this embodiment, as Figure 3 As shown, the fine-tuned target load prediction model is used to predict the load of the corresponding target nodes based on the target load characteristics and the corresponding attention scores to obtain the corresponding load prediction results. Specifically, it can include: using each target sub-model of the fine-tuned target load prediction model to predict the load of the corresponding target nodes based on the target load characteristics and the corresponding attention scores to obtain each initial load prediction result; using a preset confidence calibration mechanism, adjusting the fusion weights corresponding to each target sub-model based on the volatility characteristics corresponding to the current target load state of the target node; and fusing each initial load prediction result based on the adjusted fusion weights to obtain the load prediction result corresponding to the target node.
[0040] In one specific implementation, an improved LSTM is used as the master model among all target sub-models, while GRU (Gate Recurrent Unit) (for short-term dependencies) and XGBoost (for nonlinearities) are used as auxiliary models. The weighted average of the prediction accuracies from nearly 100 trials (with a time decay factor of 0.9) is used as the confidence score for each target sub-model. The dynamic weight is ,in The confidence scores of each target sub-model participating in the integration under the current load scenario are used to determine the final prediction result. , The initial load prediction results for each target sub-model are shown. LSTM+GRU is used during stable periods (volatility less than 5%), LSTM+GRU+XGBoost during volatile periods (volatility between 5% and 15%), and XGBoost+LSTM during periods of rapid change (volatility greater than 15%). It is understood that the time decay factor can be adjusted in real-time using an online adaptive algorithm based on the changing trend of the model prediction error to achieve a better decay effect. When calculating the confidence score, in addition to considering prediction accuracy, the model's stability index under different load scenarios is also included, making the weight allocation more reasonable. This embodiment innovatively adopts an integrated framework of "main model (improved LSTM) + auxiliary model (GRU / XGBoost)," dynamically switching model combinations based on load volatility to realize a multi-model dynamic integration strategy with confidence calibration.
[0041] As can be seen, this application achieves multi-dimensional optimization of container cluster load management, bringing significant benefits: In terms of prediction accuracy, the adaptive window mechanism dynamically adjusts the analysis granularity according to the load state, and combined with scenario-specific hybrid interpolation and outlier filtering, it provides high-quality input to the model; feature weight decay and correlation modeling enhance the dynamic capture capability of key features, while the multi-model ensemble strategy with confidence calibration can maintain stable prediction performance under different load scenarios, significantly reducing the overall prediction error (MAE), especially during periods of rapid change, the prediction accuracy is improved more significantly. In terms of resource efficiency, a large window is used during stable periods to reduce computational consumption, and pattern matching is used to accurately adjust the sampling frequency during periods of rapid change to avoid unnecessary resource consumption; the reinforcement learning framework that integrates transfer learning combines lightweight online fine-tuning with asynchronous offline retraining, which reduces real-time computation costs while ensuring the correction effect, achieving a balance between prediction accuracy and resource consumption.
[0042] Based on the above embodiments, this application discloses a load prediction method for container clusters. The load prediction process for a specific container cluster will be described below.
[0043] A custom Exporter is deployed on each node of the Kubernetes cluster to monitor five metrics, including CPU and memory, and generate raw time-series data streams with timestamps, which are then pushed to InfluxDB via an HTTP interface. Missing data within 10 seconds (≤3 sampling points) is filled with linear interpolation, and long missing data is fitted with spline functions. Feature extraction is performed using relevant Python libraries.
[0044] When an e-commerce flash sale scenario is detected (load surges from 20% to 90% within 5 minutes), the DTW algorithm calculates a 92% match with the "pulse mutation" template, triggering a window adjustment: 6 hours in length, 1 sampling frequency per second, and 7200 data points.
[0045] The reinforcement learning correction process is as follows: Current MAE = 0.05, load trend = increasing, recent fine-tuning gain = +0.02, last retraining = 48 hours. The agent determines that the current error has room for optimization and that recent fine-tuning is effective, so it decides to take the action: adjust the ensemble weights. Specifically, the XGBoost weights are increased by 5% from 0.352 to 0.37, and the weights of LSTM and GRU are correspondingly decreased. After this action, the MAE for the next prediction period decreases from 0.05 to 0.047. The reward is calculated as: R = ΔMAE = 0.05 - 0.047 = +0.003 (positive reward).
[0046] If the RL Agent triggers three consecutive weight adjustment actions, but the MAE continues to slowly increase (0.047 -> 0.049 -> 0.052), and the status shows 72 hours since the last retraining, the Agent decides to issue a heavy weight suggestion action. It extracts the most recent three days of regularized data from the data warehouse. On the training cluster, it starts a distributed training task. It freezes the bottom LSTM / GRU layers of the pre-trained model, updating the parameters of the top three fully connected layers only with a batch size of 32 and a learning rate of 0.001.
[0047] The new model file is deployed to the online prediction service via the CI / CD pipeline, completing hot loading. A notification is then sent to the RL Agent. Upon receiving the notification, the RL Agent resets its state since the last retraining to 0, clears the experience replay buffer, and begins to re-explore the optimal strategy under the new model.
[0048] As can be seen, this application utilizes a target adaptive window to obtain the load information of each target node in the target container cluster, achieving dynamic adjustment of the analysis granularity of load information. Furthermore, by preprocessing the original load information, corresponding target load features are extracted, providing high-quality input for the target load prediction model. Simultaneously, attention scores for target load features are determined based on a target weight decay mechanism, and through reinforcement learning, the target load prediction model is fine-tuned based on each target load feature and its corresponding attention score. This enhances the target load prediction model's ability to dynamically capture key features, making the load prediction results output by the fine-tuned model more closely match the load characteristics of the target container cluster. This allows for dynamic adaptation to load changes, optimization of feature weights, and real-time fine-tuning of the target load prediction model, improving the resource scheduling efficiency and service stability of the container cluster.
[0049] See Figure 5 As shown, this application discloses a load prediction device for a container cluster, comprising: The load feature acquisition module 11 is used to acquire the original load information of each target node based on the target adaptive window using the acquisition agent corresponding to each target node of the target container cluster, and to preprocess the original load information to obtain the corresponding target load features; the original load information includes the CPU utilization, memory usage, network bandwidth utilization, request processing volume and disk input / output read / write rate of the target node. The model fine-tuning module 12 is used to determine the attention score corresponding to each of the target load features based on the target weight decay mechanism, and to fine-tune the pre-acquired target load prediction model through reinforcement learning based on each of the target load features and the corresponding attention score. The load prediction module 13 is used to perform load prediction on the corresponding target node based on the target load characteristics and the corresponding attention score using the fine-tuned target load prediction model, so as to obtain the corresponding load prediction result.
[0050] As can be seen, this application utilizes a target adaptive window to obtain the load information of each target node in the target container cluster, achieving dynamic adjustment of the analysis granularity of load information. Furthermore, by preprocessing the original load information, corresponding target load features are extracted, providing high-quality input for the target load prediction model. Simultaneously, attention scores for target load features are determined based on a target weight decay mechanism, and through reinforcement learning, the target load prediction model is fine-tuned based on each target load feature and its corresponding attention score. This enhances the target load prediction model's ability to dynamically capture key features, making the load prediction results output by the fine-tuned model more closely match the load characteristics of the target container cluster. This allows for dynamic adaptation to load changes, optimization of feature weights, and real-time fine-tuning of the target load prediction model, improving the resource scheduling efficiency and service stability of the container cluster.
[0051] In one specific embodiment, the device may further include: The load status determination module is used to determine whether the current target load status of the target node is the same as the previous target load status based on the volatility characteristics in the target load characteristics. The window adjustment module is used to adjust the target adaptive window based on the volatility characteristics corresponding to the current target load state if the current target load state of the target node is different from the previous target load state, to determine the adjusted target adaptive window, and then jump to the step of obtaining the original load information of each target node based on the target adaptive window using the acquisition agent corresponding to each target node of the target container cluster.
[0052] In one specific implementation, the window adjustment module may include: The first window adjustment unit is used to perform similarity matching between the load curve in the target load feature and the load mutation pattern in the pre-built load mutation pattern library if the volatility feature corresponding to the current target load state of the target node is greater than or equal to a preset volatility threshold, so as to determine the target load mutation pattern based on the preset matching threshold, and adjust the target adaptive window based on the target window parameters corresponding to the target load mutation pattern to determine the adjusted target adaptive window. The second window adjustment unit is used to adjust the target adaptive window based on the target window parameters corresponding to the load stabilization period if the volatility characteristic corresponding to the current target load state of the target node is less than the preset volatility threshold, so as to determine the adjusted target adaptive window. The load mutation modes include pulsed load mutation, stepped load mutation, and periodic load mutation.
[0053] In one specific embodiment, the load prediction module 13 may include: The first load prediction unit is used to use each target sub-model of the fine-tuned target load prediction model to perform load prediction on the corresponding target node based on the target load characteristics and the corresponding attention score, so as to obtain each initial load prediction result. The fusion weight adjustment unit is used to adjust the fusion weights corresponding to each target sub-model based on the volatility characteristics corresponding to the current target load state of the target node using a preset confidence calibration mechanism.
[0054] The second load prediction unit is used to fuse the initial load prediction results based on the adjusted fusion weights to obtain the load prediction result corresponding to the target node.
[0055] In one specific embodiment, the model fine-tuning module 12 may include: An attention weight determination unit is used to determine the attention weights corresponding to each of the target load features based on a target weight decay mechanism. A dependency determination unit is used to determine the dependency relationships between the target load features using a target correlation matrix; the target correlation matrix is a global correlation matrix determined based on mutual information. The attention score determination unit is used to determine the attention score corresponding to each target load feature based on the dependency relationship and the attention weight corresponding to each target load feature.
[0056] In one specific embodiment, the model fine-tuning module 12 may include: A load characteristic determination unit is used to determine the target load characteristics of the target container cluster based on all the target load characteristics and the corresponding attention scores; The model parameter fine-tuning unit is used to fine-tune the target weight parameters of the pre-acquired target load prediction model based on the target load characteristics using the pre-acquired first dataset and the first action space of reinforcement learning. The first dataset is a dataset constructed based on the historical load time-series data of the target container cluster, and the first dataset includes a first training set and a first validation set; the target weight parameters include the load prediction weights of the long short-term memory network of the target load prediction model and the load prediction weights corresponding to the attention scores.
[0057] In one specific embodiment, the device may further include: The update request retrieval module is used to retrieve model update requests; A dataset construction module is used to construct a second dataset based on the model update request using historical load time-series data of the target container cluster; the second dataset includes a second training set and a second validation set. The model update module is used to update the target load prediction model using the second dataset to obtain the updated target load prediction model, so as to use the new target load prediction model to predict the load of the target container cluster.
[0058] Furthermore, embodiments of this application also disclose an electronic device, Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0059] Figure 6 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the container cluster load prediction method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be a computer.
[0060] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0061] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0062] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the load prediction method for a container cluster executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0063] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned load prediction method for container clusters. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0064] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0065] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0066] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0067] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0068] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A load prediction method for container clusters, characterized in that, include: The raw load information of each target node in the target container cluster is obtained by the acquisition agent corresponding to each target node based on the target adaptive window, and the raw load information is preprocessed to obtain the corresponding target load characteristics; the raw load information includes the CPU utilization, memory usage, network bandwidth utilization, request processing volume and disk input / output read / write rate of the target node. The attention score corresponding to each target load feature is determined based on the target weight decay mechanism, and the pre-acquired target load prediction model is fine-tuned through reinforcement learning based on each target load feature and the corresponding attention score. The fine-tuned target load prediction model is used to predict the load of the target node based on the target load characteristics and the corresponding attention score, so as to obtain the corresponding load prediction results.
2. The load prediction method for container clusters according to claim 1, characterized in that, Before determining the attention score corresponding to each of the target load features based on the target weight decay mechanism, the method further includes: Based on the volatility characteristics in the target load characteristics, determine whether the current target load state of the target node is the same as the previous target load state; If the current target load state of the target node is different from the previous target load state, the target adaptive window is adjusted based on the volatility characteristics corresponding to the current target load state to determine the adjusted target adaptive window, and then the process jumps to the step of using the acquisition agent corresponding to each target node of the target container cluster to obtain the original load information of each target node based on the target adaptive window.
3. The load prediction method for container clusters according to claim 2, characterized in that, The step of adjusting the target adaptive window based on the volatility characteristics corresponding to the current target load state to determine the adjusted target adaptive window includes: If the volatility feature corresponding to the current target load state of the target node is greater than or equal to a preset volatility threshold, then the load curve in the target load feature is matched with the load mutation pattern in the pre-built load mutation pattern library to determine the target load mutation pattern based on the preset matching threshold, and the target adaptive window is adjusted based on the target window parameters corresponding to the target load mutation pattern to determine the adjusted target adaptive window. If the volatility characteristic corresponding to the current target load state of the target node is less than the preset volatility threshold, the target adaptive window is adjusted based on the target window parameter corresponding to the load stabilization period to determine the adjusted target adaptive window. The load mutation modes include pulsed load mutation, stepped load mutation, and periodic load mutation.
4. The load prediction method for container clusters according to claim 3, characterized in that, The step of using the fine-tuned target load prediction model to predict the load of the corresponding target nodes based on the target load characteristics and the corresponding attention scores, to obtain the corresponding load prediction results, includes: Using the fine-tuned target load prediction model, load prediction is performed on the corresponding target nodes based on the target load features and the corresponding attention scores to obtain initial load prediction results. Using a preset confidence calibration mechanism, the fusion weights corresponding to each target sub-model are adjusted based on the volatility characteristics corresponding to the current target load state of the target node; The initial load prediction results are fused based on the adjusted fusion weights to obtain the load prediction result corresponding to the target node.
5. The load prediction method for container clusters according to claim 1, characterized in that, The determination of the attention score corresponding to each target load feature based on the target weight decay mechanism includes: The attention weights corresponding to each of the target load features are determined based on the target weight decay mechanism. The dependencies between the target load features are determined using a target correlation matrix; the target correlation matrix is a global correlation matrix determined based on mutual information. The attention score for each target load feature is determined based on the dependencies and the attention weights corresponding to each target load feature.
6. The load prediction method for container clusters according to claim 1, characterized in that, The step of fine-tuning the pre-acquired target load prediction model through reinforcement learning based on the target load features and the corresponding attention scores includes: The target load characteristics of the target container cluster are determined based on all the target load characteristics and the corresponding attention scores. Using the first dataset acquired in advance and the first action space of reinforcement learning, the target weight parameters of the pre-acquired target load prediction model are fine-tuned based on the target load characteristics; The first dataset is a dataset constructed based on the historical load time-series data of the target container cluster, and the first dataset includes a first training set and a first validation set; the target weight parameters include the load prediction weights of the long short-term memory network of the target load prediction model and the load prediction weights corresponding to the attention scores.
7. The load prediction method for container clusters according to any one of claims 1 to 6, characterized in that, Also includes: Get the model update request; Based on the model update request, a second dataset is constructed using the historical load time-series data of the target container cluster; The second dataset includes a second training set and a second validation set; The target load prediction model is updated using the second dataset to obtain the updated target load prediction model, so as to use the new target load prediction model to predict the load of the target container cluster.
8. A load prediction device for a container cluster, characterized in that, include: The load feature acquisition module is used to acquire the original load information of each target node based on the target adaptive window using the acquisition agent corresponding to each target node of the target container cluster, and to preprocess the original load information to obtain the corresponding target load features; the original load information includes the CPU utilization, memory usage, network bandwidth utilization, request processing volume and disk input / output read / write rate of the target node. The model fine-tuning module is used to determine the attention score corresponding to each of the target load features based on the target weight decay mechanism, and to fine-tune the pre-acquired target load prediction model through reinforcement learning based on each of the target load features and the corresponding attention score. The load prediction module is used to perform load prediction on the corresponding target node based on the target load characteristics and the corresponding attention score using the fine-tuned target load prediction model, so as to obtain the corresponding load prediction result.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the load prediction method for container clusters as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the load prediction method for container clusters as described in any one of claims 1 to 7.
Citation Information
Patent Citations
DWT-LSTM power load prediction method based on attention mechanism
CN114219139A
Robot cable fault classification method and system based on deep tree learning
CN120217126A
Soft switch resource flexible scheduling method and device of cloud native architecture, equipment and medium
CN120750878A
Cloud platform capacity expansion and contraction method, device, equipment and medium
CN120896855A
Distributed computing power scheduling method and system
CN121008911A