Container energy-saving elastic scaling method and system based on time series prediction and medium
By combining an LSTM time series prediction model and a server energy efficiency curve model, the latency problem of Kubernetes elastic scaling is solved, achieving efficient container resource management and energy efficiency optimization, meeting the scaling requirements of latency-sensitive applications, and reducing the power consumption of large server clusters.
Patent Information
- Application Number
- CN202410240656.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-04
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-03-04
AI Technical Summary
Existing Kubernetes elastic scaling methods suffer from latency in responding to changes in business container load, failing to meet the needs of latency-sensitive applications. Furthermore, traditional methods can only choose between horizontal or vertical scaling, resulting in low resource utilization and insufficient energy efficiency.
We use an LSTM time series forecasting model to predict future business loads, and combine horizontal and vertical scaling strategies. By constructing a server energy efficiency curve model, we select the most energy-efficient server for container scaling, thus anticipating changes in resource demand and optimizing server energy efficiency in advance.
It enables rapid response to changes in business container resource requests, improves resource utilization, reduces server resource fragmentation, significantly saves power consumption, and meets the scaling requirements of latency-sensitive applications.
Smart Images

Figure CN118260021B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of cloud computing technology and containers, and in particular to a method, system, and medium for energy-saving elastic expansion and contraction of containers based on time series prediction. Background Art
[0002] In recent years, the cloud computing sector has experienced rapid growth, and the scale of global data centers has continued to expand. Containers, as a lightweight virtualization technology, offer flexible deployment, fast startup, and increased resilience compared to virtual machines, making them widely used in cloud computing. Driven by the advancement of cloud computing and container technologies, traditional monolithic applications are gradually evolving towards microservices architectures. Consequently, many business or application functions are deployed in data centers using containers. Currently, Kubernetes is the most popular container orchestration framework, becoming the de facto standard for container management and orchestration. Kubernetes provides automated configuration, management, and orchestration of containers. Furthermore, due to the rapid startup and shutdown of containers, Kubernetes also offers automatic elastic scaling to accommodate changing resource demands from business containers.
[0003] Kubernetes supports both horizontal pod auto-scaling (HPA) and vertical pod auto-scaling (VPA) for containers. HPA, a responsive approach that determines scaling based on simple threshold policies, is significantly delayed by changes in business container load and cannot meet the scaling needs of latency-sensitive application containers. VPA uses a histogram combined with historical data to determine container resource limits, but this method requires redeploying containers, which is costly and can easily impact online business operations. Kubernetes officials stated in their design of the automatic scaling solution that a future goal is to enable both VPA and HPA mechanisms to run simultaneously, but a suitable approach has not yet been found, requiring only one or the other. Therefore, a more intelligent and rational approach is urgently needed to adapt to the automatic scaling requirements of cloud-native environments.
[0004] Large server clusters, such as those used for data centers, HPC systems, and supercomputers, incur enormous annual electricity costs. Analysis of server test data from the SPECpower_ssj2008 benchmark reveals that performance-to-power consumption ratios vary under varying load intensities, meaning energy efficiency gains vary. Furthermore, most servers do not achieve optimal energy efficiency at full load. By applying this knowledge to container elastic scaling, we can guide the placement of expanded container replicas on servers with the highest energy efficiency, ensuring that servers operate within a high energy efficiency range. This can significantly reduce electricity consumption in large server clusters. Summary of the Invention
[0005] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the existing technology, such as non-intelligent adaptation to changes in business container resource requirements, low resource utilization, and lack of utilization of server energy efficiency characteristics. The present invention provides a container energy-saving elastic scaling method, system, and medium based on time series prediction. The method uses an LSTM time series prediction model to predict business load data for a period of time in the future, so as to achieve the purpose of early perception of the changing trend of business container resource requests, perform elastic scaling operations in advance, solve the problem of delay-aware load changes caused by responsive elastic scaling methods, and meet the scaling requirements of delay-sensitive application containers. The present invention generates a business container scaling policy by combining horizontal scaling with vertical scaling, solving the problem that traditional scaling can only choose one of horizontal scaling or vertical scaling. Vertical scaling effectively reduces server resource fragmentation and improves resource utilization, while maintaining the characteristics of horizontal scaling to cope with changes in business container resource requirements. The present invention models the energy efficiency curve of the server and uses the server energy efficiency curve model to guide the placement of expansion container replicas on the optimal energy efficiency server, so that the server remains in a high energy efficiency range and can significantly save power consumption in large server clusters.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present invention provides a method for energy-saving elastic expansion and contraction of a container based on time series prediction, comprising the following steps:
[0008] Collect energy efficiency information of each server in the server cluster and build a cluster server energy efficiency information database;
[0009] Obtain the historical time series data of the business load deployed in the server cluster, build an LSTM time series prediction model, and train the LSTM time series prediction model based on the historical time series data of the business load to predict the business load forecast data for a period of time in the future;
[0010] Calculate an estimated amount of resource requests for vertical scaling of a business container replica based on historical business load time series data and real-time business load data; input the real-time business load data into a trained LSTM time series prediction model to predict business load forecast data for a period of time in the future, and use the business load forecast data as an estimated amount of resource requests for horizontal scaling of a business container; and generate a business container scaling strategy using a method that combines horizontal scaling and vertical scaling based on the estimated amount of resource requests for vertical scaling of a business container replica and the estimated amount of resource requests for horizontal scaling of a business container.
[0011] Based on the business container expansion and contraction strategy, a server with the best energy efficiency is selected according to the energy efficiency information of each server in the cluster server energy efficiency information library to perform business container expansion and contraction operations.
[0012] As a preferred technical solution, the energy efficiency information of each server in the server cluster is collected to build a cluster server energy efficiency information database, specifically:
[0013] Determine the server types in the server cluster. If the hardware configurations of two servers are exactly the same, they are of the same type; if the hardware configurations of two servers are different, they are not of the same type.
[0014] Use a unified load benchmark tool to benchmark each server type. The benchmark test needs to cover the full range of CPU utilization, from 0% to 100%. The CPU utilization is divided into predefined increments to create multiple test scenarios with different CPU utilization rates. During the benchmark test, the server's CPU utilization and the corresponding power consumption must be collected simultaneously.
[0015] The collected server CPU utilization and the corresponding whole machine power consumption are subjected to curve fitting by polynomial curve fitting to obtain a server energy efficiency curve model.
[0016] As a preferred technical solution, the LSTM time series prediction model is trained based on the historical time series data of the business load to predict the business load prediction data for a period of time in the future, specifically:
[0017] Collect resource usage of business containers deployed in the cluster at fixed time intervals less than or equal to T. Average the resource usage data collected within the time interval as a time series data. Traverse the collected data to obtain the historical time series data of business load.
[0018] Determine the input / output dimensions and hyperparameters of the LSTM time series prediction model based on the historical time series data of the business load and the required prediction accuracy.
[0019] The normalized business load historical time series data is used as training data for the LSTM time series prediction model, and the LSTM time series prediction model is trained to make the neural network of the LSTM time series prediction model converge, so as to predict the business load prediction data for a period of time in the future.
[0020] As an optimal technical solution, the LSTM time series prediction model is a recurrent neural network model based on long short-term memory.
[0021] As a preferred technical solution, the estimated amount of resource requests for vertical scaling of business container replicas is calculated based on the historical time series data of business load and the real-time business load data, specifically:
[0022] Set the initial value of the estimated resource request for vertical expansion of the business container replica to the initial resource quota requested by the business container replica;
[0023] At time intervals of T, real-time service load data is collected, and an updated estimated amount of service container replica vertical scaling resource requests is calculated based on the real-time service load data. The specific calculation formula for the updated estimated amount of service container replica vertical scaling resource requests is as follows:
[0024]
[0025] in, is the estimated amount of resource requests for vertical scaling of business container replicas, t is the number of iterative calculation rounds, is the resource usage of the latest copy of the business container copy collected at the current time point, and θ is the smoothing factor.
[0026] As a preferred technical solution, based on the estimated amount of resource requests for vertical scaling of the business container replicas and the estimated amount of resource requests for horizontal scaling of the business container, a method combining horizontal scaling and vertical scaling is used to generate a business container scaling strategy, specifically:
[0027] The business load prediction data is used as the estimated resource request R for horizontal scaling of the business container. hpa ;
[0028] According to the estimated resource request amount R of the business container horizontal expansion and contraction hpa , if R hpa If the resource quota of all copies of the current business container is greater than the resource quota of all copies of the current business container, a horizontal expansion strategy is generated, which is to increase the number of business container copies so that the resource quota of all copies of the business container exceeds R hpa , where the resource quota for increasing the business container replica is the estimated resource request for vertical scaling of the business container replica Multiply by the safety margin;
[0029] Maintain a sliding time window that covers multiple business container resource usage collection time points. If all business container resource usage within the sliding time window and R hpaIf both are smaller than the resource quotas of all replicas of the current business container, a horizontal scaling-in strategy is generated. The horizontal scaling-in strategy is to reduce the number of business container replicas so that the resource quotas of all business container replicas are reduced to the minimum value that exceeds the maximum value of the business container resource usage within the sliding time window. The method for reducing the number of business container replicas is to sort the business container replicas by startup time and iteratively select the oldest container replica for scaling down until the horizontal scaling-in condition is met.
[0030] As a preferred technical solution, the specific calculation formula for the resource quota of the business container copy is as follows:
[0031]
[0032] Among them, request pod is the resource quota of the business container copy, α is the safety margin coefficient, α is greater than zero, Estimated resource requests for scaling up and down business container replicas.
[0033] As a preferred technical solution, based on the business container expansion and contraction strategy, the server with the best energy efficiency is selected according to the energy efficiency information of each server in the cluster server energy efficiency information library to perform business container expansion and contraction operations, specifically:
[0034] When a horizontal expansion strategy is generated, the power consumption difference before and after placement is calculated by simulating the placement of expanded business container replicas based on the server energy efficiency curve model. The power consumption difference before and after placement is calculated for all servers that meet the resource quota requirements for placing business container replicas. The server with the smallest power consumption difference before and after placement is selected as the server to be scheduled. The power consumption difference before and after placement is calculated as follows:
[0035] ΔE i =f i (u cur +Δu)-f i (u cur )
[0036] Where i represents the i-th server, f i (·) represents the energy efficiency curve model of the i-th server, u cur Indicates the current utilization of the server CPU, Δu indicates the increased server CPU utilization after placing the expanded business container replica, ΔE i Indicates the difference in power consumption before and after the server where the business container replica resource quota is placed is placed;
[0037] When a horizontal scaling-in policy is generated, the business container replicas are sorted by startup time, and the oldest container replica is iteratively selected for scaling-in until the horizontal scaling-in conditions are met.
[0038] If the capacity expansion strategy executed is a horizontal capacity expansion strategy, the expanded business container copy is bound to the to-be-scheduled server.
[0039] In a second aspect, the present invention provides a container energy-saving elastic scaling system based on time series prediction, which is applied to the above-mentioned container energy-saving elastic scaling method based on time series prediction, including an energy efficiency information collection module, a business load prediction module, a horizontal and vertical container scaling module, and a scaling policy execution module;
[0040] The energy efficiency information collection module is used to collect energy efficiency information of each server in the server cluster and build a cluster server energy efficiency information database;
[0041] The business load prediction module is used to obtain the historical time series data of the business load deployed in the server cluster, build an LSTM time series prediction model, and train the LSTM time series prediction model based on the historical time series data of the business load to predict the business load prediction data for a period of time in the future;
[0042] The horizontal and vertical container scaling module is used to calculate an estimated amount of resource requests for vertical scaling of a business container replica based on historical business load time series data and real-time business load data; input the real-time business load data into a trained LSTM time series prediction model to predict business load forecast data for a period of time in the future, and use the business load forecast data as an estimated amount of resource requests for horizontal scaling of the business container; and based on the estimated amount of resource requests for vertical scaling of the business container replica and the estimated amount of resource requests for horizontal scaling of the business container, generate a business container scaling strategy using a method that combines horizontal scaling with vertical scaling;
[0043] The expansion / contraction policy execution module is configured to select a server with the best energy efficiency to perform expansion / contraction operations on the business container based on the business container expansion / contraction policy and the energy efficiency information of each server in the cluster server energy efficiency information library.
[0044] In a third aspect, the present invention provides an electronic device, wherein the electronic device comprises:
[0045] at least one processor; and,
[0046] a memory communicatively connected to the at least one processor; wherein,
[0047] The memory stores computer program instructions that can be executed by the at least one processor. The computer program instructions are executed by the at least one processor to enable the at least one processor to execute the container energy-saving elastic scaling method based on time series prediction.
[0048] In a fourth aspect, the present invention provides a computer-readable storage medium storing a program, characterized in that when the program is executed by a processor, the method for energy-saving elastic expansion and contraction of a container based on time series prediction is implemented.
[0049] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0050] (1) The present invention predicts the business load data for a period of time in the future through the LSTM time series prediction model, so as to achieve the purpose of perceiving the changing trend of business container resource requests in advance, perform elastic expansion operations in advance, solve the problem of delay-aware load changes caused by the responsive elastic expansion and contraction method, meet the expansion and contraction requirements of delay-sensitive application containers, and be able to quickly respond to the surge in business container resource requests, improve the QoS of the business, and reduce the service default rate.
[0051] (2) The present invention generates a business container scaling strategy by combining horizontal scaling with vertical scaling, solving the problem that traditional scaling can only choose one of horizontal scaling or vertical scaling. Vertical scaling effectively reduces server resource fragmentation and improves resource utilization, while maintaining the characteristics of horizontal scaling to cope with changes in business container resource requirements.
[0052] (3) The present invention models the energy efficiency curve of the server and uses the server energy efficiency curve model to guide the placement of expansion container replicas on the optimal energy efficiency server, so that the server can operate in a high energy efficiency range, which can significantly save the power consumption of large server clusters. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0054] Figure 1 This is a flow chart of a method for energy-saving elastic expansion and contraction of a container based on time series prediction according to the present invention;
[0055] Figure 2 A flow chart of an elastic scaling method combining horizontal and vertical scaling;
[0056] Figure 3 This is a schematic diagram of the framework of the elastic scaling method that combines horizontal scaling with vertical scaling.
[0057] Figure 4A schematic diagram of the process of selecting the optimal energy-efficient server and binding it to the Pod for capacity expansion based on the server energy efficiency curve model;
[0058] Figure 5 This is a schematic diagram of the structure of a container energy-saving elastic scaling system based on time series prediction;
[0059] Figure 6 Schematic diagram of the structure of the electronic device of the present invention. DETAILED DESCRIPTION
[0060] In order to enable those skilled in the art to better understand the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0061] In order to make the purpose, technical solutions and advantages of the present invention clearer, the following will take the Kubernetes container orchestration system as an example, and combine the drawings and embodiments to further explain in detail the method, system and medium for energy-saving elastic expansion and contraction of containers based on time series prediction of the present invention. It should be noted that the method, system and medium for energy-saving elastic expansion and contraction of containers based on time series prediction of the present invention do not rely on the Kubernetes container orchestration system, and can also be applied to other container orchestration systems. The described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0062] For the Kubernetes container orchestration system, a Pod is the smallest scheduling unit in Kubernetes. A Pod contains a group of containers. The Pod definition file contains quotas for various resources. When a Pod is scheduled to a node, the node must allocate resources according to the Pod's resource quota. A Deployment is responsible for the creation and operation of a group of Pods. It uses the ReplicaSet controller to control the number of replicas in the Deployment to adjust the number of Pods. A group of Pods under a Deployment belongs to the same set of business container replicas, meaning that a Deployment can be considered a business container group.
[0063] like Figure 1 As shown, a method for energy-saving elastic scaling of containers based on time series prediction in this embodiment includes the following steps:
[0064] S1: Collect energy efficiency information of each server in the server cluster and build a cluster server energy efficiency information database;
[0065] Furthermore, the specific steps for building a cluster server energy efficiency information database are as follows:
[0066] S1-1: Determine the server types in the server cluster. If two servers have identical hardware configurations, they are considered to be of the same type. If two servers have different hardware configurations, they are not considered to be of the same type. For example, servers of the same manufacturer and model can generally be considered to be of the same type because they have identical hardware configurations. Therefore, only one server needs to be selected to collect server energy efficiency information.
[0067] S1-2: Use SPECpower_ssj 2008 to benchmark each server type. During the test, the BMC system collects the server's real-time power consumption and simultaneously records the CPU utilization to generate server CPU utilization-power consumption data.
[0068] S1-3: The collected server CPU utilization-power consumption data is fitted with a 9th-order polynomial curve to obtain a server energy efficiency curve model.
[0069] S2: Obtain the historical time series data of the business deployment load deployed in the server cluster, build an LSTM time series prediction model, and train the LSTM time series prediction model based on the historical time series data of the business deployment load to predict the business deployment load data for a period of time in the future.
[0070] Furthermore, the specific steps of data collection and model training are as follows:
[0071] S2-1: Use tools such as MetricsServer and cAdvisor in the Kubernetes container orchestration engine to collect resource usage information for business deployments deployed in the cluster within 24 hours at a fixed interval of 15 seconds. This information is then stored in the Prometheus time series database. The resource usage data collected within this interval is averaged at 5-minute intervals as a time series data item. This collected data is then traversed to obtain the historical time series data of the business deployment's load.
[0072] S2-2: Determine the input / output dimensions and hyperparameters of the LSTM time series prediction model based on the historical time series data of the business deployment load and the required prediction accuracy.
[0073] S2-3: Use the normalized and preprocessed historical time series data of the business deployment load as training data for the LSTM time series prediction model, train the LSTM time series prediction model, and make the neural network of the LSTM time series prediction model converge to predict the business load forecast data for a period of time in the future; the LSTM time series prediction model is a recurrent neural network model based on long short-term memory.
[0074] S3: Use a heuristic recursive calculation method to calculate the estimated amount of vertical scaling resource requests for the business Pod based on the business Deployment's historical load time series data and the business Deployment's real-time load data.
[0075] Furthermore, the step S3 specifically includes:
[0076] S3-1: Set the initial value of the service Pod's vertical scaling resource request estimate to the Pod initial value in the Deployment definition file;
[0077] S3-2: Collect the real-time load data of the newly deployed Pod under the business Deployment at 15-second intervals. Calculate the updated estimated vertical scaling resource request amount of the business Pod based on the real-time load data of the Pod. The specific calculation formula for the updated estimated vertical scaling resource request amount of the business Pod is as follows:
[0078]
[0079] in, is the estimated amount of resource requests for vertical expansion of the business Pod, t is the iterative calculation round, The resource usage of the latest deployed Pod under the business Deployment collected at the current time point, and θ is the smoothing factor.
[0080] S4: Based on the LSTM time series prediction model, the service deployment load forecast data for the future period is predicted based on the real-time load data of the service deployment. Combined with the estimated vertical scaling resource request of the service pod, a service container scaling strategy is generated using a method that combines horizontal scaling and vertical scaling.
[0081] like Figure 2 、 Figure 3 As shown, a method combining horizontal scaling and vertical scaling to generate a business container scaling strategy includes the following specific steps:
[0082] S4-1: Based on the LSTM time series prediction model, the business deployment load situation in the next time step is predicted according to the business deployment real-time load data. The business deployment load prediction data is used as the estimated amount of resource request R for horizontal expansion of the business deployment. hpa ;
[0083] S4-2: Scale out the estimated resource request R for the service deployment described in step S4-1 hpa , if R hpa If the total resource application amount of all Pods under the current business Deployment is greater than R, a horizontal expansion strategy is generated. The horizontal expansion strategy is to increase the number of Pod copies under the business Deployment so that the total resource application amount of all Pods under the business Deployment exceeds R hpa , where the resource request for adding Pod replicas is the estimated resource request for vertical scaling of the business Pod Multiply by the safety margin, the specific calculation formula is as follows:
[0084]
[0085] Among them, request pod is the resource request amount for the Pod replica, α is the safety margin coefficient, α is greater than zero, and is generally set to [0.2, 1.0];
[0086] Maintain a sliding time window with a width of 5 minutes. The time point of business Deployment resource usage within 5 minutes will be recorded. The collection time is once every 15 seconds. If the usage of all business Deployment resources in the sliding time window and R hpa If both are less than the resource application amount of the current business Deployment, a horizontal scaling-in strategy is generated. The horizontal scaling-in strategy is to reduce the number of Pod copies in the business Deployment so that the resource application amount of all Pod copies of the business Deployment is reduced to the minimum value that exceeds the maximum value of the business container resource usage within the sliding time window. The method for reducing the number of Pod copies is to sort the Pod copies by startup time and iteratively select the oldest Pod copy for scaling down until the horizontal scaling-in conditions are met.
[0087] S5: Selecting a server with optimal energy efficiency to perform business deployment expansion and contraction operations based on the energy efficiency information of each server in the cluster server energy efficiency information database.
[0088] like Figure 4As shown in the figure, the specific steps for selecting the server with the best energy efficiency to perform business deployment expansion and contraction operations based on the energy efficiency information of each server are as follows:
[0089] S5-1: If a horizontal expansion strategy is generated in step S4-2, the power consumption difference before and after placement is calculated by simulating the placement of the expanded Pod replica according to the server energy efficiency curve model described in step S1-3. The power consumption difference before and after placement of all servers that meet the Pod replica resource quota requirements is calculated, and the server with the smallest power consumption difference before and after placement is selected as the server to be scheduled. The power consumption difference before and after placement is calculated as follows:
[0090] ΔE i =f i (u cur +Δu)-f i (u cur )
[0091] Where i represents the i-th server, f i (·) represents the energy efficiency curve model of the i-th server, u cur Indicates the current utilization of the server CPU, Δu indicates the increased server CPU utilization after placing the expanded Pod replica, and ΔE i Indicates the difference in power consumption before and after the server where the Pod replica resource request is placed.
[0092] If a horizontal scaling-in strategy is generated in step S4-2, the Pod replicas are sorted by startup time, and the oldest Pod replica is iteratively selected for scaling down until the horizontal scaling-in conditions are met.
[0093] S5-2: If the scaling strategy executed in step S5-1 is a horizontal scaling strategy, the expanded Pod replica is bound to the server to be scheduled.
[0094] The present invention uses the LSTM time series prediction model to predict business load data for a period of time in the future, so as to achieve the purpose of perceiving the changing trend of business container resource requests in advance, perform elastic expansion operations in advance, solve the problem of delay-aware load changes caused by responsive elastic expansion and contraction methods, meet the expansion and contraction requirements of delay-sensitive application containers, and can quickly respond to the surge in business container resource requests, improve business QoS, and reduce service default rates.
[0095] It should be noted that, for the sake of convenience, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited to the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously.
[0096] Based on the same concept as the container energy-saving elastic scaling method based on time series prediction in the above-mentioned embodiment, the present invention also provides a container energy-saving elastic scaling system based on time series prediction, which can be used to execute the above-mentioned container energy-saving elastic scaling method based on time series prediction. For ease of explanation, the structural diagram of the embodiment of the container energy-saving elastic scaling system based on time series prediction only shows the parts related to the embodiment of the present invention. Those skilled in the art will understand that the illustrated structure does not constitute a limitation of the device, and it may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0097] See also Figure 5 In another embodiment of the present application, a container energy-saving elastic scaling system 100 based on time series prediction is provided. The system includes an energy efficiency information collection module 101, a service load prediction module 102, a horizontal and vertical container scaling module 103, and a scaling policy execution module 104.
[0098] The energy efficiency information collection module 101 is used to collect energy efficiency information of each server in the server cluster and build a cluster server energy efficiency information database;
[0099] The service load prediction module 102 is used to obtain the historical time series data of the service load deployed in the server cluster, build an LSTM time series prediction model, and train the LSTM time series prediction model based on the historical time series data of the service load to predict the service load prediction data for a period of time in the future;
[0100] The horizontal and vertical container scaling module 103 is configured to calculate an estimated amount of resource requests for vertical scaling of a business container replica based on historical business load time series data and real-time business load data; input the real-time business load data into a trained LSTM time series prediction model to predict business load forecast data for a period of time in the future, and use the business load forecast data as an estimated amount of resource requests for horizontal scaling of the business container; and generate a business container scaling strategy using a method that combines horizontal scaling and vertical scaling based on the estimated amount of resource requests for vertical scaling of the business container replica and the estimated amount of resource requests for horizontal scaling of the business container.
[0101] The expansion / contraction policy execution module 104 is configured to select a server with the best energy efficiency to perform expansion / contraction operations on the business container based on the business container expansion / contraction policy and the energy efficiency information of each server in the cluster server energy efficiency information database.
[0102] It should be noted that the container energy-saving elastic scaling system based on time series prediction of the present invention corresponds one-to-one to the container energy-saving elastic scaling method based on time series prediction of the present invention. The technical features and beneficial effects described in the above-mentioned embodiment of the container energy-saving elastic scaling method based on time series prediction are applicable to the embodiment of the container energy-saving elastic scaling method based on time series prediction. For specific contents, please refer to the description in the embodiment of the method of the present invention. No further details will be given here. This is hereby declared.
[0103] In addition, in the implementation of the energy-saving and elastic scaling system for containers based on time series prediction in the above-mentioned embodiment, the logical division of each program module is only an example. In actual applications, the above-mentioned functions can be assigned to different program modules as needed, for example, for the convenience of corresponding hardware configuration requirements or software implementation. That is, the internal structure of the energy-saving and elastic scaling system for containers based on time series prediction is divided into different program modules to complete all or part of the functions described above.
[0104] See also Figure 6 In one embodiment, an electronic device is provided for implementing a method for elastically scaling container capacity based on time series prediction and energy conservation. The electronic device 200 may include a first processor 201, a first memory 202, and a bus. It may also include a computer program stored in the first memory 202 and executable on the first processor 201, such as a program 203 for elastically scaling container capacity based on time series prediction and energy conservation.
[0105] The first memory 202 includes at least one type of readable storage medium, including flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the first memory 202 can be an internal storage unit of the electronic device 200, such as a mobile hard disk of the electronic device 200. In other embodiments, the first memory 202 can also be an external storage device of the electronic device 200, such as a plug-in mobile hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 200. Furthermore, the first memory 202 can also include both an internal storage unit of the electronic device 200 and an external storage device. The first memory 202 can not only be used to store application software and various types of data installed on the electronic device 200, such as the code of the container energy-saving elastic scaling program 203 based on time series prediction, but can also be used to temporarily store data that has been output or is about to be output.
[0106] In some embodiments, the first processor 201 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including a combination of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The first processor 201 is the control core (Control Unit) of the electronic device, connecting the various components of the entire electronic device using various interfaces and lines, and executing or executing programs or modules stored in the first memory 202, as well as calling data stored in the first memory 202, to perform various functions of the electronic device 200 and process data.
[0107] Figure 6 Only the electronic device with components is shown, and it can be understood by those skilled in the art that Figure 6 The structure shown does not constitute a limitation on the electronic device 200 , and the electronic device 200 may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0108] The container energy-saving elastic scaling program 203 based on time series prediction stored in the first memory 202 of the electronic device 200 is a combination of multiple instructions. When executed in the first processor 201, it can achieve the following:
[0109] Collect energy efficiency information of each server in the server cluster and build a cluster server energy efficiency information database;
[0110] Obtain the historical time series data of the business load deployed in the server cluster, build an LSTM time series prediction model, and train the LSTM time series prediction model based on the historical time series data of the business load to predict the business load forecast data for a period of time in the future;
[0111] Calculate an estimated amount of resource requests for vertical scaling of a business container replica based on historical business load time series data and real-time business load data; input the real-time business load data into a trained LSTM time series prediction model to predict business load forecast data for a period of time in the future, and use the business load forecast data as an estimated amount of resource requests for horizontal scaling of a business container; and generate a business container scaling strategy using a method that combines horizontal scaling and vertical scaling based on the estimated amount of resource requests for vertical scaling of a business container replica and the estimated amount of resource requests for horizontal scaling of a business container.
[0112] Based on the business container expansion and contraction strategy, a server with the best energy efficiency is selected according to the energy efficiency information of each server in the cluster server energy efficiency information library to perform business container expansion and contraction operations.
[0113] Furthermore, if the modules / units integrated in the electronic device 200 are implemented as software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium. The computer-readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0114] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0115] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0116] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be considered as equivalent replacement methods and are included in the scope of protection of the present invention.
Claims
1. A container energy-saving elastic expansion and contraction method based on time series prediction, characterized in that: The following steps are involved: Determine the server types in the server cluster, where if the hardware configurations of two servers are exactly the same, they belong to the same type of server; if the hardware configurations of the two servers are different, they do not belong to the same type of server; use a unified load benchmark tool to benchmark each type of server, where the benchmark test needs to cover the full range of CPU utilization from 0% to 100%, divide the CPU utilization by set increments, and obtain multiple test scenarios with different CPU utilization; during the benchmark test process, it is necessary to synchronously collect the server CPU utilization and the corresponding whole machine power consumption; perform curve fitting on the collected server CPU utilization and the corresponding whole machine power consumption through polynomial curve fitting to obtain a server energy efficiency curve model; Obtain historical time series data of business loads deployed in the server cluster, build an LSTM time series prediction model, and train the LSTM time series prediction model based on the historical time series data of business loads; The estimated resource request amount for vertical scaling of the business container replica is set to the initial resource quota requested by the business container replica. Real-time business load data is collected at time intervals of T, and an updated estimated resource request amount for vertical scaling of the business container replica is calculated based on the real-time business load data. The specific calculation formula for updating the estimated resource request amount for vertical scaling of the business container replica is as follows: ; in, Estimated resource requests for scaling up and down business container replicas, t is the iterative calculation round, The resource usage of the latest copy of the business container copy collected at the current time point, θ is the smoothing factor; Input the real-time business load data into the trained LSTM time series prediction model to predict the business load forecast data for a period of time in the future; use the business load forecast data as the estimated amount of resource requests for horizontal expansion and contraction of the business container. If the estimated amount of resource requests for horizontal expansion and contraction of the business container is greater than the resource quota of all copies of the current business container, a horizontal expansion strategy is generated. The horizontal expansion strategy is to increase the number of business container copies so that the resource quota of all copies of the business container exceeds the estimated amount of resource requests for horizontal expansion and contraction of the business container, where the resource quota of the increased business container copy is the estimated amount of resource requests for vertical expansion and contraction of the business container copy. Multiply by the safety margin; Maintain a sliding time window that covers multiple business container resource usage collection time points. If the resource usage of all business containers within the sliding time window and the estimated resource requests for horizontal expansion and contraction of the business container are both less than the resource quotas of all replicas of the current business container, generate a horizontal scaling strategy. The horizontal scaling strategy is to reduce the number of business container replicas so that the resource quotas of all business container replicas are reduced to a minimum value that exceeds the maximum value of the business container resource usage within the sliding time window. The method for reducing the number of business container replicas is to sort the business container replicas by startup time and iteratively select the oldest container replica for scaling down until the horizontal scaling conditions are met. When a horizontal expansion strategy is generated, the power consumption difference before and after placement is calculated by simulating the placement of expanded business container replicas based on the server energy efficiency curve model. The power consumption difference before and after placement is calculated for all servers that meet the resource quota requirements for placing business container replicas. The server with the smallest power consumption difference before and after placement is selected as the server to be scheduled. When a horizontal scaling-in policy is generated, the business container replicas are sorted by startup time, and the oldest container replica is iteratively selected for scaling-in until the horizontal scaling-in conditions are met. If the capacity expansion strategy executed is a horizontal capacity expansion strategy, the expanded business container copy is bound to the to-be-scheduled server.
2. The method for energy-saving and elastic expansion and contraction of containers based on time series prediction according to claim 1 is characterized in that: The LSTM time series prediction model is trained according to the business load historical time series data, specifically: Less than or equal to T The resource usage of the business containers deployed in the cluster is collected at fixed time intervals within a period of time, and the T The resource usage data collected within the time interval is averaged as a time series data, and the collected data is traversed to obtain the business load historical time series data; Determine the input / output dimensions and hyperparameters of the LSTM time series prediction model based on the historical time series data of the business load and the required prediction accuracy. Using the normalized business load historical time series data as training data for the LSTM time series prediction model, training the LSTM time series prediction model to converge the neural network of the LSTM time series prediction model, and using it to predict business load forecast data for a period of time in the future; The LSTM time series prediction model is a recurrent neural network model based on long short-term memory.
3. The method for energy-saving elastic expansion and contraction of containers based on time series prediction according to claim 1 is characterized in that: The specific calculation formula for the resource quota of the business container copy is as follows: ; in, The resource quota for the business container replica. α is the safety margin factor, α Greater than zero.
4. A container energy-saving elastic expansion and contraction system based on time series prediction, characterized in that: It includes an energy efficiency information collection module, a business load prediction module, a horizontal and vertical container scaling module, and a scaling strategy execution module; The energy efficiency information collection module is used to determine the server types in the server cluster, wherein if the hardware configurations of two servers are exactly the same, they belong to the same type of server; if the hardware configurations of the two servers are different, they do not belong to the same type of server; a unified load benchmark tool is used to benchmark each type of server, wherein the benchmark test needs to cover the full range of CPU utilization from 0% to 100%, and the CPU utilization is divided into set increments to obtain multiple test scenarios with different CPU utilization; during the benchmark test process, the server CPU utilization and the corresponding whole machine power consumption need to be collected synchronously; the collected server CPU utilization and the corresponding whole machine power consumption are curve-fitted by polynomial curve fitting to obtain a server energy efficiency curve model; The business load prediction module is used to obtain the historical time series data of the business load deployed in the server cluster, build an LSTM time series prediction model, and train the LSTM time series prediction model based on the historical time series data of the business load; The horizontal and vertical container scaling module is used to set the initial value of the estimated resource request for vertical scaling of the business container replica to the initial resource quota requested by the business container replica; collect real-time business load data at time intervals of T, and calculate an updated estimated resource request for vertical scaling of the business container replica based on the real-time business load data. The specific calculation formula for updating the estimated resource request for vertical scaling of the business container replica is as follows: ; in, Estimated resource requests for scaling up and down business container replicas, t is the iterative calculation round, The resource usage of the latest copy of the business container copy collected at the current time point, θ is the smoothing factor; Input the real-time business load data into the trained LSTM time series prediction model to predict the business load forecast data for a period of time in the future; use the business load forecast data as the estimated amount of resource requests for horizontal expansion and contraction of the business container. If the estimated amount of resource requests for horizontal expansion and contraction of the business container is greater than the resource quota of all copies of the current business container, a horizontal expansion strategy is generated. The horizontal expansion strategy is to increase the number of business container copies so that the resource quota of all copies of the business container exceeds the estimated amount of resource requests for horizontal expansion and contraction of the business container, where the resource quota of the increased business container copy is the estimated amount of resource requests for vertical expansion and contraction of the business container copy. Multiply by the safety margin; The scaling policy execution module is used to maintain a sliding time window, which covers multiple business container resource usage collection time points. If the resource usage of all business containers in the sliding time window and the estimated horizontal scaling resource requests of the business containers are less than the resource quotas of all copies of the current business container, a horizontal scaling policy is generated. The horizontal scaling policy is to reduce the number of business container copies so that the resource quotas of all business container copies are reduced to a minimum value that exceeds the maximum value of the business container resource usage in the sliding time window. The method for reducing the number of business container copies is to sort the business container copies by startup time and iteratively select the oldest container copy for scaling until the horizontal scaling condition is met; When a horizontal expansion strategy is generated, the power consumption difference before and after placement is calculated by simulating the placement of expanded business container replicas based on the server energy efficiency curve model. The power consumption difference before and after placement is calculated for all servers that meet the resource quota requirements for placing business container replicas. The server with the smallest power consumption difference before and after placement is selected as the server to be scheduled. When a horizontal scaling-in policy is generated, the business container replicas are sorted by startup time, and the oldest container replica is iteratively selected for scaling-in until the horizontal scaling-in conditions are met. If the capacity expansion strategy executed is a horizontal capacity expansion strategy, the expanded business container copy is bound to the to-be-scheduled server.
5. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the container energy-saving elastic scaling method based on time series prediction as described in any one of claims 1 to 3.
6. A computer-readable storage medium storing a program, characterized in that: When the program is executed by a processor, the container energy-saving elastic scaling method based on time series prediction according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Container resource elastic pre-scaling method based on application operation load data prediction
CN113722108A
Method for balanced scale out of resources in distributed and collaborative container platform environment
US20210149745A1