Container adjustment method and device, equipment, storage medium and program product
By performing time-series decomposition and model prediction on container load data, the problem of frequent start-ups and shutdowns caused by container load fluctuations was solved, enabling timely adjustment of the number of containers and improving system performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-17
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies cannot respond to load changes in a timely manner when container load fluctuates greatly or sudden loads occur, resulting in a decline in system performance due to frequent container startup and shutdown.
By performing time series decomposition on container load data, trend, seasonal, and residual data are obtained. Using trend forecasting models, seasonal forecasting models, and smoothing calculations, container load changes are predicted, and the number of containers is adjusted accordingly.
This enabled timely adjustment of the number of containers, improved system performance, ensured that containers could respond promptly to load changes, and reduced performance degradation caused by frequent start-stop operations.
Smart Images

Figure CN121636192A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of artificial intelligence technology, and in particular relates to a method, apparatus, device, storage medium and program product for container adjustment. Background Technology
[0002] As the load on containers or applications changes, the number of containers needs to be adjusted to ensure the system meets business and resource requirements. Currently, the load on containers or applications can be monitored by tracking a series of predefined load metrics, including CPU utilization, memory utilization, and network traffic. When the load increases, the system increases the number of containers to meet business needs; when the load decreases, the system automatically reduces the number of containers to conserve resources.
[0003] Currently, containers can be added and removed using Horizontal Pod Autoscaler (HPA) and Vertical Pod Autoscaler (VPA) mechanisms in container orchestration platforms. However, in practice, when there are large load fluctuations or sudden load spikes, these HPA and VPA mechanisms may lead to frequent container starts and stops. Since starting and stopping containers requires time and resources, they cannot respond to load changes in real time, thus failing to adjust container sizes accurately and promptly, resulting in degraded system performance. Summary of the Invention
[0004] This application provides a method, apparatus, device, storage medium, and program product for container adjustment, which can predict container load and adjust the number of containers in a timely and accurate manner to improve system performance.
[0005] In a first aspect, embodiments of this application provide a method for container tuning, applied to a container orchestration server, the method comprising: Obtain container load data within a preset time period; The container load data is decomposed into a time series according to a preset time window to obtain trend data, seasonal data and residual data. The trend data represents the changing trend of the container load data, the seasonal data represents the periodically fluctuating container load data, and the residual data represents the randomly fluctuating container load data. The trend data is input into the trend prediction model to obtain the trend prediction result, which represents the predicted container load data of the container showing the changing trend within a preset time period. The seasonal data is input into the seasonal prediction model to obtain the seasonal prediction result, which represents the predicted container load data of the container exhibiting the periodic fluctuation within the preset time period. The residual term data is smoothed to obtain the residual term prediction result, which represents the predicted container load data of the container exhibiting random fluctuations within the preset time period. Based on the trend prediction results, the seasonal prediction results, and the residual prediction results, the container load prediction data is calculated. The number of containers is scaled up or down based on the container load prediction data.
[0006] In one possible implementation, the step of performing time-series decomposition on the container load data according to a preset time window to obtain trend data, seasonal data, and residual data includes: Based on the distance between the container load data and the initial cluster center, the container load data is clustered to obtain multiple clusters; Construct a container load time series corresponding to the container load data in each cluster in chronological order; The container load time series is decomposed based on the preset time window to obtain the trend data, the seasonal data, and the residual data.
[0007] In one possible implementation, before clustering the container load data based on the distance between the container load data and the initial cluster centers to obtain multiple clusters, the method further includes: Within each preset period, obtain the maximum values of different indicators for the same container in the container load data to obtain the maximum value load sequence of different indicators; Combine the maximum load sequence of multiple different indicators of the same container within each preset period to obtain the data points corresponding to the preset period of each container; For each data point, calculate the distance between that data point and other data points; Sort each data point according to its distance from other data points to obtain an ascending queue; The first preset number of data points in the ascending queue are used as the initial cluster centers.
[0008] In one possible implementation, the container load time series is decomposed according to the preset time window to obtain the trend data, the seasonal data, and the residual data, including: The container load time series is smoothed using the preset time window to obtain a preliminary trend estimate; Subtract the preliminary trend estimate from the container load data to obtain detrended data; The detrended data is grouped according to the preset time window to obtain multiple data groups; Calculate the mean of the multiple data groups to obtain a preliminary seasonal estimate; The preliminary seasonal estimate is smoothed to obtain the seasonal data; Subtract the seasonal data from the container load data to obtain the de-seasoned data; The deseasonal data is smoothed to obtain the trend data. The residual data is obtained by subtracting the seasonal data and the trend data from the container load data.
[0009] In one possible implementation, the step of smoothing the container load time series using the preset time window to obtain a preliminary trend estimate includes: The container load time series is dimensionality reduced to obtain the target time series; The target time series is smoothed using the preset time window to obtain the preliminary trend estimate.
[0010] In one possible implementation, calculating the container load forecast data based on the trend forecast result, the seasonal forecast result, and the residual term forecast result includes: The container load prediction data is obtained by weighted summing of the trend prediction results, the seasonal prediction results, and the residual prediction results.
[0011] In one possible implementation, before inputting the trend item data into the trend prediction model to obtain the trend prediction result, the method further includes: Obtain training sample data; The training sample data is decomposed into time series data to obtain trend sample data and seasonal sample data; Input the trend term sample data into the autoregressive integral moving average model; The training sample data is differentially processed using the autoregressive integral moving average model to obtain a stationary trend term sample sequence. The autoregressive integral moving average model is ordered to obtain the trend prediction model.
[0012] In one possible implementation, after performing time-series decomposition on the training sample data to obtain trend term sample data and seasonal term sample data, the method further includes: Input the seasonal sample data into the seasonal autoregressive integral moving average model; The training sample data is differentially processed using the seasonal autoregressive integral moving average model to obtain a stationary seasonal term sample sequence. The seasonal autoregressive integral moving average model is ordered to obtain the seasonal prediction model.
[0013] In one possible implementation, scaling up or down the number of containers based on the container load prediction data includes: If the predicted container data reaches the preset scaling conditions, the number of containers is scaled up or down.
[0014] Secondly, embodiments of this application provide a container adjustment apparatus, applied to a container orchestration server, the apparatus comprising: The acquisition module is used to acquire container load data within a preset time period; The decomposition module is used to perform time series decomposition on the container load data according to a preset time window to obtain trend data, seasonal data and residual data. The trend data represents the changing trend of the container load data, the seasonal data represents the periodically fluctuating container load data, and the residual data represents the randomly fluctuating container load data. The prediction module is used to input the trend data into the trend prediction model to obtain the trend prediction result, which represents the predicted container load data of the container exhibiting the changing trend within a preset time period. The prediction module is used to input the seasonal data into the seasonal prediction model to obtain the seasonal prediction result. The seasonal prediction result represents the predicted container load data of the container exhibiting the periodic fluctuation within the preset time period. The smoothing calculation module is used to perform smoothing calculations on the residual term data to obtain the residual term prediction result. The residual term prediction result represents the predicted container load data of the container exhibiting random fluctuations within the preset time period. The calculation module is used to calculate the container load prediction data based on the trend prediction results, the seasonal prediction results, and the residual term prediction results. The adjustment module is used to scale the number of containers up or down based on the container load prediction data.
[0015] Thirdly, embodiments of this application provide an electronic device, the device including: a processor and a memory storing computer program instructions; The processor implements a method for adjusting containers as described in the first aspect when executing computer program instructions.
[0016] Fourthly, embodiments of this application provide a computer storage medium on which computer program instructions are stored, and when executed by a processor, the computer program instructions implement the container adjustment method as described in the first aspect.
[0017] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform a container adjustment method as described in the first aspect.
[0018] This application discloses a method, apparatus, device, storage medium, and program product for container adjustment. A container orchestration server acquires container load data within a preset time period. The container load data is decomposed into time series data to obtain trend data, seasonal data, and residual data. The trend data represents the changing trend of the container load data, reflecting the changes in container load within the preset time period. The seasonal data represents periodically fluctuating container load data, reflecting the periodic change pattern of container load. Based on this, a trend prediction model predicts the trend forecast result within a second preset period using the trend data. Then, a seasonal prediction model predicts the seasonal forecast result within the second preset period. The residuals are then smoothed to obtain the residual forecast result. Finally, container load forecast data is obtained based on the trend forecast result, seasonal forecast result, and residual forecast result. The system reflects the changes in container load within the second preset period from two dimensions: trend forecast results and seasonal forecast results. Finally, residual forecast results are superimposed to reduce errors. In this way, by comprehensively judging the changes in container load within the second preset period using trend forecast results, seasonal forecast results, and residual forecast results, the accuracy of container load forecast results is ensured. Furthermore, by using container load forecast data to expand or shrink the container data volume, it can be ensured that the expanded containers can respond to load changes in a timely manner, thereby improving system performance. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating a method for adjusting a container provided in an embodiment of this application; Figure 2 This is a flowchart illustrating the specific implementation of S102 in a container adjustment method provided in this application embodiment; Figure 3This is a flowchart illustrating a time series decomposition method provided in an embodiment of this application; Figure 4 This is a flowchart illustrating a trend prediction model training method provided in an embodiment of this application; Figure 5 This is a schematic flowchart of a model order determination method provided in an embodiment of this application; Figure 6 This is a flowchart illustrating a seasonal prediction model training method provided in an embodiment of this application; Figure 7 This is an exemplary schematic diagram of a container adjustment method provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of a container adjustment device provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0021] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0022] It should be noted that, in this document, relational terms such as "first" and "second" are used merely 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..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0023] Currently, the main methods for automatically expanding and shrinking containers include the following: The first approach is metric-based auto-scaling. Specifically, it uses predefined container load metrics to detect the load on containers or applications, and then automatically adjusts the number of containers based on changes in these metrics. For example, it uses HPA and VPA mechanisms to adjust the number of containers. HPA automatically adjusts the number of containers deployed in a pod to cope with changes in container load and fluctuations in resource requirements. A pod is the smallest scheduling unit in containerization technology. HPA dynamically increases or decreases the number of pod replicas by monitoring pod load metrics, such as CPU utilization or custom metrics. VPA automatically adjusts the resource configuration of a pod.
[0024] However, this approach can lead to frequent container starts and stops when container load fluctuates significantly or sudden loads occur. Since container starts and stops take time, it may be impossible to adjust the size of containers and resource allocation in a timely manner, thereby reducing system performance.
[0025] The second method is rule-based automatic scaling. Specifically, rules for adjusting the number of containers can be set based on the periodic changes in container load, application load, or traffic. This allows the container orchestration center to periodically adjust the number of containers according to the preset rules.
[0026] However, the second approach is simpler to adjust and is only suitable for scenarios with regular load changes.
[0027] To address the problems existing in the prior art, embodiments of this application provide a method, apparatus, device, storage medium, and program product for container adjustment. The following first describes the container adjustment method provided in this application embodiment. This method is applied to a container orchestration center, such as... Figure 1 As shown, the method includes: S101. Obtain container load data within a preset time period.
[0028] The container orchestration center obtains container load data through the monitoring system Prometheus. Prometheus is an open-source monitoring and alerting system that can be used to monitor load changes in each container. The preset duration is set based on experience. Specifically, the container orchestration center obtains container load data for the preset duration preceding the current moment.
[0029] Container load data includes various load metrics, which are pre-set based on the actual business scenario. In one example, container load data may include CPU utilization, memory usage, and network traffic. This application does not impose limitations on these metrics.
[0030] S102. Perform time series decomposition on the container load data according to the preset time window to obtain trend data, seasonal data and residual data.
[0031] Among them, the trend data represents the changing trend of container load data, the seasonal data represents the periodically fluctuating container load data, and the residual data represents the randomly fluctuating container load data.
[0032] The preset time window is set based on the actual business fluctuation cycle. For example, taking an application container as an example, since the load corresponding to the application container is related to the frequency and intensity of application usage, the load change cycle of the container is determined to be one week by statistically analyzing the application's usage frequency and intensity. Therefore, the preset time window is set to one week.
[0033] Understandably, since the frequency and intensity of application usage depend on users' rest time, and the higher the frequency and intensity of user usage, the higher the load on the container, the user's rest time affects the container load variation. The container load on weekdays is significantly lower than the container load on rest days. The container load fluctuates in a seven-day cycle, so the business fluctuation cycle is one week.
[0034] One method for time series decomposition of container load data is the local trend decomposition (STL).
[0035] S103. Input the trend data into the trend prediction model to obtain the trend prediction results.
[0036] The trend prediction result represents the predicted container load data showing the changing trend of containers within a preset time period. The trend prediction model is obtained by training a time series prediction model using historical trend data.
[0037] S104. Input the seasonal data into the seasonal prediction model to obtain the seasonal prediction results.
[0038] The seasonal forecast results represent the predicted container load data, which shows cyclical fluctuations within a preset time period. The seasonal forecast model is obtained by training a time series forecast model using historical seasonal data.
[0039] Historical seasonal data and historical trend data are obtained by time series decomposition of historical container load data.
[0040] In one implementation, the time series decomposition method can be the classical decomposition method, which involves decomposing historical container load data into historical seasonal data, historical trend data, and historical residual data using an additive or multiplicative model.
[0041] In another implementation, the method for time-series decomposition of historical container load data can be the STL algorithm based on Locally Weighted Regression (LOESS).
[0042] In one example, the trend forecasting model and the seasonal forecasting model can both be time series forecasting models. Specifically, the trend forecasting model is obtained by training an Autoregressive Integrated Moving Average (ARIMA) model. The target model parameters of the ARIMA model are determined using autocorrelation coefficient feature maps and partial autocorrelation coefficient feature maps, and the ARIMA model parameters are then adjusted to match the target model parameters. Historical trend data is input into the ARIMA model as training sample data. Difference calculations are performed on the historical trend data to process it into stationary time series data. Then, the root mean square error (RMSE) between the ARIMA model's output and the true values is calculated. The model parameters are adjusted based on the RMSE until the calculated RMSE is less than a threshold.
[0043] A seasonal autoregressive integrated moving average (SARIMA) model is trained to obtain a seasonal prediction model. The target model parameters of the SARIMA model are determined using autocorrelation coefficient feature maps and partial autocorrelation coefficient feature maps, and the SARIMA model parameters are adjusted to match the target model parameters. Historical seasonal data is input into the SARIMA model as training sample data. Difference calculations are performed on the historical seasonal data to process it into stationary time series data. Then, the root mean square error (RMSE) between the SARIMA model's output and the true values is calculated. The model parameters are adjusted based on the RMSE until the calculated RMSE is less than a threshold.
[0044] S105. Perform smoothing calculations on the residual term data to obtain the prediction results of the residual term.
[0045] The residual prediction result represents the predicted container load data, which exhibits random fluctuations within a preset time period. The container orchestration center can use an exponentially weighted moving average to smooth the residual data.
[0046] Specifically, the smoothing calculation process is as follows: The first residual data in the time series of residual data is used as the initial data. Then, the second residual data and the initial data are weighted and summed according to the preset smoothing parameters to obtain the first residual prediction data. The first residual prediction data is used as the initial data. The third residual data and the initial data are weighted and summed according to the pre-smoothing parameters to obtain the second residual prediction data. This process continues until the residual prediction data is calculated based on the last residual data in the time series of residual data. The calculated residual prediction data and the first residual data are used as the residual prediction result.
[0047] S106. Based on the trend forecast results, seasonal forecast results, and residual term forecast results, the container load forecast data is calculated.
[0048] In one implementation, the trend forecast results, seasonal forecast results, and residual term forecast results are summed to obtain the container load forecast data.
[0049] In another implementation, the container load forecast data is obtained by weighted summation of the trend forecast results, seasonal forecast results, and residual forecast results. The weights corresponding to the trend forecast results, seasonal forecast results, and residual forecast results can be preset, or they can be calculated by taking the root mean square error (RMSE) of each forecast result and then using the RMSE to calculate the weights.
[0050] The method for calculating the weights using the root mean square error is as follows: Calculate the first root mean square error corresponding to the trend forecast result, the second root mean square error corresponding to the seasonal forecast result, and the third root mean square error corresponding to the residual term forecast result.
[0051] Determine the reciprocals of the first root mean square error, the second root mean square error, and the third root mean square error to obtain the corresponding first weight component, the second weight component corresponding to the second root mean square error, and the third weight component corresponding to the second root mean square error.
[0052] Calculate the sum of the first weighted component, the second weighted component, and the third weighted component to obtain the first sum.
[0053] Based on the trend prediction result, the difference between the first weighted component and the first sum is calculated to obtain the weight corresponding to the trend prediction result. The weight corresponding to the trend prediction result can be expressed as: in, The first root mean square error, This is the second root mean square error. This is the third root mean square error.
[0054] For the seasonal forecast results, the difference between the second weighted component and the first sum is calculated to obtain the weights corresponding to the seasonal forecast results. The weights corresponding to the seasonal forecast results can be expressed as follows: For the predicted results of the residual term, the difference between the third weight component and the first sum is calculated to obtain the weight corresponding to the predicted results of the residual term. The weight corresponding to the predicted results of the residual term can be expressed as: Based on the weights corresponding to the trend forecast results, seasonal forecast results, and residual term forecast results obtained from the above calculations, a weighted sum is performed on the trend forecast results, seasonal forecast results, and residual term forecast results to obtain the container load forecast data, which can be specifically expressed as follows: in, This represents container load forecast data. This indicates the trend prediction result. This indicates the seasonal forecast result. This indicates the prediction result of the residual term.
[0055] Understandably, by predicting the trend forecast based on the trend data, the seasonal forecast based on the seasonal data, and the residual forecast based on the residual data, the container load can be predicted separately from three dimensions. Finally, the container load prediction data is calculated by combining the predicted trend forecast, seasonal forecast, and residual forecast results, thereby improving the accuracy of the container load prediction results.
[0056] S107. Adjust the number of containers based on container load prediction data.
[0057] Understandably, if the container load forecast data indicates that the container load will increase at a certain target time in the future, the container orchestration center will increase the number of containers at that target time. If the container load forecast data indicates that the container load will decrease at a certain target time in the future, the container orchestration center can reduce the number of containers at that target time.
[0058] Using the above method, the container orchestration server acquires container load data within a preset time period. Time series decomposition of the container load data yields trend data, seasonal data, and residual data. The trend data represents the changing trend of the container load data, reflecting the changes in container load within the preset time period. The seasonal data represents the periodically fluctuating container load data, reflecting the cyclical change pattern of the container load. Based on this, a trend prediction model predicts the trend forecast result for a second preset period using the trend data. Then, a seasonal prediction model predicts the seasonal forecast result for the second preset period. Finally, the residuals are smoothed to obtain the residual forecast result. Finally, the container load forecast data is obtained based on the trend forecast result, the seasonal forecast result, and the residual forecast result. The system reflects the changes in container load within the second preset period from two dimensions: trend forecast results and seasonal forecast results. Finally, residual forecast results are superimposed to reduce errors. In this way, by comprehensively judging the changes in container load within the second preset period using trend forecast results, seasonal forecast results, and residual forecast results, the accuracy of container load forecast results is ensured. Furthermore, by using container load forecast data to expand or shrink the container data volume, it can be ensured that the expanded containers can respond to load changes in a timely manner, thereby improving system performance.
[0059] Regarding S102 above, the container load data is decomposed into a time series according to a preset time window to obtain trend data, seasonal data, and residual data, such as... Figure 2 As shown, the specific implementation is as follows: S1021. Based on the distance between the container load data and the initial cluster center, the container load data is clustered to obtain multiple clusters.
[0060] By performing clustering operations on container load data, the data of containers with the same load behavior can be divided into the same cluster, meaning that the containers corresponding to each cluster have the same load behavior.
[0061] One approach is to use the free container load data as the initial cluster centers. After a new container load data is added, the container load data is clustered to determine the corresponding cluster. Then, the cluster centers are re-determined based on the container load data currently contained in the cluster. This process is iterated until the cluster centers no longer change. The new cluster centers can be obtained by calculating the average value of the container load data currently contained in the cluster.
[0062] S1022. Construct the container load time series corresponding to the container load data in each cluster according to the time order.
[0063] Specifically, for each cluster, the container load data corresponding to the cluster center of that cluster is obtained, and the container load data is sorted in chronological order to obtain the container load time series.
[0064] If the cluster center has corresponding container load data, a container load time series is constructed using this data. If the cluster center does not have corresponding container load data, the average value of the container load data within the cluster is calculated to obtain the central container load data, which is then used to construct a container load time series.
[0065] The container load time series described above consists of multiple data points, each representing container load data for a different metric at that specific time point. For example, different metric container load data include CPU utilization, memory usage, and data flow.
[0066] S1023. Based on a preset time window, perform time series decomposition on the container load time series to obtain trend data, seasonal data, and residual data.
[0067] The method provided in this application allows for the clustering of container load data, enabling containers with similar load variation behaviors to be grouped into clusters. For each cluster, time series decomposition can be performed, and container load can be predicted using the corresponding trend data, seasonal data, and residual data. This clustering operation reduces the amount of data that needs to be processed, thereby improving data processing efficiency.
[0068] In some embodiments of this application, the container load data includes data for different metrics; therefore, the data required for the clustering operation is constructed before performing the clustering operation. Based on this, before S1021 above, where the container load data is clustered based on the distance between the container load data and the initial cluster centers to obtain multiple clusters, the method further includes: Step 1: Obtain the maximum values of different indicators for the same container in the container load data within each preset period, and obtain the maximum load sequence of different indicators.
[0069] The preset period is set based on experience. In one example, the preset period can be one day.
[0070] Specifically, for each container, the container orchestration center obtains container load data for different metrics, such as CPU utilization and memory usage from January 1, 2025 to March 1, 2025. Then, for each metric, it obtains the maximum value for that metric within each preset period. For example, if the preset period is one day, for CPU utilization, it obtains the daily maximum CPU utilization, thus obtaining the maximum load sequence of CPU utilization over the time range of January 1, 2025 to March 1, 2025. Similarly, it can obtain the maximum load sequence of memory usage over the time range of January 1, 2025 to March 1, 2025.
[0071] Step 2: Combine the maximum load sequence of multiple different indicators of the same container within each preset period to obtain the data points corresponding to the preset period of each container.
[0072] In one example, the metrics for a container include CPU utilization and memory usage. For the container load data corresponding to a container, the maximum CPU utilization and maximum memory usage for that container are obtained for each day. In this way, the maximum CPU utilization load sequence and the maximum memory usage load sequence for that container can be obtained. Then, according to the corresponding date, the maximum CPU utilization and maximum memory usage for each day are combined to obtain the corresponding data points for each day.
[0073] Step 3: For each data point, calculate the distance between the data point and other data points.
[0074] Specifically, calculate the Euclidean distance between each data point and all other data points. The formula for calculating the Euclidean distance is: .in, This represents the i-th data point. This represents the j-th data point.
[0075] Step 4: Sort each data point according to its distance from other data points to obtain an ascending queue.
[0076] Step 5: Use the first preset number of data points in the ascending queue as the initial cluster centers.
[0077] This approach uses the first predetermined number of data points in the ascending queue as initial cluster centers, meaning the data points furthest away are chosen as the initial cluster centers. This ensures that the statistical characteristics of the container load data are grouped into more representative clusters. These statistical characteristics can be peak values, mean values, or standard deviations, etc.
[0078] Using the method provided in this application, the maximum values of different indicators for the same container within each preset period are obtained, resulting in a maximum load sequence for each container's different indicators. This maximum load sequence effectively reflects the container's load across different indicator dimensions. Therefore, by combining the maximum load sequences of multiple different indicators for the same container within each preset period, data points corresponding to each container's preset period can be obtained. Each data point reflects the container's load within that preset period from multiple indicator dimensions. Then, for each data point, the distance between that data point and other data points is calculated, and the data points are sorted according to distance. The top preset number of data points in the ascending queue are used as initial cluster centers. By selecting the farthest data point as the initial cluster center, the statistical characteristics of the container load data are divided into more representative clusters. Each cluster corresponds to containers with similar load behavior, providing more accurate input data for subsequent sequence prediction, thereby improving the overall accuracy of the prediction results.
[0079] The following combination Figure 3 The detailed process of time series decomposition is described, such as... Figure 3 As shown, S1023 above, which decomposes the container load time series based on a preset time window to obtain trend data, seasonal data, and residual data, can be specifically implemented as follows: S301. Use a preset time window to perform smoothing calculations on the container load time series to obtain a preliminary trend estimate.
[0080] Specifically, the boundaries of the preset time window are aligned with the initial moment of the container load time series. The average value of the container load data within the current preset time window is calculated to obtain the smoothed value corresponding to the current preset time window. Then, the preset time window is slid along the direction of the container load time series by one moment, and the average value of the container load data within the current preset time window is calculated to obtain the smoothed value corresponding to the current preset time window. This process is repeated to obtain a preliminary trend estimate.
[0081] The preliminary trend estimate can be expressed as: in, Indicates smooth calculation, Represents the container load time series. This indicates a preset time window.
[0082] S302. Subtract the preliminary trend estimate from the container load data to obtain detrended data.
[0083] Detrended data can be represented as: .
[0084] S303. Group the detrended data according to the preset time window to obtain multiple data groups.
[0085] Specifically, according to the preset time window length, the data is evenly grouped according to the time corresponding to the detrended data to obtain multiple data groups.
[0086] For example, if the preset time window is 30 days and the detrended data includes 90 days of data, then according to the preset time window, the detrended data will be divided into data from day 1 to day 30, data from day 31 to day 60, and data from day 61 to day 90.
[0087] S304. Calculate the mean of multiple data groups to obtain a preliminary seasonal estimate.
[0088] S305. Perform smoothing calculations on the preliminary seasonal estimates to obtain seasonal data.
[0089] Specifically, using locally weighted regression for smoothing the initial seasonal estimate yields more accurate seasonal data. Understandably, employing locally weighted regression preserves the local characteristics of container load data, thus making the extracted seasonal data more consistent with actual business scenarios.
[0090] S306. Subtract the seasonal data from the container load data to obtain the de-seasoned data.
[0091] The seasonal data is represented as follows: .in, This indicates data without seasonal items. This indicates seasonal data.
[0092] S307. Smooth the seasonal data to obtain the trend data.
[0093] In this method, local weighted regression is used to smooth the deseasonal data. The above smoothing algorithm is only an example; in actual implementations, the smoothing algorithm is not limited to this.
[0094] S308. Subtract the seasonal and trend data from the container load data to obtain the residual data.
[0095] The time-series decomposition of container load data can be represented as follows: Therefore, after calculating the seasonal and trend data, the residual data can be obtained by subtraction, i.e. .
[0096] The method provided in this application involves obtaining seasonal data through smoothing operations and calculations within a preset time window. Then, smoothing is applied to the deseasonal data to obtain trend data. Finally, smoothing is performed on the preliminary seasonal estimate to obtain the remaining seasonal data. This allows for the extraction of periodic change patterns and load change trends from container load data within a preset time window. Subsequent subtraction of the seasonal and trend data from the container load data yields residual data, ensuring the accuracy of the calculation results.
[0097] Regarding S301 above, by using a preset time window to smooth the container load time series and obtaining a preliminary trend estimate, it can be implemented as follows: The container load time series is dimensionality-reduced to obtain the target time series. A pre-defined time window is then used to smooth the target time series, yielding a preliminary trend estimate.
[0098] Principal component analysis can be used to reduce the dimensionality of the container load time series.
[0099] Using the method provided in this application embodiment, since the input data of the time series decomposition algorithm is one-dimensional data, while the dimensions of the above data points are multi-dimensional, it is necessary to perform dimensionality reduction processing on the container load time series to obtain a one-dimensional target time series, thereby ensuring the accuracy of subsequent calculation results.
[0100] In some embodiments of this application, after obtaining the trend prediction results, seasonal prediction results and residual prediction results through the above calculations, the trend prediction results, seasonal prediction results and residual prediction results can be weighted and summed to obtain container load prediction data.
[0101] The trend forecast results, seasonal forecast results, and residual forecast results can be preset based on experience, or their respective weights can be calculated using the root mean square error corresponding to the trend forecast results, seasonal forecast results, and residual forecast results.
[0102] Specifically, the weight calculation method is described in the above embodiments and will not be repeated here.
[0103] Thus, by weighting and summing the trend forecast results, seasonal forecast results, and residual forecast results according to their respective weights, more accurate container load forecast data can be obtained.
[0104] The trend prediction model and the seasonal prediction model were trained using the following methods: For trend prediction models, according to... Figure 4 The method shown is used to train the data, as follows: Figure 4 As shown: S401. Obtain training sample data.
[0105] Specifically, for each cluster, historical container load data for that cluster is obtained. It's understandable that the same clusters correspond to the same load behavior; therefore, for each cluster, historical container load data of the containers at the cluster center is obtained as training sample data.
[0106] S402. Perform time series decomposition on the training sample data to obtain trend sample data and seasonal sample data.
[0107] Specifically, the method for performing time series decomposition on the training sample data is the same as the method for performing time series decomposition on the container load data described above, and will not be repeated here.
[0108] S403. Input the trend term sample data into the autoregressive integral moving average model.
[0109] The autoregressive integral moving average model ARIMA(p, d, q) represents the number of observations, q the number of residuals, and d the difference order. The training process of the autoregressive integral moving average model is as follows: in, d represents the component sequence of container load trends; d represents the difference order; B represents the hysteresis operator; T represents the component sequence of container load trends. t For stationary trend component sequences; denoted as the predicted residual; μ is the mean of the sequence; p is the autoregression order. The moving average coefficient; is the autoregressive coefficient; q is the moving average order.
[0110] Here, p represents the number of data points corresponding to the container load data used by the autoregressive integral moving average model in the load forecasting process. In one example, when p=1, it means that the autoregressive integral moving average model uses the container load data from the previous time step to predict the container load data at the current time step. Therefore, when the container load data from the past week has a significant impact on the current container load data, p=7 can be set.
[0111] q represents the number of residual terms used in the autoregressive integral moving average model for load forecasting. In one example, when q=1, it means that the autoregressive integral moving average model uses the prediction error from the previous time step to predict the container load data at the current time step. The prediction error is calculated by subtracting the model's predicted data from the historical container load data during the model fitting phase, and the specific formula is as follows: ,in, This represents the historical container load data at time n. This represents the predicted data at time n.
[0112] Where d represents the number of differencing operations required to station the time series, which is usually determined by the changes in the time series during the actual calculation process.
[0113] After each difference calculation, the stationarity of the time series is checked until the stationarity check passes.
[0114] S404. The training sample data is differentially processed using an autoregressive integral moving average model to obtain a stationary trend term sample sequence.
[0115] S405. Determine the model order of the autoregressive integral moving average model to obtain the trend prediction model.
[0116] The parameters p and q of the autoregressive integral moving average model can be determined by combining the autocorrelation function (ACF) and the partial autocorrelation function (PACF). The methods for selecting parameters p and q are shown in Table 1. Table 1 The table above does not cover all cases. Therefore, multiple alternative models can be fitted, and the model with the smallest Akaike Information Criterion (AIC) value can be selected as the preferred model.
[0117] Specifically, the method for determining the optimal model based on ACF and PACF is as follows: Figure 5 As shown, the method includes: S501. Obtain stationary time series.
[0118] To ensure the authenticity and accuracy of the data, the acquired historical container load data is stabilized to obtain a stationary time series.
[0119] S502. Draw the autocorrelation coefficient characteristic map and the partial autocorrelation coefficient characteristic map.
[0120] Among them, the autocorrelation coefficient is used to represent the correlation between the historical container load data of the current stage and the historical container load data of the previous stage. The partial autocorrelation coefficient represents the correlation between the historical container load data of the current stage and the historical container load data of a certain stage in the past after excluding the influence of the historical container load data of the intermediate stage. The "certain stage in the past" refers to the time before the intermediate stage.
[0121] S503. Perform characteristic analysis of autocorrelation coefficient and partial autocorrelation coefficient respectively.
[0122] Among them, feature analysis is performed based on the autocorrelation coefficient feature map and the partial autocorrelation coefficient feature map. If the curve of the feature map shows a gradual decrease, it indicates that the feature map is showing a tailing decay. If the curve of the feature map sharply decreases at a certain order and the value after the sharp decrease is close to 0, it indicates that the feature map is showing a truncation at a certain order.
[0123] S504. Determine the autoregressive model under the condition of tail decay of the autocorrelation coefficient.
[0124] In the case of autocorrelation coefficient tail decay, it means that the historical container load data of the current stage is linearly affected by the historical container load data of the previous stage. Therefore, the autoregressive model can be used as a seasonal forecasting model and a trend forecasting model for prediction.
[0125] S505. Determine the p-order autoregressive model when the partial autocorrelation coefficient is truncated at the p-order.
[0126] Among them, the p-order autoregressive model is one of the core models in time series analysis, used to describe the linear relationship between the current value and the past p historical values.
[0127] When the partial autocorrelation coefficient is truncated at order p, it means that the historical container load data at order p is only affected by the historical container load data before order p. Therefore, the order p autoregressive model can be used as a seasonal forecasting model and a trend forecasting model for prediction.
[0128] S506. Determine the q-order moving average model after truncating the autocorrelation coefficient at order q.
[0129] Among them, the q-order moving average model is one of the core models in time series analysis, used to describe the linear relationship between the current value and the error of the past q historical values.
[0130] When the autocorrelation coefficient is truncated after the qth order, it means that the historical container load data of the current order is affected by the error values of the historical container load data of the past q orders. Therefore, the q-order moving average model can be used as a seasonal forecasting model and a trend forecasting model for prediction.
[0131] S507. Determine the moving average model when the partial autocorrelation coefficient is tailing attenuation.
[0132] S508, Set the initial p value.
[0133] S509, Set the initial q value.
[0134] S510. Make a combined judgment on the p-value and q-value.
[0135] The process involves iterating through p-values and q-values to obtain different parameter combinations. For each parameter combination, the model parameters are adjusted accordingly. The adjusted model is then used to make predictions, and the prediction results are calculated. The error between the prediction results and the true values is then used to evaluate the model performance.
[0136] S511. In cases where the autocorrelation coefficient is tailed or the partial autocorrelation coefficient is truncated, set the q value of the autoregressive integral moving average model to 0.
[0137] In the case of ACF tailing and PACF truncation, it is indicated that the feature affecting the fluctuation of historical container load data is an autoregressive model feature. Therefore, q=0 is set.
[0138] S512. Verify the p-value.
[0139] When q is 0, different p values are iterated to determine the model performance corresponding to different p values. Specifically, the model performance can be evaluated by calculating the error between the predicted result and the true value.
[0140] S513. When the autocorrelation coefficient is truncated and the partial autocorrelation coefficient is tailed, set the p-value of the autoregressive integral moving average model to 0.
[0141] In the case of ACF truncation and PACF tailing, it is indicated that the fluctuation characteristics of historical container load data are those of a moving average model. Therefore, p=0 is set.
[0142] S514. Verify the q value.
[0143] Specifically, when p is 0, different q values are iterated to determine the model performance corresponding to different q values. In particular, the model performance can be evaluated by calculating the error between the predicted result and the true value.
[0144] S515. When both the autocorrelation coefficient and the partial autocorrelation coefficient have tails, set the q value and the p value.
[0145] In cases where both models have tailing characteristics, it is necessary to consider both the moving average model features and the autoregressive model features simultaneously, thus requiring the setting of p-values and q-values.
[0146] S516. Verify the combination of p-values and q-values.
[0147] The process involves iterating through and combining p-values and q-values to obtain different parameter combinations. For each parameter combination, the model parameters are adjusted accordingly. The adjusted model is then used for prediction to obtain the prediction results. The error between the prediction results and the true values is calculated, and the error is used to evaluate the model performance. S517. Calculate the AIC value for each model.
[0148] The AIC value can be used to evaluate the performance of each model; the smaller the AIC value, the higher the model's prediction accuracy.
[0149] S518. Perform model diagnosis.
[0150] After determining multiple models, for each model, the predicted residual terms are calculated. The residual terms are then assessed to determine if they are random noise. If they are, the model fit is considered complete; otherwise, the p-value and q-value of the model are readjusted.
[0151] S519. Determine the final parameters.
[0152] use Figure 5 The method provided in the illustrated embodiment determines a suitable model for historical container load data through ACF and PACF, and then selects the optimal model from multiple models using the AIC value, thereby obtaining an accurate time series prediction model and improving the accuracy of subsequent prediction results.
[0153] After performing time-series decomposition on the training data to obtain trend and seasonal sample data, the following steps are followed: Figure 6 The method shown is used to train a seasonal prediction model, such as Figure 5 As shown: S601. Input the seasonal sample data into the seasonal autoregressive integral moving average model.
[0154] Among them, the Seasonal Autoregressive Integrated Moving Average (SARIMA) model is used to predict data with obvious seasonal components. It adds time series analysis and prediction methods for seasonal components to the autoregressive integrated moving average model.
[0155] A SARIMA model is typically written as SARIMA(p,d,q) (P,D,Q)s, where p, d, and q represent the orders of the autoregression, differencing, and moving average, respectively, while P, D, and Q represent the orders of the periodic autoregression, differencing, and moving average with period s. The mathematical expression of the model is as follows: Among them, S t The time series value at time t; Let c be the white noise sequence value at time t; c is the constant term; B is the delay operator; B s Indicates that St Shifting backwards s times in time, i.e., B s = S t - s ; and Let p represent the autoregressive polynomial of order p and the moving average polynomial of order q, respectively. and Let represent a P-order periodic autoregressive polynomial and a Q-order periodic moving average polynomial with period s, respectively.
[0156] In one example, P represents the amount of historical container load data used in predicting the current container load data within a period. When P=2, it means that the seasonal autoregressive integral moving average model considers historical container load data from two periods prior to the current period when making predictions.
[0157] D is used to eliminate values in the period. When D=1, it means that there is a significant trend in the container load data in each period, and the seasonal autoregressive integral moving average model performs seasonal differencing.
[0158] Q represents the number of error terms used when forecasting current container load data over a period. For example, when Q=1, it means that the seasonal autoregressive integral moving average model considers error terms from one period ago.
[0159] S602. The training sample data is differentially processed using a seasonal autoregressive integral moving average model to obtain a stationary seasonal term sample sequence.
[0160] S603. Determine the model order of the seasonal autoregressive integral moving average model to obtain the seasonal prediction model.
[0161] Specifically, based on the grid search algorithm, all combinations of parameters p and q are traversed, and the fitted value of the historical container load data time series is calculated for each combination. The AIC function value of each fitted value is calculated using the AIC criterion, and the combination with the smallest AIC function value is selected as the optimal combination, thus obtaining the seasonal prediction model.
[0162] Using the method provided in this application, after time-series decomposition of the training sample data, trend term sample data and seasonal term sample data are obtained. An autoregressive integral moving average model is trained using the trend term sample data, and a seasonal autoregressive integral moving average model is trained using the seasonal term sample data. The training sample data is then differenced using the autoregressive integral moving average model to obtain a stationary trend term sample sequence, and the training sample data is differenced using the seasonal autoregressive integral moving average model to obtain a stationary seasonal term sample sequence. Finally, by determining the order of the autoregressive integral moving average model and the seasonal autoregressive integral moving average model, the trend prediction model and the seasonal prediction model are obtained. This improves the accuracy of the prediction results of the trend prediction model and the seasonal prediction model.
[0163] Furthermore, for the aforementioned residual data, the predicted residual data can be calculated using the Exponential Weighted Moving Average (EWMA) model. The calculation process of the EWMA prediction model is described below: First, determine the preset smoothing parameter within the preset smoothing parameter value range. ,in The closer a value is to 1, the higher the weight of the residual data from the current container load data. In practice, The value of is usually between 0.05 and 0.3.
[0164] Then, the data collected at the very beginning of the residual data is used as the initial smoothing value.
[0165] Finally, starting from the initial smoothing value, the container load data at the current time and the residual data at the previous time are weighted and summed according to the preset smoothing parameters to obtain the moving average value at the current time. The moving average time series is then used as the residual prediction data.
[0166] The moving average is calculated using the following formula: . This represents the moving average at the current time. This represents the container load data at time t. Represents the residual data at time t-1 In some embodiments of this application, the above-mentioned S107, scaling up or down the number of containers based on container load prediction data, can be implemented as follows: If the container prediction data reaches the preset scaling conditions, the number of containers will be scaled up or down.
[0167] In this way, by setting preset scaling conditions for different indicators, it can be determined whether the container prediction data has reached the corresponding preset scaling conditions. When the container prediction data reaches the preset scaling conditions, the number of containers is scaled up or down, thereby ensuring that the number of containers can be adjusted in a timely manner when the container load changes, thus ensuring the real-time response of the container load and shortening the response time.
[0168] The following combination Figure 7 This application describes a method for adjusting a container, as illustrated in the embodiments below. Figure 7 As shown, the method includes: S701, Obtain historical container load data.
[0169] Among them, the container historical load data is the historical data of preset load indicators, such as CPU utilization, memory usage, etc.
[0170] S702, Perform feature processing on historical container load data.
[0171] Specifically, for the container load data of each preset load index, statistical characteristics are calculated to achieve feature processing. Statistical characteristics can be the mean, variance, standard deviation, etc., and this application does not impose specific restrictions on the statistical characteristics.
[0172] S703, Extract the smallest sample.
[0173] The method for extracting the minimum sample is as follows: obtain the maximum values of different indicators of the same container in the historical container load data within each preset period, thereby obtaining the maximum load sequence of different indicators. Then, combine the maximum load sequences of multiple different indicators of the same container within each preset period to obtain the data point corresponding to the preset period of each container. For each data point, calculate the distance between the data point and other data points, and then sort each data point according to the distance to obtain an ascending queue. The data points of the first preset number in the ascending queue are the minimum sample. The minimum sample is used as the initial cluster center for subsequent K-means clustering.
[0174] S704. Grouping is performed based on the K-means clustering algorithm to obtain clusters.
[0175] Specifically, the K-means clustering algorithm iterates based on the initial cluster centers to cluster historical container load data, thus obtaining different clusters.
[0176] S705. For each cluster, extract the historical load data of the cluster center container.
[0177] S706. Decompose using the local trend decomposition method.
[0178] Specifically, STL decomposition of the container load data corresponding to the cluster centers yields trend data, seasonal data, and residual data. STL decomposition is the time series decomposition algorithm described above; the specific calculation method is described in the relevant embodiments above and will not be repeated here.
[0179] S707. A seasonal autoregressive moving average model is used to predict seasonal data to obtain seasonal forecast data.
[0180] The method for training the seasonal autoregressive moving average model is described in the above embodiments and will not be repeated here.
[0181] S708. For the trend data, an autoregressive moving average model is used to predict the trend data to obtain the predicted trend data.
[0182] The method for training the autoregressive moving average model is described in the above embodiments and will not be repeated here.
[0183] S709. An exponentially weighted moving average model is used to predict the residual data to obtain the predicted residual data.
[0184] The method for prediction using the exponentially weighted moving average model is described in the above embodiments and will not be repeated here.
[0185] S710: Reconstruct future container load forecast data by overlaying seasonal forecast data, trend forecast data, and residual forecast data.
[0186] Furthermore, based on the predicted load forecast data, the predicted load data at a certain point in the future is determined, and then it is determined whether the predicted load data meets the preset automatic scaling mechanism, thereby realizing the dynamic adjustment of the number of containers.
[0187] The process involves calculating the root mean square error (RMSE) of the seasonal, trend, and residual forecast data, then using the RMSE to calculate the weights of the seasonal, trend, and residual forecast data, and finally using the calculated weights to perform a weighted sum of the seasonal, trend, and residual forecast data to obtain the future container load forecast data.
[0188] The method provided in this application predicts the future load of containers based on historical container load data. Seasonal forecast data, trend forecast data, and residual forecast data are combined according to weights to form the overall load of the containers. Finally, an automatic scaling mechanism is used to maintain the container load within a reasonable range, thereby improving the stability and reliability of the system.
[0189] Based on the same concept, embodiments of this application provide a container adjustment apparatus, applied to a container orchestration server, such as... Figure 8 As shown, the device includes: The acquisition module 801 is used to acquire container load data within a preset time period; The decomposition module 802 is used to perform time series decomposition on the container load data according to a preset time window to obtain trend data, seasonal data and residual data. The trend data represents the changing trend of the container load data, the seasonal data represents the periodically fluctuating container load data, and the residual data represents the randomly fluctuating container load data. The prediction module 803 is used to input trend data into the trend prediction model to obtain trend prediction results. The trend prediction results represent the predicted container load data showing the changing trend of the container within a preset time period. Prediction module 803 is used to input seasonal data into the seasonal prediction model to obtain seasonal prediction results. The seasonal prediction results represent the predicted container load data that shows periodic fluctuations within a preset time period. The smoothing calculation module 804 is used to perform smoothing calculations on the residual term data to obtain the residual term prediction results. The residual term prediction results represent the predicted container load data that exhibits random fluctuations within a preset time period. The calculation module 805 is used to calculate the container load forecast data based on the trend forecast results, seasonal forecast results and residual term forecast results. Adjustment module 806 is used to scale the number of containers based on container load prediction data.
[0190] In one possible implementation, the decomposition module 802 is specifically used for: Based on the distance between the container load data and the initial cluster center, the container load data is clustered to obtain multiple clusters; Construct a container load time series corresponding to the container load data in each cluster in chronological order; The container load time series is decomposed based on the preset time window to obtain the trend data, the seasonal data, and the residual data.
[0191] In one possible implementation, before clustering the container load data based on the distance between the container load data and the initial cluster center to obtain multiple clusters, the apparatus further includes: The acquisition module 801 is used to acquire the maximum values of different indicators of the same container in the container load data within each preset period, and to obtain the maximum value load sequence of different indicators. The combination module is used to combine the maximum load sequence of multiple different indicators of the same container within each preset period to obtain the data points corresponding to the preset period of each container. The calculation module 805 is used to calculate the distance between each data point and other data points. The sorting module is used to sort each data point according to the distance between each data point and other data points, resulting in an ascending queue; The determination module is used to select the first preset number of data points in the ascending queue as the initial cluster centers.
[0192] In one possible implementation, the decomposition module 802 is specifically used for: The container load time series is smoothed using a preset time window to obtain a preliminary trend estimate; Subtract the initial trend estimate from the container load data to obtain the detrended data; The detrended data is grouped according to a preset time window to obtain multiple data groups; Calculate the mean of multiple data groups to obtain a preliminary seasonal estimate; The preliminary seasonal estimates are smoothed to obtain seasonal data. Subtract the seasonal data from the container load data to obtain the de-seasoned data; Smooth the deseasonal data to obtain the trend data; Subtract the seasonal and trend data from the container load data to obtain the residual data.
[0193] In one possible implementation, the decomposition module 802 is specifically used for: The container load time series is dimensionality reduced to obtain the target time series. By using a preset time window to smooth the target time series, a preliminary trend estimate is obtained.
[0194] In one possible implementation, the computing module 805 is used for: The container load forecast data is obtained by weighted summation of the trend forecast results, seasonal forecast results, and residual forecast results.
[0195] In one possible implementation, the device further includes: The acquisition module 801 is also used to acquire training sample data; The decomposition module 802 is also used to perform time series decomposition on the training sample data to obtain trend sample data and seasonal sample data; The input module is used to input the trend term sample data into the autoregressive integral moving average model. The training module is used to perform difference operations on the training sample data using an autoregressive integral moving average model to obtain a stationary trend term sample sequence. The order determination module is used to determine the order of the autoregressive integral moving average model to obtain the trend prediction model.
[0196] In one possible implementation, the input module is also used to input the seasonal item sample data into a seasonal autoregressive integral moving average model. The training module is also used to perform difference operations on the training sample data through the seasonal autoregressive integral moving average model to obtain a stationary seasonal term sample sequence. The order determination module is also used to determine the order of the seasonal autoregressive integral moving average model to obtain the seasonal prediction model.
[0197] In one possible implementation, module 806 is adjusted specifically for: If the predicted container data reaches the preset scaling conditions, the number of containers is scaled up or down.
[0198] It should be noted that the device for adjusting the container is the same as the method for adjusting the container described above. All implementation methods in the above method embodiments are applicable to the embodiments of this device and can achieve the same technical effect.
[0199] Figure 9 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown.
[0200] The electronic device may include a processor 901 and a memory 902 storing computer program instructions.
[0201] Specifically, the processor 901 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0202] Memory 902 may include mass storage for data or instructions. For example, and not limitingly, memory 902 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 902 may include removable or non-removable (or fixed) media. Where appropriate, memory 902 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 902 is non-volatile solid-state memory.
[0203] In a particular embodiment, memory 902 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Thus, generally, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the methods according to one aspect of this disclosure.
[0204] The processor 901 implements any of the container adjustment methods described in the above embodiments by reading and executing computer program instructions stored in the memory 902.
[0205] In one example, the electronic device may also include a communication interface 903 and a bus 904. For example, Figure 9 As shown, the processor 901, memory 902, and communication interface 903 are connected through bus 904 and complete communication with each other.
[0206] The communication interface 903 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0207] Bus 904 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Super Transmission (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 904 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application considers any suitable bus or interconnection.
[0208] Furthermore, in conjunction with the container adjustment methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the container adjustment methods in the above embodiments.
[0209] This application also provides a computer program product, including a computer program that, when executed, implements any of the container adjustment methods described in the above embodiments.
[0210] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0211] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on machine-readable media or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable media" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0212] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0213] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0214] The above are merely specific embodiments of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A method of container adjustment, characterized by, The method applied to a container orchestration server comprises: obtaining container load data within a preset time period; performing time series decomposition on the container load data according to a preset time window to obtain trend item data, seasonal item data and residual item data, wherein the trend item data represents a change trend of the container load data, the seasonal item data represents periodically fluctuating container load data, and the residual item data represents randomly fluctuating container load data; inputting the trend item data into a trend prediction model to obtain a trend prediction result, wherein the trend prediction result represents predicted container load data of the container in a preset time period and the container presents the change trend; inputting the seasonal item data into a seasonal prediction model to obtain a seasonal prediction result, wherein the seasonal prediction result represents predicted container load data of the container in the preset time period and the container presents the periodic fluctuation; performing smoothing calculation on the residual item data to obtain a residual item prediction result, wherein the residual item prediction result represents predicted container load data of the container in the preset time period and the container presents random fluctuation; calculating container load prediction data according to the trend prediction result, the seasonal prediction result and the residual item prediction result; and expanding or reducing the number of containers according to the container load prediction data.
2. The method of claim 1, wherein, The method further comprises the following steps before the step of performing clustering on the container load data based on the distance between the container load data and an initial clustering center to obtain a plurality of clustering clusters: obtaining a maximum value load sequence of different indexes of the same container in the container load data in each preset period; combining the maximum value load sequences of a plurality of different indexes of the same container in each preset period to obtain a data point corresponding to each container in each preset period; calculating the distance between each data point and other data points for each data point; 3. The method of claim 2, wherein, sorting each data point according to the distance between each data point and other data points to obtain an ascending queue; and taking the first preset number of data points in the ascending queue as the initial clustering center. The method further comprises the following steps in the step of performing time series decomposition on the container load time sequence according to the preset time window to obtain the trend item data, the seasonal item data and the residual item data: performing smoothing calculation on the container load time sequence using the preset time window to obtain a preliminary trend estimate; subtracting the preliminary trend estimate from the container load data to obtain detrended data; grouping the detrended data according to the preset time window to obtain a plurality of data groups; and 4. The method of claim 2, wherein, performing time series decomposition on each data group according to the preset time window to obtain the trend item data, the seasonal item data and the residual item data. calculating a mean of the plurality of data packets to obtain a preliminary season estimate; performing a smoothing calculation on the preliminary season estimate to obtain the season data; subtracting the season data from the container load data to obtain deseasoned data; performing a smoothing operation on the deseasoned data to obtain the trend data; subtracting the season data and the trend data from the container load data to obtain the residual data.
5. The method of claim 4, wherein, the smoothing calculation on the container load time series using the preset time window to obtain a preliminary trend estimate, comprising: performing dimensionality reduction processing on the container load time series to obtain a target time series; performing smoothing calculation on the target time series using the preset time window to obtain the preliminary trend estimate.
6. The method of claim 1, wherein, the container load prediction data is calculated according to the trend prediction result, the season prediction result and the residual prediction result, comprising: performing weighted summation on the trend prediction result, the season prediction result and the residual prediction result to obtain the container load prediction data.
7. The method of claim 1, wherein, Before the trend prediction result is obtained by inputting the trend data into a trend prediction model, the method further comprises: obtaining training sample data; performing time series decomposition on the training sample data to obtain trend sample data and season sample data; inputting the trend sample data into an autoregressive integrated moving average model; performing difference operation on the training sample data through the autoregressive integrated moving average model to obtain a stationary trend sample sequence; model order determination is performed on the autoregressive integrated moving average model to obtain the trend prediction model.
8. The method of claim 7, wherein, After the time series decomposition is performed on the training sample data to obtain the trend sample data and the season sample data, the method further comprises: inputting the season sample data into a seasonal autoregressive integrated moving average model; performing difference operation on the training sample data through the seasonal autoregressive integrated moving average model to obtain a stationary season sample sequence; model order determination is performed on the seasonal autoregressive integrated moving average model to obtain the season prediction model.
9. The method of claim 1, wherein, the container number is expanded or reduced according to the container load prediction data, comprising: in the case that the container prediction data reaches a preset expansion and reduction condition, the container number is expanded or reduced.
10. A device for adjusting a container, characterized in that application to a container orchestration server, the device comprises: an acquisition module configured to acquire container load data within a preset time period; a decomposition module configured to perform time series decomposition on the container load data according to a preset time window to obtain trend data, season data and residual data, the trend data representing a change trend of the container load data, the season data representing periodic fluctuation of the container load data, and the residual data representing random fluctuation of the container load data; a prediction module configured to input the trend data into a trend prediction model to obtain a trend prediction result, the trend prediction result representing predicted container load data of the container in a preset time period in which the change trend is presented. The prediction module is configured to input the seasonal term data into a seasonal prediction model to obtain a seasonal prediction result, the seasonal prediction result representing predicted container load data of the container in the preset time period and showing the periodic fluctuation; The smoothing calculation module is configured to perform smoothing calculation on the residual term data to obtain a residual term prediction result, the residual term prediction result representing predicted container load data of the container in the preset time period and showing the random fluctuation; The calculation module is configured to calculate container load prediction data according to the trend prediction result, the seasonal prediction result and the residual term prediction result. The adjustment module is configured to adjust the number of containers according to the container load prediction data.
11. An electronic device, comprising: The electronic device comprises a processor and a memory storing computer program instructions. The processor executes the computer program instructions to implement the method for adjusting the containers according to any one of claims 1-9.
12. A computer storage medium, characterized in that, The computer program instructions stored on the computer readable storage medium are executed by the processor to implement the method for adjusting the containers according to any one of claims 1-9.
13. A computer program product, characterised in that, The instructions in the computer program product are executed by the processor of the electronic device to enable the electronic device to implement the method for adjusting the containers according to any one of claims 1-9.