WO2023061348A1 - 应用的容器数量调节 - Google Patents

应用的容器数量调节 Download PDF

Info

Publication number
WO2023061348A1
WO2023061348A1 PCT/CN2022/124500 CN2022124500W WO2023061348A1 WO 2023061348 A1 WO2023061348 A1 WO 2023061348A1 CN 2022124500 W CN2022124500 W CN 2022124500W WO 2023061348 A1 WO2023061348 A1 WO 2023061348A1
Authority
WO
WIPO (PCT)
Prior art keywords
containers
application
historical
moment
distribution
Prior art date
Application number
PCT/CN2022/124500
Other languages
English (en)
French (fr)
Inventor
胡韵
雷磊
郑洋飞
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2023061348A1 publication Critical patent/WO2023061348A1/zh
Priority to US18/397,379 priority Critical patent/US20240137411A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1025Dynamic adaptation of the criteria on which the server selection is based
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/147Network analysis or design for predicting network behaviour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/16Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks using machine learning or artificial intelligence
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/70Admission control; Resource allocation
    • H04L47/82Miscellaneous aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5019Workload prediction

Definitions

  • This description relates to the field of computer technology, in particular to an applied container quantity adjustment method and device.
  • the number of containers is adjusted according to the preset service level objective (Service Level Objective, SLO) based on the traffic at each moment by monitoring the traffic of the application at each moment.
  • SLO Service Level Objective
  • the number of containers is increased based on the increased traffic value, and when the application traffic decreases, the number of containers is decreased based on the reduced traffic value.
  • the existing adjustment method is post-adjustment based on the flow change, that is, the number of containers is adjusted only after the flow change is observed, it is easy to cause the problem that the number of containers is not adjusted in time, resulting in limited operation of the application or even failure.
  • This specification provides an applied method and device for adjusting the number of containers to partially solve the above-mentioned problems in the prior art.
  • This specification adopts the following technical solution:
  • This specification provides a container quantity adjustment method for an application, including: determining the historical data of the application, the historical data at least including the actual flow of the application at each historical moment; Data, through the pre-trained traffic prediction model, predict the traffic distribution of the application within the preset time period; according to the traffic distribution and the preset target utilization rate of the container, through the pre-trained quantity prediction model, predict the The distribution of the number of containers of the application within the preset time length; according to the distribution of the number of containers, the number of containers of the application at each moment within the preset time length is adjusted.
  • determining the historical data of the application specifically includes: determining the historical quantity distribution according to the quantity of containers configured for the application at each historical moment; determining the change of the container quantity of the application at each historical moment according to the historical quantity distribution When it is periodic, determine the historical data of the application.
  • the method further includes: according to the historical quantity distribution, determining the cycle length of the container quantity change of the application; determining each target historical period according to the preset cycle quantity and the cycle length; according to the The historical quantity distribution is to determine the quantity of containers at each historical moment in each target historical period; according to the quantity of containers at each historical moment in each target historical period, determine the quantity of containers at each moment within the preset time length as the periodic quantity distribution.
  • adjusting the number of containers of the application at each moment within the preset time length specifically includes: determining a target number distribution according to the distribution of the number of containers and the distribution of the number of cycles; The target quantity distribution adjusts the quantity of containers of the application at each moment within the preset time period.
  • adjusting the number of containers of the application at each time within the preset time length specifically includes: for each time within the preset time length, according to the traffic distribution, determining The predicted traffic corresponding to this moment, and according to the distribution of the number of containers, determine the number of containers that should be configured for the application at this moment; determine the number of processors in the container corresponding to this moment according to the determined traffic and the number of containers at this moment Forecasting the utilization rate: adjusting the quantity of containers according to the predicted utilization rate at this moment based on the target utilization rate.
  • the historical data further includes the historical predicted traffic of the application at each historical moment, the historical predicted quantity of the container, and the historical actual utilization rate of the processor in the container;
  • the number of containers at each time within the preset time length specifically includes: determining the historical forecast utilization rate of each historical time according to the historical forecast flow rate and historical forecast quantity at each historical time within the preset time before the current time;
  • the historical predicted utilization rate and historical actual utilization rate at each historical moment determine the accuracy rate of the quantity prediction model; when the accuracy rate is greater than a preset ratio threshold, adjust the application according to the container quantity distribution
  • the number of containers at each moment within the preset time length when the accuracy rate is not greater than the preset ratio threshold, according to the initialization quantity distribution of the application, determine the number of containers at each time within the preset time length number of containers.
  • determining the accuracy rate of the quantity forecast model according to the historical predicted utilization rate and historical actual utilization rate of each historical moment specifically includes: for each historical moment within the preset time period before the current moment , determine the difference between the historical predicted utilization rate and the historical actual utilization rate at the historical moment, as the utilization rate difference at the historical moment; before determining the current moment, the utilization rate difference within the preset time length is less than the preset difference
  • the number of historical moments with a threshold value is used as the number of reaching the standard; according to the number of reaching the standard and the total number of historical moments included in the preset time period before the current moment, the accuracy rate is determined.
  • the method further includes: determining the loss according to the utilization rate difference corresponding to each historical moment within the preset time period before the current moment; and adjusting the quantity prediction model and the parameters of the traffic forecasting model.
  • the method further includes: acquiring the operating index of the application; according to the operating index and the target utilization rate, using a reinforced prediction model obtained through pre-reinforcement learning to predict the The number distribution of the application containers is used as an enhanced number distribution; when the evaluation of the number prediction model fails, according to the enhanced number distribution, the number of containers of the application at each moment within the preset time length is adjusted.
  • predicting the traffic distribution of the application within a preset period of time specifically includes: for each preset traffic data type, determining at each historical moment, The branch traffic corresponding to the traffic data type; according to the branch traffic corresponding to each traffic data type at each historical moment, through the pre-trained traffic prediction model, predict the branch traffic of the application at each time within the preset time length, as the The traffic distribution of the application within the preset time period.
  • using a pre-trained quantity prediction model, predicting the distribution of the number of containers of the application within the preset time length specifically includes: using the pre-trained Set the flow of each branch at each moment in the duration and the preset target utilization rate of the container, input the pre-trained quantity prediction model, and determine the number of containers that should be configured for the application at each moment in the preset duration; wherein, the The number of containers is composed of the number of containers corresponding to each branch flow. Under the same flow, the number of containers corresponding to different branch flows is not exactly the same.
  • adjusting the number of containers of the application at each moment within the preset time length specifically includes: determining an application portrait of the application, and determining an application suitable for the application according to the application portrait.
  • An adjustment mode according to the adjustment mode and the distribution of the number of containers, adjust the number of containers of the application at each moment within the preset time length.
  • This specification provides a device for regulating the number of containers, including: a historical data determination module, used to determine the historical data of the application, the historical data includes at least the actual flow of the application at each historical moment; a flow prediction module, used According to the historical data, the traffic distribution of the application within the preset time period is predicted through the pre-trained traffic prediction model; the quantity prediction module is used to predict the traffic distribution and the preset target utilization rate of the container through A pre-trained quantity prediction model, predicting the distribution of the number of containers of the application within the preset time period; an adjustment module, configured to adjust the number of containers of the application at each moment within the preset time period according to the distribution of the number of containers quantity.
  • This specification provides a computer-readable storage medium, the storage medium stores a computer program, and when the computer program is executed by a processor, the method for adjusting the number of containers used above is realized.
  • This specification provides an electronic device, including a memory, a processor, and a computer program stored on the memory and operable on the processor.
  • the processor executes the program, the method for adjusting the number of containers used above is realized.
  • At least one of the above-mentioned technical solutions adopted in this manual can achieve the following beneficial effects:
  • the application container quantity adjustment method provided in this manual based on the historical data of the application, through the pre-trained flow prediction model, the future preset time period of the application is calculated.
  • the pre-trained quantity prediction model is used to predict the distribution of the number of containers of the application within the preset period of time, and according to the obtained distribution of the number of containers, the application is adjusted in the preset period. Set the number of containers at each moment within the duration.
  • this method can predict the traffic of the application within the preset time in the future in advance, so as to obtain the corresponding number of containers to be deployed at each time, and adjust the number of containers at each time of the application in time.
  • Fig. 1 is a schematic flow chart of a method for adjusting the number of containers used in this specification
  • Fig. 2 is a schematic diagram of a prediction model provided in this specification
  • Fig. 3 is a schematic diagram of a prediction model provided in this specification.
  • Fig. 4 is a schematic diagram of adjusting the number of containers provided in this specification.
  • Fig. 5 is a schematic diagram of an applied container quantity regulating device provided in this specification.
  • FIG. 6 is a schematic structural diagram of an electronic device provided in this specification.
  • FIG. 1 is a schematic flowchart of a method for adjusting the number of containers for an application in this specification, which specifically includes the following steps: S100: Determine historical data of the application, the historical data at least including the actual flow of the application at each historical moment.
  • the method for adjusting the number of containers of the application can be executed by the server.
  • the number of containers used at each time can be predicted through the model in advance, and according to the number of containers obtained from the prediction, timely adjust the number of containers for each The number of containers configured to support the running of the application is adjusted at all times.
  • the application's demand for the number of containers at each moment in the future can be predicted based on the historical data of the application.
  • the server may first determine the historical data of the application, where the historical data at least includes the actual traffic of the application at each historical moment. That is, the historical traffic of the application at each moment in the running process is determined. In order to predict the traffic of the application at each time in the future according to the actual traffic in history in the subsequent steps, that is, the predicted traffic at each time in the future.
  • the server may preprocess the historical data after determining the historical data , and then predict the traffic distribution according to the preprocessed historical data. Specifically, the server may, for each historical moment at which no traffic is captured, determine the actual traffic at the historical moment according to the actual traffic corresponding to the adjacent historical moments before and after the historical moment. For example, the average value of the actual flow corresponding to the adjacent historical moments before and after the historical moment can be taken as the actual flow of the historical moment, or the maximum value, the minimum value, etc. can also be taken, which can be set according to needs. Do limit.
  • the actual flow at the historical moment can be determined according to several historical moments before and after the historical moment, which can be flexibly set, for example, a time interval can be set in advance, and adjacent historical moments can be determined according to the time interval.
  • a time interval can be set in advance
  • adjacent historical moments can be determined according to the time interval.
  • the server can determine the actual traffic at the historical moment according to the actual traffic corresponding to the three adjacent historical moments before the historical moment and the actual traffic corresponding to the three adjacent historical moments after the historical moment. flow.
  • S102 According to the historical data, predict the traffic distribution of the application within a preset time period by using a pre-trained traffic prediction model.
  • the server can predict the traffic of the application at each moment within a preset time length through a pre-trained traffic prediction model based on the historical data of the application, and obtain the traffic corresponding to the preset time length.
  • the traffic distribution of the application that is, to predict the traffic distribution of the application within a preset period of time.
  • the server can further predict according to the traffic distribution, and obtain the distribution of the number of containers of the application within the preset time period.
  • the preset duration is a preset period of time in the future that needs to predict the number of containers of the application.
  • the preset time length can be one day in the future, or one hour in the future, or eight hours in the future, etc. Of course, it can also be other time lengths, which can be set according to needs, and this specification does not limit it here.
  • the historical data may be historical data accumulated by the application for a long time, from which the server may determine that at least part of the historical data is input to the traffic prediction model to obtain the traffic distribution within the preset time period.
  • the historical data may correspond to the input of the traffic forecasting model, for example, the input of the traffic forecasting model is the historical data of two months before the current moment, then the server may directly determine the historical data of the application within two months, There is no need to determine the historical data accumulated by the application over a long period of time.
  • the server may execute the method for adjusting the number of containers of the application at the cut-off point of the date or at the moment before and after the cut-off point, for example, at 00:00 on the 8th (or 23:59 on the 7th), According to the historical data before midnight, predict the distribution of the number of containers for the application on the 8th.
  • the zero point is just an example, and other times may also be used, and this specification does not limit it here.
  • S104 According to the traffic distribution and the preset target utilization rate of the container, predict the container quantity distribution of the application within the preset time period through the pre-trained quantity prediction model.
  • the server can predict, according to the predicted traffic distribution and the preset target utilization rate of the container, through the pre-trained prediction model, at each time within the preset time length, the server should be configured for
  • the number of containers of the application obtains the distribution of the number of containers of the application within the preset time period, that is, predicts the distribution of the number of containers of the application within the preset time period.
  • the target utilization rate is the target utilization rate of the processor in the container, which may be determined at least according to the historical utilization rate of the application.
  • S106 According to the distribution of the number of containers, adjust the number of containers of the application at each moment within the preset duration.
  • the server may adjust the distribution of the number of containers of the application at each moment within the preset duration according to the distribution of the number of containers quantity.
  • the initialized number of containers is 4, and the predicted number of containers is 6.
  • the predicted The number of containers at a time is the target, and the number of containers of the application at that time is adjusted. Therefore, the number of containers of the application in the third minute within the preset duration can be increased by 2 to 6.
  • an application container may correspond to specified computing resources, storage resources, and other resources required to run the application.
  • one container may correspond to four processor cores (Cores).
  • the traffic forecasting model and the quantity forecasting model can be regarded as a forecasting model.
  • the structure of the prediction model can be shown in Figure 2.
  • Fig. 2 is a schematic diagram of a prediction model provided in this specification.
  • the forecasting model includes a traffic forecasting model and a quantity forecasting model. After inputting the actual traffic at each historical moment into the traffic forecasting model, the traffic distribution within the preset time period after the current moment is obtained, and the traffic distribution is input into the quantity forecasting model. , the distribution of the number of containers within the preset time period can be obtained.
  • the pre-trained traffic prediction model Based on the container quantity adjustment method for the application shown in Figure 1, based on the historical data of the application, through the pre-trained traffic prediction model, the traffic distribution within the future preset time period of the application is predicted, and based on the predicted traffic distribution, through The pre-trained quantity prediction model predicts the distribution of the number of containers of the application within the preset time period, and adjusts the number of containers of the application at each moment within the preset time period according to the obtained distribution of the number of containers.
  • this method can predict the traffic of the application within the preset time in the future in advance, so as to obtain the corresponding number of containers to be deployed at each time, and adjust the number of containers at each time of the application in time.
  • the server can also evaluate the quantity forecast model according to the forecast data and actual data at each time point in the history of the quantity forecast model.
  • the historical data of the application may also include the historical predicted traffic of the application at each historical moment, the historical predicted quantity of the container, and the historical actual utilization rate of the processor in the container.
  • the historical utilization rate and the actual utilization rate at each historical moment are used to evaluate the quantity forecasting model.
  • the server may determine the historically predicted utilization rate of each historical moment according to the historically predicted traffic and the historically predicted quantity of each historical moment within a preset time period before the current moment. And according to the historical predicted utilization rate and historical actual utilization rate at each historical moment, the accuracy rate of the quantity forecasting model is determined.
  • the accuracy rate is greater than the preset ratio threshold
  • the evaluation is passed, and it is determined that the prediction result of the quantity prediction model is accurate enough, and the server can adjust the number of containers of the application at each time within the preset time period according to the distribution of the number of containers.
  • the accuracy rate is not greater than the preset ratio threshold
  • the evaluation fails, and the server can determine the number of containers of the application at each moment within the preset time period according to the distribution of the initialization number of the application.
  • the server may determine from the historical data part of historical data corresponding to 24 hours before the preset time period to evaluate the quantity forecasting model.
  • the server may also determine the loss according to the difference in utilization rate corresponding to each historical moment within the preset time before the current moment, and adjust the quantity forecast with the goal of minimizing the loss model and the parameters of the traffic forecasting model.
  • the server when determining the accuracy rate of the quantity forecasting model, may determine the historical forecast utilization ratio and The difference between historical actual utilization rates is used as the utilization rate difference at this historical moment. And before the current moment, the number of historical moments in which the utilization rate difference is smaller than the preset difference threshold within the preset time period is determined as the number of reaching the standard. Then, the accuracy rate is determined according to the number of reaching the standard and the total number of historical moments included in the preset time period before the current moment.
  • the ratio of the number of reaching the target and the total number of historical moments included in the preset time period before the current moment can be used as the accuracy rate.
  • the server may also determine the non-standard quantity according to the difference between the total number and the standard quantity, and determine the accuracy rate according to the ratio of the standard quantity and the non-standard quantity.
  • the utilization rate difference at the historical moment is smaller than the preset difference threshold, it is determined that the historical moment corresponds to The number of containers obtained by the forecast is accurate, and the forecast result at this historical moment is up to standard.
  • the up-to-standard quantity is the quantity at the historical moment when the predicted container quantity is accurate within the preset period of time before the current moment.
  • the difference threshold and the ratio threshold can be specifically set according to requirements, which are not limited in this specification.
  • the ratio threshold may be 80%.
  • the evaluation when evaluating the quantity prediction model, the evaluation may also be performed according to the following three aspects: result difference, deviation direction, and deviation ratio.
  • result difference refers to the difference between the historical predicted utilization rate at each historical moment and the respective corresponding actual utilization rate, that is, the utilization rate difference at each historical moment.
  • direction of deviation refers to whether the historical forecast utilization rate is larger or smaller than the actual utilization rate.
  • deviation ratio refers to the ratio of the time when the difference between the result difference and the preset difference threshold is greater than the preset value.
  • the magnitude of the result difference is negatively correlated with the accuracy of the prediction result of the quantity prediction model, and the smaller the result difference, the more likely the quantity prediction model will pass the evaluation.
  • the predicted number of containers for the application is not accurate enough, it is hoped that the predicted number of containers should be larger than the actual number of containers that should be allocated to the application, so as to avoid limiting the operation of the application due to insufficient container capacity.
  • the quantity forecasting model is more likely to pass the evaluation.
  • the quantity prediction model is more likely to pass the evaluation, that is, when the non-deviation ratio is larger, the quantity prediction model is more likely to pass the evaluation, and when the non-deviation ratio is greater than the preset ratio threshold, the evaluation is passed.
  • the non-deviation ratio may correspond to the above concept of accuracy rate.
  • the evaluation can be performed according to one or more of the result difference, deviation direction and deviation ratio. This manual does not limit it here, and it can be set as needed.
  • the server instead of predicting the number of containers based on the traffic, can predict the number of containers based on the operating indicators generated during the running of the application and through an enhanced prediction model obtained through reinforcement learning.
  • the server may also predict the number of containers at each time within the preset time period according to the reinforcement prediction model obtained in advance reinforcement learning, and in step In S106, the number of containers of the application is adjusted according to the number of containers at each time within the preset time period predicted by the enhanced prediction model.
  • the server can obtain the operating index of the application, and according to the operating index and the preset target utilization rate, determine the application within the preset time period through the enhanced prediction model obtained through pre-reinforcement learning.
  • the number of containers that should be allocated to the application at each time so as to obtain the distribution of the number of containers of the application within the preset period of time, as an enhanced distribution of the number.
  • the evaluation of the quantity prediction model fails, the quantity of containers of the application at each moment within the preset time period is adjusted according to the enhanced quantity distribution.
  • the running indicator includes various indicator data generated during the running of the application, for example, the number of thread switching times, the number of traffic data packets, the number of loads, the number of times garbage collection (Garbage Collection, GC) is triggered, etc. .
  • the operating index may be an index at a time level, for example, if one minute is a time, then the operating index is an index at a minute level.
  • the operating index at each moment within the same time period as the preset time before the preset time can be specifically used. For example, assuming that the preset duration is one hour, and the preset duration is the third hour of the day in which the preset duration is located, the operating index may be an operating index at each moment in the third hour of the previous day.
  • the operating index may also include a flow rate, specifically, the actual flow rate at each moment in the same time period before the preset time period as the preset time period.
  • the server may determine the Enhance the loss of the prediction model, and adjust the parameters of the enhanced prediction model with the goal of minimizing the loss.
  • the server can also directly predict the number of containers through the enhanced prediction model according to the operation index of the application. And according to the distribution of the number of reinforcements predicted by the reinforcement prediction model, the number of containers of the application at each moment within the preset duration is adjusted. That is, it is not necessary to use the enhanced forecasting model when the evaluation of the quantity forecasting model fails, and the operating index of the application can be obtained directly.
  • the number of containers that should be allocated to the application at each time within the preset time period is used to predict the number distribution of the application's containers within the preset time period as an enhanced number distribution. And adjust the number of containers of the application at each moment within the preset duration according to the enhanced quantity distribution.
  • the server can predict the number of containers according to the two models of the quantity prediction model and the enhanced prediction model, and preferentially use the prediction results of the quantity prediction model in the preset
  • the server may perform prediction only through one of the quantity prediction model and the enhanced prediction model, and adjust the number of containers of the application within a preset time period according to a prediction result obtained.
  • the server in order to ensure the normal operation of the application to the greatest extent, can also predict the number distribution of containers and the number distribution of reinforcement through the number prediction model and the reinforcement prediction model respectively, for the preset At each moment within the duration, the maximum value of the number of containers corresponding to the moment in the distribution of the number of containers and the number of containers corresponding to the moment in the distribution of the number of reinforcements is adjusted to adjust the number of containers of the application at that moment within the preset duration.
  • the server may also evaluate the enhanced prediction model, determine the accuracy rate of the enhanced prediction model, and when the accuracy rate of the enhanced prediction model is greater than a preset ratio threshold, According to the distribution of the number of reinforcements output by the reinforcement prediction model, the number of containers of the application at each moment within the preset time period is adjusted. When the accuracy rate of the enhanced prediction model is not greater than the preset proportion threshold, according to the initialization quantity distribution of the application, the number of containers of the application at each moment within the preset time length is determined.
  • the server may also evaluate the quantity forecasting model before forecasting through the traffic forecasting model, and then perform forecasting through the quantity forecasting model when the assessment is passed. That is, there is no need to first predict the traffic distribution within the preset time period through the traffic prediction model. According to the traffic distribution and the preset target utilization rate of the container, the quantity prediction model is used to predict the distribution of the number of containers, and then the quantity prediction model to evaluate. Instead, the quantity forecasting model is evaluated first, and after the assessment is passed, forecasting is performed sequentially based on the traffic forecasting model and the quantity forecasting model, so as to reduce the amount of computation caused by the forecasting.
  • the server when evaluating the quantity forecasting model, may also perform cyclic evaluation. Specifically, firstly, the server may adjust the parameters of the quantity prediction model after determining the loss according to the difference in utilization rate corresponding to each historical moment within the preset time before the current moment determined in the evaluation process, and obtain the adjusted Quantity forecasting model. Afterwards, according to the adjusted quantity forecasting model, re-execute the above-mentioned historical forecasted flow rate and historical forecasted quantity at each historical time within the preset time before the current time, and determine the historical forecasted utilization rate at each historical time. Finally, the evaluation process is performed according to the historical forecast utilization rate at each historical moment, the utilization rate difference, the preset difference threshold and the ratio threshold.
  • the server can re-predict the flow rate and the quantity of containers at each historical moment before the current moment and within the preset time period according to the historical data and through the adjusted quantity forecast model, and based on the forecast As a result, re-determine the historical forecast utilization rate at each historical moment within the preset time period before the current moment, so as to re-evaluate the adjusted quantity forecast model based on the re-determined historical forecast utilization rate and historical actual utilization rate at each historical moment .
  • the server can then use the traffic forecasting model to predict the traffic at each time within the preset time period, so as to further predict the number of containers at each time within the preset time period through the quantity forecasting model. If the re-evaluation fails, the server can directly determine the number of containers of the application at each time within a preset time period after the current time according to the distribution of the initialized number.
  • step S106 when determining the number of containers that should be allocated to the application at this moment based on the distribution of the number of containers predicted by the number prediction model, the server can directly distribute the number of containers , the number of containers corresponding to this moment is taken as the number of containers that should be allocated to the application at this moment, or, when the evaluation of the quantity prediction model fails, the number of containers corresponding to this moment in the enhanced quantity distribution predicted by the enhanced prediction model Quantity, as the number of containers that should be provisioned to the app at that moment.
  • the server may also use the maximum value of the number of containers corresponding to the time in the distribution of the number of containers and the number of containers corresponding to the time in the distribution of the number of reinforcements as the number of containers that should be allocated to the application at the time.
  • an average value or the like may also be taken, which is not limited in this description.
  • the server may also use the predicted distribution of the number of containers according to the preset Service Level Indicator (Service Level Indicator, SLI) and Service Level Objective (Service Level Objective, SLO).
  • SLI Service Level Indicator
  • SLO Service Level Objective
  • the number of containers of the application at each moment within the preset duration is adjusted in real time. That is, combining the predicted number of containers of the application at each time within the preset time length and the actual captured traffic, the number of containers of the application at each time within the preset time length can be flexibly adjusted.
  • the server may determine the actual utilization rate of the processor at this moment for each moment within the preset time period. Afterwards, the server can adjust the number of containers according to the actual utilization rate at that moment, with the target utilization rate as the target.
  • the server can also preset the target utilization rate of the application, and adjust the time allocated to the application according to the actual utilization rate at the time and the preset time limit condition. number of containers.
  • the target utilization rate and the preset time limit condition correspond to the SLI and the SLO respectively.
  • the SLI includes a limit on the relationship between the actual utilization rate and the target utilization rate of the application at each moment
  • the SLO includes a limit on the number of moments that do not meet the SLI within the preset time period.
  • the SLI may specifically include: for each moment within the preset duration, the actual utilization rate of the processor at this moment is not greater than the target utilization rate.
  • the SLO may specifically include: the number of moments when the actual utilization rate of the processor is greater than the target utilization rate within the preset time period is less than the number of preset moments, that is, the number of moments when the processor utilization rate does not meet the SLI within the preset time period Less than the preset number of moments.
  • the server can determine whether the actual utilization rate of the application has violated the SLO by the time of the preset time period, that is, the processor within the preset time period Whether the number of moments when the utilization rate does not meet the SLI is not less than the preset number of moments, if so, make the actual utilization rate at the next moment less than the target utilization rate, and adjust the number of containers configured for the application at the next moment, otherwise , according to one of the prediction result of the quantity prediction model and/or the prediction result of the enhanced prediction model, adjust the quantity of containers configured for the application at this moment.
  • the preset time can be set according to needs, for example, the preset time can be 5, 10, etc., which can be reasonably set according to needs, and this specification does not make limitations here.
  • step S100 it will be more accurate to determine their future traffic distribution based on their historical data. Therefore, before determining the historical data in step S100, it may also be determined whether the application is a periodic application.
  • the server may determine the number of containers at each historical moment in the application history as each historical quantity, and use the determined historical quantities at each historical moment to determine the historical quantity distribution. Afterwards, the server can determine whether the change in the number of containers of the application is periodic according to the historical number distribution. When it is determined according to the historical quantity distribution that the change of the container quantity of the application at each historical moment is periodic, then the historical data of the application is determined.
  • the server does not need to determine the long-term historical quantity distribution, so that the determined historical quantity distribution can reflect the periodicity of the application. For example, the historical volume distribution over a two-month period can be determined to determine whether there is a cyclical change in the application's container population.
  • the server may also determine the number of containers of the application at each moment within the preset time period according to the periodical change of the number of containers of the application, as a periodic number distribution. Specifically, the server may determine the cycle length of the container quantity change of the application according to the determined historical quantity distribution.
  • the cycle length is the duration corresponding to one cycle.
  • the preset number of cycles is the number of retroactive cycles. The number of cycles can be set as required, and this specification does not make a limitation here.
  • the server may directly determine the historical quantity distribution and determine the cycle length of the application container quantity change without judging whether the application container quantity change is periodic.
  • the preset duration may be the same as the period length of the application, or have a multiple relationship.
  • the server can determine the number of containers at each historical moment in each target historical period to determine the The distribution of the number of cycles at each moment in time. Specifically, when the cycle number is 1, that is, when the target historical cycle number is 1 and the cycle length is not less than the preset duration, the server can use the number of containers corresponding to each historical moment of the target historical cycle as The number of containers configured by the application at each moment within the preset duration.
  • the server can cut the preset time length according to the cycle length to determine each time segment, and for the time segment that is the same as the cycle length, the target history cycle of each
  • the number of containers at the historical moment is the number of containers configured by the application at each moment in the time segment.
  • the server may, in chronological order, take the number of containers at each historical moment in the target historical cycle as the number of containers configured at each time segment in a time segment different from the cycle length.
  • the number of containers corresponding to each moment in the target historical period is taken as the number of containers configured by the application at each moment within the preset duration, that is, the number of containers corresponding to each moment in the target historical period according to the time sequence within a period , corresponding to the number of containers corresponding to each moment of the application within the preset duration. That is, the number of containers at the i-th moment in the target history period is the same as the number of containers at the i-th moment in the preset time period.
  • the number of containers can also be adjusted up according to a preset value on the number of containers corresponding to each moment in the target historical period, and the number of containers after the increase can be used as the number of containers within the preset time period. The number of containers corresponding to each moment, so as to ensure that the determined number of containers will not limit the normal operation of the application.
  • the server can determine the container of the application at the time dimension in the preset duration according to the number of containers at the time dimension in each target historical period for each time dimension within a period length quantity.
  • the server can determine the number of containers in the preset time period of the application by taking the maximum value, average value, median, etc. of the number of containers in the dimension of each target historical period The number of containers in the moment dimension.
  • the time dimension refers to the order of time within a cycle. For example, assuming that the length of a cycle is 1 hour, each minute corresponds to a time dimension. The 10th minute in this cycle is the 10th time dimension.
  • the flow distribution may include a long-term flow distribution and a short-term flow distribution
  • the container quantity distribution may include a long-term quantity distribution and a short-term quantity distribution.
  • the server may output the long-term quantity distribution through the quantity prediction model according to the obtained long-term quantity distribution.
  • the server can also perform short-term traffic forecasting within the preset time length. Specifically, the server can divide the preset time length to determine each time period. For example, assuming that the preset time length is 1 day, A time period may be 1 hour.
  • the server can update the historical data up to the time period for each time period sequentially in chronological order, and intercept the second historical data from the updated historical data in reverse chronological order according to the second time period Data, according to the obtained second historical data, through the traffic forecasting model, the traffic at each moment in the time period is obtained as the short-term traffic distribution in the time period.
  • the server may determine the short-term traffic volume of each time period according to the short-term traffic distribution corresponding to each time period through the quantity prediction model in chronological order distributed.
  • the server can learn from the history In the data, the historical data within 7 days before the preset period is traced back, and the obtained historical data within 7 days is used as the first historical data. Assuming that the second time interval is 2 days, the server can trace back the historical data of 2 days before the current time period from the historical data, and use the obtained historical data of 2 days as the second historical data. When predicting the short-term traffic distribution in the subsequent time period, the historical data of the second time interval before the time period can be traced forward.
  • the server may further control the application within the preset time period according to the cycle quantity distribution determined based on the change period of the container quantity of the application and the predicted container quantity distribution.
  • the number of containers at a time is adjusted. Therefore, in step S106 of this specification, when adjusting the number of containers of the application at each moment within the preset duration according to the distribution of the number of containers, the server can also determine the target number distribution according to the distribution of the number of containers and the distribution of the period number . Afterwards, the server can adjust the number of containers of the application at each moment within the preset time period according to the target number distribution.
  • the server when determining the target quantity distribution, may, for each moment within the preset duration, determine the first quantity corresponding to the moment according to the period quantity distribution, and According to the container quantity distribution, the second quantity corresponding to this moment is determined. When the second quantity is greater than the first quantity, the second quantity is used as the target quantity at this moment, and the target quantity distribution is determined according to the target quantity at each moment within the preset time length. When the second quantity is not greater than the first quantity, the server may use the first quantity as the target quantity, and determine the target quantity distribution according to the target quantity at each moment within the preset time period.
  • the server may also use the average value of the first quantity and the second quantity at each moment as the target quantity at each moment, so as to determine the target quantity distribution of the preset duration.
  • the prediction of the short-term traffic distribution corresponding to each time period is a gradual forecasting process. Based on the gradual forecasting process, based on the flow gradually generated within the preset time length, considering the flow change within the preset time length, the short-term flow distribution can be obtained, so that the final predicted number of containers is more reasonable. The number of containers can be adjusted more reasonably and accurately at each moment within the preset time period.
  • the same traffic forecasting model can be used in the prediction of long-term traffic distribution and short-term traffic distribution.
  • the dimensions can be unified by means of interpolation. For example, the historical data intercepted according to the second time interval is filled with 0s to obtain an input with the same dimensions as the historical data intercepted in the first time interval.
  • the traffic forecasting model may include a long-term forecasting model and a short-term forecasting model, and training samples of different dimensions may be used to train them respectively.
  • the long-term prediction model is used to predict long-term traffic distribution
  • the short-term prediction model is used to predict short-term traffic distribution.
  • the input of the long-term forecasting model may be the actual traffic at each moment in the past 2 months, and the output is the traffic distribution in the next day.
  • the input of the short-term forecasting model can be the actual traffic at each moment in the past two days, and the output is the traffic distribution in the next hour.
  • the server may adjust the number of containers configured for the application at each moment within the preset time period according to the long-term quantity distribution and the short-term quantity distribution. Specifically, the server may, for each moment within the preset duration, determine the first target adjustment quantity corresponding to the moment according to the long-term quantity distribution; The second target reconciliation amount for . Afterwards, the server can adjust the container quantity at that moment according to the first target adjustment quantity and the second target adjustment quantity.
  • the server when adjusting the number of containers at this time according to the first target adjustment quantity and the second target adjustment quantity, may adjust the quantity according to the first target adjustment quantity and the second target adjustment quantity.
  • the maximum value of the target adjustment quantity which adjusts the number of containers at this moment.
  • the server may also adjust the container quantity at the moment according to the average value of the first target adjustment quantity and the second target adjustment quantity.
  • the total flow at that moment is composed of branch flows of various types and sources. Different types of traffic from different sources consume different amounts of containers. However, for two moments with the same total traffic, due to differences in internal branch traffic, the number of containers that need to be allocated to the application may be different at the two moments.
  • the server may also, for each preset traffic data type, determine the branch traffic corresponding to the traffic data type at each historical moment. And according to the branch traffic corresponding to each traffic data type at each historical moment, through the pre-trained traffic prediction model, predict the branch traffic of the application at each time within the preset time length, as the traffic distribution of the application within the preset time length .
  • the preset traffic data types can be determined according to the interfaces corresponding to different functions of the application and the source of the traffic data.
  • the traffic data source may include: hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP) traffic, information (message) traffic, and so on.
  • the server may input the traffic of each branch at each time within the preset time period into a pre-trained quantity prediction model to determine the number of containers that should be configured for the application at each time within the preset time period.
  • the number of containers is composed of the number of containers corresponding to each branch flow, and under the same total flow, the number of containers corresponding to different branch flows is not exactly the same.
  • the server when adjusting the number of containers of the application at each moment within the preset time period according to the distribution of the number of containers in step S106, the server may also time, according to the traffic distribution, determine the predicted traffic corresponding to the time, and determine the number of containers that should be configured for the application at that time according to the distribution of the number of containers. Afterwards, according to the determined flow rate and the number of containers at that moment, the predicted utilization rate of the processors in the container corresponding to this moment is determined, and the target utilization rate is used as a target, and the number of containers is adjusted according to the predicted utilization rate at this moment.
  • the predicted utilization rate can be determined through a linear regression model, and the formula for determining the predicted utilization rate can be specifically as follows:
  • C represents the predicted utilization rate corresponding to the application at a time
  • b 0 ⁇ b n and ⁇ are the parameters obtained from the training of the linear regression model
  • x 1 ⁇ x n represent the stand-alone machines corresponding to the traffic of each branch corresponding to the application at this time
  • Capacity that is, the ratio of the predicted flow of each branch to the number of containers corresponding to this moment
  • F n represents the nth branch flow corresponding to this moment
  • N represents the predicted number of containers corresponding to this moment.
  • the server when adjusting the number of containers based on the target utilization rate and the predicted utilization rate at this time, first, the server can The size relationship of the rate and the preset adjustment interval of the number of containers determine the search interval of the number of containers. For example, [countmin, countmax] represents the preset adjustment interval, countmin represents the minimum value of the preset number of containers allowed to be adjusted, and countmax represents the preset maximum value of the number of containers allowed to be adjusted.
  • the predicted utilization rate at this time is greater than the target utilization rate, in order to make the predicted utilization rate at this time equal to the target utilization rate or as close as possible to the target utilization rate, the predicted utilization rate at this time can be reduced by increasing the number of containers , then the server can determine [countnow, countmax] as the search interval corresponding to this moment.
  • the predicted utilization rate at this time is lower than the target utilization rate, in order to make the predicted utilization rate at this time equal to the target utilization rate or as close as possible to the target utilization rate, the forecasted utilization rate at this time can be increased by reducing the number of containers rate, the server can determine [countmin, countnow] as the search interval corresponding to this moment.
  • countnow indicates the number of containers corresponding to the moment output by the quantity prediction model, and it is within the adjustment interval.
  • the server can use the number of containers as the number of intervals for each number of containers in the adjustment interval, and determine the number of intervals according to the number of intervals and the traffic obtained through the traffic prediction model corresponding to the moment The corresponding predicted utilization rate is used as the interval utilization rate. Then, the server may determine, from the search interval, the number of intervals whose interval utilization rate is not greater than the target utilization rate, and from the obtained interval number, determine the interval number with the smallest difference between the corresponding interval utilization rate and the target utilization rate, As the final number of containers configured to the application at that moment.
  • suitable capacity adjustment modes for different applications are different. For example, some applications are not suitable for frequently adjusting the number of containers, while some applications have better performance and can be adjusted frequently. Therefore, the adjustment mode can also be preset to flexibly adjust the number of containers according to the application performance.
  • the server can determine the application profile of the application, determine an adjustment mode suitable for the application according to the application profile, and adjust the application according to the adjustment mode and the container quantity distribution The number of containers at each moment within the preset duration.
  • the adjustment mode may include: low frequency adjustment, cycle adjustment and high frequency adjustment. Assuming that the adjustment mode corresponding to the application is low-frequency adjustment, and the low-frequency adjustment is adjusted once a day, then the server can determine the maximum value as the adjustment target from the predicted number of containers at each time of the preset duration, and according to the maximum The value adjusts the number of containers for the app at each moment of the preset duration.
  • the server can, for each cycle length, use the maximum number of containers corresponding to the cycle length value, the number of containers at each moment in the length of the cycle is adjusted.
  • the server can cut the preset time length by 5 minutes, determine each time segment, and target the preset For each time segment in the duration, the number of containers at each moment in the time segment is adjusted according to the maximum value of the number of containers corresponding to the time segment. Specifically, it can be set as required, and this specification does not make a limitation here.
  • the server may determine each tag of the application and each data corresponding to each tag, and determine the application profile of the application according to the data corresponding to each tag. Since the running status of the application is not fixed, the application portrait can be updated flexibly, for example, the application portrait of the application is updated every day in a cycle of one day.
  • each label of the application can be set as required, for example, the label can include: a fact label, a description label, and a prediction label.
  • the fact-type tags include statistical data, including application running indicators at a historical moment level (eg, minute level), application deployment status, and the like.
  • Descriptive tags include tags that describe the objective attributes of the application, which are stability tags. Specifically, they can include application status, version, whether the traffic is periodic, the application developer's annotation of application performance, whether the central processing unit (Central Processing Unit, CPU)-sensitive applications, memory-sensitive applications, etc.
  • Predictive tags are based on application scenarios, and they predict subsequent tags from time series, including time series prediction of traffic, and prediction of the number of containers applied in various scenarios (such as stress testing, drainage, forecasting, etc.).
  • the data used to determine each tag of an application may include at least some of the following data: periodicity of the application (such as one cycle per day, two cycles per month, etc.), and Relevant data of each interface associated with each function of the application, the current scenario and node of the application (stress test, emergency, activity, daily), the capacity characteristics of the application (whether it is in the blacklist or whitelist based on the developer's label) , the safety water level of the CPU utilization rate of the application, whether it is memory-sensitive, whether it is CPU-sensitive, etc.), whether the application is a middleware version, the resource status of the application (whether it is a keep-alive application, whether it is a mixed-deployed application waiting), and the application involved Container deployment status (server models, computer rooms, sites, etc. corresponding to the application), historical events of the application (traffic growth, alarm status, current limiting status, etc.), business scenarios corresponding to the application, etc.
  • periodicity of the application such as one cycle per day, two cycles per month, etc.
  • the server can determine the adjustment mode of the application according to one or more of the above tags.
  • the capacity refers to the total resources of the containers used by the application when it is running. For example, the capacity corresponding to two 2Core containers is 4Core.
  • the above only discloses part of the adjustment based on one method or a combination of multiple methods.
  • the content of the number of containers at each moment in the duration is not limited to the above content.
  • the server can arbitrarily combine the results obtained in the above several ways to adjust the number of containers at each moment within the preset time period.
  • the server in addition to determining the target distribution according to the container quantity distribution and the cycle quantity distribution, may also determine the target quantity distribution according to the cycle quantity distribution and the reinforcement quantity distribution.
  • the server when adjusting the number of containers of the application at each time within the preset duration according to the target number distribution, the server may also determine the corresponding The target number of containers for , and determine the forecasted utilization for that target number. And according to the preset adjustment interval of the number of containers, the predicted utilization rate and the preset target utilization rate, the search interval at this moment is determined, so as to determine the final number of containers allocated to the application at this moment according to the search interval.
  • adjusting the number of containers of the application at each time within the preset time length according to the cycle number distribution is based on history.
  • the adjustment application is in The number of containers at each moment within the preset time period is adjusted based on prediction, and the adjustment based on the preset SLO is a real-time dynamic adjustment.
  • the server can flexibly adjust the number of containers of the application at each moment within the preset time period based on one or more of history, forecast, and SLO.
  • the server when pre-training the traffic forecasting model, can determine each target time, and for each target time, each time in the first time interval before the target time The actual traffic of the target time is used as a training sample, and the actual traffic at each time within the preset time after the target time is used as a label. After inputting the training sample into the traffic forecasting model, the predicted traffic at each moment within the preset time period is obtained. The server can determine the loss according to the difference between the actual traffic at each moment and the predicted traffic, and aim to minimize the loss , to adjust the parameters of the traffic forecasting model.
  • the server when the quantity forecasting model is trained in advance, can, for each target time, output the traffic forecasting model output at each time within a preset time period after the target time Predict traffic as training samples.
  • the actual utilization rate of the processor at each time within the preset time after the target time is used as a label. And based on the difference between the predicted utilization rate at each moment and the actual utilization rate, the loss of the quantity forecasting model is determined, and the parameters of the quantity forecasting model are adjusted with the goal of minimizing the loss.
  • Fig. 3 is a schematic diagram of a prediction model provided in this specification.
  • the forecasting model includes a traffic forecasting model, a quantity forecasting model, and an enhanced forecasting model.
  • the traffic distribution within the preset time period after the current moment is obtained, and the traffic distribution is input into the quantity
  • the distribution of the number of containers within the preset time period can be obtained.
  • the distribution of the number of strengthening within the preset time period after the current moment can be obtained.
  • Fig. 4 is a schematic diagram of container quantity adjustment provided in this specification.
  • the vertical axis N represents the number of containers
  • the horizontal axis represents time T. It can be seen that the number of containers of this application changes periodically, and the number of containers has two peaks in one day. Due to the sudden increase in traffic during the time period t1 and t2, the server also adjusts the number of containers in the time period t1 and t2 to be higher.
  • this specification also provides a corresponding device for adjusting the number of containers used, as shown in FIG. 5 .
  • Fig. 5 is a schematic diagram of an application container quantity adjustment device provided in this specification, the device includes: a historical data determination module 200, used to determine the historical data of the application, the historical data includes at least the actual traffic; the traffic forecasting module 201 is used to predict the traffic distribution of the application within a preset period of time through a pre-trained traffic prediction model according to the historical data; The target utilization rate of the container is set, and the pre-trained quantity prediction model is used to predict the distribution of the number of containers of the application within the preset time period; the adjustment module 203 is used to adjust the number of the application in the The number of containers at each moment within the preset time period.
  • a historical data determination module 200 used to determine the historical data of the application, the historical data includes at least the actual traffic
  • the traffic forecasting module 201 is used to predict the traffic distribution of the application within a preset period of time through a pre-trained traffic prediction model according to the historical data
  • the target utilization rate of the container is set, and the pre-trained quantity prediction
  • the historical data determining module 200 is further configured to determine the historical quantity distribution according to the quantity of containers configured for the application at each historical moment, when determining the quantity of containers of the application at each historical moment according to the historical quantity distribution When the change is periodic, the historical data of the application is determined.
  • the device further includes: a cycle determination module 204, configured to determine the cycle length of the container quantity change of the application according to the historical quantity distribution, and determine each target historical cycle according to the preset cycle number and the cycle length, Determine the number of containers at each historical moment in each target historical period according to the historical quantity distribution, and determine the number of containers at each moment in the preset time length according to the number of containers at each historical moment in each target historical period as the period quantity distributed.
  • a cycle determination module 204 configured to determine the cycle length of the container quantity change of the application according to the historical quantity distribution, and determine each target historical cycle according to the preset cycle number and the cycle length, Determine the number of containers at each historical moment in each target historical period according to the historical quantity distribution, and determine the number of containers at each moment in the preset time length according to the number of containers at each historical moment in each target historical period as the period quantity distributed.
  • the adjustment module 203 is further configured to determine a target quantity distribution according to the container quantity distribution and the cycle quantity distribution, and adjust the application to each container within the preset time period according to the target quantity distribution. The number of containers at the moment.
  • the adjustment module 203 is further configured to, for each moment within the preset duration, determine the predicted flow corresponding to the moment according to the flow distribution, and determine the moment according to the distribution of the number of containers.
  • the number of containers that should be configured for the application according to the determined flow rate and the number of containers at the time, determine the predicted utilization rate of the processor in the container corresponding to the time, with the target utilization rate as the target, according to the forecast at the time Utilization, adjust the number of containers.
  • the historical data also includes the historical predicted flow of the application at each historical moment, the historical predicted quantity of the container, and the historical actual utilization rate of the processor.
  • the adjustment module 203 is also configured to Within the preset period of time, the historical predicted traffic flow and historical predicted quantity at each historical moment are determined to determine the historical predicted utilization rate at each historical moment, and the quantity is determined according to the historical predicted utilization rate and historical actual utilization rate at each historical moment Predict the accuracy of the model.
  • the accuracy is greater than a preset ratio threshold, adjust the number of containers of the application at each time within the preset duration according to the distribution of the number of containers.
  • the preset proportion threshold is reached, the number of containers of the application at each moment within the preset time duration is determined according to the initialization quantity distribution of the application.
  • the adjustment module 203 is further configured to, for each historical moment within the preset duration before the current moment, determine the difference between the historical predicted utilization rate and the historical actual utilization rate at the historical moment, as The difference in utilization rate at this historical moment determines the number of historical moments in which the difference in utilization rate within the preset time period is less than the preset difference threshold before the current moment, as the number of up-to-standards, according to the number of up-to-standards and before the current time The total number of historical moments included in the preset time length determines the accuracy rate.
  • the device also includes: a regression module 205, configured to determine the loss according to the utilization rate difference corresponding to each historical time within the preset time before the current time, and adjust the quantity prediction model with the goal of minimizing the loss and the parameters of the traffic forecasting model.
  • a regression module 205 configured to determine the loss according to the utilization rate difference corresponding to each historical time within the preset time before the current time, and adjust the quantity prediction model with the goal of minimizing the loss and the parameters of the traffic forecasting model.
  • the adjustment module 203 is further configured to obtain the operation index of the application, and predict the application within the preset time period according to the operation index and the target utilization rate, through the reinforcement prediction model obtained in advance reinforcement learning.
  • the number distribution of containers in the application is used as an enhanced number distribution, and when the evaluation of the number prediction model fails, according to the enhanced number distribution, the number of containers of the application at each moment within the preset time length is adjusted.
  • the traffic forecasting module 201 is further configured to, for each preset traffic data type, determine the branch traffic corresponding to the traffic data type at each historical time, according to the corresponding branch traffic of each traffic data type at each historical time
  • the branch traffic is to predict the traffic of each branch of the application at each moment within the preset time length by using a pre-trained traffic prediction model, as the traffic distribution of the application within the preset time length.
  • the quantity prediction module 202 is further configured to input the flow of each branch at each moment within the preset time period and the preset target utilization rate of the container into a pre-trained quantity prediction model to determine the preset The number of containers that should be configured for the application at each moment within the duration, wherein the number of containers is composed of the number of containers corresponding to each branch flow, and under the same flow, the number of containers corresponding to different branch flows is not exactly the same.
  • the adjustment module 203 is further configured to determine the application portrait of the application, determine an adjustment mode suitable for the application according to the application portrait, and adjust the adjustment mode and the container quantity distribution according to the adjustment mode. The number of containers of the application at each moment within the preset time period.
  • This specification also provides a computer-readable storage medium, which stores a computer program, and the computer program can be used to execute the method for adjusting the number of containers for the application provided in FIG. 1 .
  • the electronic device includes a processor, an internal bus, a memory, and a non-volatile memory, and of course may include hardware required by other services.
  • the processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, so as to realize the method for adjusting the number of containers for the application provided in FIG. 1 above.
  • the improvement of a technology can be clearly distinguished as an improvement in hardware (for example, improvements in circuit structures such as diodes, transistors, and switches) or improvements in software (improvement in method flow).
  • improvements in circuit structures such as diodes, transistors, and switches
  • improvements in software improvement in method flow
  • the improvement of many current method flows can be regarded as the direct improvement of the hardware circuit structure.
  • Designers almost always get the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be realized by hardware physical modules.
  • a programmable logic device Programmable Logic Device, PLD
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • HDL Hardware Description Language
  • ABEL Advanced Boolean Expression Language
  • AHDL Altera Hardware Description Language
  • HDCal JHDL
  • Lava Lava
  • Lola MyHDL
  • PALASM RHDL
  • VHDL Very-High-Speed Integrated Circuit Hardware Description Language
  • Verilog Verilog
  • the controller may be implemented in any suitable way, for example the controller may take the form of a microprocessor or processor and a computer readable medium storing computer readable program code (such as software or firmware) executable by the (micro)processor , logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers and embedded microcontrollers, examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the control logic of the memory.
  • controller in addition to realizing the controller in a purely computer-readable program code mode, it is entirely possible to make the controller use logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded The same function can be realized in the form of a microcontroller or the like. Therefore, such a controller can be regarded as a hardware component, and the devices included in it for realizing various functions can also be regarded as structures within the hardware component. Or even, means for realizing various functions can be regarded as a structure within both a software module realizing a method and a hardware component.
  • a typical implementing device is a computer.
  • the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or Combinations of any of these devices.
  • the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions
  • the device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer-readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information.
  • Information may be computer readable instructions, data structures, modules of a program, 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 tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
  • computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
  • program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types.
  • the present description may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network.
  • program modules may be located in both local and remote computer storage media including storage devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

本说明书公开了一种应用的容器数量调节方法及装置,基于应用的历史数据,通过预训练的流量预测模型,对应用的未来预设时长内的流量分布进行预测,并基于预测得到的流量分布,通过预训练的数量预测模型,预测在该预设时长内该应用的容器数量分布,并根据得到的容器数量分布,调节该应用在该预设时长内各时刻的容器数量。能够预先对未来预设时长内应用的流量进行预测,以得到相应的各时刻应部署的容器数量,及时对应用各时刻的容器数量进行调节。

Description

应用的容器数量调节 技术领域
本说明书涉及计算机技术领域,尤其涉及一种应用的容器数量调节方法及装置。
背景技术
对于容器化的应用,合理分配应用占用的容器资源,灵活根据应用的运行情况调节支持应用运行的容器数量,是避免应用运行故障,使应用保持良好的运行状态的关键。
在现有技术中,通过监测应用各时刻的流量,基于各时刻的流量,根据预设的服务等级目标(Service Level Objective,SLO)来对容器数量进行调节。在不违背SLO的前提下,当应用流量增加时,则基于增加后的流量值上调容器数量,当应用流量减少时,则基于减少后的流量值下调容器数量。
但是,由于现有的调节方法是基于流量变化进行后调节,即观测到流量变化后才进行容器数量的调节,容易出现容器数量调整不及时,导致应用运行受限甚至故障的问题。
发明内容
本说明书提供一种应用的容器数量调节方法及装置,以部分的解决现有技术存在的上述问题。
本说明书采用下述技术方案:本说明书提供了一种应用的容器数量调节方法,包括:确定应用的历史数据,所述历史数据至少包括所述应用在各历史时刻的实际流量;根据所述历史数据,通过预先训练的流量预测模型,预测所述应用在预设时长内的流量分布;根据所述流量分布以及预设的容器的目标利用率,通过预先训练的数量预测模型,预测在所述预设时长内所述应用的容器数量分布;根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
可选地,确定应用的历史数据,具体包括:根据历史上各时刻为应用配置的容器数量,确定历史数量分布;当根据所述历史数量分布,确定所述应用在各历史时刻的容器数量变化具有周期性时,确定所述应用的历史数据。
可选地,所述方法还包括:根据所述历史数量分布,确定所述应用的容器数量变化的周期长度;根据预设的周期数量以及所述周期长度,确定各目标历史周期;根据所述历史数量分布,确定各目标历史周期中各历史时刻的容器数量;根据各目标历史周期中各历史时刻的容器数量,确定在所述预设时长内各时刻的容器数量,作为周期数量分布。
可选地,根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量,具体包括:根据所述容器数量分布以及所述周期数量分布,确定目标数量分布;根据所述目标数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
可选地,根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量,具体包括:针对所述预设时长内的每个时刻,根据所述流量分布,确定该时刻对应的预测流量,并根据所述容器数量分布,确定该时刻应为所述应用配置的容器数量;根据确定出的该时刻的流量以及容器数量,确定该时刻对应的容器中处理器的预测利用率;以所述目标利用率为目标,根据该时刻的预测利用率,调节所述容器数量。
可选地,所述历史数据还包括所述应用在各历史时刻的历史预测流量、容器的历史 预测数量以及容器中处理器的历史实际利用率;根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量,具体包括:根据当前时刻之前,所述预设时长内,各历史时刻的历史预测流量以及历史预测数量,确定各历史时刻的历史预测利用率;根据所述各历史时刻的历史预测利用率以及历史实际利用率,确定所述数量预测模型的准确率;当所述准确率大于预设的比例阈值时,根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量;当所述准确率不大于预设的比例阈值时,根据所述应用的初始化数量分布,确定所述应用在所述预设时长内各时刻的容器数量。
可选地,根据所述各历史时刻的历史预测利用率以及历史实际利用率,确定所述数量预测模型的准确率,具体包括:针对当前时刻之前,所述预设时长内的每个历史时刻,确定该历史时刻的历史预测利用率与历史实际利用率间的差值,作为该历史时刻的利用率差值;确定当前时刻之前,所述预设时长内利用率差值小于预设的差值阈值的历史时刻的数量,作为达标数量;根据所述达标数量以及当前时刻之前所述预设时长内包含的历史时刻的总数,确定准确率。
可选地,所述方法还包括:根据当前时刻之前,所述预设时长内各历史时刻对应的利用率差值,确定损失;以所述损失最小为目标,调整所述数量预测模型以及所述流量预测模型的参数。
可选地,所述方法还包括:获取所述应用的运行指标;根据所述运行指标以及所述目标利用率,通过预先强化学习得到的强化预测模型,预测在所述预设时长内所述应用的容器的数量分布,作为强化数量分布;当所述数量预测模型评估未通过时,根据所述强化数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
可选地,根据所述历史数据,通过预先训练的流量预测模型,预测所述应用在预设时长内的流量分布,具体包括:针对预设的每种流量数据类型,确定各历史时刻中,该流量数据类型对应的分支流量;根据各历史时刻的各流量数据类型对应的分支流量,通过预先训练的流量预测模型,预测所述应用在预设时长内各时刻的各分支流量,作为所述应用在所述预设时长内的流量分布。
可选地,根据所述流量分布以及预设的容器的目标利用率,通过预先训练的数量预测模型,预测在所述预设时长内所述应用的容器数量分布,具体包括:将所述预设时长内各时刻的各分支流量以及预设的容器的目标利用率,输入预先训练的数量预测模型,确定所述预设时长内各时刻应为所述应用配置的容器数量;其中,所述容器数量由各分支流量对应的容器数量构成,在同样流量下,不同分支流量对应的容器数量不完全相同。
可选地,根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量,具体包括:确定所述应用的应用画像,根据所述应用画像,确定适合所述应用的调节模式;根据所述调节模式以及所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
本说明书提供了一种应用的容器数量调节装置,包括:历史数据确定模块,用于确定应用的历史数据,所述历史数据至少包括所述应用在各历史时刻的实际流量;流量预测模块,用于根据所述历史数据,通过预先训练的流量预测模型,预测所述应用在预设时长内的流量分布;数量预测模块,用于根据所述流量分布以及预设的容器的目标利用率,通过预先训练的数量预测模型,预测在所述预设时长内所述应用的容器数量分布; 调节模块,用于根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
本说明书提供了一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序被处理器执行时实现上述应用的容器数量调节方法。
本说明书提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述应用的容器数量调节方法。
本说明书采用的上述至少一个技术方案能够达到以下有益效果:在本说明书提供的应用的容器数量调节方法中,基于应用的历史数据,通过预训练的流量预测模型,对应用的未来预设时长内的流量分布进行预测,并基于预测得到的流量分布,通过预训练的数量预测模型,预测在该预设时长内该应用的容器数量分布,并根据得到的容器数量分布,调节该应用在该预设时长内各时刻的容器数量。
从上述方法中可以看出,本方法能够预先对未来预设时长内应用的流量进行预测,以得到相应的各时刻应部署的容器数量,及时对应用各时刻的容器数量进行调节。
附图说明
此处所说明的附图用来提供对本说明书的进一步理解,构成本说明书的一部分,本说明书的示意性实施例及其说明用于解释本说明书,并不构成对本说明书的不当限定。在附图中:
图1为本说明书中一种应用的容器数量调节方法的流程示意图;
图2为本说明书提供的一种预测模型的示意图;
图3为本说明书提供的一种预测模型示意图;
图4为本说明书提供的一种容器数量调节示意图;
图5为本说明书提供的一种应用的容器数量调节装置的示意图;
图6为本说明书提供的一种电子设备的结构示意图。
具体实施方式
为使本说明书的目的、技术方案和优点更加清楚,下面将结合本说明书具体实施例及相应的附图对本说明书技术方案进行清楚、完整地描述。显然,所描述的实施例仅是本说明书一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本说明书保护的范围。
以下结合附图,详细说明本说明书各实施例提供的技术方案。
图1为本说明书中一种应用的容器数量调节方法的流程示意图,具体包括以下步骤:S100:确定应用的历史数据,所述历史数据至少包括所述应用在各历史时刻的实际流量。
在本说明书中,该应用的容器数量调节方法可由服务器执行。
为了能够及时对应用各时刻的容器数量进行调节,避免出现调节不及时的情况,在本说明书中,可预先通过模型对各时刻应用的容器数量进行预测,根据预测得到的容器 数量,及时对各时刻配置给应用的支持应用运行的容器数量进行调节。
由于应用的历史运行情况已知,且能够体现应用长期对容器数量的需求以及需求的变化,因此,可以基于应用的历史数据来对应用未来各时刻对容器数量的需求进行预测。
于是,在本说明书一个或多个实施例中,该服务器首先可确定应用的历史数据,该历史数据至少包括该应用在各历史时刻的实际流量。即确定历史上该应用在运行过程中各时刻的流量。以便于在后续步骤中根据历史上的实际流量,预测该应用未来各时刻的流量,即未来各时刻的预测流量。
在本说明书一个或多个实施例中,由于可能存在未捕捉到应用流量的特殊情况,即存在个别时刻未捕捉到流量的情况,该服务器在确定出历史数据后,可对历史数据进行预处理,再根据预处理后的历史数据进行流量分布的预测。具体的,该服务器可针对每个未捕捉到流量的历史时刻,根据该历史时刻前后的相邻历史时刻对应的实际流量,确定该历史时刻的实际流量。例如,可将该历史时刻前后相邻历史时刻对应的实际流量取平均值,作为该历史时刻的实际流量,或者也可以取最大值,最小值等,具体可根据需要设置,本说明书在此不做限制。
当然,具体根据该历史时刻前后几个历史时刻来确定该历史时刻的实际流量,可灵活设置,如可预先设置时间区间,根据该时间区间来确定相邻历史时刻。例如,假设该时间区间为3,则该服务器可根据该历史时刻前3个相邻历史时刻对应的实际流量以及该历史时刻后3个相邻历史时刻对应的实际流量来确定该历史时刻的实际流量。
S102:根据所述历史数据,通过预先训练的流量预测模型,预测所述应用在预设时长内的流量分布。
在本说明书一个或多个实施例中,该服务器可根据该应用的历史数据,通过预训练的流量预测模型,预测该应用在预设时长内各时刻的流量,得到该预设时长对应的该应用的流量分布,即预测该应用在预设时长内的流量分布。使得能够在后续步骤中,该服务器可根据该流量分布,进一步进行预测,得到该应用在该预设时长内的容器数量分布。
其中,该预设时长即预设的需要对该应用的容器数量进行预测的未来的一段时间长度。例如,该预设时长可以是未来一天,或者未来一小时、未来八小时等,当然也可以是其他时长,具体可根据需要设置,本说明书在此不做限制。该历史数据可以是该应用长期积累的历史数据,该服务器可从中确定至少部分历史数据输入到该流量预测模型,得到该预设时长内的流量分布。或者,该历史数据可与该流量预测模型的输入对应,例如该流量预测模型的输入为当前时刻前两个月内的历史数据,则该服务器可直接确定该应用两个月内的历史数据,而无需确定该应用长期累积的历史数据。
在本说明书一个或多个实施例中,该服务器可在日期的分界点或分界点前后时刻执行该应用的容器数量调节方法,例如,可在8日零点(或7日23:59分),根据零点前的历史数据,预测8日当天该应用的容器数量分布。当然,零点只是示例,也可以是其他时间,本说明书在此不做限制。
S104:根据所述流量分布以及预设的容器的目标利用率,通过预先训练的数量预测 模型,预测在所述预设时长内所述应用的容器数量分布。
在本说明书一个或多个实施例中,该服务器可根据预测得到的流量分布以及预设的容器的目标利用率,通过预训练的预测模型,预测在该预设时长内各时刻,应配置给该应用的容器数量,得到该预设时长内该应用的容器数量分布,即预测在该预设时长内该应用的容器数量分布。
其中,该目标利用率即容器中处理器的目标利用率,可至少根据该应用的历史利用率确定。
S106:根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
在本说明书一个或多个实施例中,在确定出该应用在该预设时长内的容器数量分布后,该服务器可根据该容器数量分布,调节该应用在该预设时长内各时刻的容器数量。
通常,不同的应用皆有其对应的初始化的容器数量,对应用的容器数量的调节是在对应用的容器数量进行初始化后,在初始化得到该预设时长内容器的初始化数量分布的基础上进行调节,即在该预设时长内各时刻的初始化数量的基础上进行容器数量的增减。因此,在本说明书中,可在对应用的容器数量进行初始化后,在得到的该预设时长内各时刻的初始化数量的基础上,根据预测得到的各时刻的容器数量,在初始化数量的基础上进行容器数量的调节。例如,假设该预设时长对应未来的一个小时,在该预设时长内的第3分钟,即第3时刻,容器的初始化数量为4,预测得到的容器数量为6,可将预测得到的该时刻的容器数量为目标,对该应用在该时刻的容器数量进行调节,因此,可将该预设时长内的第3分钟该应用的容器数量上调2个成为6个。
在本说明书一个或多个实施例中,应用的容器可对应指定的计算资源、存储资源等运行该应用所需的资源。例如,一个容器可以对应4个处理器内核(Core)。
在本说明书一个或多个实施例中,可将该流量预测模型以及该数量预测模型视为一个预测模型。该预测模型的结构可如图2所示。
图2为本说明书提供的一种预测模型的示意图。如图,该预测模型包括流量预测模型以及数量预测模型,将各历史时刻的实际流量输入该流量预测模型后,得到当前时刻后预设时长内的流量分布,将该流量分布输入数量预测模型后,可得到该预设时长内的容器数量分布。
基于图1所示的应用的容器数量调节方法,基于应用的历史数据,通过预训练的流量预测模型,对应用的未来预设时长内的流量分布进行预测,并基于预测得到的流量分布,通过预训练的数量预测模型,预测在该预设时长内该应用的容器数量分布,并根据得到的容器数量分布,调节该应用在该预设时长内各时刻的容器数量。
从上述方法中可以看出,本方法能够预先对未来预设时长内应用的流量进行预测,以得到相应的各时刻应部署的容器数量,及时对应用各时刻的容器数量进行调节。
另外,为了使对容器数量的调节尽可能可靠,该服务器还可以根据该数量预测模型历史上各时刻的预测数据以及实际数据,对该数量预测模型进行评估。
在本说明书一个或多个实施例中,该应用的历史数据还可包括该应用在各历史时刻的历史预测流量、容器的历史预测数量以及容器中处理器的历史实际利用率,该服务器可根据各历史时刻的历史利用率以及实际利用率,对该数量预测模型进行评估。
具体的,该服务器可根据当前时刻之前的预设时长内,各历史时刻的历史预测流量以及历史预测数量,确定各历史时刻的历史预测利用率。并根据各历史时刻的历史预测利用率以及历史实际利用率,确定该数量预测模型的准确率。当该准确率大于预设的比例阈值时,则评估通过,确定该数量预测模型的预测结果足够准确,该服务器可根据该容器数量分布调节该应用在该预设时长内各时刻的容器数量。当该准确率不大于预设的比例阈值时,则评估不通过,该服务器可根据该应用的初始化数量分布,确定该应用在该预设时长内各时刻的容器数量。
在本说明书一个或多个实施例中,该服务器可从该历史数据中确定该预设时长前24小时对应的部分历史数据对该数量预测模型进行评估。
在本说明书一个或多个实施例中,该服务器还可以根据当前时刻之前,该预设时长内各历史时刻对应的利用率差值,确定损失,并以该损失最小为目标,调整该数量预测模型以及该流量预测模型的参数。
在本说明书一个或多个实施例中,该服务器在确定该数量预测模型的准确率时,可针对当前时刻之前该预设时长内的每个历史时刻,确定该历史时刻的历史预测利用率与历史实际利用率间的差值,作为该历史时刻的利用率差值。并确定当前时刻之前,该预设时长内利用率差值小于预设的差值阈值的历史时刻的数量,作为达标数量。然后,根据该达标数量以及当前时刻之前的预设时长内包含的历史时刻的总数,确定准确率。
在本说明书一个或多个实施例中,可将该达标数量以及当前时刻之前的预设时长内包含的历史时刻的总数的比值,作为准确率。
在本说明书一个或多个实施例中,该服务器还可以根据该总数以及该达标数量的差值,确定非达标数量,并根据该达标数量以及该非达标数量的比值,确定准确率。
在本说明书一个或多个实施例中,当针对当前时刻之前该预设时长内的每个历史时刻,该历史时刻的利用率差值小于预设的差值阈值时,则确定该历史时刻对应的预测得到的容器数量准确,该历史时刻的预测结果达标。该达标数量即当前时刻之前该预设时长内,预测得到的容器数量准确的历史时刻的数量。
其中,该差值阈值以及比例阈值具体皆可根据需要设置,本说明书在此不做限制。例如,该比例阈值可为80%。
在本说明书一个或多个实施例中,在对该数量预测模型进行评估时,还可根据以下三个方面进行评估:结果差值、偏离方向以及偏离比例。其中,结果差值,是指各历史时刻的历史预测利用率与各自对应的实际利用率间的差值,即各历史时刻的利用率差值。偏离方向是指历史预测利用率与实际利用率相比是偏大还是偏小。偏离比例是指结果差值与预设的差值阈值之差大于预设值的时刻所占的比例。
在本说明书一个或多个实施例中,结果差值的大小与数量预测模型的预测结果的准 确性负相关,结果差值越小数量预测模型越有可能通过评估。为了保障应用的正常运行,即使预测得到的应用的容器数量不够准确,也希望预测得到的容器数量尽可能大于实际应当配置给应用的容器数量,避免由于容器容量不足而限制了应用的运行,因此,当各历史时刻的历史预测利用率与实际利用率相比偏大时,数量预测模型更有可能通过评估。当偏离比例越小时,数量预测模型更有可能通过评估,即当未偏离比例越大时,数量预测模型越有可能通过评估,且当未偏离比例大于预设的比例阈值时,评估通过。其中,该未偏离比例可对应上述准确率概念。
在本说明书一个或多个实施例中,可根据结果差值、偏离方向以及偏离比例中的一种或几种进行评估,具体怎样根据结果差值、偏离方向以及偏离比例中的一种或几种进行评估,本说明书在此不做限制,可根据需要设置。
在本说明书一个或多个实施例中,还可以不根据流量进行容器数量的预测,该服务器可基于应用运行过程中产生的运行指标,通过强化学习得到的强化预测模型进行容器数量的预测。
在本说明书一个或多个实施例中,在数量预测模型评估未通过时,该服务器还可以根据预先强化学习得到的强化预测模型预测得到的该预设时长内各时刻的容器数量,并在步骤S106中,根据强化预测模型预测得到的该预设时长内各时刻的容器数量,调节该应用的容器数量。
在本说明书一个或多个实施例中,该服务器可获取该应用的运行指标,根据该运行指标以及预设的目标利用率,通过预先强化学习得到的强化预测模型,确定在该预设时长内各时刻应配置给该应用的容器数量,以得到在该预设时长内该应用的容器的数量分布,作为强化数量分布。当该数量预测模型评估未通过时,再根据该强化数量分布,调节该应用在该预设时长内各时刻的容器数量。
其中,该运行指标包括该应用在运行过程中产生的各项指标数据,例如,线程切换次数、传输(traffic)数据包的数量、负载数量、触发垃圾回收(Garbage Collection,GC)的次数等等。
在本说明书一个或多个实施例中,该运行指标可以是时刻级别的指标,例如,一分钟为一个时刻,则该运行指标为分钟级别的指标。可具体采用该预设时长前与该预设时长处于同一时间段内每个时刻的运行指标。例如,假设该预设时长为一小时,且该预设时长为该预设时长所在的一天的第三个小时,则该运行指标可以是前一天第三个小时内每个时刻的运行指标。
在本说明书一个或多个实施例中,该运行指标中还可以包括流量,具体可以是该预设时长前与该预设时长处于同一时间段内每个时刻的实际流量。
在本说明书一个或多个实施例中,该服务器可根据该强化预测模型预测得到的该预设时长内各时刻对应的利用率与该预设时长内各时刻的实际利用率的差异,确定该强化预测模型的损失,并以该损失最小为目标,调整该强化预测模型的参数。
在本说明书一个或多个实施例中,该服务器还可直接根据该应用的运行指标,通过 该强化预测模型进行容器数量的预测。并根据该强化预测模型预测得到的强化数量分布,调节该应用在该预设时长内各时刻的容器数量。即,无需在该数量预测模型评估未通过时,才使用该强化预测模型,可直接获取该应用的运行指标,根据该运行指标,通过预先强化学习得到的强化预测模型,确定在该预设时长内各时刻应配置给该应用的容器数量,以预测在该预设时长内该应用的容器的数量分布,作为强化数量分布。并根据该强化数量分布调节该应用在该预设时长内各时刻的容器数量。
即,在本说明书一个或多个实施例中,该服务器可根据通过数量预测模型以及强化预测模型两个模型进行容器数量的预测,并以优先根据数量预测模型的预测结果对该应用在预设时长内的容器数量进行调节的规则,根据对数量预测模型的评估结果,选择根据哪一模型的预测结果进行容器数量的调节。或者,该服务器也可以仅通过数量预测模型和强化预测模型中的一个模型进行预测,并根据得到的一个预测结果,对该应用在预设时长内的容器数量进行调节。
在本说明书一个或多个实施例中,为了最大程度的保障应用的正常运行,该服务器还可以在分别通过数量预测模型和强化预测模型预测得到容器数量分布以及强化数量分布后,针对该预设时长内的每个时刻,将容器数量分布中该时刻对应的容器数量以及强化数量分布中该时刻对应的容器数量的最大值,对该应用在预设时长内该时刻的容器数量进行调节。
在本说明书一个或多个实施例中,该服务器还可以对该强化预测模型进行评估,确定该强化预测模型的准确率,并在当该强化预测模型的准确率大于预设的比例阈值时,根据该强化预测模型输出的强化数量分布,调节该应用在该预设时长内各时刻的容器数量。在当该强化预测模型的准确率不大于预设的比例阈值时,根据该应用的初始化数量分布,确定该应用在该预设时长内各时刻的容器数量。
在本说明书一个或多个实施例中,该服务器还可以在通过流量预测模型进行预测前,先对该数量预测模型进行评估,当评估通过时,再通过该数量预测模型进行预测。即无需先通过流量预测模型预测得到在预设时长内的流量分布,根据流量分布以及预设的容器的目标利用率,通过该数量预测模型,预测得到容器数量分布后,再对该数量预测模型进行评估。而是先对该数量预测模型进行评估,待评估通过后,再依次基于该流量预测模型以及该数量预测模型进行预测,以减少预测带来的计算量。
在本说明书一个或多个实施例中,在对该数量预测模型进行评估时,该服务器还可以进行循环评估。具体的,首先,该服务器可根据评估过程中确定出的当前时刻之前,该预设时长内各历史时刻对应的利用率差值,确定损失以调整该数量预测模型的参数之后,得到调整后的数量预测模型。之后,根据调整后的数量预测模型,重新执行上述根据当前时刻之前的预设时长内,各历史时刻的历史预测流量以及历史预测数量,确定各历史时刻的历史预测利用率。最后以根据各历史时刻的历史预测利用率、利用率差值、预设的差值阈值以及比例阈值进行评估的过程。
即,在调整数量预测模型参数后,该服务器可根据历史数据,通过调整后的数量预测模型,重新对当前时刻之前,该预设时长内各历史时刻的流量以及容器数量进行预测, 并基于预测结果,重新确定当前时刻之前预设时长内,各历史时刻的历史预测利用率,以根据重新确定的各历史时刻的历史预测利用率以及历史实际利用率,重新对调整后的数量预测模型进行评估。待重新评估通过后,该服务器可再通过该流量预测模型对该预设时长内各时刻的流量进行预测,以进一步通过该数量预测模型,对该预设时长内各时刻的容器数量进行预测。若重新评估未通过,该服务器可直接根据初始化数量分布,确定该应用在当前时刻后的预设时长内各时刻的容器数量。
在本说明书一个或多个实施例中,在步骤S106中根据该数量预测模型预测得到的容器数量分布,确定应在该时刻配置给该应用的容器数量时,该服务器可直接将该容器数量分布中,该时刻对应的容器数量作为应在该时刻配置给该应用的容器数量,或者,当该数量预测模型评估未通过时,将该强化预测模型预测得到的强化数量分布中该时刻对应的容器数量,作为应在该时刻配置给该应用的容器数量。再或者,该服务器还可以将该容器数量分布中该时刻对应的容器数量与强化数量分布中该时刻对应的容器数量中的最大值,作为应在该时刻配置给该应用的容器数量。当然,也可以取平均值等,本说明书在此不做限制。
在本说明书一个或多个实施例中,该服务器还可以根据预设的服务水平指标(Service Level Indicator,SLI)以及服务等级目标(Service Level Objective,SLO),结合预测得到的该容器数量分布来实时调节该应用在该预设时长内各时刻的容器数量。即结合预测得到的应用在该预设时长内各时刻的容器数量,以及实际捕捉到的流量,灵活调节该应用在该预设时长内各时刻的容器数量。
在本说明书一个或多个实施例中,具体的,该服务器可针对该预设时长内的每个时刻,确定该时刻处理器的实际利用率。之后,该服务器可根据该时刻的实际利用率,以该目标利用率为目标,调节该容器数量。
在本说明书一个或多个实施例中,该服务器还可以预设的该应用的目标利用率为目标,根据该时刻的实际利用率以及预设的时间限制条件,调节该时刻配置给该应用的容器数量。
其中,该目标利用率、预设的时间限制条件分别对应SLI以及SLO。SLI包括对该应用各时刻的实际利用率与目标利用率的大小关系的限制,SLO包括对该预设时长内不符合SLI的时刻的数量限制。
例如,在本说明书一个或多个实施例中,SLI可具体包括:针对该预设时长内的每个时刻,该时刻处理器的实际利用率不大于目标利用率。SLO可具体包括:在该预设时长内处理器的实际利用率大于目标利用率的时刻的数量小于预设时刻数量,即在该预设时长内处理器的利用率不满足SLI的时刻的数量小于预设时刻数量。
当在该预设时长内,依次针对该预设时长内的每个时刻,该服务器可判断截止到该时刻时,该应用的实际利用率是否违背了SLO,即在该预设时长内处理器的利用率不满足SLI的时刻的数量是否不小于预设时刻数量,若是,则以使下一时刻的实际利用率小于目标利用率为目标,调节下一时刻为该应用配置的容器数量,否则,根据该数量预测模型的预测结果和/或该强化预测模型的预测结果中的一种,调节该时刻为该应用配置的 容器数量。
其中,该预设时刻可根据需要设置,如该预设时刻可以是5、10等,可根据需要合理设置,本说明书在此不做限制。
另外,由于对于具有周期性的应用,根据其历史数据确定其未来的流量分布会更准确。因此,在步骤S100确定历史数据之前,还可以判断该应用是否为周期性应用。
具体的,该服务器可确定该应用历史上各历史时刻的容器数量,作为各历史数量,并将确定出的各历史时刻的各历史数量,确定历史数量分布。之后,该服务器可根据该历史数量分布,判断该应用的容器数量变化是否具有周期性。当根据该历史数量分布,确定该应用在各历史时刻的容器数量变化具有周期性时,再确定该应用的历史数据。
在本说明书一个或多个实施例中,该服务器无需确定长期的历史数量分布,使得确定出的历史数量分布能够体现应用的周期性即可。例如,可确定两个月内的历史数量分布,以确定该应用的容器数量变化是否具有周期性。
进一步地,该服务器还可以根据该应用的容器数量变化的周期性,确定该应用在该预设时长内各时刻的容器数量,作为周期数量分布。具体的,该服务器可根据确定出的该历史数量分布,确定该应用的容器数量变化的周期长度。
并按照时间倒序,根据预设的周期数以及该周期长度,从该预设时长前向前追溯,确定各目标历史周期,并根据该历史数量分布,确定各目标历史周期中各历史时刻的容器数量,以根据各目标历史周期中各历史时刻的容器数量,确定在该预设时长内各时刻的容器数量,作为周期数量分布。
其中,该周期长度,即一个周期对应的时长。该预设的周期数即向前追溯的周期数量。该周期数可根据需要设置,本说明书在此不做限制。
在本说明书一个或多个实施例中,该服务器还可以不判断该应用的容器数量变化是否具有周期性,直接确定历史数量分布以及确定该应用的容器数量变化的周期长度。
在本说明书一个或多个实施例中,该预设时长的时间长度可与该应用的周期长度相同,或存在倍数关系。
在本说明书一个或多个实施例中,在得到各目标历史周期中各历史时刻的容器数量之后,该服务器可根据各目标历史周期中各历史时刻的容器数量,确定该应用在该预设时长内各时刻的周期数量分布。具体的,当该周期数为1时,即当目标历史周期数量为1,且该周期长度不小于该预设时长时,该服务器可将该目标历史周期的各历史时刻对应的容器数量,作为该应用在该预设时长内各时刻配置的容器数量。当该周期长度小于该预设时长时,该服务器可根据该周期长度对该预设时长进行切割,确定各时间片段,并针对与该周期长度时长相同的时间片段,将该目标历史周期中各历史时刻的容器数量,作为该应用在该时间片段内各时刻配置的容器数量。对于与该周期长度时长不同的时间片段,该服务器可按照时间顺序,依次将该目标历史周期中各历史时刻的容器数量,作为与该周期长度时长不同的时间片段各时刻配置的容器数量。
其中,将该目标历史周期中各时刻对应的容器数量,作为该应用在该预设时长内各 时刻配置的容器数量,即按照一个周期内部的时间顺序,该目标历史周期各时刻对应的容器数量,分别与该应用在该预设时长内各时刻对应的容器数量一一对应。即该目标历史周期中第i个时刻的容器数量与该应用在该预设时长内第i个时刻的容器数量相同。
在本说明书一个或多个实施例中,还可以在该目标历史周期中各时刻对应的容器数量上将容器数量按照预设的数值上调,并将上调后的各容器数量作为该预设时长内各时刻对应的容器数量,以尽可能保障确定出的容器数量不会限制该应用的正常运行。
当该周期数不为1时,该服务器可针对一个周期长度内的每个时刻维度,根据各目标历史周期在该时刻维度的容器数量,确定该应用在该预设时长中该时刻维度的容器数量。
在本说明书一个或多个实施例中,该服务器可通过将各目标历史周期在该时刻维度的容器数量取最大值、平均值、中位数等方法,确定该应用在该预设时长中该时刻维度的容器数量。
其中,该时刻维度,即在一个周期内,时刻的顺位。例如,假设一个周期的长度为1小时,则每一分钟对应一个时刻维度。该周期内的第10分钟即第10个时刻维度。
另外,为了使最终预测得到的该预设时长的容器数量分布尽可能准确,在本说明书中,在根据历史数据,通过流量预测模型进行该预设时长的流量分布的预测时,可分别进行长期以及短期的流量分布,以得到更丰富的流量分布,并基于流量分布得到更丰富的容器数量分布。
因此,在本说明书一个或多个实施例中,该流量分布可包括长期流量分布以及短期流量分布,该容器数量分布可包括长期数量分布以及短期数量分布。在步骤S102中基于历史数据进行预测时,该服务器可根据第一时间区间,按照时间倒序,从应用的历史数据中截取得到第一历史数据,并根据该第一历史数据,通过流量预测模型,进行长期的流量预测,得到该预设时长中各时刻的流量,作为长期流量分布。
在本说明书一个或多个实施例中,相应的,在步骤S104中,该服务器可根据得到的长期数量分布,通过该数量预测模型,输出长期数量分布。
另外,由于流量变化可能具有临时性以及突发性,为了使预测得到的该预设时长内各时刻的容器数量更准确,可使该预设时长内产生的数据参与到流量的预测。因此,该服务器还可在该预设时长内再进行短期的流量预测,具体的,该服务器可将该预设时长进行切分,确定各时间段,例如,假设该预设时长为1天,一个时间段可为1小时。之后,该服务器可按照时间顺序,依次针对每个时间段,更新截止到该时间段前的历史数据,并根据第二时间区间,按照时间倒序,从更新后的历史数据中截取得到第二历史数据,根据得到的第二历史数据,通过流量预测模型,得到该时间段中各时刻的流量,作为该时间段的短期流量分布。
在本说明书一个或多个实施例中,相应的,在步骤S104中,该服务器可按照时间顺序,分别根据各时间段对应的短期流量分布,通过该数量预测模型,确定各时间段的短期数量分布。
其中,该第一时间区间与该第二时间区间的长度不同,且该第一时间区间的长度大于该第二时间区间的长度,例如该第一时间区间为7天,则该服务器可从历史数据中追溯该预设时长前7天内的历史数据,并将得到的7天内的历史数据作为第一历史数据。假设该第二时间区间为2天,则该服务器可从历史数据中追溯当前时间段前2天内的历史数据,并将得到的2天内的历史数据作为第二历史数据。在对后续的时间段进行短期流量分布的预测时,可向前追溯该时间段前第二时间区间的历史数据。
在本说明书提供的一个或多个实施例中,该服务器还可以根据基于该应用的容器数量的变化周期确定的周期数量分布以及预测得到的该容器数量分布对该应用在该预设时长内各时刻的容器数量进行调节。因此,在本说明书步骤S106中,在根据该容器数量分布调节该应用在该预设时长内各时刻的容器数量时,该服务器还可以根据该容器数量分布以及该周期数量分布,确定目标数量分布。之后,该服务器可根据该目标数量分布,调节该应用在该预设时长内各时刻的容器数量。
在本说明书提供的一个或多个实施例中,在确定目标数量分布时,该服务器可针对该预设时长内的每个时刻,根据该周期数量分布,确定该时刻对应的第一数量,并根据该容器数量分布,确定该时刻对应的第二数量。当该第二数量大于该第一数量时,将该第二数量作为该时刻的目标数量,并根据该预设时长内各时刻的目标数量,确定目标数量分布。当该第二数量不大于该第一数量时,该服务器可将该第一数量作为目标数量,并根据该预设时长内各时刻的目标数量,确定目标数量分布。
在本说明书提供的一个或多个实施例中,该服务器还可以将各时刻的第一数量以及第二数量的平均值作为各时刻的目标数量,以确定该预设时长的目标数量分布。
在本说明书中,由于该服务器需要针对每个时间段,更新截止到该时间段前的历史数据,因此,对于每个时间段对应的短期流量分布的预测是一个渐进的预测过程。基于该渐进的预测过程,能够基于在该预设时长内逐渐产生的流量,考虑到该预设时长内的流量变动,得到短期流量分布,使得最终预测出的容器数量更合理,基于预测的各容器数量对该预设时长内各时刻容器数量的调节更合理准确。
在本说明书一个或多个实施例中,在进行长期流量分布的预测以及短期流量分布预测时可采用同一流量预测模型,为了使输入维度统一,可通过插值的方法进行维度同一。例如,将根据第二时间区间截取的历史数据进行补0,得到与第一时间区间截取的历史数据维度相同的输入。
或者,在本说明书一个或多个实施例中,该流量预测模型可包括长期预测模型以及短期预测模型,可以采用不同维度的训练样本分别对其进行训练。该长期预测模型则用于对长期流量分布的预测,该短期预测模型则用于对短期流量分布的预测。
在本说明书一个或多个实施例中,该长期预测模型的输入可以是历史2个月内每个时刻的实际流量,输出为未来一天内的流量分布。该短期预测模型的输入可以是历史两天内每个时刻的实际流量,输出为未来一小时内的流量分布。
在本说明书步骤S106中,该服务器可根据该长期数量分布以及短期数量分布,调节该预设时长内的各时刻为该应用配置的容器数量。具体的,该服务器可针对该预设时 长内的每个时刻,根据该长期数量分布,确定该时刻对应的第一目标调节数量,根据该时刻所在时间段对应的短期数量分布,确定该时刻对应的第二目标调节数量。之后,该服务器可根据该第一目标调节数量以及该第二目标调节数量,调节该时刻的容器数量。
在本说明书提供的一个或多个实施例中,根据该第一目标调节数量以及该第二目标调节数量,调节该时刻的容器数量时,该服务器可根据该第一目标调节数量以及该第二目标调节数量中的最大值,对该时刻的容器数量进行调节。或者,该服务器还可以根据该第一目标调节数量以及该第二目标调节数量的平均值,对该时刻的容器数量进行调节。
另外,由于对于一个应用而言,针对每个时刻,该时刻的总流量由多种类型多种来源的分支流量构成。不同类型不同来源的流量,对容器数量的消耗不同。而对于总流量相同的两个时刻,由于其内部分支流量的差异性,该两个时刻分别需要分配给该应用的容器数量可能不同。
因此,在本说明书步骤S102中,该服务器还可以针对预设的每种流量数据类型,确定各历史时刻中,该流量数据类型对应的分支流量。并根据各历史时刻的各流量数据类型对应的分支流量,通过预先训练的流量预测模型,预测该应用在预设时长内各时刻的各分支流量,作为该应用在该预设时长内的流量分布。
其中预设的各流量数据类型,可根据该应用的不同功能对应的接口以及流量数据来源确定。例如,流量数据来源可包括:超文本传输协议(Hyper Text Transfer Protocol,HTTP)流量,信息(message)流量等等。
在本说明书步骤S104中,该服务器可将该预设时长内各时刻的各分支流量,输入预先训练的数量预测模型,确定该预设时长内各时刻应为该应用配置的容器数量。
其中,该容器数量由各分支流量对应的容器数量构成,在同样的总流量下,不同分支流量对应的容器数量不完全相同。
在本说明书一个或多个实施例中,在步骤S106中根据该容器数量分布,调节该应用在该预设时长内各时刻的容器数量时,该服务器还可以针对该预设时长内的每个时刻,根据该流量分布,确定该时刻对应预测的流量,并根据该容器数量分布,确定该时刻应为该应用配置的容器数量。之后,根据确定出的该时刻的流量以及容器数量,确定该时刻对应的容器中处理器的预测利用率,并以该目标利用率为目标,根据该时刻的预测利用率,调节该容器数量。
在本说明书一个或多个实施例中,可通过线性回归模型确定预测利用率,确定预测利用率的公式可具体如下:
C=b 0+b 1x 1+…+b nx n
其中,C表示一个时刻该应用对应的预测利用率,b 0~b n以及ε为对该线性回归模型训练得到的参数,x 1~x n表示该时刻应用对应的各分支流量分别对应的单机能力,即该时刻对应的预测的各分支流量与容器数量的比值,则
Figure PCTCN2022124500-appb-000001
F n表示该时刻对应的第n种分支流量,N表示该时刻对应的预测得到的容器数量。可见,同一时刻的预测利用率与容器数量负相关,可通过上调容器数量或下调容器数量来降低C的值或增大C的值。
在本说明书一个或多个实施例中,在以该目标利用率为目标,根据该时刻的预测利用率,调节该容器数量时,首先,该服务器可根据该时刻的预测利用率与该目标利用率的大小关系,以及预设的容器数量的调节区间,确定容器数量的搜索区间。例如,以[countmin,countmax]表示预设的调节区间,countmin表示预设的允许调节的容器数量的最小值,countmax表示预设的允许调节的容器数量的最大值。当该时刻的预测利用率大于该目标利用率时,为了使该时刻的预测利用率等于该目标利用率或尽可能接近该目标利用率,则可通过上调容器数量来降低该时刻的预测利用率,则该服务器可确定[countnow,countmax]为该时刻对应的搜索区间。当该时刻的预测利用率小于该目标利用率时,为了使该时刻的预测利用率等于该目标利用率或尽可能接近该目标利用率,则可通过下调容器数量来增大该时刻的预测利用率,则该服务器可确定[countmin,countnow]为该时刻对应的搜索区间。
其中,countnow表示该数量预测模型输出的该时刻对应的容器数量,且处于该调节区间内。
在确定出搜索区间之后,该服务器可针对该调节区间内的每一个容器数量,将该容器数量作为区间数量,根据该区间数量与该时刻对应的通过流量预测模型得到的流量,确定该区间数量对应的预测利用率,作为区间利用率。然后,该服务器可从该搜索区间中,确定使得区间利用率不大于目标利用率的区间数量,并从得到的区间数量中,确定对应的区间利用率与目标利用率差值最小的区间数量,作为最终在该时刻配置给该应用的容器数量。
在本说明书提供的一个或多个实施例中,当该时刻的预测利用率等于该目标利用率时,则无需根据预设的调节区间对该时刻的容器数量进行调节,可直接将该时刻对应的预测得到的容器数量,作为最终在该时刻配置给该应用的容器数量。
在本说明书提供的一个或多个实施例中,考虑到不同应用的性质不同,不同应用适合的容量调节模式不同。例如,一些应用不适合频繁调节容器数量,一些应用性能较好,则可频繁调节。因此,还可预设调节模式,灵活的根据应用性能,对其容器数量进行调节。
在本说明书提供的一个或多个实施例中,该服务器可确定该应用的应用画像,根据该应用画像,确定适合该应用的调节模式,并根据该调节模式以及该容器数量分布,调节该应用在该预设时长内各时刻的容器数量。
例如,该调节模式可包括:低频调节、周期调节以及高频调节。假设应用对应的调节模式为低频调节,且该低频调节为一天调节一次,则,该服务器可从预测得到的该预设时长各时刻的容器数量中,确定最大值作为调节目标,并根据该最大值对该应用在该预设时长各时刻的容器数量进行调节。
假设该应用对应的调节模式为周期调节,且在该预设时长内,包含该应用的两个周期长度,则该服务器可针对每一个周期长度,根据该周期长度对应的各容器数量中的最大值,对该周期长度中各时刻的容器数量进行调节。
假设该应用对应的调节模式为高频调节,且该高频调节为每5分钟一次,则该服务 器可以5分数为长度,对该预设时长进行切割,确定各时间片段,并针对该预设时长中的每个时间片段,根据该时间片段对应的各容器数量中的最大值,对该时间片段中各时刻的容器数量进行调节。具体可根据需要设置,本说明书在此不做限制。
在本说明书提供的一个或多个实施例中,该服务器可确定该应用的各标签以及各标签对应的各数据,并根据各标签对应的数据,确定该应用的应用画像。由于应用的运行情况并非固定不变的,因此,可灵活对应用画像进行更新,如以一天为一个周期,每天更新应用的应用画像。
其中,该应用的各标签可根据需要设置,例如,标签可包括:事实类标签、刻画类标签以及预测类标签。其中,事实类标签包括统计型数据,包括历史上时刻级别(如,分钟级别)的应用运行指标、应用的部署情况等。刻画类标签包括对应用的客观属性进行描述的标签,属于稳定性的标签,具体可包括应用状态、版本、流量是否具有周期性、应用开发者对应用性能的标注、是否中央处理器(Central Processing Unit,CPU)敏感型应用、是否内存敏感型应用等。预测类标签为基于应用的场景,从时序上对后续标签的推测,包括流量的时序预测、应用在各种场景(如压力测试、引流、预测等场景)的容器数量的预测。
在本说明书提供的一个或多个实施例中,用于确定应用的各标签的数据可包括如下的至少部分数据:应用的周期性(如,一天一个周期、一个月两个周期等)、与应用的各功能关联的各接口的相关数据、应用当前处于的场景和节点(压力测试、应急、活动、日常)、应用的容量特征(是否处于基于开发者的标签制定的黑名单或白名单中、应用的CPU利用率的安全水位、是否内存敏感、是否CPU敏感等)、应用是否为中间件版本、应用的资源情况(是否为保活应用、是否为混合部署的应用等待)、应用涉及的容器部署情况(应用对应的服务器机型、机房、站点等)、应用的历史事件(流量增长情况、告警情况、限流情况等)、应用对应的业务场景等。
该服务器可根据上述标签中的一种或几种,确定该应用的调节模式。
在本说明书中,容量即与应用运行时使用的容器的总资源量,例如2个2Core的容器对应的容量为4Core。
另外,由于本说明书中可通过多种方式得到在该预设时长内每个时刻应为应用分配的容器数量,上述只公开了部分仅基于一种方式或多种方式的组合,调节该预设时长内各时刻的容器数量的内容。但本说明书不仅限于上述内容,在基于各种方式得到的在该预设时长内每个时刻应为应用分配的容器数量,调节该应用在该预设时长内各时刻的容器数量不冲突时,该服务器可任意组合上述几种方式得到的结果,以对该预设时长内各时刻的容器数量进行调节。
例如,本说明书一个或多个实施例中,除了根据容器数量分布以及周期数量分布确定目标分布,该服务器还可以根据周期数量分布以及强化数量分布,确定目标数量分布。
本说明书一个或多个实施例中,在根据目标数量分布,调节应用在该预设时长内各时刻的容器数量时,该服务器还可以针对每个时刻,从该目标数量分布中确定该时刻对应的容器的目标数量,以及确定该目标数量对应的预测利用率。并根据预设的容器数量 的调节区间、该预测利用率以及预设的目标利用率,确定该时刻的搜索区间,以根据该搜索区间,确定最终在该时刻配置给该应用的容器数量。
在本说明书提供的一个或多个实施例中,根据周期数量分布调节应用在该预设时长内各时刻的容器数量,是基于历史的调节,根据数量预测模型输出的容器数量分布,调节应用在该预设时长内各时刻的容器数量,是基于预测的调节,基于预设的SLO的调节是实时的动态调节。该服务器可基于历史、预测、SLO中的一种或多种,灵活调节应用在该预设时长内各时刻的容器数量。
在本说明书提供的一个或多个实施例中,在预先对流量预测模型进行训练时,该服务器可确定各目标时刻,并针对每个目标时刻,将该目标时刻前第一时间区间内各时刻的实际流量作为训练样本,将该目标时刻后预设时长内各时刻的实际流量作为标签。将该训练样本输入到该流量预测模型后,得到该预设时长内各时刻的预测流量,该服务器可根据各时刻的实际流量以及预测流量间的差异,确定损失,并以该损失最小为目标,调整该流量预测模型的参数。
在本说明书提供的一个或多个实施例中,在预先对数量预测模型进行训练时,该服务器可针对每个目标时刻,将该流量预测模型输出的该目标时刻后预设时长内各时刻的预测流量作为训练样本。并将该目标时刻后预设时长内各时刻的处理器的实际利用率作为标签。并基于预测得到的各时刻的利用率与实际利用率的差值,确定该数量预测模型的损失,并以损失最小为目标,调整该数量预测模型的参数。
图3为本说明书提供的一种预测模型的示意图。如图,该预测模型包括流量预测模型、数量预测模型以及强化预测模型,将各历史时刻的实际流量输入流量预测模型后,得到当前时刻后预设时长内的流量分布,将该流量分布输入数量预测模型后,可得到该预设时长内的容器数量分布。将应用的运行指标输入该强化预测模型后,可得到当前时刻后预设时长内的强化数量分布。
图4为本说明书提供的一种容器数量调节示意图。如图,纵轴N表示容器数量,横轴表示时间T。可见该应用的容器数量变化具有周期性,且在一天内容器数量具有两个峰值。在t1与t2时间段由于存在流量突增的情况,该服务器将t1与t2时间段的容器数量也调节较高。
以上为本说明书的一个或多个实施例提供的应用的容器数量调节方法,基于同样的思路,本说明书还提供了相应的应用的容器数量调节装置,如图5所示。
图5为本说明书提供的一种应用的容器数量调节装置示意图,该装置包括:历史数据确定模块200,用于确定应用的历史数据,所述历史数据至少包括所述应用在各历史时刻的实际流量;流量预测模块201,用于根据所述历史数据,通过预先训练的流量预测模型,预测所述应用在预设时长内的流量分布;数量预测模块202,用于根据所述流量分布以及预设的容器的目标利用率,通过预先训练的数量预测模型,预测在所述预设时长内所述应用的容器数量分布;调节模块203,用于根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
可选地,所述历史数据确定模块200,还用于根据各历史时刻为应用配置的容器数 量,确定历史数量分布,当根据所述历史数量分布,确定所述应用在各历史时刻的容器数量变化具有周期性时,确定所述应用的历史数据。
所述装置还包括:周期确定模块204,用于根据所述历史数量分布,确定所述应用的容器数量变化的周期长度,根据预设的周期数量以及所述周期长度,确定各目标历史周期,根据所述历史数量分布,确定各目标历史周期中各历史时刻的容器数量,根据各目标历史周期中各历史时刻的容器数量,确定在所述预设时长内各时刻的容器数量,作为周期数量分布。
可选地,所述调节模块203,还用于根据所述容器数量分布以及所述周期数量分布,确定目标数量分布,根据所述目标数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
可选地,所述调节模块203,还用于针对所述预设时长内的每个时刻,根据所述流量分布,确定该时刻对应的预测流量,并根据所述容器数量分布,确定该时刻应为所述应用配置的容器数量,根据确定出的该时刻的流量以及容器数量,确定该时刻对应的容器中处理器的预测利用率,以所述目标利用率为目标,根据该时刻的预测利用率,调节所述容器数量。
可选地,所述历史数据还包括所述应用在各历史时刻的历史预测流量、容器的历史预测数量以及处理器的历史实际利用率,所述调节模块203,还用于根据当前时刻之前,所述预设时长内,各历史时刻的历史预测流量以及历史预测数量,确定各历史时刻的历史预测利用率,根据所述各历史时刻的历史预测利用率以及历史实际利用率,确定所述数量预测模型的准确率,当所述准确率大于预设的比例阈值时,根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量,当所述准确率不大于预设的比例阈值时,根据所述应用的初始化数量分布,确定所述应用在所述预设时长内各时刻的容器数量。
可选地,所述调节模块203,还用于针对当前时刻之前,所述预设时长内的每个历史时刻,确定该历史时刻的历史预测利用率与历史实际利用率间的差值,作为该历史时刻的利用率差值,确定当前时刻之前,所述预设时长内利用率差值小于预设的差值阈值的历史时刻的数量,作为达标数量,根据所述达标数量以及当前时刻之前所述预设时长内包含的历史时刻的总数,确定准确率。
所述装置还包括:回归模块205,用于根据当前时刻之前,所述预设时长内各历史时刻对应的利用率差值,确定损失,以所述损失最小为目标,调整所述数量预测模型以及所述流量预测模型的参数。
可选地,所述调节模块203,还用于获取所述应用的运行指标,根据所述运行指标以及所述目标利用率,通过预先强化学习得到的强化预测模型,预测在所述预设时长内所述应用的容器的数量分布,作为强化数量分布,当所述数量预测模型评估未通过时,根据所述强化数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
可选地,所述流量预测模块201,还用于针对预设的每种流量数据类型,确定各历史时刻中,该流量数据类型对应的分支流量,根据各历史时刻的各流量数据类型对应的 分支流量,通过预先训练的流量预测模型,预测所述应用在预设时长内各时刻的各分支流量,作为所述应用在所述预设时长内的流量分布。
可选地,所述数量预测模块202,还用于将所述预设时长内各时刻的各分支流量以及预设的容器的目标利用率,输入预先训练的数量预测模型,确定所述预设时长内各时刻应为所述应用配置的容器数量,其中,所述容器数量由各分支流量对应的容器数量构成,在同样流量下,不同分支流量对应的容器数量不完全相同。
可选地,所述调节模块203,还用于确定所述应用的应用画像,根据所述应用画像,确定适合所述应用的调节模式,根据所述调节模式以及所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
本说明书还提供了一种计算机可读存储介质,该存储介质存储有计算机程序,计算机程序可用于执行上述图1提供的应用的容器数量调节方法。
本说明书还提供了图6所示的电子设备的结构示意图。如图6所示,在硬件层面,该电子设备包括处理器、内部总线、内存以及非易失性存储器,当然还可能包括其他业务所需要的硬件。处理器从非易失性存储器中读取对应的计算机程序到内存中然后运行,以实现上述图1提供的应用的容器数量调节方法。
当然,除了软件实现方式之外,本说明书并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机。具体的,计算机例如可以为个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本说明书时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框 图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
本领域技术人员应明白,本说明书的实施例可提供为方法、系统或计算机程序产品。因此,本说明书可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本说明书可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本说明书,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述仅为本说明书的实施例而已,并不用于限制本说明书。对于本领域技术人员来说,本说明书可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本说明书的权利要求范围之内。

Claims (15)

  1. 一种应用的容器数量调节方法,其特征在于,包括:
    确定应用的历史数据,所述历史数据至少包括所述应用在各历史时刻的实际流量;
    根据所述历史数据,通过预先训练的流量预测模型,预测所述应用在预设时长内的流量分布;
    根据所述流量分布以及预设的容器的目标利用率,通过预先训练的数量预测模型,预测在所述预设时长内所述应用的容器数量分布;
    根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
  2. 如权利要求1所述的方法,其特征在于,确定应用的历史数据,具体包括:
    根据各历史时刻为应用配置的容器数量,确定历史数量分布;
    当根据所述历史数量分布,确定所述应用在各历史时刻的容器数量变化具有周期性时,确定所述应用的历史数据。
  3. 如权利要求2所述的方法,其特征在于,所述方法还包括:
    根据所述历史数量分布,确定所述应用的容器数量变化的周期长度;
    根据预设的周期数量以及所述周期长度,确定各目标历史周期;
    根据所述历史数量分布,确定各目标历史周期中各历史时刻的容器数量;
    根据各目标历史周期中各历史时刻的容器数量,确定在所述预设时长内各时刻的容器数量,作为周期数量分布。
  4. 如权利要求3所述的方法,其特征在于,根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量,具体包括:
    根据所述容器数量分布以及所述周期数量分布,确定目标数量分布;
    根据所述目标数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
  5. 如权利要求1所述的方法,其特征在于,根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量,具体包括:
    针对所述预设时长内的每个时刻,根据所述流量分布,确定该时刻对应预测的流量,并根据所述容器数量分布,确定该时刻应为所述应用配置的容器数量;
    根据确定出的该时刻的流量以及容器数量,确定该时刻对应的容器中处理器的预测利用率;
    以所述目标利用率为目标,根据该时刻的预测利用率,调节所述容器数量。
  6. 如权利要求1所述的方法,其特征在于,所述历史数据还包括所述应用在各历史时刻的历史预测流量、容器的历史预测数量以及容器中处理器的历史实际利用率;
    根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量,具体包括:
    根据当前时刻之前,所述预设时长内,各历史时刻的历史预测流量以及历史预测数量,确定各历史时刻的历史预测利用率;
    根据所述各历史时刻的历史预测利用率以及历史实际利用率,确定所述数量预测模型的准确率;
    当所述准确率大于预设的比例阈值时,根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量;
    当所述准确率不大于预设的比例阈值时,根据所述应用的初始化数量分布,确定所述应用在所述预设时长内各时刻的容器数量。
  7. 如权利要求6所述的方法,其特征在于,根据所述各历史时刻的历史预测利用率以及历史实际利用率,确定所述数量预测模型的准确率,具体包括:
    针对当前时刻之前,所述预设时长内的每个历史时刻,确定该历史时刻的历史预测利用率与历史实际利用率间的差值,作为该历史时刻的利用率差值;
    确定当前时刻之前,所述预设时长内利用率差值小于预设的差值阈值的历史时刻的数量,作为达标数量;
    根据所述达标数量以及当前时刻之前所述预设时长内包含的历史时刻的总数,确定准确率。
  8. 如权利要求7所述的方法,其特征在于,所述方法还包括:
    根据当前时刻之前,所述预设时长内各历史时刻对应的利用率差值,确定损失;
    以所述损失最小为目标,调整所述数量预测模型以及所述流量预测模型的参数。
  9. 如权利要求6所述的方法,其特征在于,所述方法还包括:
    获取所述应用的运行指标;
    根据所述运行指标以及所述目标利用率,通过预先强化学习得到的强化预测模型,预测在所述预设时长内所述应用的容器的数量分布,作为强化数量分布;
    当所述数量预测模型评估未通过时,根据所述强化数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
  10. 如权利要求1所述的方法,其特征在于,根据所述历史数据,通过预先训练的流量预测模型,预测所述应用在预设时长内的流量分布,具体包括:
    针对预设的每种流量数据类型,确定各历史时刻中,该流量数据类型对应的分支流量;
    根据各历史时刻的各流量数据类型对应的分支流量,通过预先训练的流量预测模型,预测所述应用在预设时长内各时刻的各分支流量,作为所述应用在所述预设时长内的流量分布。
  11. 如权利要求10所述的方法,其特征在于,根据所述流量分布以及预设的容器的目标利用率,通过预先训练的数量预测模型,预测在所述预设时长内所述应用的容器数量分布,具体包括:
    将所述预设时长内各时刻的各分支流量以及预设的容器的目标利用率,输入预先训练的数量预测模型,确定所述预设时长内各时刻应为所述应用配置的容器数量;
    其中,所述容器数量由各分支流量对应的容器数量构成,在同样流量下,不同分支流量对应的容器数量不完全相同。
  12. 如权利要求1所述的方法,其特征在于,根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量,具体包括:
    确定所述应用的应用画像,根据所述应用画像,确定适合所述应用的调节模式;
    根据所述调节模式以及所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
  13. 一种应用的容器数量调节装置,其特征在于,包括:
    历史数据确定模块,用于确定应用的历史数据,所述历史数据至少包括所述应用在各历史时刻的实际流量;
    流量预测模块,用于根据所述历史数据,通过预先训练的流量预测模型,预测所述应用在预设时长内的流量分布;
    数量预测模块,用于根据所述流量分布以及预设的容器的目标利用率,通过预先训练的数量预测模型,预测在所述预设时长内所述应用的容器数量分布;
    调节模块,用于根据所述容器数量分布,调节所述应用在所述预设时长内各时刻的容器数量。
  14. 一种计算机可读存储介质,其特征在于,所述存储介质存储有计算机程序,所述计算机程序被处理器执行时实现上述权利要求1~12任一项所述的方法。
  15. 一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现上述权利要求1~12任一项所述的方法。
PCT/CN2022/124500 2021-10-12 2022-10-11 应用的容器数量调节 WO2023061348A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/397,379 US20240137411A1 (en) 2021-10-12 2023-12-27 Container quantity adjustment for application

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111187472.9 2021-10-12
CN202111187472.9A CN113992525B (zh) 2021-10-12 2021-10-12 一种应用的容器数量调节方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/397,379 Continuation US20240137411A1 (en) 2021-10-12 2023-12-27 Container quantity adjustment for application

Publications (1)

Publication Number Publication Date
WO2023061348A1 true WO2023061348A1 (zh) 2023-04-20

Family

ID=79738227

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/124500 WO2023061348A1 (zh) 2021-10-12 2022-10-11 应用的容器数量调节

Country Status (3)

Country Link
US (1) US20240137411A1 (zh)
CN (1) CN113992525B (zh)
WO (1) WO2023061348A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116167463A (zh) * 2023-04-26 2023-05-26 之江实验室 一种模型训练的方法、装置、存储介质及电子设备
CN117451284A (zh) * 2023-12-26 2024-01-26 宁德时代新能源科技股份有限公司 容器气密性异常检测方法、装置、电子设备和存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113992525B (zh) * 2021-10-12 2024-06-21 支付宝(杭州)信息技术有限公司 一种应用的容器数量调节方法及装置
CN115037655B (zh) * 2022-05-19 2024-03-12 支付宝(杭州)信息技术有限公司 压测方法和系统
CN115550259B (zh) * 2022-09-13 2024-05-14 平安银行股份有限公司 基于白名单的流量分配方法及相关设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150288573A1 (en) * 2014-04-08 2015-10-08 International Business Machines Corporation Hyperparameter and network topology selection in network demand forecasting
US20170331705A1 (en) * 2015-01-30 2017-11-16 Huawei Technologies Co., Ltd. Resource Scaling Method on Cloud Platform and Cloud Platform
US20180287956A1 (en) * 2017-03-30 2018-10-04 Home Box Office, Inc. Predictive scaling of computing resources
US20210064432A1 (en) * 2018-02-05 2021-03-04 Telefonaktiebolaget Lm Ericsson (Publ) Resource needs prediction in virtualized systems: generic proactive and self-adaptive solution
CN113992525A (zh) * 2021-10-12 2022-01-28 支付宝(杭州)信息技术有限公司 一种应用的容器数量调节方法及装置

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018214060A1 (zh) * 2017-05-24 2018-11-29 北京质享科技有限公司 一种城市小尺度空气质量指数预测方法与系统
CN108093046A (zh) * 2017-12-18 2018-05-29 江苏润和软件股份有限公司 一种基于前馈控制的云应用容器资源调度方法
US10579093B2 (en) * 2018-03-01 2020-03-03 At&T Intellectual Property I, L.P. Workload prediction based CPU frequency scaling
CN110278288B (zh) * 2019-05-17 2021-10-26 平安科技(深圳)有限公司 预分配容器ip的方法、装置、计算机设备及存储介质
CN111130839B (zh) * 2019-11-04 2021-07-16 清华大学 一种流量需求矩阵预测方法及其系统
CN111079980B (zh) * 2019-11-22 2021-06-29 天合云能源互联网技术(杭州)有限公司 基于自适应分类策略和混合优化svr的光功率预测方法
CN111026550A (zh) * 2019-11-29 2020-04-17 中国科学院深圳先进技术研究院 容器云环境下的任务调度方法、装置、服务器及存储装置
CN111030869B (zh) * 2019-12-20 2022-09-20 锐捷网络股份有限公司 一种网络流量的预测方法及预测装置
CN111143033B (zh) * 2019-12-20 2024-03-22 青岛海尔科技有限公司 基于可伸缩操作系统的操作执行方法及装置
CN111401609B (zh) * 2020-03-04 2023-01-17 平安科技(深圳)有限公司 车流量时间序列的预测方法及预测装置
CN112087504A (zh) * 2020-08-31 2020-12-15 浪潮通用软件有限公司 一种基于工作负载特性的动态负载均衡的方法及装置
CN112084040B (zh) * 2020-09-28 2021-07-20 上海道客网络科技有限公司 一种基于应用镜像数据识别的容器资源规划系统与方法
CN112289391B (zh) * 2020-10-28 2023-08-22 广西贺州市桂东电子科技有限责任公司 一种基于机器学习的阳极铝箔性能预测系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150288573A1 (en) * 2014-04-08 2015-10-08 International Business Machines Corporation Hyperparameter and network topology selection in network demand forecasting
US20170331705A1 (en) * 2015-01-30 2017-11-16 Huawei Technologies Co., Ltd. Resource Scaling Method on Cloud Platform and Cloud Platform
US20180287956A1 (en) * 2017-03-30 2018-10-04 Home Box Office, Inc. Predictive scaling of computing resources
US20210064432A1 (en) * 2018-02-05 2021-03-04 Telefonaktiebolaget Lm Ericsson (Publ) Resource needs prediction in virtualized systems: generic proactive and self-adaptive solution
CN113992525A (zh) * 2021-10-12 2022-01-28 支付宝(杭州)信息技术有限公司 一种应用的容器数量调节方法及装置

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116167463A (zh) * 2023-04-26 2023-05-26 之江实验室 一种模型训练的方法、装置、存储介质及电子设备
CN116167463B (zh) * 2023-04-26 2023-07-07 之江实验室 一种面向智能计算的分布式模型训练容器调度方法及装置
CN117451284A (zh) * 2023-12-26 2024-01-26 宁德时代新能源科技股份有限公司 容器气密性异常检测方法、装置、电子设备和存储介质
CN117451284B (zh) * 2023-12-26 2024-04-12 宁德时代新能源科技股份有限公司 容器气密性异常检测方法、装置、电子设备和存储介质

Also Published As

Publication number Publication date
CN113992525A (zh) 2022-01-28
CN113992525B (zh) 2024-06-21
US20240137411A1 (en) 2024-04-25

Similar Documents

Publication Publication Date Title
WO2023061348A1 (zh) 应用的容器数量调节
US10417111B2 (en) Correlation of stack segment intensity in emergent relationships
BR112021007847A2 (pt) método de monitoramento de integridade de uma rede de comunicação, método realizado pelo um ou mais computadores, sistema, e uma ou mais mídias de leitura por computador
US11374876B2 (en) Intelligent cloud platform to host resource efficient edge network function
CN113886010A (zh) 容器资源的控制方法、设备及计算机存储介质
CN110287229A (zh) 一种数据统计处理方法及装置
CN108243032A (zh) 一种服务等级信息的获取方法、装置及设备
US20170061786A1 (en) Diagnostic system, method, and recording medium for signalized transportation networks
CN117079480A (zh) 一种快速路上匝道交通信号灯的控制方法及装置
US20210133211A1 (en) Adaptive Usage of Storage Resources Using Data Source Models and Data Source Representations
US20160299787A1 (en) System, method and managing device
US20190363968A1 (en) Monitoring system for metric data
US20230236871A1 (en) Computing environment predictive provisioning
Liu Robust resource management in distributed stream processing systems
CN116760871B (zh) 基于多协议协同的智慧表务管理系统
CN116149865B (zh) 一种变频执行任务的方法、装置、设备及可读存储介质
WO2024131059A1 (zh) 自动化测试任务调度方法、设备和存储介质
CN116996397B (zh) 一种网络丢包优化的方法、装置、存储介质及电子设备
CN109271269A (zh) 一种应用闪退的处理方法、装置及设备
CN116661977B (zh) 任务管理方法、装置、计算设备和存储介质
CN116484768B (zh) 一种系统动力学模型构建方法及装置
Zalokostas-Diplas et al. Experimental Evaluation of ML Models for Dynamic VNF Autoscaling
US11775516B2 (en) Machine-learning-based, adaptive updating of quantitative data in database system
WO2024066330A1 (zh) Gpu资源调度方法、服务器及存储介质
CN117348999B (zh) 一种业务执行系统及业务执行方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22880285

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE