AI-driven container resource configuration method, system, and medium

Through AI-driven container resource configuration methods, prediction tools and decision models are used to predict the optimal Pod configuration, which solves the delay and resource waste problems of traditional HPA mechanisms and realizes efficient, stable and adaptive management of container resources.

CN120448135BActive Publication Date: 2025-09-23SHANGHAI SHUHE INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510934918.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-08
Publication Date
2025-09-23
Estimated Expiration
2045-07-08

AI Technical Summary

Technical Problem

The traditional HPA mechanism suffers from expansion response delays, low resource utilization, reliance on a single indicator for judgment, and lack of adaptability in container resource configuration, leading to system instability and resource waste in high-concurrency scenarios.

Method used

An AI-driven container resource configuration method is used to collect key performance indicators, use prediction tools and decision models to predict the optimal Pod configuration, and combine self-healing model training to dynamically adjust resource configuration, avoid manually setting thresholds, and achieve proactive scheduling and self-adaptation.

Benefits of technology

It improves the utilization efficiency of container resources, ensures system stability and robustness, reduces manual maintenance costs, and can effectively respond to changes in resource requirements in complex scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448135B_ABST
    Figure CN120448135B_ABST
Patent Text Reader

Abstract

The present application provides an AI-driven container resource configuration method, system and medium, the method comprising: collecting key performance indicators generated during the real-time operation of a target system, preprocessing the key performance indicators to generate standardized data; inputting the standardized data into a prediction tool, and sequentially generating multiple indicator prediction values ​​after predicting them in accordance with the prediction interval time within a prediction period; after inputting the multiple indicator prediction values ​​into a decision model, calculating the optimal Pod configuration within the prediction period; and configuring resources for the target system according to the optimal Pod configuration according to the scheduled scheduling period and the predicted configuration time corresponding to the optimal Pod configuration; the present application effectively improves the stability and resource utilization efficiency of the target system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology and relates to a computing resource configuration method, and in particular to an AI-driven container resource configuration method, system, and medium. Background Art

[0002] With the increasing popularity of cloud-native infrastructure, most enterprise businesses are running on containerized computing environments, such as Kubernetes (K8s). To manage business traffic fluctuations and ensure system stability, the Horizontal Pod Autoscaler (HPA) is often used in these environments. This mechanism sets thresholds based on metrics such as CPU and memory utilization. When actual usage exceeds the threshold, the HPA automatically triggers capacity expansion, and vice versa.

[0003] However, traditional HPA mechanisms are inherently reactive and have the following limitations: 1. Scaling response is delayed: From reaching the threshold, initiating the scaling process, and then fully provisioning the new pod, it often takes 30 seconds to 5 minutes. In high-concurrency scenarios such as financial transactions, this can easily lead to request backlogs, service jitter, and even avalanches. Low resource utilization: Due to the lag inherent in HPA scaling, redundant resources are typically reserved to ensure service stability under bursts. This results in low resource utilization during peak service periods. Furthermore, traditional HPA relies solely on a single metric (such as CPU) to determine scaling, making it incapable of identifying resource bottlenecks in complex scenarios and lacking adaptive capabilities, requiring manual parameter tuning. Furthermore, HPA or scheduled scaling solutions rely on manually configured fixed thresholds or time points, failing to automatically learn and adjust to business changes. This results in high maintenance costs and a lack of self-learning capabilities. Summary of the Invention

[0004] The purpose of this application is to provide an AI-driven container resource configuration method, system and medium to solve the problem of low efficiency of container resource utilization in the prior art.

[0005] In a first aspect, the present application provides an AI-driven container resource configuration method, comprising the following steps:

[0006] Collecting key performance indicators generated during the real-time operation of the target system, and preprocessing the key performance indicators to generate standardized data;

[0007] Inputting the standardized data into a forecasting tool, and sequentially generating a plurality of indicator forecast values ​​after forecasting in sequence according to the forecast interval time within the forecast period;

[0008] After inputting the predicted values ​​of the multiple indicators into the decision model, the optimal Pod configuration is calculated accordingly within the prediction period;

[0009] According to the scheduled scheduling period and the predicted configuration time corresponding to the optimal Pod configuration, resources of the target system are configured according to the optimal Pod configuration.

[0010] In an implementation of the first aspect, after inputting the plurality of predicted indicator values ​​into the decision model, calculating the optimal Pod configuration within the prediction period includes:

[0011] Selecting a historical data window according to a first preset time, and selecting a reference indicator in the historical data window;

[0012] Determining a prediction period according to a second preset time, and determining the number of predictions within the prediction period according to the prediction interval time;

[0013] Generate Pod configuration prediction values ​​at different times within the prediction period in sequence according to the prediction interval based on the reference indicator and the indicator prediction value, and store the plurality of Pod configuration prediction values ​​in a storage queue, where the number of the Pod configuration prediction values ​​is the same as the number of predictions;

[0014] The largest predicted value of the Pod configuration is selected in the storage queue as the optimal Pod configuration.

[0015] In an implementation of the first aspect, the reference indicator includes a historical Pod usage peak value and a historical indicator usage peak value within a first preset time period, and generating, based on the reference indicator and the indicator prediction value, Pod configuration prediction values ​​at different times within the prediction period in sequence according to the prediction interval, includes:

[0016] Calculating a first prediction value based on the reference indicator and the indicator prediction value, and determining whether the current indicator prediction value is less than the historical indicator usage peak value;

[0017] When it is determined that the current predicted value of the indicator is greater than the historical indicator usage peak value, the first predicted value is used as the current predicted value of the Pod configuration;

[0018] When it is determined that the current predicted value of the indicator is less than or equal to the historical peak usage value of the indicator, a second predicted value is calculated based on the safety factor and the first predicted value, and the current predicted value of the Pod configuration is determined based on the second predicted value and the historical peak usage value of the Pod;

[0019] The above process is repeated for the indicator prediction values ​​and the reference indicator at other times within the prediction period to obtain multiple Pod configuration prediction values ​​within the prediction period.

[0020] In an implementation of the first aspect, the calculation process of the first prediction value satisfies the following formula:

[0021] ;

[0022] in, represents the first predicted value, M represents the indicator predicted value, N represents the historical Pod usage peak value, and S represents the historical indicator usage peak value.

[0023] In an implementation of the first aspect, determining the current Pod configuration prediction value based on the second prediction value and the historical Pod usage peak value includes:

[0024] Determine the difference between the second predicted value and the historical Pod usage peak value;

[0025] After determining that the second predicted value is less than or equal to the historical Pod usage peak value, use the second predicted value as the current Pod configuration predicted value;

[0026] After determining that the second predicted value is greater than the historical Pod usage peak value, the historical Pod usage peak value is used as the Pod configuration predicted value.

[0027] In an implementation of the first aspect, the method further includes:

[0028] After the target system runs to the predicted configuration time, sequentially obtaining the indicator operation data of the target system according to the predicted interval time, and calculating a first error value between the indicator prediction value and the indicator operation data;

[0029] After determining that M consecutive first error values ​​exceed a first preset error threshold within the prediction configuration time, performing self-healing model training on the prediction tool to fine-tune parameters and update the structure of the trained prediction tool; and / or

[0030] After the target system runs to the predicted configuration time, sequentially obtaining Pod operation data of the target system according to the predicted interval time, and calculating a second error value between the optimal Pod configuration and the Pod operation data;

[0031] After determining that the second error value exceeds a second preset error threshold for N consecutive times within the prediction configuration time, performing self-healing model training on the decision model to fine-tune parameters and update the structure of the trained decision model;

[0032] Wherein, M and N are both integers greater than 2.

[0033] In an implementation of the first aspect, the self-healing model training process includes:

[0034] Freezing parameters of an old version model and creating a fine-tuned copy of the old version model, where the old version model is the prediction tool or the decision model;

[0035] Loading the target system's operating data within a third preset time to perform incremental training on the model fine-tuning copy to generate a new version model;

[0036] Performing A / B testing on the new version model, obtaining the latest data of the target system to test the new version model, and calculating the improvement rate of the mean square error (MAE) of the new version model, where the improvement rate is the ratio of the negative of the difference between the mean square error of the new version model and the mean square error of the old version model to the mean square error of the old version model;

[0037] If the improvement rate is greater than or equal to the improvement threshold, the new version model replaces the old version model; otherwise, the new version model is discarded and the old version model is retained.

[0038] In an implementation of the first aspect, the method further includes:

[0039] After resources are configured for the target system according to the optimal Pod configuration, the HPA mechanism is started to perform resource configuration in real time during the operation of the target system.

[0040] In a second aspect, the present invention further provides an AI-driven container resource configuration system, the system comprising:

[0041] A data acquisition module is used to collect key performance indicators generated during the real-time operation of the target system and pre-process the key performance indicators to generate standardized data;

[0042] A prediction engine module is used to input the standardized data into a prediction tool, and generate a plurality of indicator prediction values ​​in sequence after sequentially predicting according to the prediction interval time within the prediction period;

[0043] A decision engine module, configured to input the plurality of predicted indicator values ​​into a decision model and calculate the optimal Pod configuration within the prediction period;

[0044] The resource scheduling module is used to configure resources for the target system according to the optimal Pod configuration according to the scheduled scheduling period and the predicted configuration time corresponding to the optimal Pod configuration.

[0045] In a third aspect, the present invention further discloses a computer-readable storage medium storing a computer program, which, when executed, implements the above-mentioned AI-driven container resource configuration method.

[0046] As described above, the AI-driven container resource configuration method, system, and medium described in this application have the following beneficial effects:

[0047] This application solution uses a prediction tool to predict the indicator prediction values ​​of the target system in advance, and cooperates with the decision model to determine the final optimal Pod configuration of the target system. It not only breaks through the traditional HPA passive trigger mechanism and dynamically adjusts the HPA minimum baseline without directly controlling the application to ensure safety, but also introduces a decision buffer mechanism that can effectively prevent frequent fluctuations and integrates a self-healing model training process to ensure the long-term stability of the entire system prediction. There is no need to manually set thresholds, which saves significant costs, and can effectively improve the stability and robustness of the target system, improve the resource utilization efficiency of the target system, and effectively cope with various complex scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 Shown is a flowchart of the AI-driven container resource configuration method described in an embodiment of the present application.

[0049] Figure 2 Shown is a specific process diagram of step S300 of the AI-driven container resource configuration method described in an embodiment of the present application.

[0050] Figure 3 Shown is a schematic diagram of the Demo verification prediction effect of the AI-driven container resource configuration method described in an embodiment of the present application.

[0051] Figure 4 A comparison chart showing the effects of the AI-driven container resource configuration method described in an embodiment of the present application and the traditional HPA mechanism during business peak periods is shown.

[0052] Figure 5 The figure shows a comparison of the effects of the AI-driven container resource configuration method described in an embodiment of the present application and the traditional HPA mechanism during low-peak business periods.

[0053] Figure 6 Shown is a structural block diagram of the AI-driven container resource configuration system described in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The following describes the embodiments of the present application through specific examples. Those skilled in the art can easily understand the other advantages and effects of the present application from the content disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.

[0055] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application. Therefore, the illustrations only show components related to the present application and are not drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component can be changed at will, and the component layout type may also be more complicated.

[0056] The AI-driven container resource configuration method, system and medium of the present application solution use prediction tools to predict the indicator prediction values ​​of the target system in advance, and cooperate with the decision-making model to determine the final optimal Pod configuration of the target system. It not only breaks through the traditional HPA passive trigger mechanism and dynamically adjusts the HPA minimum baseline without directly controlling the application to ensure safety, but also introduces a decision buffer mechanism that can effectively prevent frequent fluctuations and integrates a self-healing model training process to ensure the long-term stability of the entire system prediction. There is no need to manually set thresholds, which saves significant costs, and can effectively improve the stability and robustness of the target system, improve the resource utilization efficiency of the target system, and effectively cope with various complex scenarios.

[0057] The technical solutions in the embodiments of the present application will be described in detail below with reference to the accompanying drawings in the embodiments of the present application.

[0058] like Figure 1 As shown, this embodiment provides an AI-driven container resource configuration method, including the following steps:

[0059] S100 , collecting key performance indicators generated during the real-time operation of the target system, and preprocessing the key performance indicators to generate standardized data.

[0060] The key performance indicators include at least one of CPU usage, number of requests per second (QPS), and response time.

[0061] In this embodiment, CPU utilization is a resource bottleneck indicator used to determine whether the system is facing computing resource constraints. If CPU utilization consistently approaches a threshold (e.g., 70%, depending on business characteristics), it may indicate that system resources are nearing saturation. CPU utilization is a key factor in scaling decisions, reflecting the system's ability to handle the current load and helping to assess whether pods need to be expanded to alleviate the pressure. Response time is a user experience indicator that directly measures the efficiency of the system in processing requests. Increased response time typically indicates degraded system performance, which may be caused by resource bottlenecks (e.g., CPU saturation) or sudden increases in load (e.g., QPS surges). Analyzing response time fluctuations in conjunction with CPU utilization and QPS can help more accurately identify the source of performance bottlenecks. Queries per second (QPS) is a key metric for measuring system processing capacity. It represents the number of query requests a server or database can respond to per unit time. It is often used to evaluate the performance of databases and network services in high-concurrency scenarios, reflecting the current request pressure on the system and serving as a core indicator for assessing system operational stress. It is often considered a factor in changes in system resource usage (e.g., CPU utilization and response time). In traffic-driven automatic scaling strategies, the predicted future QPS can be used to allocate computing resources in advance, enabling proactive resource scheduling and elastic response.

[0062] When processing the key performance indicators, the specific processing methods include dynamic sampling, outlier cleaning and missing value filling. Dynamic sampling uses a dynamic sampling window to automatically adjust the data sampling window according to the degree of data fluctuation (such as reducing the window to 1 minute during high-load periods); outlier cleaning includes two methods, one is single-indicator outlier detection, which uses a sliding window (default 5 minutes) to identify statistical outliers of a single indicator (such as a 300% CPU surge at a single sampling point) to clean the outliers; the other is cross-indicator correlation verification: combining related indicators (checking whether the CPU utilization changes synchronously when the QPS drops suddenly) to reduce misjudgment during outlier cleaning. Missing value filling combines time periodicity (such as weekday / holiday mode) and neighboring node data to fill missing values. The original data is processed in the above manner.

[0063] S200: Input the standardized data into a prediction tool, and generate a plurality of indicator prediction values ​​in sequence after sequentially predicting according to the prediction interval time within the prediction period.

[0064] In this example, the Chronos time series model is used as the core forecasting tool, leveraging historical load data for modeling and trend analysis. This model possesses adaptive learning capabilities, automatically adjusting its parameters based on the deviation between predicted and true values ​​during actual operation, dynamically optimizing forecast accuracy.

[0065] Among them, since the key performance indicators include at least one of CPU usage, number of requests per second and response time, the indicator prediction value also correspondingly includes CPU usage prediction value, number of requests per second prediction value and response time prediction value.

[0066] Specifically, after data collection and preprocessing to obtain standardized data, the standardized data is input into the Chronos time series model, a prediction tool, to achieve high-precision predictions through a three-stage processing process, including the following three stages:

[0067] Phase 1: Data preprocessing

[0068] The data preprocessing stage includes feature standardization and outlier correction. Feature standardization is to perform Z-score normalization on heterogeneous indicators such as CPU usage, query rate per second (QPS), and response time. Outlier correction is based on the Hampel filter to identify and replace outliers in the standardized data (for example, window size = 6, threshold = 3σ).

[0069] Phase 2: Model training

[0070] After the standardized data is processed in the first stage, the Chronos time series model is based on the Encoder-Decoder architecture. Since a large amount of time series data has been learned during the pre-training process, a large amount of application data (CPU, QPS, etc.) is subsequently provided to further train and verify the Chronos time series model to improve the accuracy of the model.

[0071] Phase 3: Prediction Generation

[0072] By inputting the processed standardized data into the trained Chronos time series model, the Chronos time series model outputs the predicted indicator value.

[0073] For example, taking a prediction period of 30 minutes as an example, the Chronos time series model performs a rolling prediction every 5 minutes. The specific process is as follows:

[0074] Input the latest 48 hours of standardized data (time series length = 576, time granularity = 5 minutes) into the Chronos time series big model. The Chronos time series big model generates forecast values ​​for the next six time steps (corresponding to a 30-minute forecast span). The output formats include CPU forecast value (%), QPS forecast value (times / second), etc., and you can obtain forecast values ​​for multiple indicators.

[0075] It should be noted that in this embodiment, the Chronos time series large model used as a prediction tool has a self-healing optimization mechanism that can dynamically adjust model parameters through closed-loop feedback. Specifically, the following steps are included:

[0076] During the prediction period, each of the predicted values ​​of the indicator is compared with the actual value of the indicator to calculate a first error value;

[0077] After determining that M consecutive first error values ​​exceed a first preset error threshold within the prediction configuration time, performing self-healing model training on the prediction tool to fine-tune parameters and update the structure of the trained prediction tool;

[0078] Exemplarily, deviations of the predicted values ​​of the indicators of the prediction tool are monitored, the actual operating data of the indicators (CPU, QPS, etc.) are obtained every 5 minutes, and the first error value between the predicted value of the indicator and the actual value of the indicator is calculated. If the first error value of at least three consecutive time points within the prediction period is greater than or equal to 15%, self-healing model training of the prediction tool is initiated to fine-tune the parameters and update the structure of the trained prediction tool.

[0079] S300: After inputting the plurality of predicted indicator values ​​into the decision model, the optimal Pod configuration is calculated correspondingly within the prediction period.

[0080] In some embodiments, reference Figure 2 After inputting the multiple predicted indicator values ​​into the decision model, the optimal Pod configuration is calculated within the prediction period, including:

[0081] S301, selecting a historical data window according to a first preset time, and selecting a reference indicator in the historical data window;

[0082] S302, determining a prediction period according to a second preset time, and determining the number of predictions within the prediction period according to the prediction interval;

[0083] S303: Generate Pod configuration prediction values ​​at different times within the prediction period in sequence according to the prediction interval based on the reference indicator and the indicator prediction value, and store the plurality of Pod configuration prediction values ​​in a storage queue, where the number of the Pod configuration prediction values ​​is the same as the number of predictions;

[0084] S304: Select the largest predicted value of the Pod configuration in the storage queue as the optimal Pod configuration.

[0085] In this embodiment, after the prediction tool outputs the indicator prediction value corresponding to the key performance indicator, the historical data window is first selected according to the first preset time as a reference interval for dynamic benchmark calculation, and the corresponding reference indicator is selected from the historical data window. Then, the prediction period is determined according to the pre-set second preset time, and the number of predictions within the prediction period is determined according to the prediction interval time of the aforementioned prediction tool. For example, if the prediction period is 20 minutes and the prediction interval time is 5 minutes, the number of predictions is four times. The decision model then generates Pod configuration prediction values ​​at different times within the prediction period according to the prediction interval time based on the input reference indicators and indicator prediction values, and stores multiple Pod configuration prediction values ​​in order in the storage queue. Then, the largest Pod configuration prediction value is selected from the storage queue as the optimal Pod configuration to achieve the prediction of the resource configuration of the target system.

[0086] The reference indicators include historical Pod usage peaks and historical indicator usage peaks within a first preset time period.

[0087] For example, taking the historical indicator usage peak as the CPU usage peak, the first preset time is one month, and the historical data of the target system in the past month is selected as the historical data window, and the CPU usage peak and the historical Pod usage peak in the past month are selected in the historical data window. The second preset time is set to 20 minutes, that is, the prediction period is determined to be 20 minutes, and the prediction interval is 5 minutes, then the number of predictions is four times. Then, within the 20 minutes of the prediction period, four Pod configuration prediction values ​​are generated every five minutes based on the indicator prediction value, the CPU usage peak and the historical Pod usage peak, and then stored in the storage queue. Then, the largest Pod configuration prediction value is selected from the storage queue as the optimal Pod configuration.

[0088] It should be noted that in the present application, the length of the historical event window, that is, the size of the first preset time, can be flexibly adjusted according to actual needs, so as to obtain the corresponding reference index value based on the historical actual load. This solution does not specifically limit this and will not be repeated here.

[0089] In some further embodiments, the reference indicator includes a historical Pod usage peak value and a historical indicator usage peak value within a first preset time period, and generating Pod configuration prediction values ​​at different times within the prediction period in sequence according to the prediction interval based on the reference indicator and the indicator prediction value includes:

[0090] Calculating a first prediction value based on the reference indicator and the indicator prediction value, and determining whether the current indicator prediction value is less than the historical indicator usage peak value;

[0091] When it is determined that the current predicted value of the indicator is greater than the historical indicator usage peak value, the first predicted value is used as the current predicted value of the Pod configuration;

[0092] When it is determined that the current predicted value of the indicator is less than or equal to the historical peak usage value of the indicator, a second predicted value is calculated based on the safety factor and the first predicted value, and the current predicted value of the Pod configuration is determined based on the second predicted value and the historical peak usage value of the Pod;

[0093] The above process is repeated for the indicator prediction values ​​and the reference indicator at other times within the prediction period to obtain multiple Pod configuration prediction values ​​within the prediction period.

[0094] In this embodiment, when specifically predicting the Pod configuration prediction value at different times within the prediction period, a first prediction value is first directly calculated based on the reference indicator and the indicator prediction value, and then it is determined whether the current indicator prediction value is less than the historical indicator usage peak value. When it is determined that the current indicator prediction value is greater than the historical indicator usage peak value, the first prediction value is used as the current Pod configuration prediction value. If it is determined that the current indicator prediction value is less than or equal to the historical indicator usage peak value, a second prediction value is calculated by multiplying the first prediction value and the safety factor, and the second prediction value is further compared with the historical Pod usage peak value to determine the final Pod configuration prediction value.

[0095] In this embodiment, when it is determined that the current predicted value of the indicator is less than or equal to the historical indicator usage peak value, the second predicted value is calculated by multiplying the first predicted value and the safety factor, thereby leaving a certain margin for resource scheduling of the entire system and preventing the risk of resource shortage due to insufficient prediction.

[0096] The calculation of the first prediction value satisfies the following formula:

[0097] ;

[0098] in, represents the first predicted value, M represents the indicator predicted value, N represents the historical Pod usage peak value, and S represents the historical indicator usage peak value.

[0099] For example, let's take the key performance indicator (KPI) as CPU usage. The corresponding historical peak value is the peak CPU usage, and the predicted value is the predicted CPU usage. Substituting these parameters into the above formula yields the final first predicted value. Similarly, the corresponding second predicted value can be calculated by multiplying the first predicted value by the safety factor, which is not detailed here.

[0100] It should be noted that when other indicators are selected as key performance indicators, after selecting the corresponding peak value in the historical data window, the corresponding first prediction value can be calculated according to the above formula. Since the calculation process of the first prediction value when selecting other data indicators as key performance indicators is basically the same as the above process, it will not be repeated here.

[0101] Furthermore, determining the current Pod configuration prediction value based on the second prediction value and the historical Pod usage peak value includes:

[0102] Determine the difference between the second predicted value and the historical Pod usage peak value;

[0103] After determining that the second predicted value is less than or equal to the historical Pod usage peak value, use the second predicted value as the current Pod configuration predicted value;

[0104] After determining that the second predicted value is greater than the historical Pod usage peak value, the historical Pod usage peak value is used as the Pod configuration predicted value.

[0105] In this embodiment, after calculating the second predicted value, the smaller of the second predicted value and the Pod usage peak is selected as the final Pod configuration predicted value. This is mainly because the historical Pod usage peak represents the highest load level that the entire system has actually experienced. It is a verified reasonable resource upper limit and has a strong reference value, which is conducive to reducing resource waste. If capacity is expanded directly according to an overly high predicted value, unnecessary resource waste may be caused.

[0106] S400 : According to a scheduled scheduling period and a predicted configuration time corresponding to the optimal Pod configuration, perform resource configuration on the target system according to the optimal Pod configuration.

[0107] In this embodiment, after the largest Pod configuration prediction value is selected in the storage queue as the optimal Pod configuration, resources are configured for the predicted configuration time corresponding to the target system according to the optimal Pod configuration according to the scheduled scheduling cycle, thereby improving the resource utilization efficiency of the entire target system and ensuring the stability of the system.

[0108] It should be noted that the time of the scheduled scheduling cycle is the same as the time of the prediction cycle. When the prediction is completed within the prediction cycle and the final optimal Pod configuration is determined, the resources of the target system can be scheduled in advance according to the preset scheduled scheduling cycle, that is, the prediction cycle, thereby avoiding the response delay problem caused by the traditional expansion mechanism.

[0109] Furthermore, the method further comprises the following steps:

[0110] After resources are configured for the target system according to the optimal Pod configuration, the HPA mechanism is started to perform resource configuration in real time during the operation of the target system.

[0111] In this embodiment, after completing resource allocation within the predicted time period, the HPA mechanism is used as a safety net. During actual operation, resource allocation is further dynamically adjusted based on the HPA mechanism to achieve flexible resource scheduling. Specifically, when the lower limit of the number of system resource Pods is raised according to the predicted optimal Pod configuration, the HPA will at least maintain the number of resources at the lower limit of the number of Pods, thereby achieving capacity expansion. However, the HPA itself will dynamically determine whether further expansion or contraction is needed based on actual key performance indicators (such as CPU utilization). Therefore, even if the lower limit of the number of Pods is lowered, the HPA will still dynamically calculate the actual number of Pods required based on the current real-time monitoring data. The final number of Pods is automatically determined by the HPA based on real-time indicators, thereby assisting the HPA in achieving dynamic resource adjustment, thereby improving resource utilization efficiency while ensuring system stability to the greatest extent.

[0112] For example, during business peak periods, the HPA mechanism is used to increase the minimum resource configuration of the HPA in advance to achieve active capacity expansion; during business off-peak periods, the HPA mechanism is used to adjust the minimum resource configuration of the HPA in advance in a timely manner to save resources. This will not be repeated here.

[0113] In some embodiments, the method further comprises:

[0114] After the target system runs to the predicted configuration time, sequentially obtaining the indicator operation data of the target system according to the predicted interval time, and calculating a first error value between the indicator prediction value and the indicator operation data;

[0115] After determining that M consecutive first error values ​​exceed a first preset error threshold within the prediction configuration time, performing self-healing model training on the prediction tool to fine-tune parameters and update the structure of the trained prediction tool; and / or

[0116] After the target system runs to the predicted configuration time, sequentially obtaining Pod operation data of the target system according to the predicted interval time, and calculating a second error value between the optimal Pod configuration and the Pod operation data;

[0117] After determining that the second error value exceeds a second preset error threshold for N consecutive times within the prediction configuration time, performing self-healing model training on the decision model to fine-tune parameters and update the structure of the trained decision model;

[0118] Wherein, M and N are both integers greater than 2.

[0119] In this embodiment, after the prediction index value is generated by the prediction tool and the corresponding optimal Pod configuration is generated by the decision model, in order to further improve the accuracy of the model, a self-healing optimization mechanism is started. That is, by comparing the difference between the predicted value and the actual operation result, the accuracy of the prediction result is judged, so as to further optimize the prediction tool and decision model, and achieve continuous optimization and enhanced robustness of the resource configuration prediction capability of the entire target system.

[0120] Specifically, for the prediction tool, taking the predicted configuration time corresponding to the optimal Pod configuration as 2:10 to 2:40 as an example, after the target system runs to 2:10, the indicator operation data of the actual operation of the target system is obtained in sequence according to the preset interval time, and the first error value between each indicator operation data and the indicator prediction value is calculated respectively. After determining that M consecutive first error values ​​exceed the first preset error threshold within the predicted configuration time, the prediction tool is subjected to self-healing model training to fine-tune the parameters and update the structure of the trained prediction tool.

[0121] Similarly, for the decision model, taking the predicted configuration time corresponding to the optimal Pod configuration as 2:10 to 2:40 as an example, after the target system runs until 2:10, the Pod operation data of the actual operation of the target system is obtained in sequence according to the preset interval time, and the second error value between each Pod operation data and the optimal Pod configuration is calculated respectively. After determining that N consecutive second error values ​​exceed the second preset error threshold within the predicted configuration time, the decision model is self-healing model training to fine-tune the parameters and update the structure of the trained decision model.

[0122] Exemplarily, during the prediction configuration time, when the first error values ​​exceed 15% for three consecutive times, the prediction tool is subjected to self-healing model training; and during the prediction configuration time, when the second error values ​​exceed 15% for three consecutive times, the decision model is subjected to self-healing model training.

[0123] In some further embodiments, the process of self-healing model training includes:

[0124] Freezing parameters of an old version model and creating a fine-tuned copy of the old version model, where the old version model is the prediction tool or the decision model;

[0125] Loading the target system's operating data within a third preset time to perform incremental training on the model fine-tuning copy to generate a new version model;

[0126] Perform A / B testing on the new version model, obtain the latest data of the target system to test the new version model, and calculate the improvement rate of the mean square error (MAE) of the new version model. The improvement rate is the ratio of the negative of the difference between the mean square error of the new version model and the mean square error of the old version model to the mean square error of the old version model. The smaller the mean square error (MAE), the more accurate the corresponding model.

[0127] If the improvement rate is greater than or equal to the improvement threshold, the new version model replaces the old version model; otherwise, the new version model is discarded and the old version model is retained.

[0128] In this embodiment, when self-healing model training is required for an old version model, a fine-tuned copy of the model is created by freezing the parameters of the old version model, and the running data of the target system within a third preset time is loaded to perform incremental training on the fine-tuned copy of the model to generate a new version model. The third preset time is selected based on actual needs or experience values. In this embodiment, it is selected as two months. After that, the new version model is verified by A / B testing, and the latest data of the target system is obtained to test the new version model. The mean square error (MAE) improvement rate of the new version model is calculated. Based on the improvement rate of the mean square error (MAE), the new version model is selected as the new old version model or the old version model is retained to complete the self-healing model training of the old version model. This can stabilize the prediction error of the entire prediction method for the target system within a relatively low range, such as 10%, and the entire model update process has zero perception on the online service and will not affect the user experience.

[0129] The calculation process of the improvement rate satisfies the following formula:

[0130] ;

[0131] in, represents the improvement rate, P represents the mean square error MAE of the new version model, and Q represents the mean square error MAE of the old version model.

[0132] Exemplary, reference Figure 3 It can be determined that the target system predicted and resource allocated by this solution has a peak capture rate of 100%, an interval coverage rate of 90%, a MAE (mean square error) of 0.69, and a RMSE (root mean square error) of 0.66. Figure 4 and Figure 5 This solution enables pre-emptive resource scheduling. During peak system service periods, the error between the predicted and HPA resource counts is less than 5%. During off-peak service periods, the total predicted resource count can be reduced by approximately 30% by releasing idle resources. This demonstrates that this solution's resource allocation method, based on predictions and pre-emptive scheduling based on a large AI model, can effectively improve system stability and resource utilization.

[0133] The scope of protection of the AI-driven container resource configuration method described in the embodiment of the present application is not limited to the order of execution of the steps listed in this embodiment. All solutions implemented by adding, subtracting, or replacing steps in the existing technology based on the principles of the present application are included in the scope of protection of the present application.

[0134] The present invention also discloses an AI-driven container resource configuration system, referring to Figure 6 , the system comprising:

[0135] The data acquisition module 601 is used to collect key performance indicators generated during the real-time operation of the target system and pre-process the key performance indicators to generate standardized data;

[0136] The prediction engine module 602 is used to input the standardized data into the prediction tool, and generate a plurality of indicator prediction values ​​in sequence after sequentially predicting according to the prediction interval time within the prediction period;

[0137] The decision engine module 603 is configured to input the plurality of predicted indicator values ​​into the decision model and calculate the optimal Pod configuration within the prediction period;

[0138] The resource scheduling module 604 is configured to configure resources for the target system according to the optimal Pod configuration based on a scheduled scheduling period and a predicted configuration time corresponding to the optimal Pod configuration.

[0139] Furthermore, the system further comprises:

[0140] The stability guarantee module 605 is used to start the HPA mechanism to perform real-time resource configuration during the operation of the target system after configuring resources for the target system according to the optimal Pod configuration.

[0141] Among them, since the various modules of the AI-driven container resource configuration system correspond one-to-one to the steps in the above-mentioned AI-driven container resource configuration method, its specific working principle can also refer to the introduction of the AI-driven container resource configuration method in the above-mentioned embodiment, so it will not be repeated here.

[0142] It should be noted that the AI-driven container resource configuration system can implement the AI-driven container resource configuration method described in this application, but the implementation device of the AI-driven container resource configuration method described in this application includes but is not limited to the structure of the AI-driven container resource configuration system listed in this embodiment. All structural deformations and replacements of the existing technology made according to the principles of this application are included in the scope of protection of this application.

[0143] An embodiment of the present invention also provides an electronic device, comprising: a processor and a memory; the memory is used to store a computer program; the processor is used to execute the computer program stored in the memory, so that the electronic device executes the above-mentioned AI-driven container resource configuration method.

[0144] An embodiment of the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by an electronic device, implements the above-mentioned AI-driven container resource configuration method.

[0145] Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments can be performed by instructing a processor through a program. The program can be stored in a computer-readable storage medium, which is a non-transitory medium, such as random access memory, read-only memory, flash memory, a hard disk, a solid-state drive, a magnetic tape, a floppy disk, an optical disc, or any combination thereof. The storage medium can be any available medium accessible by a computer, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0146] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices or methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules / units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules or units, which can be electrical, mechanical or other forms.

[0147] The modules / units described as separate components may or may not be physically separate, and the components displayed as modules / units may or may not be physical modules, that is, they may be located in one place or distributed across multiple network elements. Some or all of the modules / units may be selected according to actual needs to achieve the purpose of the embodiments of the present application. For example, the functional modules / units in the various embodiments of the present application may be integrated into a processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into a single module / unit.

[0148] Those skilled in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0149] The descriptions of the processes or structures corresponding to the above figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.

[0150] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical concepts disclosed in this application shall be covered by the claims of this application.

Claims

1. A container resource configuration method based on AI driving, characterized in that: The steps include: Collecting key performance indicators generated during the real-time operation of the target system, and preprocessing the key performance indicators to generate standardized data; Inputting the standardized data into a forecasting tool, and sequentially generating a plurality of indicator forecast values ​​after forecasting in sequence according to the forecast interval time within the forecast period; After inputting the predicted values ​​of the multiple indicators into the decision model, the optimal Pod configuration is calculated accordingly within the prediction period; According to the scheduled scheduling period and the predicted configuration time corresponding to the optimal Pod configuration, resources of the target system are configured according to the optimal Pod configuration; After inputting the plurality of predicted indicator values ​​into the decision model, the optimal Pod configuration is calculated correspondingly within the prediction period, including: Selecting a historical data window according to a first preset time, and selecting a reference indicator in the historical data window; Determining a prediction period according to a second preset time, and determining the number of predictions within the prediction period according to the prediction interval time; Generate Pod configuration prediction values ​​at different times within the prediction period in sequence according to the prediction interval based on the reference indicator and the indicator prediction value, and store the plurality of Pod configuration prediction values ​​in a storage queue, where the number of the Pod configuration prediction values ​​is the same as the number of predictions; Selecting the largest predicted value of the Pod configuration in the storage queue as the optimal Pod configuration; The reference indicator includes a historical Pod usage peak value and a historical indicator usage peak value within a first preset time period. The Pod configuration prediction values ​​at different times within the prediction period are generated in sequence according to the prediction interval based on the reference indicator and the indicator prediction value, including: Calculating a first prediction value based on the reference indicator and the indicator prediction value, and determining whether the current indicator prediction value is less than the historical indicator usage peak value; When it is determined that the current predicted value of the indicator is greater than the historical indicator usage peak value, the first predicted value is used as the current predicted value of the Pod configuration; When it is determined that the current predicted value of the indicator is less than or equal to the historical peak usage value of the indicator, a second predicted value is calculated based on the safety factor and the first predicted value, and the current predicted value of the Pod configuration is determined based on the second predicted value and the historical peak usage value of the Pod; Repeating the above process for the indicator prediction values ​​and the reference indicator at other times within the prediction period to obtain multiple Pod configuration prediction values ​​within the prediction period; The calculation process of the first prediction value satisfies the following formula: ; in, represents the first predicted value, represents the predicted value of the indicator, Indicates the historical Pod usage peak value. Indicates the peak usage of the historical indicator; The second predicted value is the product of the first predicted value and a safety factor.

2. The AI-driven container resource configuration method according to claim 1, characterized in that: Determining the current Pod configuration prediction value according to the second prediction value and the historical Pod usage peak value includes: Determine the difference between the second predicted value and the historical Pod usage peak value; After determining that the second predicted value is less than or equal to the historical Pod usage peak value, use the second predicted value as the current Pod configuration predicted value; After determining that the second predicted value is greater than the historical Pod usage peak value, the historical Pod usage peak value is used as the Pod configuration predicted value.

3. The AI-driven container resource configuration method according to claim 1, characterized in that: The method further comprises: After the target system runs to the predicted configuration time, sequentially obtaining the indicator operation data of the target system according to the predicted interval time, and calculating a first error value between the indicator prediction value and the indicator operation data; After determining that M consecutive first error values ​​exceed a first preset error threshold within the prediction configuration time, performing self-healing model training on the prediction tool to fine-tune parameters and update the structure of the trained prediction tool; and / or After the target system runs to the predicted configuration time, sequentially obtaining Pod operation data of the target system according to the predicted interval time, and calculating a second error value between the optimal Pod configuration and the Pod operation data; After determining that the second error value exceeds a second preset error threshold for N consecutive times within the prediction configuration time, performing self-healing model training on the decision model to fine-tune parameters and update the structure of the trained decision model; Wherein, M and N are both integers greater than 2.

4. The AI-driven container resource configuration method according to claim 3 is characterized in that: The self-healing model training process includes: Freezing parameters of an old version model and creating a fine-tuned copy of the old version model, where the old version model is the prediction tool or the decision model; Loading the target system's operating data within a third preset time to perform incremental training on the model fine-tuning copy to generate a new version model; Performing A / B testing on the new version model, obtaining the latest data of the target system to test the new version model, and calculating the improvement rate of the mean square error (MAE) of the new version model, where the improvement rate is the ratio of the negative of the difference between the mean square error of the new version model and the mean square error of the old version model to the mean square error of the old version model; If the improvement rate is greater than or equal to the improvement threshold, the new version model replaces the old version model; otherwise, the new version model is discarded and the old version model is retained.

5. The AI-driven container resource configuration method according to any one of claims 1 to 4, characterized in that: The method further comprises: After resources are configured for the target system according to the optimal Pod configuration, the HPA mechanism is started to perform resource configuration in real time during the operation of the target system.

6. An AI-driven container resource configuration system, characterized in that: The system comprises: A data acquisition module is used to collect key performance indicators generated during the real-time operation of the target system and pre-process the key performance indicators to generate standardized data; A prediction engine module, configured to input the standardized data into a prediction tool, and generate a plurality of indicator prediction values ​​in sequence after sequentially predicting according to the prediction interval within a prediction period; A decision engine module, configured to input the predicted values ​​of the multiple indicators into the decision model and calculate the optimal Pod configuration within the prediction period; A resource scheduling module is used to configure resources for the target system according to the optimal Pod configuration based on a scheduled scheduling period and a predicted configuration time corresponding to the optimal Pod configuration; After inputting the plurality of predicted indicator values ​​into the decision model, the optimal Pod configuration is calculated correspondingly within the prediction period, including: Selecting a historical data window according to a first preset time, and selecting a reference indicator in the historical data window; Determining a prediction period according to a second preset time, and determining the number of predictions within the prediction period according to the prediction interval time; Generate Pod configuration prediction values ​​at different times within the prediction period in sequence according to the prediction interval based on the reference indicator and the indicator prediction value, and store the plurality of Pod configuration prediction values ​​in a storage queue, where the number of the Pod configuration prediction values ​​is the same as the number of predictions; Selecting the largest predicted value of the Pod configuration in the storage queue as the optimal Pod configuration; The reference indicator includes a historical Pod usage peak value and a historical indicator usage peak value within a first preset time period. The Pod configuration prediction values ​​at different times within the prediction period are generated in sequence according to the prediction interval based on the reference indicator and the indicator prediction value, including: Calculating a first prediction value based on the reference indicator and the indicator prediction value, and determining whether the current indicator prediction value is less than the historical indicator usage peak value; When it is determined that the current predicted value of the indicator is greater than the historical indicator usage peak value, the first predicted value is used as the current predicted value of the Pod configuration; When it is determined that the current predicted value of the indicator is less than or equal to the historical peak usage value of the indicator, a second predicted value is calculated based on the safety factor and the first predicted value, and the current predicted value of the Pod configuration is determined based on the second predicted value and the historical peak usage value of the Pod; Repeating the above process for the indicator prediction values ​​and the reference indicator at other times within the prediction period to obtain multiple Pod configuration prediction values ​​within the prediction period; The calculation process of the first prediction value satisfies the following formula: ; in, represents the first predicted value, represents the predicted value of the indicator, Indicates the historical Pod usage peak value. Indicates the peak usage of the historical indicator; The second predicted value is the product of the first predicted value and a safety factor.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed, the AI-driven container resource configuration method described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Container resource dynamic scheduling method and system based on usage amount prediction

    CN115118602A

  • Container cloud elastic scaling method based on GRU-attention mechanism

    CN120196400A