Method, device and computer storage medium for controlling container resources
By acquiring time-series runtime data to identify traffic cycle characteristics, generating capacity profiles, and performing container resource scaling operations, the problem of low resource utilization in cloud-native applications is solved, enabling on-demand elastic adjustment, saving costs, and ensuring service quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-27
- Publication Date
- 2026-03-20
AI Technical Summary
Existing technologies cannot effectively solve the problems of low resource utilization and severe redundancy in cloud-native applications, especially in application scenarios where traffic changes periodically. They cannot achieve elastic scaling operations at the second level, resulting in resource waste and a decline in service quality.
By acquiring time-series operational data, identifying traffic cycle characteristics, generating capacity profiles, and performing container resource scaling operations based on traffic prediction data, on-demand elastic adjustments can be achieved.
It effectively improves resource utilization, saves costs, and ensures service quality without causing a decline in service quality, thus enhancing the practicality of the method.
Smart Images

Figure CN113886010B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and particularly relates to a container resource control method and device and computer storage medium. BACKGROUND
[0002] With the development and popularization of cloud native technology, container virtualization technology provides a more lightweight, simple, efficient and controllable resource pooling method for users. Moreover, with the continuous updating of the above technology, applications with cloud native architecture can maximize the use of cloud services and improve the software continuous delivery capability.
[0003] For large cloud data centers providing basic infrastructure for cloud native applications, due to the limitations of resource heterogeneity, software and hardware configuration diversity, complex management rules, application openness, mixed deployment of multiple types of loads and other service side factors, as well as the uneven distribution of user access to cloud services in time and space, the resource utilization is generally low and the redundancy is serious. SUMMARY
[0004] The embodiments of the present application provide a container resource control method, device and computer storage medium, which can realize on-demand scaling operation for time series running data with traffic periodic characteristics, save resource cost, and will not cause the decline of service quality.
[0005] In a first aspect, the embodiments of the present application provide a container resource control method, comprising:
[0006] obtaining time series running data to be analyzed;
[0007] when the time series running data has traffic periodic characteristics, obtaining a traffic running period corresponding to the time series running data;
[0008] generating a capacity image based on the traffic running period and the time series running data;
[0009] determining traffic prediction data corresponding to the time series running data based on the capacity image;
[0010] performing scaling operation on container resources used for analyzing and processing the time series running data based on the traffic prediction data.
[0011] In a second aspect, the embodiments of the present application provide a container resource control device, comprising:
[0012] a first obtaining module configured to obtain time series running data to be analyzed;
[0013] The first obtaining module is further configured to obtain a traffic running period corresponding to the time-series running data when the time-series running data has a traffic period characteristic.
[0014] The first generating module is configured to generate a capacity profile based on the traffic running period and the time-series running data.
[0015] The first processing module is configured to determine traffic prediction data corresponding to the time-series running data based on the capacity profile.
[0016] The first processing module is configured to perform scale-in or scale-out operation on a container resource used for analyzing and processing the time-series running data based on the traffic prediction data.
[0017] In a third aspect, an electronic device is provided, including a memory and a processor, wherein the memory is configured to store one or more computer instructions, and the one or more computer instructions are configured to implement the container resource control method in the first aspect when executed by the processor.
[0018] In a fourth aspect, a computer storage medium is provided, configured to store a computer program, and the computer program is configured to implement the container resource control method in the first aspect when executed by a computer.
[0019] In a fifth aspect, a computer program product is provided, including a computer readable storage medium storing computer instructions, and the computer instructions are configured to cause one or more processors to perform the steps of the container resource control method in the first aspect when executed by the one or more processors.
[0020] In a sixth aspect, a container resource control method is provided, including:
[0021] In response to a control request of a container resource, determining a processing resource corresponding to a control service of the container resource;
[0022] Using the processing resource to perform the following steps: obtaining time-series running data to be analyzed; obtaining a traffic running period corresponding to the time-series running data when the time-series running data has a traffic period characteristic; generating a capacity profile based on the traffic running period and the time-series running data; determining traffic prediction data corresponding to the time-series running data based on the capacity profile; and performing scale-in or scale-out operation on a container resource used for analyzing and processing the time-series running data based on the traffic prediction data.
[0023] In a seventh aspect, a container resource control device is provided, including:
[0024] The second determining module is configured to determine, in response to a control request for invoking a container resource, a processing resource corresponding to a control service of the container resource.
[0025] The second processing module is configured to perform the following steps by using the processing resource: obtaining time-series running data to be analyzed; when the time-series running data has a traffic cycle characteristic, obtaining a traffic running cycle corresponding to the time-series running data; generating a capacity image based on the traffic running cycle and the time-series running data; determining traffic prediction data corresponding to the time-series running data based on the capacity image; and performing a scale operation on a container resource used for analyzing and processing the time-series running data based on the traffic prediction data.
[0026] In an eighth aspect, an electronic device is provided, including a memory and a processor, wherein the memory is configured to store one or more computer instructions, and the one or more computer instructions are configured to implement the container resource control method in the sixth aspect when executed by the processor.
[0027] In a ninth aspect, a computer storage medium is provided, configured to store a computer program, and the computer program is configured to implement the container resource control method in the sixth aspect when executed by a computer.
[0028] In a tenth aspect, a computer program product is provided, including a computer readable storage medium storing computer instructions, and the computer instructions are configured to cause one or more processors to perform the steps in the container resource control method in the sixth aspect when executed by the one or more processors.
[0029] The technical scheme provided by the embodiments of the present application, by obtaining time-series running data, when the time-series running data has a traffic cycle characteristic, obtaining a traffic running cycle corresponding to the time-series running data, and then generating a capacity image based on the traffic running cycle and the time-series running data, and then determining traffic prediction data corresponding to the time-series running data based on the capacity image, the traffic prediction data can include next cycle predicted traffic corresponding to the time-series running data, and based on the traffic prediction data, performing a scale operation on a container resource used for data processing operation, effectively realizing the time-series running data with traffic cycle characteristic, generating a capacity image based on the traffic running cycle, and performing an elastic scale operation on the container resource based on the generated capacity image, not only effectively realizing the on-demand scale operation, saving resource cost, and not causing the decline of service quality, ensuring the practicability of the control method, and being beneficial to the market promotion and application. BRIEF DESCRIPTION OF DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the accompanying drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained based on these drawings without creative labor.
[0031] Figure 1 A structural schematic diagram of a container resource control system provided by an embodiment of the present application;
[0032] Figure 2 A scenario schematic diagram of a container resource control method provided by an embodiment of the present application;
[0033] Figure 3 A flow schematic diagram of a container resource control method provided by an embodiment of the present application;
[0034] Figure 4 A flow schematic diagram of another container resource control method provided by an embodiment of the present application;
[0035] Figure 5 A flow schematic diagram of determining at least one scaling node for implementing a scaling operation provided by an embodiment of the present application;
[0036] Figure 6 A flow schematic diagram of performing a scaling operation on a container resource corresponding to the timing operation data based on the capacity profile provided by an embodiment of the present application;
[0037] Figure 7 A flow schematic diagram of another container resource control method provided by an embodiment of the present application;
[0038] Figure 8 A flow schematic diagram of a container resource control method provided by an application embodiment of the present application;
[0039] Figure 9 A schematic diagram of predicting QPS timing data provided by an application embodiment of the present application Figure 1 ;
[0040] Figure 10 A schematic diagram of predicting QPS timing data provided by an application embodiment of the present application Figure 2 ;
[0041] Figure 11 A schematic diagram of predicting QPS timing data provided by an application embodiment of the present application Figure 3 ;
[0042] Figure 12A schematic diagram of Gaussian distribution fitting of single-instance QPS time series data provided for the application embodiments;
[0043] Figure 13 A schematic diagram of solving a shortest path based on a DAG provided for the application embodiments Figure 1 ;
[0044] Figure 14 A schematic diagram of solving a shortest path based on a DAG provided for the application embodiments Figure 2 ;
[0045] Figure 15 A schematic diagram of a capacity profile provided for the application embodiments;
[0046] Figure 16 A schematic diagram of a flow of another container resource control method provided for the application embodiments;
[0047] Figure 17 A schematic diagram of a structure of a container resource control apparatus provided for the application embodiments;
[0048] Figure 18 A schematic diagram of a structure of an electronic device corresponding to the container resource control apparatus shown in Figure 17 ;
[0049] Figure 19 A schematic diagram of a structure of another container resource control apparatus provided for the application embodiments;
[0050] Figure 20 A schematic diagram of a structure of an electronic device corresponding to the container resource control apparatus shown in Figure 19 . DETAILED DESCRIPTION
[0051] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0052] The terms used in the embodiments of the present application are merely for the purpose of describing the specific embodiments, and are not intended to limit the present application. The singular forms "a", "an" and "the" used in the embodiments of the present application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise. "Plural" generally includes at least two, but does not exclude the case of including at least one.
[0053] It should be understood that the term "and / or" as used herein merely describes an associated relationship between associated objects, and can represent three relationships, for example, A and / or B can represent three cases of A alone, A and B together, and B alone. In addition, the character " / " herein generally represents an "or" relationship between the front and rear associated objects.
[0054] Depending on the context, the word "if" as used herein can be interpreted as meaning "when" or "while" or "in response to determining" or "in response to detecting". Similarly, depending on the context, the phrase "if it is determined" or "if (a stated condition or event) is detected" can be interpreted as meaning "when it is determined" or "in response to determining" or "when (a stated condition or event) is detected" or "in response to detecting (a stated condition or event)".
[0055] It should also be noted that the terms "comprising", "including", or any other variant thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such product or system. Without more limitations, the element defined by the phrase "comprising a" does not exclude the presence of additional identical elements in the product or system comprising the element.
[0056] In addition, the step sequence in each of the following method embodiments is only an example, and is not strictly limited.
[0057] In order to facilitate those skilled in the art to understand the technical solutions provided by the embodiments of the present application, the related art is described as follows:
[0058] With the development and popularization of cloud native technology, container virtualization technology provides users with a more lightweight, simple, efficient and controllable resource pooling method. Moreover, with the continuous updating of the above technology, applications with cloud native architecture can maximize the use of cloud services and improve the software continuous delivery capability.
[0059] For large cloud data centers providing infrastructure for cloud-native applications, due to the limitations of resource heterogeneity, software and hardware configuration diversity, complex management rules, application openness, mixed deployment of multiple types of loads, and other service-side factors, as well as the uneven distribution of user access to cloud services in time and space, the resource utilization is generally low and the redundancy is serious.
[0060] According to relevant research, the resource utilization rate of the mainstream data center is only between 6% and 12%. Specifically, in the process of application running, most application traffic is affected by people's production and life, and can show obvious characteristics such as peak and valley, periodicity, trend, etc. For example, there are lunch and evening peaks in the take-out application, and there are morning and evening check-in peaks in the office application. The daily traffic of the e-commerce application is more than three times the trough, and some applications such as live video applications may cause traffic to surge due to a sudden event. These online long-life cycle applications are mostly latency-sensitive (LC) applications, at this time, the container runtime needs to support real-time interaction, fast response, and low response time (RT), and a slight delay will cause a significant decline in service feeling.
[0061] Specifically, since the existing applications are mostly implemented in Java language and based on Spring framework, the cold start needs to go through the processes of Spring startup, plug-in loading, middleware initialization, instance (Bean) initialization, etc. In addition, the sandbox cold start needs to parse configuration files, allocate virtual resources, mount the root file system, initialize the guest kernel, and it takes several minutes from the creation of the container to the provision of services to the outside, therefore, the prior art cannot achieve the operation of elastic expansion and contraction in seconds. In addition, in order to avoid violating the service level agreement (SLA) and causing RT jitter, the container instances can be deployed based on the resource allocation mode of over-provisioning, and these applications can long hold the underlying physical and network resources. However, in a large-scale scenario, this can easily lead to low resource utilization and cause a serious cost burden.
[0062] To solve the above technical problems, the related art provides a resource management method which mainly aims to solve the resource redundancy problem of random access memory (RAM) and central processing unit (CPU) from the perspective of vertical scaling. The implementation principle is to use the ratio between the load statistics observed in a period of time and the target load as the expansion coefficient, then calculate the reasonable replica number based on the expansion coefficient, and then adjust the limit value corresponding to the core processor / the limit value corresponding to the memory based on the reasonable replica number. However, due to the limitation of host resources, the above method is mainly applicable to large-scale jobs and is stretched by several days. For most traffic-driven, delay-sensitive and slow-starting applications, the above implementation method is difficult to meet the scene requirements. If the expansion time is long, sudden traffic surge can easily cause system failure, causing economic, reputation and other losses. Therefore, a single vertical expansion and contraction operation cannot meet the normal data processing requirements.
[0063] To solve the above technical problems, the present embodiment provides a container resource control method, device and computer storage medium. The technical solution is suitable for the scene of applications lacking in elasticity, can effectively exert the elasticity of cloud resources, and optimizes resource supply on the premise of guaranteeing the current quality of service (QoS) without loss. The execution subject of the container resource control method is a container resource control system. Referring to the container resource control system shown in the accompanying drawings, the container resource control system can include: Figure 1
[0064] Data node: including a data collection component Walle and one or more container sets Pod;
[0065] The data collection component is used to collect kernel indicators of the data node, the container set and the container level. The kernel indicators can include CPU utilization, memory utilization, etc. After obtaining the kernel indicators, the kernel indicators can be converted into time sequence indicators, i.e. combining the indicator collection time and the indicator value to obtain the time sequence indicators. After obtaining the time sequence indicators, the time sequence indicators can be actively uploaded to the collection container included in the container set.
[0066] The container set is a basic operation unit and a carrier of the application, and can include one or more closely related containers. Specifically, the container set in the embodiment can include a collection container and an application container container. The collection container determines the traffic prediction data corresponding to the time series running data. The application container corresponds to an application program, such as a social application container, an e-commerce application container, and the like. It can be understood that different application programs can correspond to different application containers, and the same application program can correspond to one or more application containers. The collection container can take log information as a data source, collect all kernel indicators and application indicators in the data node, and specifically, the collection container can obtain application indicators through the application container. The application indicators can include Query Per Second (QPS), and specifically, the kernel indicators can be obtained through a data collection component. In addition, the collection container can be deployed together with the application container.
[0067] The time series database TSDB obtains and stores various indicators obtained through the data node in the format of time series, to perform persistent storage on the indicators. The implementation of the time series database can be a Prometheus database or an InfluxDB database.
[0068] The capacity image generation component is configured to obtain time series running data from the time series database, and generate a capacity image based on the time series running data. Specifically, after obtaining the time series running data, a periodic identification operation can be performed on the time series running data. When the time series running data has a traffic period characteristic, a traffic running period corresponding to the time series running data can be identified. A traffic prediction operation is performed based on the traffic running period, to obtain predicted traffic of the next period. Then, the query rate per second of each instance is determined, and a capacity image is generated based on the query rate per second and the predicted traffic of the next period. The capacity image includes the predicted traffic of the next period corresponding to the time series running data.
[0069] The capacity changing component is a horizontal elasticity component for a preset cluster, and is used as an executor of a capacity image to change the number of replicas controlled in a stateful set. Specifically, the number of replicas that need to be scaled can be determined by parameters in the capacity image, and then the number of replicas is transmitted to a distributed storage component (for example, a distributed storage system ETCD, a Hadoop distributed file system HDFS, etc.) through an API service interface, so that the distributed storage component adjusts resource state parameters based on the obtained number of replicas. The distributed storage system ETCD is a distributed configuration storage that saves full state information of various resource objects in the cluster. The distributed file system HDFS is suitable for the demand of high data throughput for large data sets on commercial hardware. Specifically, a pod resource request can be generated to realize the adjustment or change operation of the number of replicas. Then, the distributed storage component realizes the scaling operation through the API service interface and a scheduling component Scheduler. Specifically, the scheduling component can place the pod to a suitable computing node according to the pod resource request generated by the distributed storage component and the cluster running status. After the scaling operation is realized, the instance number in the state set can be updated correspondingly.
[0070] The API service interface provides a unique operation entrance of the resource object, and other components can operate resource data through the API service interface to complete real-time data processing operations such as full query, incremental update and change listening of the resource concerned. The state set StatefulSet is used to deploy corresponding data applications and can control the application instance number to maintain at a target value. Specifically, the state set can obtain the corresponding instance number from the distributed storage component through the API interface, and when the instance number changes, the corresponding instance scaling operation can be performed based on the changed instance number.
[0071] The technical scheme provided by the embodiment can analyze the collected time series traffic data offline, and determine whether there is a clear periodicity based on the traffic characteristic law. For the application with periodicity, an active elastic scaling strategy is used. Specifically, a capacity image can be generated based on the traffic running period corresponding to the time series traffic data. The capacity image includes the predicted next-period traffic corresponding to the time series running data. Then, the container resources corresponding to the time series running data can be scaled based on the capacity image. In this way, the elastic scaling operation is realized on demand, resource cost is saved, service quality is not reduced, and the practicability of the method is further improved.
[0072] The container resource control method, device and computer storage medium provided by various embodiments of the present application will be specifically described below through an exemplary application scenario.
[0073] Figure 2 A scenario schematic diagram of the container resource control method provided by an embodiment of the present application is shown in FIG. 1. Figure 3 A flowchart of the container resource control method provided by an embodiment of the present application is shown in FIG. 2. Figures 2-3 As shown in the figure, the embodiment provides a container resource control method, and the execution subject of the method can be a container resource control device. It can be understood that the container resource control device can be implemented as software or a combination of software and hardware. In a specific application, the container resource control device can be carried on a server, and the container resource control method can include the following steps.
[0074] Step S301: obtaining time-series running data to be analyzed.
[0075] Step S302: when the time-series running data has a traffic cycle characteristic, obtaining a traffic running cycle corresponding to the time-series running data.
[0076] Step S303: generating a capacity profile based on the traffic running cycle and the time-series running data.
[0077] Step S304: determining traffic prediction data corresponding to the time-series running data based on the capacity profile.
[0078] Step S305: performing a capacity expansion or contraction operation on a container resource used for analyzing and processing the time-series running data based on the traffic prediction data.
[0079] The various steps described above will be described in detail as follows:
[0080] Step S301: obtaining time-series running data to be analyzed.
[0081] The time-series running data to be analyzed refers to running data corresponding to an application and needing traffic characteristic analysis, and the time-series running data includes running data sorted in time sequence. It can be understood that different applications can correspond to different time-series running data, and the time-series running data obtained in different application scenarios can be different.
[0082] In addition, the specific implementation of obtaining the time series running data to be analyzed is not limited in the embodiment, and can be set according to a specific application scenario or application requirement by a person skilled in the art. For example, the time series running data to be analyzed can be stored in a time series database, and the time series running data to be analyzed can be obtained by accessing the time series database. Alternatively, the container resource control apparatus can be communicatively connected with a data acquisition unit, the data acquisition unit can acquire the time series running data corresponding to the application program, and after the time series running data is acquired, the time series running data can be sent to the container resource control apparatus, so that the container resource control apparatus can obtain the time series running data to be analyzed.
[0083] In some examples, obtaining the time series running data to be analyzed can include: obtaining original time series running data; and performing downsampling processing on the original time series running data to obtain the time series running data.
[0084] Specifically, during the running of an application program, original time series running data can be obtained, and the original time series running data can include thousands of running data. At this time, if the original time series running data is directly analyzed and processed, a large amount of data processing resources will be required, and the data processing time will be long. Therefore, in order to ensure the quality and efficiency of data processing and reduce the data amount of data processing, after the original time series running data is obtained, the original time series running data can be subjected to downsampling processing, so that the time series running data subjected to downsampling processing can be obtained. The data amount of the time series running data is far less than the data amount corresponding to the original time series running data, which is beneficial to improving the quality and efficiency of data processing.
[0085] In order to ensure the quality and efficiency of the downsampling processing operation on the original time series running data, the downsampling processing on the original time series running data to obtain the time series running data can include: obtaining a sampling period for performing downsampling operation on the original time series running data; and performing downsampling processing on the time series running data based on the sampling period to obtain the time series running data.
[0086] In the process of downsampling the original time series running data, since the container resource expansion and contraction operation does not need to be performed in real time, the sampling period for downsampling the original time series running data can be obtained, which can be a time window of a preset time period, for example, a time window of 5s, a time window of 10s, or a time window of 15s, etc. Then, the time series running data is downsampled based on the sampling period. Specifically, the time window determined above can be used to slide on the original time series running data, and then the maximum value of the data included in each window is obtained, which is taken as the current window value. Since the collected original time series running data may include abnormal collection values, determining the maximum value of the data as the current window value not only has the effect of data denoising, but also can reduce the error rate of data prediction in the process of flow prediction, further ensuring the accuracy and reliability of the expansion and contraction operation of the container resource.
[0087] Of course, those skilled in the art can also use other ways to obtain the time series running data to be analyzed, as long as the accuracy and reliability of obtaining the time series running data to be analyzed can be ensured, which will not be described here.
[0088] Step S302: When the time series running data has a flow period characteristic, a flow running period corresponding to the time series running data is obtained.
[0089] After obtaining the time series running data, it can be detected whether the time series running data has a flow period characteristic, which means that the running flow corresponding to the application program changes periodically. When the time series running data has a flow period characteristic, a flow running period corresponding to the time series running data can be obtained. In some examples, obtaining a flow running period corresponding to the time series running data can include: obtaining a power spectral density corresponding to the time series running data; determining a local maximum value corresponding to the time series running data based on the power spectral density; and determining a flow period corresponding to the time series running data based on the local maximum value.
[0090] Specifically, after obtaining the time series running data, the time series running data can be subjected to spectral analysis processing to obtain a power spectral density; after obtaining the power spectral density, the power spectral density can be subjected to analysis processing, so that a local maximum value corresponding to the time series running data can be determined. It can be understood that the number of the local maximum value can be one or more, and generally, a first local maximum value can be obtained; and then the reciprocal of the local maximum value is determined as the flow period. For example, one or more local maximum values are obtained as f1, f2 and f3, the first local maximum value f1 is determined as a target local maximum value corresponding to the power spectral density, and then the target local maximum value 1 / f1 is determined as the flow period T, so as to effectively ensure the accuracy and reliability of determining the flow period corresponding to the time series running data.
[0091] Step S303: generating a capacity image based on the flow running period and the time series running data.
[0092] After obtaining the flow running period, the flow running period and the time series running data can be subjected to analysis processing to generate a capacity image. The capacity image can refer to reflecting or identifying the flow characteristics or flow data of an application during the running of the application. In some examples, generating the capacity image based on the flow running period and the time series running data can include determining a running characteristic value corresponding to the time series running data; and generating a capacity image corresponding to the time series running data based on the flow running period and the running characteristic value.
[0093] After obtaining the time series running data, the time series running data can be subjected to analysis processing to determine a running characteristic value corresponding to the time series running data. The running characteristic value can include an average value of QPS, a variance value of QPS, etc. Specifically, the time series running data can be subjected to analysis processing by using the central limit theorem to determine the average value of QPS and the variance value of QPS. After obtaining the flow running period and the running characteristic value, the flow running period and the running characteristic value can be subjected to analysis processing to generate a capacity image corresponding to the time series running data. In some examples, the flow running period and the running characteristic value can be input into a pre-trained network model, and the capacity image corresponding to the time series running data can be obtained through the network model, so as to ensure the quality and effect of the capacity image generation.
[0094] Step S304: determining flow prediction data corresponding to the time series running data based on the capacity image.
[0095] After obtaining the capacity image, the capacity image can be analyzed and processed to determine the traffic prediction data corresponding to the time-series operation data. The traffic prediction data can include the next period prediction traffic, the next two period prediction traffic, and the like corresponding to the time-series operation data. In some examples, determining the traffic prediction data corresponding to the time-series operation data based on the capacity image can include: obtaining a machine learning model for analyzing and processing the capacity image, inputting the capacity image into the machine learning model, and thus obtaining the traffic prediction data corresponding to the time-series operation data. In other examples, determining the traffic prediction data corresponding to the time-series operation data based on the capacity image can include: obtaining a preset rule for analyzing and processing the capacity image, and analyzing and processing the capacity image based on the preset rule to determine the traffic prediction data corresponding to the time-series operation data.
[0096] Step S305: based on the traffic prediction data, performing the scaling operation on the container resources for analyzing and processing the time-series operation data.
[0097] After obtaining the traffic prediction data, the container resources for analyzing and processing the time-series operation data can be scaled based on the traffic prediction data. In some examples, the scaling operation on the container resources for analyzing and processing the time-series operation data based on the traffic prediction data can include: based on the traffic prediction data, obtaining the expected container resources corresponding to the next period of the time-series operation data; determining at least one scaling node for implementing the scaling operation; and performing the scaling operation based on the expected container resources and the at least one scaling node.
[0098] Specifically, after obtaining the traffic prediction data, the next period prediction traffic data corresponding to the time-series operation data can be obtained based on the traffic prediction data, and the next period prediction traffic data is converted into resource information, so that the expected container resources corresponding to the next period of the time-series operation data can be obtained, which is the target container resource obtained by estimation to ensure the stability of data processing. Then, at least one scaling node for implementing the scaling operation is determined, and after obtaining the expected container resources and the at least one scaling node, the scaling operation can be performed based on the expected container resources and the at least one scaling node. In some examples, the scaling operation based on the expected container resources and the at least one scaling node can include: obtaining the maximum number of replicas of the at least one scaling node within the scaling period; and performing the scaling operation based on the expected container resources and the maximum number of replicas.
[0099] For the expansion and contraction node, different copy numbers can be corresponded at different time, and different expansion and contraction nodes can correspond to different copy numbers. In order to ensure the quality and efficiency of data processing, when the expansion and contraction operation is performed, the maximum copy number of at least one expansion and contraction node in the expansion and contraction time period can be obtained, and the expansion and contraction time period can be the interval time formed by two expansion and contraction operations. After obtaining the maximum copy number, the expansion and contraction operation can be performed based on the expected container resource and the maximum copy number, and specifically, the maximum copy number of the expansion and contraction node can be always below the expected container resource, so that various traffic surges and traffic reductions can be coped with, so that the data processing cost can be reduced while maintaining the stability of data processing.
[0100] The container resource control method provided by the embodiment can obtain time sequence running data, when the time sequence running data has traffic cycle characteristics, obtain a traffic running cycle corresponding to the time sequence running data, then generate a capacity image based on the traffic running cycle and the time sequence running data, then determine traffic prediction data corresponding to the time sequence running data based on the capacity image, the traffic prediction data can include next cycle predicted traffic corresponding to the time sequence running data, and the container resource used for data processing operation is expanded and contracted based on the traffic prediction data, which effectively realizes the time sequence running data with traffic cycle characteristics, generates a capacity image based on the traffic running cycle, and performs elastic expansion and contraction operation on the container resource based on the generated capacity image. Not only the expansion and contraction operation is effectively realized on demand, the resource cost is saved, and the service quality is not reduced, but also the practicability of the control method is ensured, which is beneficial to the promotion and application in the market.
[0101] Figure 4 Another flowchart of the container resource control method provided by the embodiment of the present application is shown in FIG. 8. Figure 4 After obtaining the time sequence running data to be analyzed, the method in the embodiment can further include:
[0102] Step S401: Obtain the power spectral density corresponding to the time sequence running data.
[0103] Step S402: Based on the power spectral density, detect whether the time sequence running data has traffic cycle characteristics.
[0104] After the time series operation data is acquired, the time series operation data can be subjected to spectrum analysis processing, so that the power spectrum density corresponding to the time series operation data can be acquired, and then the power spectrum density can be analyzed and processed to detect whether the time series operation data has the flow periodicity characteristic. In some examples, based on the power spectrum density, detecting whether the time series operation data has the flow periodicity characteristic can include: based on the power spectrum density, acquiring a spectrum density region in a preset frequency range; based on the detection result, determining whether the time series operation data has the flow periodicity characteristic.
[0105] Specifically, since the frequency range corresponding to the power spectrum density is wide, and when detecting whether the time series operation data has the flow periodicity characteristic, it is not necessary to analyze and process the data of all frequency ranges, therefore, in order to improve the quality and efficiency of detecting the time series operation data and reduce the resource of data processing, after the power spectrum density is acquired, the spectrum density region in the preset frequency range can be acquired. The preset frequency range can be a frequency range that needs to be concerned and is pre-configured, and the specific frequency range can be set based on the specific application scenario. In some examples, the preset frequency range can refer to the frequency range corresponding to 0 to 10 DB, and then the spectrum density region corresponding to 0 to 10 DB can be acquired.
[0106] After the spectrum density region is acquired, whether there is a local maximum value in the spectrum density region can be detected, and then based on the detection result, whether the time series operation data has the flow periodicity characteristic can be determined. In some examples, based on the detection result, determining whether the time series operation data has the flow periodicity characteristic can include: when there is a local maximum value, it is determined that the time series operation data has the flow periodicity characteristic; and when there is no local maximum value, it is determined that the time series operation data does not have the flow periodicity characteristic.
[0107] When the detection result of the time series operation data is that there is a local maximum value, it is determined that the time series operation data has the flow periodicity characteristic; and when there is no local maximum value, it is determined that the time series operation data does not have the flow periodicity characteristic, so that the detection operation of whether the time series operation data has the flow periodicity characteristic is effectively realized.
[0108] In yet some examples, based on the detection result, detecting whether the time series operation data has the flow periodicity characteristic can include: when there is a local maximum value, acquiring time series prediction data corresponding to the time series operation data; and based on the time series prediction data, detecting whether the time series operation data has the flow periodicity characteristic.
[0109] When the detection result of the time series running data is that there is a local maximum value, it indicates that the time series running data is more likely to have the traffic periodicity characteristic. In order to further determine whether the time series running data has the traffic periodicity characteristic, time series prediction data corresponding to the time series running data can be obtained. In some examples, obtaining the time series prediction data corresponding to the time series running data can include: obtaining at least one network model for time series prediction of the time series running data; and predicting the time series running data by using the at least one network model to obtain at least one time series prediction data corresponding to the at least one network model.
[0110] Specifically, after obtaining the time series running data, at least one network model for time series prediction of the time series running data can be obtained. In some examples, the at least one network model can include at least one of the following: a gradient boosting tree model LightGBM, a neural network LSTM, a linear model ARIMA, and other models capable of time series prediction. After obtaining the at least one network model, the time series running data can be predicted by using the at least one network model. Specifically, the time series running data can be input into the at least one network model, so that at least one time series prediction data output by the at least one network model can be obtained. The time series prediction data includes data traffic required for the next period corresponding to the time series running data.
[0111] After obtaining the at least one time series prediction data, the at least one time series prediction data can be analyzed and processed to detect whether the time series running data has the traffic periodicity characteristic. In some examples, based on the time series prediction data, detecting whether the time series running data has the traffic periodicity characteristic can include: obtaining a minimum error corresponding to the at least one time series prediction data; when the minimum error is less than or equal to a preset threshold, it is determined that the time series running data has the traffic periodicity characteristic; and when the minimum error is greater than the preset threshold, it is determined that the time series running data does not have the traffic periodicity characteristic.
[0112] Specifically, after obtaining the at least one time series prediction data, error information corresponding to each time series prediction data can be obtained. The error information can be a mean absolute percentage error MAPE. Specifically, the MAPE can be implemented by the following formula, Then, a minimum error is determined from all the error information, so that the minimum error corresponding to the at least one time series prediction data is effectively obtained. The minimum error can be a minimum mean absolute percentage error value MAPE.
[0113] After the minimum error is obtained, the minimum error can be compared with the preset threshold. When the minimum error is less than or equal to the preset threshold, it is indicated that the error corresponding to the time series prediction data obtained based on the time series running data is small, and then it can be determined that the time series running data has the flow periodicity characteristic. When the minimum error is greater than the preset threshold, it is indicated that the error corresponding to the time series prediction data obtained based on the time series running data is large, and then it can be determined that the time series running data does not have the flow periodicity characteristic, thereby effectively improving the accuracy and reliability of detecting whether the time series running data has the flow periodicity characteristic.
[0114] In this embodiment, by obtaining the power spectral density corresponding to the time series running data, and then detecting whether the time series running data has the flow periodicity characteristic based on the power spectral density, the detection of whether the time series running data has the flow periodicity characteristic is effectively realized, thereby ensuring the accuracy and reliability of controlling the container resources.
[0115] Figure 5 The flowchart for determining at least one scaling node for implementing the scaling operation is provided in the embodiments of the present application. Based on the above embodiments, referring to FIG. 8, the embodiments provide an implementation manner for determining at least one scaling node for implementing the scaling operation. Specifically, the determination of at least one scaling node for implementing the scaling operation in the embodiments can include: Figure 5 The flowchart for determining at least one scaling node for implementing the scaling operation is provided in the embodiments of the present application. Based on the above embodiments, referring to FIG. 8, the embodiments provide an implementation manner for determining at least one scaling node for implementing the scaling operation. Specifically, the determination of at least one scaling node for implementing the scaling operation in the embodiments can include:
[0116] Step S501: Obtain the scaling times for implementing the scaling operation.
[0117] Step S502: Determine at least one scaling node for implementing the scaling operation based on the scaling times.
[0118] When the container resources are scaled, the scaling operation cannot be performed in real time. Therefore, in order to ensure the quality and efficiency of the scaling operation, the scaling times for implementing the scaling operation can be obtained. Specifically, different scaling times can be configured according to application scenarios and design requirements, for example, the scaling times can be 3, 4 or 5, etc. After the scaling times are obtained, at least one scaling node for implementing the scaling operation can be determined based on the scaling times. In some examples, determining at least one scaling node for implementing the scaling operation can include: obtaining all current container nodes corresponding to the time series running data; determining the shortest path corresponding to all current container nodes based on the directed acyclic graph under the constraint of the scaling times; and determining at least one scaling node for implementing the scaling operation based on the shortest path.
[0119] After obtaining the timing running data, the timing running data can be analyzed and processed to determine all current container nodes corresponding to the timing running data, and then based on the constraint of the number of scaling operations, the shortest path corresponding to the current all container nodes is determined based on the directed acyclic graph. Specifically, all paths corresponding to the current all container nodes can be obtained based on the directed acyclic graph, and then all paths are analyzed and compared to select the shortest path corresponding to the current all container nodes. After obtaining the shortest path, at least one scaling node for implementing the scaling operation can be determined based on the shortest path, further ensuring the accuracy and reliability of determining the scaling node.
[0120] In the embodiment, the number of scaling operations for implementing the scaling operation is obtained, and then at least one scaling node for implementing the scaling operation is determined based on the number of scaling operations, thereby effectively realizing the accuracy and reliability of determining the at least one scaling node, and further ensuring the quality and efficiency of the scaling operation of the container resource.
[0121] Figure 6 The flowchart provided by the embodiment of the present application for performing the scaling operation on the container resource based on the capacity image for analyzing and processing the timing running data; based on the above-mentioned embodiment, referring to the attached Figure 6 As shown in the figure, in order to further reduce the elasticity risk of the scaling operation, the embodiment provides an implementation manner of performing the scaling operation on the container resource based on the traffic prediction data for analyzing and processing the timing running data. Specifically, the implementation manner of performing the scaling operation on the container resource based on the traffic prediction data for analyzing and processing the timing running data in the embodiment can include:
[0122] Step S601: obtaining time information for implementing the scaling operation.
[0123] Step S602: performing the scaling operation on the container resource corresponding to the timing running data in advance based on the time information and the traffic prediction data; and / or, performing the scaling operation on the container resource corresponding to the timing running data in lag based on the time information and the traffic prediction data.
[0124] In the process of scaling the container resources for analyzing and processing the time series running data, in order to ensure the quality and efficiency of the scaling operation, the time information for the scaling operation is configured in advance, which can be 30 minutes, 1 hour, 1.5 hours, etc., and the configured time information can be stored in a preset area, and the time information for implementing the scaling operation can be obtained by accessing the preset area. After obtaining the time information and the capacity image, the container resources corresponding to the time series running data can be scaled based on the time information and the traffic prediction data. Specifically, the scaling of the container resources corresponding to the time series running data based on the time information and the traffic prediction data can include: performing the scaling operation in advance on the container resources corresponding to the time series running data based on the time information and the traffic prediction data; and / or, performing the scaling operation in lag on the container resources corresponding to the time series running data based on the time information and the traffic prediction data.
[0125] In the embodiment, by obtaining the time information for implementing the scaling operation, the container resources can be scaled in advance when the scaling operation is needed, and the container resources can be scaled in lag when the scaling operation is needed, so that the scaling operation is performed on demand, the resource cost is saved, and the quality of service is not reduced, further ensuring the practicability of the control method.
[0126] Figure 7 Another flowchart of a container resource control method provided by the embodiment of the application is provided. Figure 7 The method in the embodiment can further include:
[0127] Step S701: When the time series running data does not have traffic periodicity, obtaining the current running characteristics and the current number of replicas corresponding to the time series running data.
[0128] When the result of analyzing and processing the time series running data is that the time series running data does not have traffic periodicity, the container resources corresponding to the time series running data can be passively scaled, specifically, in order to implement the passive scaling operation, the time series running data can be analyzed and processed to obtain the current running characteristics and the current number of replicas corresponding to the time series running data, the current running characteristics can include: QPS, CPU utilization, memory utilization, etc.
[0129] Step S702: Based on the current running characteristics and the current number of replicas, determining the target number of replicas corresponding to the time series running data.
[0130] After the current running feature and the current replica number are acquired, the current running feature and the current replica number can be analyzed and processed to determine the target replica number corresponding to the time-series running data. In some examples, based on the current running feature and the current replica number, determining the target replica number corresponding to the time-series running data can include: acquiring an expected running feature corresponding to the current running feature; based on the current running feature, the expected running feature and the current replica number, determining the target replica number corresponding to the time-series running data.
[0131] Specifically, the expected running feature corresponding to the current running feature is pre-configured. Since the target replica number is related to the expected running feature, in order to accurately determine the target replica number corresponding to the time-series running data, the expected running feature corresponding to the current running feature can be acquired, and then the current running feature, the expected running feature and the current replica number are analyzed and processed to determine the target replica number corresponding to the time-series running data. In some examples, the target replica number = ceil[current replica number*(current running feature / expected running feature)], wherein ceil is a ceiling function, thereby effectively ensuring the accuracy and reliability of determining the target replica number.
[0132] Step S703: based on the target replica number, performing scaling operation on the container resource used for analyzing and processing the time-series running data.
[0133] After the target replica number is acquired, the container resource corresponding to the time-series running data can be scaled based on the target replica number. In some examples, based on the target replica number, performing scaling operation on the container resource used for analyzing and processing the time-series running data can include: when the target replica number is greater than the current replica number, then based on the target replica number, performing scaling operation on the container resource corresponding to the time-series running data. When the target replica number is less than the current replica number, acquiring a scaling rate used for scaling operation on the container resource corresponding to the time-series running data; based on the scaling rate and the target replica number, performing scaling operation on the container resource corresponding to the time-series running data.
[0134] Specifically, after obtaining the target copy number, the target copy number and the current copy number can be analyzed and compared. When the target copy number is the same as the current copy number, no adjustment operation is needed for the container resource. When the target copy number is greater than the current copy number, it means that the container resource corresponding to the current copy number cannot meet the demand of data processing, and therefore, the container resource corresponding to the time series running data needs to be expanded based on the target copy number. When the target copy number is less than the current copy number, it means that the container resource corresponding to the current copy number not only meets the demand of data processing, but also has a redundant container resource, and therefore, the container resource corresponding to the time series running data needs to be shrunk based on the target copy number.
[0135] In order to ensure the quality and efficiency of the shrink operation of the container resource corresponding to the time series running data, a shrink rate for the shrink operation of the container resource corresponding to the time series running data can be obtained. Specifically, the shrink rate can include any one of the following information to identify: the number of containers for each shrink operation, the percentage of each shrink operation not exceeding the current copy number. The shrink step of the shrink operation of the container resource corresponding to the time series running data is controlled by the shrink rate, which effectively ensures that the shrink operation can be slow or gradual, thereby facilitating the improvement of the quality and efficiency of data processing. It can be understood that different application scenarios can correspond to different shrink rates.
[0136] After obtaining the shrink rate, the container resource corresponding to the time series running data can be shrunk based on the shrink rate and the target copy number. In some examples, the shrink operation of the container resource corresponding to the time series running data based on the shrink rate and the target copy number can include: determining the target container that needs to be shrunk based on the shrink rate and the target copy number; performing a shrink operation on the target container and storing the target container after the shrink operation in a preset area; recording the time information of storing the target container in the preset area; and when the time information is greater than or equal to a set time threshold, the target container in the preset area is cleared.
[0137] Specifically, in order to avoid the data processing risk caused by the shrink operation, after obtaining the shrink rate and the target number of replicas, the shrink rate and the target number of replicas can be analyzed and processed to determine the target container that needs to be operated. The target container is the container that needs to be operated / removed. After obtaining the target container, the shrink operation can be performed on the target container, and the target container after the shrink operation can be stored in a preset area. Then, the timer records the time information of storing the target container in the preset area. The time information can be compared with the set time threshold. When the time information is less than the set time threshold, it means that the target container after the shrink operation is stored in the preset area for a short time. At this time, there is still a possibility of calling the target container. In order to facilitate the calling operation of the target container at any time, the target container can continue to be stored in the preset area. When the time information is greater than or equal to the set time threshold, it means that the target container after the shrink operation is stored in the set area for a long time. At this time, the possibility of calling the target container is small. Therefore, the target container in the preset area can be cleared.
[0138] In this embodiment, when the time series running data does not have the flow period characteristic, the current running feature and the current number of replicas corresponding to the time series running data are obtained, and then the target number of replicas is determined according to the current running feature and the current number of replicas, and then the expansion and shrink operation is realized based on the target number of replicas. Specifically, when the expansion and shrink operation is performed, the target container that needs to be operated is temporarily stored in a preset area, so that the target container after the shrink operation will not be immediately cleared, but the time information of storing the target container is counted by a timer, and then a silent period is entered. After waiting for a period of time, it is confirmed that the load index is always normal, and then it is cleared. Otherwise, the target container after the shrink operation will be activated immediately through the preset area, and the activated target container can be used to accept the flow and perform corresponding data processing operation, further improving the flexibility and reliability of the method.
[0139] In specific application, refer to the attached Figure 8As shown, the application embodiment provides a container resource control method, which is suitable for the scenario of lacking elastic capability application, can realize active expansion and contraction operation for periodic application, passive expansion and contraction operation for non-periodic application, and specifically, the active expansion and contraction operation refers to actively performing expansion and contraction operation based on the traffic periodicity of the application. The passive expansion and contraction operation refers to obtaining real-time running indexes of data, and when the real-time running indexes reach a preset threshold, expansion and contraction operation can be performed. For periodic application, the control method can guide the application to perform standby operation in advance, which can not only guarantee that QoS does not decrease, but also effectively control resource cost, thereby improving the efficiency of resource allocation. Specifically, the control method can include the following steps:
[0140] Step 1: Obtain QPS time series data.
[0141] Step 2: Downsample the QPS time series data to obtain sampled data.
[0142] The data amount of QPS time series data is often large, therefore, in order to improve the quality and efficiency of data processing, the QPS time series data collected by the detection component can be downsampled. Since there is no need to perform expansion and contraction operation in real time, a preset time window can be used for sliding, for example, a 5-minute time window can be used for sliding. It can be understood that the preset time length can be configured according to the specific application scenario or application requirement. In some examples, the size of the time window can be automatically adjusted based on the data amount corresponding to the QPS time series data, for example, the larger the data amount corresponding to the QPS time series data, the longer the time window; the smaller the data amount corresponding to the QPS time series data, the shorter the time window. It can be understood that the larger the time window, the more conservative the resource estimation corresponding to the QPS time series data.
[0143] In addition, when sliding in a preset time window, since all the data collected in each window is not necessarily a real value or a normal value, in order to perform noise reduction processing on the data, the maximum QPS value of each window can be obtained, and the maximum QPS value is taken as the current window value. This not only has the effect of noise reduction, but also has a certain risk control effect on traffic prediction.
[0144] Step 3: Analyze and process the QPS time series data to detect whether the QPS time series data has a significant periodicity.
[0145] Specifically, for applications with significant traffic periodicity, an active elasticity strategy can be adopted, and for applications without significant traffic periodicity, a passive elasticity strategy can be adopted. Therefore, in order to accurately control the container resources corresponding to the time series data, the QPS time series data can be analyzed and processed to detect whether the QPS time series data can be subjected to periodic extraction operation. The operation can include: an autoregressive model can be fitted based on Akaike Information Criterion (AIC) to obtain the power spectral density corresponding to the time series running data. In the main frequency component, for example, in the frequency range corresponding to 0-10 dB, if the power spectral density has a (local) maximum value at frequency f, it indicates that the QPS time series data has significant periodicity, and T = 1 / f can be determined as the running period corresponding to the QPS time series data. If the power spectral density does not have a (local) maximum value at f, it is determined that the QPS time series data does not have significant periodicity, and thus the QPS time series data cannot be subjected to periodic extraction operation.
[0146] Step 4: for applications with significant periodicity, time series prediction is performed on the QPS time series data.
[0147] Specifically, for applications with significant periodicity, a plurality of models can be used to perform time series prediction operation on the QPS time series data, the plurality of models are used to predict the next period running data corresponding to the QPS time series data, and the frameworks of the plurality of models are different. The present embodiment takes the use of three models to perform prediction operation on the QPS time series data as an example, at this time, the Light Gradient Boosting Machine (LightGBM), the neural network-Long Short-Term Memory (LSTM) and the linear model-Autoregressive Integrated Moving Average model (ARIMA) can be respectively used to perform time series prediction on the QPS time series data, so as to obtain the prediction result 1 corresponding to the LightGBM, the prediction result 2 corresponding to the neural network LSTM and the prediction result 3 corresponding to the linear model ARIMA, respectively. Specifically, Figure 9 、 Figure 10 and Figure 11The prediction results of the next period corresponding to the QPS time series data of the same application online are respectively shown by the three types of network models. In order to reduce the risk of time series prediction deviation, the embodiment can give an upper limit value of the prediction result under different confidence intervals. When the upper limit value under a certain confidence can cover more than 95% of the true value, the prediction result under the current confidence is taken as the model output.
[0148] Then, the MAPE index 1 corresponding to the LightGBM model, the MAPE index 2 corresponding to the LSTM model, and the MAPE index 3 corresponding to the ARIMA model can be obtained. The above MAPE index can be obtained by the following formula: The MAPE index 1 is used to identify the running error of the gradient boosting tree model LightGBM, the MAPE index 2 is used to identify the running error of the neural network LSTM, and the MAPE index 3 is used to identify the running error of the linear model ARIMA. It can be understood that the smaller the MAPE index, the higher the data processing quality and accuracy of the model.
[0149] After obtaining the above three MAPE indexes, the model with the smallest MAPE index can be selected as the prediction model for time series prediction operation of the QPS time series data, and the prediction result output by the prediction model can be taken as the running period feature corresponding to the QPS time series data. It should be noted that if the smallest MAPE index is still greater than or equal to the preset threshold, for example, the smallest MAPE index is greater than or equal to 0.3, it means that the data running error of the network model with the smallest error in the three network models is still large, at this time, the capacity image can be refused to be generated, and then the QPS time series data can be determined as not having traffic period characteristics, and the QPS time series data is passively scaled operation.
[0150] Step 5: For the application with traffic period characteristics, determine the single-instance serviceable QPS.
[0151] For applications with traffic periodic characteristics, active expansion and contraction operations can be used. Specifically, runtime data of a time period with high load performance can be selected as the analysis object. In general, since the resources required by the application program are higher during the day, the QPS time series data corresponding to the daytime period can be selected as the analysis object. By statistically analyzing the single-instance QPS data, a Gaussian distribution can be approximately fitted according to the central limit theorem. Based on the 3σ principle, some "abnormal points" are removed by fitting the Gaussian distribution. The correlation value μ+3σ between the QPS average value u and the QPS variance value σ is used as the single-instance serviceable QPS value. The single-instance serviceable QPS value is within the data set range and is verified in the real environment. Then, based on the single-instance serviceable QPS value, data processing requests can be uniformly routed to each application instance, thereby realizing data balancing operations. Therefore, the single-instance serviceable QPS obtained by the above method will not violate the SLA, as shown in Figure 12 FIG. 6 is a schematic diagram of Gaussian distribution fitting of single-instance QPS time series data of an online application.
[0152] Step 6: Based on the single-instance QPS time series data and the traffic law of the next period corresponding to the QPS time series data determined by the network model, a capacity portrait is generated.
[0153] Step 7: Based on the capacity portrait, traffic prediction data corresponding to the time series running data is determined. The traffic prediction data can include predicted traffic of the next period corresponding to the time series running data.
[0154] Based on the determined traffic law of the next period and the two prior conditions of single-instance serviceable QPS (mean and variance), the traffic data can be converted into resource data. Then, under the limitation of the number of expansion and contraction times in a period, the cumulative minimum number of instances is used as the optimization target, thereby converting the determination problem of the expansion and contraction node into a dynamic programming problem. Specifically, the expansion and contraction points that need to be expanded and contracted can be solved based on a directed acyclic graph (DAG). Taking four times of expansion and contraction times as an example, the capacity portrait generation process in this embodiment is as follows:
[0155] Step a) Define the number of instances required at each time. According to the periodicity, m is different. Taking one day as an example: if the original record is every minute, then m = 1440; if it is every hour, then m = 24.
[0156] L i = [a1, a2, …, a m ]
[0157] Wherein, L i is the sequence of the number of copies; a m is the number of copies of the mth time period.
[0158] Step b) defines the optimization target, the minimum cumulative number of instances in a day, where n is the number of scaling times:
[0159]
[0160] wherein, is the number of replicas corresponding to the scaling partition b1, b i A scaling partition corresponding to the number of scaling times n.
[0161] Step c) searches for the shortest path based on the DAG under the constraint of the number of scaling times n.
[0162] Step c1) Shortest walking path: from the starting point 0 to the end point M, the entire path contains at most n links, n represents the number of scaling times;
[0163] Step c2) Under the constraint of at most n links, the shortest path from point i (i∈[0, 1, …, M]) to the end point M is the minimum number of instances;
[0164] Step c3) d i,j : the maximum number of instances from i to j, i.e., max([a i , …, a j ]);
[0165] Step c4) recursively update record until the minimum;
[0166] Step c5) initial condition:
[0167] The following is an example of scaling 3 times a day, L_i = [a1, a2, …, a4], and the solving process is shown in Figures 13-14 The following relationships can be obtained from the above figure:
[0168]
[0169]
[0170] wherein, is the computing node passed through by the path between node 0 and node M, d 0,1 is the path between node 0 and node 1, d 0,2 is the path between node 0 and node 2, is the computing node passed through by the path between node 0 and node M, is the computing node passed through by the path between node 0 and node M, d 1,2 is the path between node 1 and node 2, d 1,3 is the path between node 1 and node 3, d 2,3 is the path between node 2 and node 3, d 2,M is the path between node 2 and node M, d 3,M is the path between node 3 and node M. As can be seen from the above, there are 3 paths from node 0 to node M, and the shortest path is selected by selecting the above solving process is determined as the expansion and contraction point, and the maximum number of copies in each expansion and contraction point time period is selected, that is, the number of copies that should be provided in each time period.
[0171] Taking the real QPS data of an online application as an example, the finally generated capacity profile can be as shown in Figure 15 , wherein the figure includes a first broken line, a second broken line and a third broken line:
[0172] The first broken line: according to the QPS prediction result and the single-instance serviceable QPS, theoretically calculate how many copies should be provided at each time;
[0173] The second broken line: based on the first broken line, and under the constraint of the number of expansions and contractions n (for example, the number of expansions and contractions n = 4), how many copies should be provided in each time period;
[0174] The third broken line: based on the second broken line, in order to further reduce the elasticity risk of container resources, each expansion and contraction is expanded by one hour in advance. Specifically, when resource expansion is needed, a standby operation can be performed one hour in advance; when resource contraction is needed, a contraction operation can be performed one hour later.
[0175] In some other examples, after obtaining the capacity profile, the container resources can be expanded and contracted based on the capacity profile. When the expansion and contraction of the container resources fails, a prompt information indicating that the expansion and contraction of the container resources fails can be generated to remind the user to perform manual intervention operation, further improving the practicability of the method.
[0176] Step 8: For applications without significant periodicity, passive elasticity can be used for expansion and contraction.
[0177] Specifically, the passive elastic expansion and contraction operation can include: obtaining current indicators (CPU utilization, memory utilization, modified replica number, etc.) corresponding to QPS time series data, a current replica number, and an expected indicator, determining an expected replica number corresponding to the QPS time series data based on the current indicators, the current replica number, and the expected indicator, the expected replica number = ceil[current replica number * (current indicator / expected indicator)], wherein ceil is a ceiling function, and then generating an expansion and contraction suggestion based on the expected replica number, and specifically, each load indicator can be maintained below the expected value.
[0178] It should be noted that when the contraction operation is required, the contraction rate can be limited, and then the contraction step can be controlled by limiting the number of each contraction or limiting each contraction to not more than a percentage of the current replica number, which can effectively reduce the risk of data processing.
[0179] The technical scheme provided by the application can take an active expansion and contraction strategy for periodic applications. Specifically, the traffic redundancy estimation can be achieved by predicting the traffic running state, and then the QPS value that can be served by a single application instance can be reasonably determined based on the Gaussian distribution of historical single application instance QPS, and in a period, the cumulative number of containers used in a day is minimized as an optimization target under the limitation of the expansion and contraction times, to generate a capacity portrait. Then, the traffic prediction data corresponding to the time series running data can be determined based on the capacity portrait, the traffic prediction data can include the expected traffic of the next period corresponding to the time series running data, and then the container resources can be expanded and contracted based on the traffic prediction data. In this way, not only can the resources be saved, but also the QoS will not be reduced. In addition, a passive expansion and contraction strategy can be used for applications without periodicity. This method can be applied to a large number of delay-sensitive online applications with slow cold start time, further improving the flexibility and reliability of the method, and being beneficial to market promotion and application.
[0180] Figure 16 Another flowchart of a container resource control method provided by the embodiment of the application is shown in FIG. 16. Figure 16 The embodiment provides another container resource control method, and the execution subject of the method can be a container resource control device. It can be understood that the container resource control device can be implemented as software or a combination of software and hardware. Specifically, the container resource control method can include:
[0181] Step S1601: In response to a container resource control request, determining a processing resource corresponding to a container resource control service;
[0182] Step S1602: Utilize processing resources to perform the following steps: acquire the time-series runtime data to be analyzed; when the time-series runtime data has flow periodicity characteristics, acquire the flow period corresponding to the time-series runtime data; generate a capacity profile based on the flow period and the time-series runtime data; determine the flow prediction data corresponding to the time-series runtime data based on the capacity profile; and perform scaling operations on the container resources used for analyzing and processing the time-series runtime data based on the flow prediction data.
[0183] Specifically, the container resource control method provided by this invention can be executed in the cloud, where several computing nodes can be deployed, each with processing resources such as computing and storage. In the cloud, multiple computing nodes can be organized to provide a certain service; of course, a single computing node can also provide one or more services.
[0184] According to the solution provided by this invention, the cloud can provide a service for controlling container resources, referred to as a container resource control service. When a user needs to use the container resource control service, they invoke the container resource control service to trigger a request to the cloud to invoke the container resource control service. This request can carry the time-series runtime data to be analyzed. The cloud determines the computing node that responds to the request and uses the processing resources in the computing node to perform the following steps: obtaining the time-series runtime data to be analyzed; when the time-series runtime data has traffic periodicity characteristics, obtaining the traffic operation period corresponding to the time-series runtime data; generating a capacity profile based on the traffic operation period and the time-series runtime data; determining traffic prediction data corresponding to the time-series runtime data based on the capacity profile; and performing scaling operations on the container resources used to analyze and process the time-series runtime data based on the traffic prediction data.
[0185] Specifically, the implementation process, implementation principle, and implementation effect of the above method steps in this embodiment are the same as those described above. Figures 1-15 The implementation process, principle, and effect of the method steps in the illustrated embodiment are similar. For parts not described in detail in this embodiment, please refer to the [examples provided]. Figures 1-15 The following is a description of the illustrated embodiment.
[0186] Figure 17 This is a schematic diagram of the structure of a control device for container resources provided in an embodiment of this application; see attached diagram. Figure 17 As shown, this embodiment provides a container resource control device, which is used to perform the above-described... Figure 3 The method for controlling container resources shown herein, specifically, the control device for the container resources may include:
[0187] The first acquisition module 11 is used to acquire the time series running data to be analyzed;
[0188] The first obtaining module 11 is further configured to obtain a traffic running period corresponding to the time-series running data when the time-series running data has a traffic periodic characteristic.
[0189] The first generating module 12 is configured to generate a capacity profile based on the traffic running period and the time-series running data.
[0190] The first processing module 13 is configured to determine traffic prediction data corresponding to the time-series running data based on the capacity profile.
[0191] The first processing module 13 is configured to perform a scale operation on a container resource used for analyzing and processing the time-series running data based on the traffic prediction data.
[0192] In some examples, when the first obtaining module 11 obtains the time-series running data to be analyzed, the first obtaining module 11 is configured to perform: obtaining original time-series running data; and performing down-sampling processing on the original time-series running data to obtain the time-series running data.
[0193] In some examples, after obtaining the time-series running data to be analyzed, the first obtaining module 11 and the first processing module 13 in this embodiment are respectively configured to perform:
[0194] The first obtaining module 11 is configured to obtain a power spectral density corresponding to the time-series running data.
[0195] The first processing module 13 is configured to detect whether the time-series running data has a traffic periodic characteristic based on the power spectral density.
[0196] In some examples, when the first processing module 13 detects whether the time-series running data has a traffic periodic characteristic based on the power spectral density, the first processing module 13 is configured to perform: obtaining a spectral density region in a preset frequency range based on the power spectral density; detecting whether there is a local maximum value in the spectral density region; and determining whether the time-series running data has a traffic periodic characteristic based on a detection result.
[0197] In some examples, when the first processing module 13 detects whether the time-series running data has a traffic periodic characteristic based on the detection result, the first processing module 13 is configured to perform: determining that the time-series running data has a traffic periodic characteristic when there is a local maximum value; and determining that the time-series running data does not have a traffic periodic characteristic when there is no local maximum value.
[0198] In some examples, when the first processing module 13 detects whether the time series running data has the traffic periodicity based on the detection result, the first processing module 13 is configured to: obtain time series prediction data corresponding to the time series running data when there is a local maximum; and detect whether the time series running data has the traffic periodicity based on the time series prediction data.
[0199] In some examples, when the first processing module 13 obtains the time series prediction data corresponding to the time series running data, the first processing module 13 is configured to: obtain at least one network model for time series prediction of the time series running data; and predict the time series running data by using the at least one network model to obtain at least one time series prediction data corresponding to the at least one network model.
[0200] In some examples, when the first processing module 13 detects whether the time series running data has the traffic periodicity based on the time series prediction data, the first processing module 13 is configured to: obtain a minimum error corresponding to the at least one time series prediction data; determine that the time series running data has the traffic periodicity when the minimum error is less than or equal to a preset threshold; and determine that the time series running data does not have the traffic periodicity when the minimum error is greater than the preset threshold.
[0201] In some examples, when the first generation module 12 generates the capacity image based on the traffic running period and the time series running data, the first generation module 12 is configured to: determine a running feature value corresponding to the time series running data; and generate the capacity image corresponding to the time series running data based on the traffic running period and the running feature value.
[0202] In some examples, when the first processing module 13 performs the scaling operation on the container resource for analyzing and processing the time series running data based on the traffic prediction data, the first processing module 13 is configured to: obtain expected container resources of a next period corresponding to the time series running data based on the traffic prediction data; determine at least one scaling node for implementing the scaling operation; and perform the scaling operation based on the expected container resources and the at least one scaling node.
[0203] In some examples, when the first processing module 13 determines the at least one scaling node for implementing the scaling operation, the first processing module 13 is configured to: obtain a scaling number for implementing the scaling operation; and determine the at least one scaling node for implementing the scaling operation based on the scaling number.
[0204] In some examples, when the first processing module 13 determines at least one scaling node for implementing the scaling operation, the first processing module 13 is configured to perform: obtaining all current container nodes corresponding to the time-series running data; determining a shortest path corresponding to the all current container nodes based on the directed acyclic graph under the constraint of the scaling times; and determining at least one scaling node for implementing the scaling operation based on the shortest path.
[0205] In some examples, when the first processing module 13 performs the scaling operation on the container resources for analyzing and processing the time-series running data based on the expected container resources and the at least one scaling node, the first processing module 13 is configured to perform: obtaining a maximum number of replicas of the at least one scaling node within a scaling time period; and performing the scaling operation based on the expected container resources and the maximum number of replicas.
[0206] In some examples, when the first processing module 13 performs the scaling operation on the container resources for analyzing and processing the time-series running data based on the traffic prediction data, the first processing module 13 is configured to perform: obtaining time information for implementing the scaling operation; performing the scaling operation in advance on the container resources corresponding to the time-series running data based on the time information and the traffic prediction data; and / or performing the scaling operation in lag on the container resources corresponding to the time-series running data based on the time information and the traffic prediction data.
[0207] In some examples, the first obtaining module 11 and the first processing module 13 in the embodiment are configured to perform the following steps:
[0208] The first obtaining module 11 is configured to obtain a current running feature and a current number of replicas corresponding to the time-series running data when the time-series running data does not have a traffic periodicity characteristic.
[0209] The first processing module 13 is configured to determine a target number of replicas corresponding to the time-series running data based on the current running feature and the current number of replicas.
[0210] The first processing module 13 is configured to perform the scaling operation on the container resources for analyzing and processing the time-series running data based on the target number of replicas.
[0211] In some examples, when the first processing module 13 determines the target number of replicas corresponding to the time-series running data based on the current running feature and the current number of replicas, the first processing module 13 is configured to perform: obtaining an expected running feature corresponding to the current running feature; and determining the target number of replicas corresponding to the time-series running data based on the current running feature, the expected running feature, and the current number of replicas.
[0212] In some examples, when the first processing module 13 performs the scaling operation on the container resources for analyzing and processing the time series running data based on the target number of copies, the first processing module 13 is configured to perform the following steps: when the target number of copies is less than the current number of copies, obtaining a scaling rate for scaling the container resources corresponding to the time series running data; and performing the scaling operation on the container resources corresponding to the time series running data based on the scaling rate and the target number of copies.
[0213] In some examples, when the first processing module 13 performs the scaling operation on the container resources corresponding to the time series running data based on the scaling rate and the target number of copies, the first processing module 13 is configured to perform the following steps: based on the scaling rate and the target number of copies, determining a target container that needs to be scaled; performing the scaling operation on the target container and storing the target container after the scaling operation in a preset area; recording time information of storing the target container in the preset area; and when the time information is greater than or equal to a set time threshold, clearing the target container in the preset area.
[0214] Figure 17 The device can perform the method of the embodiments described above. Figures 1-15 The method of the embodiments described above, and the parts of the embodiments not described in detail can be referred to the related descriptions of the Figures 1-15 embodiments. The execution process and technical effects of the technical solutions can be referred to the descriptions of the embodiments described above, and will not be repeated here. Figures 1-15
[0215] In one possible design, Figure 17 The structure of the container resource control device can be implemented as an electronic device, which can be a mobile phone, a tablet computer, a server, or various devices. As Figure 18 described above, the electronic device can include a first processor 21 and a first memory 22. The first memory 22 is configured to store programs for the electronic device to perform the method of the embodiments described above, and the first processor 21 is configured to execute the programs stored in the first memory 22. Figures 1-15
[0216] The programs include one or more computer instructions, and the one or more computer instructions can implement the following steps when executed by the first processor 21: obtaining time series running data to be analyzed; when the time series running data has a traffic cycle characteristic, obtaining a traffic running cycle corresponding to the time series running data; generating a capacity profile based on the traffic running cycle and the time series running data; determining traffic prediction data corresponding to the time series running data based on the capacity profile; and performing a scaling operation on container resources for analyzing and processing the time series running data based on the traffic prediction data.
[0217] Further, the first processor 21 is further configured to execute the foregoing Figures 1-15 all or part of the steps in the embodiments shown.
[0218] The electronic device can further include a first communication interface 23 for communication with other devices or communication networks.
[0219] In addition, the embodiment of the present application provides a computer storage medium for storing computer software instructions for an electronic device, which includes computer software instructions for executing the foregoing Figures 1-15 the programs involved in the container resource control method in the method embodiment shown.
[0220] In addition, the embodiment of the present application provides a computer program product, comprising: a computer readable storage medium storing computer instructions, when the computer instructions are executed by one or more processors, causing the one or more processors to execute the foregoing Figures 1-5 the steps in the container resource control method in the method embodiment shown.
[0221] Figure 19 Another container resource control device provided by the embodiment of the present application is shown in the structure diagram; refer to the accompanying Figure 19 The embodiment provides another container resource control device, which is used to execute the foregoing Figure 16 The container resource control device can include:
[0222] The second determination module 31 is configured to determine the processing resource corresponding to the container resource control service in response to the control request of calling the container resource.
[0223] The second processing module 32 is configured to execute the following steps by using the processing resource: obtaining time sequence running data to be analyzed; obtaining a traffic running period corresponding to the time sequence running data when the time sequence running data has a traffic period characteristic; generating a capacity image based on the traffic running period and the time sequence running data; determining traffic prediction data corresponding to the time sequence running data based on the capacity image; and performing a scale operation on the container resource for analyzing and processing the time sequence running data based on the traffic prediction data.
[0224] Figure 19 The device shown can execute Figure 16 The method of the embodiment shown, and the parts not described in detail in the embodiment can refer to the related description of the Figure 16 The execution process and technical effects of the technical scheme are described in the embodiment shown, and will not be described here. Figure 16 The execution process and technical effects of the technical scheme are described in the embodiment shown, and will not be described here.
[0225] In one possible design,Figure 19 The structure of the control device of the container resource can be implemented as an electronic device, which can be a mobile phone, a tablet computer, a server, or various devices. As shown in the Figure 20 The electronic device can include a second processor 41 and a second memory 42. The second memory 42 is configured to store programs for the electronic device to perform the above-mentioned Figure 16 The programs provided in the embodiments of the control method of the container resource are executed by the second processor 41.
[0226] The programs include one or more computer instructions, and the one or more computer instructions can implement the following steps when executed by the second processor 41: in response to a request for calling the control of the container resource, determining a processing resource corresponding to the control service of the container resource; using the processing resource to perform the following steps: obtaining time-series running data to be analyzed; when the time-series running data has a traffic cycle characteristic, obtaining a traffic running cycle corresponding to the time-series running data; generating a capacity image based on the traffic running cycle and the time-series running data; determining traffic prediction data corresponding to the time-series running data based on the capacity image; and performing a scaling operation on a container resource used for analyzing and processing the time-series running data based on the traffic prediction data.
[0227] Further, the second processor 41 is further configured to execute all or part of the steps of the above-mentioned Figure 16
[0228] The structure of the electronic device can further include a second communication interface 43 for communication between the electronic device and other devices or communication networks.
[0229] In addition, the embodiments of the present application provide a computer storage medium for storing computer software instructions for an electronic device, which includes programs for executing the above-mentioned Figure 16 The programs involved in the control method of the container resource in the method embodiments.
[0230] In addition, the embodiments of the present application provide a computer program product, which includes: a computer readable storage medium storing computer instructions, when the computer instructions are executed by one or more processors, the one or more processors execute the steps of the above-mentioned Figure 16 The steps in the control method of the container resource in the method embodiments.
[0231] The device embodiments described above are only illustrative, wherein the units illustrated as separate components can or can not be physically separated, and the components illustrated as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment scheme. Those skilled in the art can understand and implement without creative labor.
[0232] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be realized by means of a general hardware platform as necessary, and of course can also be realized by means of combination of hardware and software. Based on such understanding, the above technical solutions can be embodied in the form of a computer product, and the present application can adopt the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.
[0233] The present application is described with reference to flowcharts and / or block diagrams according to the method, device (system), and computer program product of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be realized by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable devices to produce a machine, so that the instructions executed by the computer or other programmable devices produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that carries out the functions specified in one or more flows and / or blocks.
[0234] These computer program instructions can also be stored in a computer readable storage medium that can direct the computer or other programmable devices to work in a specific way, so that the instructions stored in the computer readable storage medium produce a product including instruction apparatus, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that carries out the functions specified in one or more flows and / or blocks.
[0235] These computer program instructions can also be loaded into a computer or other programmable devices, so that a series of operation steps are performed on the computer or other programmable devices to produce a computer implemented process, so that the instructions executed on the computer or other programmable devices provide a process for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1The functions processes specified in a single block or multiple blocks.
[0236] In one typical arrangement, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0237] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, non-volatile memory, such as read-only memory (ROM), EPROM, and / or flash memory. The memory is an example of computer readable media.
[0238] Computer readable media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer readable media does not include transitory media, such as modulated data signals and carrier waves.
[0239] Finally, it should be noted that the above-described embodiments are merely intended for describing the technical solutions of the present application, but not to limit the present application; even though the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the above embodiments, or make equivalent replacements to some or all of the technical features; and such modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for controlling container resources, comprising: Obtain the time-series runtime data to be analyzed; When the time-series running data has a flow periodicity characteristic, the flow running period corresponding to the time-series running data is obtained, wherein the flow periodicity characteristic is used to indicate that the running flow corresponding to the time-series running data changes periodically; A capacity profile is generated based on the traffic operation cycle and the time-series operation data; Based on the capacity profile, traffic prediction data corresponding to the time-series operational data is determined; Based on the traffic prediction data, the container resources used for analyzing and processing the time-series running data are scaled up or down. The method further includes: When the time-series running data does not have traffic periodicity characteristics, obtain the current running characteristics and current number of replicas corresponding to the time-series running data; Based on the current operating characteristics, the current number of replicas, and the expected operating characteristics corresponding to the current operating characteristics, determine the target number of replicas corresponding to the time-series operating data; Based on the target number of replicas, the container resources used for analyzing and processing the time-series runtime data are scaled up or down.
2. The method according to claim 1, after acquiring the time-series runtime data to be analyzed, the method further includes: Obtain the power spectral density corresponding to the time-series running data; Based on the power spectral density, it is determined whether the time-series running data has flow periodic characteristics.
3. The method according to claim 2, wherein detecting whether the time-series operational data has flow periodic characteristics based on the power spectral density includes: Based on the power spectral density, obtain the spectral density region within a preset frequency range; Detect whether there are local maxima within the spectral density region; Based on the detection results, it is determined whether the time-series running data has flow periodic characteristics.
4. The method according to claim 3, based on the detection result, detecting whether the time-series running data has flow periodic characteristics, including: When a local maximum value exists, the time-series running data is determined to have flow periodic characteristics; If no local maximum value exists, then the time-series running data is determined to have no flow periodicity characteristics.
5. The method according to claim 3, wherein, based on the detection result, detecting whether the time-series running data has flow periodic characteristics, includes: If a local maximum exists, then obtain the time series prediction data corresponding to the time series running data; Based on the time-series prediction data, it is detected whether the time-series running data has flow periodic characteristics.
6. The method according to claim 5, wherein obtaining time-series prediction data corresponding to the time-series running data comprises: Obtain at least one network model for time series prediction of the time series running data; The time-series running data is predicted using the at least one network model to obtain at least one time-series prediction data corresponding to the at least one network model.
7. The method according to claim 6, wherein based on the time-series prediction data, detecting whether the time-series running data has flow periodic characteristics includes: Obtain the minimum error corresponding to the at least one time-series prediction data; When the minimum error is less than or equal to a preset threshold, the time-series running data is determined to have flow periodic characteristics. When the minimum error is greater than a preset threshold, it is determined that the time-series running data does not have flow periodic characteristics.
8. The method according to claim 1, wherein scaling up or down the container resources used for analyzing and processing the time-series runtime data is performed based on the traffic prediction data, comprising: Based on the traffic prediction data, obtain the expected container resources for the next period corresponding to the time-series running data; Identify at least one scaling node to implement the scaling operation; Scaling up or down is performed based on the expected container resources and the at least one scaling up / down node.
9. The method of claim 8, wherein determining at least one scaling node for implementing scaling operations comprises: Get the number of times the scaling operation is performed; Retrieve all current container nodes corresponding to the aforementioned time-series runtime data; Under the constraint of the number of expansion and contraction cycles, the shortest path corresponding to all current container nodes is determined based on the directed acyclic graph; Based on the shortest path, at least one scaling node is determined to implement the scaling operation.
10. The method according to claim 8, wherein scaling operations are performed based on the expected container resources and the at least one scaling node, comprising: Obtain the maximum number of replicas of the at least one scaling node during the scaling time period; Scaling up or down is performed based on the expected container resources and the maximum number of replicas.
11. The method according to claim 1, wherein scaling up or down container resources used for analyzing and processing the time-series runtime data is performed based on the traffic prediction data, comprising: Obtain the timing information used to implement the scaling up / down operation; Based on the time information and the traffic prediction data, the container resources corresponding to the time-series operation data are expanded in advance; and / or, based on the time information and the traffic prediction data, the container resources corresponding to the time-series operation data are reduced in a later manner.
12. The method according to claim 1, wherein scaling up or down the container resources used for analyzing and processing the time-series runtime data is performed based on the target number of replicas, comprising: When the target number of replicas is less than the current number of replicas, obtain the scaling-down rate for scaling down the container resources corresponding to the time-series running data; Based on the scaling-down rate and the target number of replicas, the container resources corresponding to the time-series runtime data are scaled down.
13. The method according to claim 12, wherein scaling down the container resources corresponding to the time-series runtime data is performed based on the scaling-down rate and the target number of replicas, comprising: Based on the scaling-down rate and the target number of replicas, determine the target container that needs to be scaled down. Perform a shrinkage operation on the target container and store the shrinkage target container in a preset area; Record the time information when the target container is stored in the preset area; When the time information is greater than or equal to a set time threshold, the target container in the preset area is cleared.
14. An electronic device, comprising: A memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the container resource control method as described in any one of claims 1-13.
15. A computer storage medium for storing a computer program that, when executed by a computer, implements the method for controlling container resources as described in any one of claims 1-13.
Citation Information
Patent Citations
Online application dynamic capacity expansion and shrinkage method based on micro-service call dependence perception
CN112199150A
Micro-service automatic telescoping system and method, corresponding equipment and storage medium
CN112291104A
Periodic flow prediction method based on random forest
CN113067724A