CN116610416A - Load prediction type elastic expansion system and method based on Kubernetes - Google Patents

Load prediction type elastic expansion system and method based on Kubernetes Download PDF

Info

Publication number
CN116610416A
CN116610416A CN202310617633.6A CN202310617633A CN116610416A CN 116610416 A CN116610416 A CN 116610416A CN 202310617633 A CN202310617633 A CN 202310617633A CN 116610416 A CN116610416 A CN 116610416A
Authority
CN
China
Prior art keywords
load
model
comprehensive
rate
time
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202310617633.6A
Other languages
Chinese (zh)
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 东北大学
Priority to CN202310617633.6A priority Critical patent/CN116610416A/en
Publication of CN116610416A publication Critical patent/CN116610416A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/27Regression, e.g. linear or logistic regression
    • 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]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • G06N3/0442Recurrent networks, e.g. Hopfield networks characterised by memory or gating, e.g. long short-term memory [LSTM] or gated recurrent units [GRU]
    • 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
    • G06F2123/00Data types
    • G06F2123/02Data types in the time domain, e.g. time-series data
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention provides a load prediction type elastic expansion system and method based on Kubernetes, and relates to the technical field of cloud computing. The system comprises: the device comprises a load monitoring module, a load predicting module, a load data storage module and an elastic telescopic module. Based on the system, a load prediction type elastic telescoping method based on Kubernetes is provided: collecting load data of all Pod nodes in a Kubertes cluster, calculating comprehensive load rate at each moment, and establishing a Prophet-LSTM load prediction model to obtain predicted comprehensive load rate; and obtaining dynamic expansion quantity according to the predicted comprehensive load rate and the current comprehensive load rate, and configuring expansion or contraction in advance. Aiming at the problems of single measurement index and response delay of a Kubernetes built-in elastic telescoping mechanism, the invention provides a method for effectively measuring the overall load level of complex application by defining a comprehensive load rate evaluation index; meanwhile, the Prophet-LSTM combination model can adapt to the change of a data set and the existence of abnormal values, provides more reliable prediction results, and stretches out and draws back in advance to ensure the service quality.

Description

Load prediction type elastic expansion system and method based on Kubernetes
Technical Field
The invention relates to the technical field of cloud computing, in particular to a load prediction type elastic expansion system and method based on Kubernetes.
Background
Kubernetes is a Docker container cluster orchestration system that provides services for containerized applications such as resource scheduling, automated deployment, service discovery, elastic scaling, resource monitoring, and the like. The elastic expansion strategy built in the Kubernetes is HPA, and the principle of the strategy is to collect CPU utilization rate of Pod and perform capacity expansion or contraction operation by comparing the current value with the set expected value. However, the HPA strategy adopts a responsive telescopic method, and the judgment of the Pod actual load is delayed, so that the final calculation result has deviation.
Aiming at the problem of hysteresis of an HPA strategy, xie Wenzhou et al propose an elastic telescoping method for predicting resource load based on an ARIMA model. The ARIMA model carries out predictive training based on the historical resource load characteristics of the CPU and the memory, provides an important reference for the current resource allocation of the Kubernetes, reduces the times that the application on the node is forced to exit because the resource usage exceeds a threshold value, and improves the resource utilization rate. Yang Mao et al propose a telescoping technique combining exponential smoothing and gray prediction to improve the capacity of predicting the system load and thus to more accurately grasp the timing of telescoping.
Xie Wenzhou et al propose an ARIMA load prediction model, which has the disadvantage that the ARIMA model has a requirement for stability of the input time series data, and is not suitable for the case that the time series data has stable amplification or the time series data is easily affected by external factors. Yang Mao et al, which discloses a telescopic technology combining an exponential smoothing method and gray prediction, has the defect that the method only considers a CPU as a prediction index, does not fully consider other types of resources of nodes, and has single judgment dimension.
Disclosure of Invention
The invention provides a load prediction type elastic expansion system and method based on Kubernetes aiming at the defects of the prior art.
A load prediction type elastic telescopic system based on Kubernetes comprises the following modules:
load monitoring module: the method comprises the steps of using Prometaus monitoring service to realize comprehensive monitoring of a Kubernetes cluster, wherein the comprehensive monitoring comprises the steps of obtaining the CPU utilization rate, the memory utilization rate, the disk I/O and the network I/O of a Pod node, and calculating the comprehensive load rate;
load prediction module: establishing a Prophet-LSTM load prediction model, analyzing and predicting load data of each node in the cluster by using the Prophet-LSTM load prediction model, and transmitting the predicted data to an elastic expansion module;
load data storage module: storing load data of each node and each container by adopting an InfluxDB open source time sequence database;
elastic expansion module: and comparing intervals according to the node load at the next moment predicted by the load prediction module, and further informing the Kubemetes scheduler to increase or decrease the service container copies.
The load prediction type elastic expansion method based on the Kubernetes is realized based on the load prediction type elastic expansion system based on the Kubernetes, and specifically comprises the following steps of:
step 1: collecting load data of all Pod nodes in a Kuberttes cluster;
step 2: calculating a comprehensive load rate Comprehensive load rate, namely a CLR (closed loop load) according to the collected load data to obtain the comprehensive load rate at each moment;
step 3: analyzing the comprehensive load rate by adopting a Prophet-LSTM combination model, constructing a load prediction model of the comprehensive load rate, and obtaining a rule of the comprehensive load rate to obtain a predicted comprehensive load rate;
step 4: and generating a dynamic expansion strategy according to the predicted comprehensive load rate and the current comprehensive load rate to obtain the dynamic expansion quantity, and configuring expansion or contraction in advance by the Kubernetes scheduler according to the dynamic expansion quantity.
Further, the step 1 specifically includes the following steps:
step 1.1: collecting load data of each node and each container in real time by using kube-state-metrics and cAdvisors to obtain service load data;
step 1.2: and deploying Prometaus monitoring service, pulling load data of each node, and storing the load data into an InfluxDB time sequence database.
Further, the step 2 specifically includes the following steps:
step 2.1: reading load data from a time sequence database, wherein the load data comprises CPU utilization rate, memory utilization rate, disk I/O and network I/O;
step 2.2: preprocessing load data, and filling with load average values at the front and rear time points if the original load data has a missing value at a specific time; if there is a period of absence, discarding the missing values; if the original load data has abnormal values, rejecting according to the Laida criterion;
step 2.3: defining the comprehensive load rate CLR of Pod, taking the CLR as a measurement index of Pod expansion and contraction, and defining the use condition of CPU at t time asThe use condition of the memory is defined as +.>The disk I/O usage is defined asThe use case of network I/O is defined as +.>The calculation formula of the comprehensive load rate CLRt at the time t is expressed as follows:
ω cpumemdisknet =1
wherein omega cpn 、ω mem 、ω disk 、ω net The weight of the CPU, the memory, the disk I/O and the network I/O in the comprehensive load rate is respectively calculated; and (3) dividing the load weight of each resource by adopting a principal component analysis method on the historical load data, calculating the comprehensive load rate CLRt corresponding to the moment t, and storing the comprehensive load rate CLRt into a time-ordered database.
Further, the step 3 specifically includes the following steps:
step 3.1: defining input sequence data as a comprehensive load rate at a plurality of moments; setting the length of the input sequence data as Q, namely the comprehensive load rate of Q seconds, setting the current time point as T, taking the total Q comprehensive load rates of [ T-Q+1, T ] as the input sequence data, dividing the input sequence data into a training set and a verification set according to the time sequence, adopting the first 80% of data as the training set and the later 20% of data as the verification set;
step 3.2: the method comprises the steps of establishing a propset model, wherein the propset is a model of predicted time sequence data based on a self-addition model, the model is integrally formed by overlapping three parts of trend item growth, period item similarity and holiday item holidays, and the basic form of a predicted value y (t) is expressed as follows:
y(t)=g(t)+s(t)+h(t)+ε t
wherein e t Is a random fluctuation item; s (t) is a periodic term, and the periodic component is expressed by adopting Fourier series approximation, and the specific form is as follows:
wherein p is the period length of the time series; n is the number of cycles; a, a n 、b n Is a smoothing parameter; n is a natural number;
h (t) is a holiday term, the influence of each holiday at different moments is regarded as an independent model, a virtual variable is set for each independent model, and the holiday term h (t) can be expressed as:
h(t)=Z(t)κ
Z(t)=[l(t∈D 1 ),...,l(t∈D i )]
κ∈Normal(0,v 2 )
wherein Z (t) is an exponential function; l is the duration of a holiday or holiday; d (D) i I=1, 2, L for the i-th set of past and future time listings of holidays; kappa is a parameter set for each holiday; v is the influence of holidays, and the larger v is, the larger the influence of holidays is; normal is a Normal distribution function;
g (t) is a trend term, and adopts a logistic growth model, and the basic form is expressed as follows:
wherein, C (t) is a saturation value changing with time, namely bearing capacity; k+a (t) T Delta is the rate of increase over time; s is S j Is a turning point; m is the offset; delta is the change of the growth rate at the turning point; a (t) is an indication function; a (t) T A transpose vector of a (t); gamma is s j Smoothing the offset at the location;
inputting the divided training set into a Prophet model, carrying out Prophet model training, determining a preliminary model, then evaluating and adjusting model parameters by using the divided verification set, and establishing a trained Prophet model to obtain a corresponding prediction comprehensive load rate;
step 3.3: establishing an LSTM model, wherein the LSTM is divided into long-term memory and short-term memory by using c t To indicate, i.e. the cell state,short-term memory h t To represent, i.e. output; LSTM with peephole connection requires input x according to time t t Short-term memory h at time t-1 t-1 And cell state c at time t-1 t--1 To update the cell state c at time t t The updating is realized through a forgetting gate, an input gate and an output gate, and the calculation formulas are respectively as follows:
i t =σ(W xi x t +W hi h t-1 +W ci c t-1 +b i )
f t =σ(W xf x t +W hf h t-1 +W cf c t-1 +b f )
c t =f t c t--1 +i t tanh(W xc x t +W hc h t-1 +b c )
o t =σ(W xo x t +W ho h t-1 +W co c t +b o )
h t =o t tanh(c t )
wherein i is t Is a forgetful door; f (f) t Is an input door; o (o) t Is an output door; sigma and tanh are both activation functions, sigma is a sigmoid function; tanh is a hyperbolic tangent activation function; w (W) xi 、W xf 、W xo 、W xc Respectively forget gate, input gate, output gate and unit state with respect to input x t Weight coefficient matrix of (a); w (W) hi 、W hf 、W ho 、W hc Respectively a forgetting gate, an input gate, an output gate and a unit state about t-1 time h t-1 Weight coefficient matrix of (a); w (W) ci 、W cf 、W co The left gate, the input gate and the output gate are respectively related to a unit state weight coefficient matrix; b i 、b f 、b o 、b c Bias vectors for forget gate, input gate, output gate and cell states, respectively;
inputting the divided training set into an LSTM model, performing LSTM model training, determining a preliminary model, evaluating and adjusting model parameters by using the divided verification set, and establishing a trained LSTM model to obtain a corresponding predicted comprehensive load rate;
step 3.4: the Prophet-LSTM load prediction model is established, and the prediction comprehensive load rates corresponding to the Prophet and the LSTM at the time t are defined as P respectively 1 (t) and P 2 (t) let Prophet weight be alpha 1 LSTM has a weight of alpha 2 The Prophet model and the LSTM model are linearly weighted, then a Prophet-LSTM load prediction model is constructed, and a final predicted comprehensive load rate at a time t obtained by the Prophet-LSTM load prediction model is defined as P (t):
P(t)=α 1 P 1 (t)+α 2 P 2 (t)
α 12 =1
step 3.5: determination of weights alpha using covariance matrix analysis 1 、α 2 P (t) is expressed in vector form as:
definition P 1 (t) and P 2 And (C) the covariance matrix of (t), then C is expressed as:
C=E[(P 1 (t)-E[P 1 (t)])(P 2 (t)E[P 2 (t)])]
wherein E [ P ] 1 (t)]And E [ P ] 2 (t)]Respectively P 1 (t) and P 2 The expected value of (t);
the variance var [ P (t) ] of P (t) is expressed as a covariance matrix:
solving for weights alpha using Lagrangian multiplier 1 And alpha 2 Constructing a Lagrange function
Where λ is the Lagrangian multiplier;
solving a solution where the partial derivative of the lagrangian is equal to 0 as follows:
thereby obtaining the weight alpha 1 、α 2 Obtaining a predicted comprehensive load rate;
step 3.6: and storing the predicted integrated load rate into a time sequence database.
Further, the step 4 specifically includes the following steps:
step 4.1: acquiring a predicted comprehensive load rate and a current comprehensive load rate from a time sequence database;
step 4.2: defining the current comprehensive load rate as Cu (t), judging whether capacity expansion or capacity contraction operation is needed by the Kubernetes scheduler according to whether Cu (t) is in a section range, and defining the predicted comprehensive load rate after m seconds as P (t+m), wherein m E [5,10], wherein the section is expressed as:
P(t+m)-P(t+m)*10%≤Cu(t)≤P(t+m)+P(t+m)*10%
when Cu (t) is in the interval range, performing no capacity expansion or capacity contraction operation, otherwise, performing capacity expansion or capacity contraction operation;
step 4.3: the calculation DR executes dynamic expansion, the number of the container copies is modified on time, and the calculation formula of the Pod number is expressed as follows:
where DR is the Desired Replicas that refer to the number of Replicas required for the final result; ceil is a rounding function; CR, current Replicas, refers to the Current number of copies.
The beneficial effects of adopting above-mentioned technical scheme to produce lie in:
the invention provides a system and a method for load prediction type elastic expansion based on Kubernetes, which are used for predicting by constructing a load prediction model Prophet-LSTM combining Prophet and a long-short-term memory artificial neural network LSTM, determining a final load prediction model by combining a covariance matrix analysis method, predicting by utilizing load characteristics of Pod multiple resources, and establishing a container dynamic expansion strategy, thereby improving service quality. The Prophet-LSTM load prediction model overcomes the defect that ARIMA model data needs to be self-correlated, breaks the limitation that only phenomena and scenes related to the self-early stage can be predicted, can adapt to the change of a data set and the existence of abnormal values, and provides more reliable prediction results under some conditions. And finally, determining whether to expand or contract based on the threshold comparison.
The invention provides an improved elastic expansion strategy aiming at the problems of single measurement index and response delay of an elastic expansion mechanism built in Kubernetes. The strategy improves the problem of single measurement index of a built-in elastic telescoping mechanism by defining the comprehensive load rate CLR as a prediction index, and effectively measures the overall load level of complex application. And meanwhile, a propset-LSTM load prediction model is used for predicting the current CLR of the application, and the current CLR is stretched in advance to ensure the service quality. The predictive model is more adaptive to handle complex time sequences than the ARIMA predictive model.
Drawings
FIG. 1 is a diagram of a general framework of a method and system for load predictive elastic telescoping based on Kubernetes in the present invention;
FIG. 2 is a schematic diagram of the propset-LSTM load prediction model of the present invention.
Detailed Description
The following describes in further detail the embodiments of the present invention with reference to the drawings and examples. The following examples are illustrative of the invention and are not intended to limit the scope of the invention.
In this embodiment, as shown in fig. 1, a load prediction type elastic telescopic system based on Kubernetes includes the following modules:
load monitoring module: the method comprises the steps of using Prometaus monitoring service to realize comprehensive monitoring of a Kubernetes cluster, wherein the comprehensive monitoring comprises the steps of obtaining the CPU utilization rate, the memory utilization rate, the disk I/O and the network I/O of a Pod node, and calculating the comprehensive load rate;
load prediction module: establishing a Prophet-LSTM load prediction model, analyzing and predicting load data of each node in the cluster by using the Prophet-LSTM load prediction model, and sending the predicted data to an elastic expansion module to provide a foundation for the elastic expansion of the cluster;
load data storage module: storing load data of each node and each container by adopting an InfluxDB open source time sequence database;
elastic expansion module: and comparing intervals according to the node load at the next moment predicted by the load prediction module, and further informing the Kubernetes scheduler to increase or decrease the copies of the service container so as to ensure the efficient operation of the system.
As shown in fig. 1, in this embodiment, a Kubernetes-based load prediction elastic expansion method is implemented based on the above-mentioned kuberetes-based load prediction elastic expansion system, and specifically includes the following steps:
step 1: collecting load data of all Pod nodes in a Kuberttes cluster;
step 1.1: collecting load data of each node and each container in real time by using kube-state-metrics and cAdvisors to obtain service load data;
step 1.2: and deploying Prometaus monitoring service, pulling load data of each node, and storing the load data into an InfluxDB time sequence database.
Step 2: calculating a comprehensive load rate Comprehensive load rate, namely a CLR (closed loop load) according to the collected load data to obtain the comprehensive load rate at each moment;
step 2.1: reading load data from a time sequence database, wherein the load data comprises CPU utilization rate, memory utilization rate, disk I/O and network I/O;
step 2.2: preprocessing load data, and filling with load average values at the front and rear time points if the original load data has a missing value at a specific time; if there is a period of absence, discarding the missing values; if the original load data has abnormal values, rejecting according to the Laida criterion;
step 2.3: defining the comprehensive load rate CLR of Pod, taking the CLR as a measurement index of Pod expansion and contraction, and defining the use condition of CPU at t time asThe use condition of the memory is defined as +.>The disk I/O usage is defined asThe use case of network I/O is defined as +.>The calculation formula of the comprehensive load rate CLRt at the time t is expressed as follows:
ω cpumemdisknet =1
wherein omega cpn 、ω mem 、ω disk 、ω net The weight of the CPU, the memory, the disk I/O and the network I/O in the comprehensive load rate is respectively calculated; the method comprises the steps of dividing the load weight of each resource by adopting a principal component analysis method for historical load data, and calculating the comprehensive load rate CLR corresponding to the moment t t And store the time sequence database.
Step 3: analyzing the comprehensive load rate by adopting a Prophet-LSTM combination model, constructing a load prediction model of the comprehensive load rate, acquiring a rule of the comprehensive load rate, and obtaining a predicted comprehensive load rate, wherein in the embodiment, the predicted comprehensive load rate is shown as shown in figure 2;
step 3.1: defining input sequence data as a comprehensive load rate at a plurality of moments; setting the length of the input sequence data as Q, namely the comprehensive load rate of Q seconds, setting the current time point as T, taking the total Q comprehensive load rates of [ T-Q+1, T ] as the input sequence data, in the embodiment, Q taking 180, dividing the input sequence data into a training set and a verification set according to the time sequence, and taking the first 80% of data as the training set and the last 20% of data as the verification set;
step 3.2: the method comprises the steps of establishing a propset model, wherein the propset is a model of predicted time sequence data based on a self-addition model, the model is integrally formed by overlapping three parts of trend item growth, period item similarity and holiday item holidays, and the basic form of a predicted value y (t) is expressed as follows:
y(t)=g(t)+s(t)+h(t)+ε t
wherein ε t Is a random fluctuation item; s (t) is a periodic term, and the periodic component is expressed by adopting Fourier series approximation, and the specific form is as follows:
wherein p is the period length of the time series; n is the number of cycles; a, a n 、b n Is a smoothing parameter; n is a natural number;
h (t) is a holiday term, the influence of each holiday at different moments is regarded as an independent model, a virtual variable is set for each independent model, and the holiday term h (t) can be expressed as:
h(t)=Z(t)κ
Z(t)=[l(t∈D 1 ),...,l(t∈D i )]
κ∈Normal(0,v 2 )
wherein Z (t) is an exponential function; l is the duration of a holiday or holiday; d (D) i Is the ithA set of time listings for the past and future holidays, i=1, 2, L; kappa is a parameter set for each holiday; v is the influence of holidays, and the larger v is, the larger the influence of holidays is; normal is a Normal distribution function;
g (t) is a trend term, and adopts a logistic growth model, and the basic form is expressed as follows:
wherein, C (t) is a saturation value changing with time, namely bearing capacity; k+a (t) T Delta is the rate of increase over time; s is(s) j Is a turning point; m is the offset; delta is the change of the growth rate at the turning point; a (t) is an indication function; a (t) T A transpose vector of a (t); gamma is s j Smoothing the offset at the location;
inputting the divided training set into a Prophet model, carrying out Prophet model training, determining a preliminary model, then evaluating and adjusting model parameters by using the divided verification set, and establishing a trained Prophet model to obtain a corresponding prediction comprehensive load rate;
step 3.3: establishing an LSTM model, wherein the LSTM is divided into long-term memory and short-term memory by using c t Expressed, i.e. cell state, short term memory h t To represent, i.e. output; LSTM with peephole connection requires input x according to time t t Short-term memory h at time t-1 t-1 And cell state c at time t-1 t--1 To update the cell state c at time t t The updating is realized through a forgetting gate, an input gate and an output gate, and the calculation formulas are respectively as follows:
i t =σ(W xi x t +W hi h t-1 +W ci c t-1 +b i )
f t =σ(W xf x t +W hf h t-1 +W cf c t-1 +b f )
c t =f t c t--1 +i t tanh(W xc x t +W hc h t-1 +b c )
o t =σ(W xo x t +W ho h t-1 +W co c t +b o )
h t =o t tanh(c t )
wherein i is t Is a forgetful door; f (f) t Is an input door; o (o) t Is an output door; sigma and tanh are both activation functions, sigma is a sigmoid function; tanh is a hyperbolic tangent activation function; w (W) xi 、W xf 、W xo 、W xc Respectively forget gate, input gate, output gate and unit state with respect to input x t Weight coefficient matrix of (a); w (W) hi 、W hf 、W ho 、W hc Respectively a forgetting gate, an input gate, an output gate and a unit state about t-1 time h t-1 Weight coefficient matrix of (a); w (W) ci 、W cf 、W co The left gate, the input gate and the output gate are respectively related to a unit state weight coefficient matrix; b i 、b f 、b o 、b c Bias vectors for forget gate, input gate, output gate and cell states, respectively;
inputting the divided training set into an LSTM model, performing LSTM model training, determining a preliminary model, evaluating and adjusting model parameters by using the divided verification set, and establishing a trained LSTM model to obtain a corresponding predicted comprehensive load rate;
step 3.4: the Prophet-LSTM load prediction model is established, and the prediction comprehensive load rates corresponding to the Prophet and the LSTM at the time t are defined as P respectively 1 (t) and P 2 (t) let Prophet weight be alpha 1 LSTM has a weight of alpha 2 The Prophet model and the LSTM model are linearly weighted, then a Prophet-LSTM load prediction model is constructed, and the t moment obtained by the Prophet-LSTM load prediction model is definedThe final predicted integrated load factor is P (t):
P(t)=α 1 P 1 (t)+α 2 P 2 (t)
α 12 =1
step 3.5: determination of weights alpha using covariance matrix analysis 1 、α 2 P (t) is expressed in vector form as:
definition P 1 (t) and P 2 And (C) the covariance matrix of (t), then C is expressed as:
C=E[(P 1 (t)E[P 1 (t)])(P 2 (t)E[P 2 (t)])]
wherein E [ P ] 1 (t)]And E [ P ] 2 (t)]Respectively P 1 (t) and P 2 The expected value of (t);
the variance var [ P (t) ] of P (t) is expressed as a covariance matrix:
solving for weights alpha using Lagrangian multiplier 1 And alpha 2 Constructing a Lagrange function
Where λ is the Lagrangian multiplier;
solving a solution where the partial derivative of the lagrangian is equal to 0 as follows:
thereby obtaining the weight alpha 1 、α 2 Obtaining a predicted comprehensive load rate;
step 3.6: and storing the predicted integrated load rate into a time sequence database.
Step 4: generating a dynamic expansion strategy according to the predicted comprehensive load rate and the current comprehensive load rate to obtain the dynamic expansion quantity, and configuring expansion or contraction in advance according to the dynamic expansion quantity by a Kubernetes scheduler;
step 4.1: acquiring a predicted comprehensive load rate and a current comprehensive load rate from a time sequence database;
step 4.2: defining the current comprehensive load rate as Cu (t), judging whether capacity expansion or capacity contraction operation is needed by the Kubernetes scheduler according to whether Cu (t) is in a section range, and defining the predicted comprehensive load rate after m seconds as P (t+m), wherein m is [5,10], and the section is expressed as:
P(t+m)-P(t+m)*10%≤Cu(t)≤P(t+m)+P(t+m)*10%
when Cu (t) is in the interval range, performing no capacity expansion or capacity contraction operation, otherwise, performing capacity expansion or capacity contraction operation;
in the present embodiment, m is 5, that is, the predicted integrated load factor after 5 seconds is P (t+5), and this interval is expressed as
P(t+5)-P(t+5)*10%≤Cu(t)≤P(t+5)+P(t+5)*10%
When Cu (t) is in the interval range, performing no capacity expansion or capacity contraction operation, otherwise, performing capacity expansion or capacity contraction operation;
step 4.3: the calculation DR executes dynamic expansion, the number of the container copies is modified on time, and the calculation formula of the Pod number is expressed as follows:
where DR is the Desired Replicas that refer to the number of Replicas required for the final result; ceil is a rounding function; CR, current Replicas, refers to the Current number of copies.
In summary, the present embodiment mainly implements a load prediction elastic expansion system and method based on Kubernetes, that is, a combination prediction model propset-LSTM combining propset and a long-short-term memory artificial neural network LSTM is constructed to perform prediction, and a covariance matrix analysis method is combined to determine a final prediction model; the Prophet-LSTM combined model overcomes the defect that ARIMA model data needs to be self-correlated, breaks the limitation that phenomena and scenes which are related to the ARIMA model data in the early stage can only be predicted, can adapt to the change of a data set and the existence of abnormal values, and provides more reliable prediction results in some cases. And finally, determining whether to expand or contract based on the threshold comparison.
The embodiment provides an improved elastic expansion strategy aiming at the problems of single measurement index and response delay of an elastic expansion mechanism built in Kubernetes. The strategy effectively measures the overall load level of complex applications by defining the comprehensive load evaluation index CLR. And meanwhile, a propset-LSTM prediction model is used for predicting the current CLR of the application, and the current CLR is stretched in advance to ensure the service quality. The predictive model is more adaptive to handle complex time sequences than the ARIMA predictive model.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions, which are defined by the scope of the appended claims.

Claims (7)

1. Load prediction formula elastic expansion system based on Kubernetes, its characterized in that: the device comprises the following modules:
load monitoring module: the method comprises the steps of using Prometaus monitoring service to realize comprehensive monitoring of a Kubernetes cluster, wherein the comprehensive monitoring comprises the steps of obtaining the CPU utilization rate, the memory utilization rate, the disk I/O and the network I/O of a Pod node, and calculating the comprehensive load rate;
load prediction module: establishing a Prophet-LSTM load prediction model, analyzing and predicting load data of each node in the cluster by using the Prophet-LSTM load prediction model, and transmitting the predicted data to an elastic expansion module;
load data storage module: storing load data of each node and each container by adopting an InfluxDB open source time sequence database;
elastic expansion module: and comparing intervals according to the node load at the next moment predicted by the load prediction module, and further informing the Kubernetes scheduler to increase or decrease the service container copies.
2. The load prediction type elastic telescoping method based on Kubernetes is characterized by comprising the following steps of: the method comprises the following steps:
step 1: collecting load data of all Pod nodes in a Kuberttes cluster;
step 2: calculating a comprehensive load rate Comprehensive load rate, namely a CLR (closed loop load) according to the collected load data to obtain the comprehensive load rate at each moment;
step 3: analyzing the comprehensive load rate by adopting a Prophet-LSTM combination model, constructing a load prediction model of the comprehensive load rate, and obtaining a rule of the comprehensive load rate to obtain a predicted comprehensive load rate;
step 4: and generating a dynamic expansion strategy according to the predicted comprehensive load rate and the current comprehensive load rate to obtain the dynamic expansion quantity, and configuring expansion or contraction in advance by the Kubernetes scheduler according to the dynamic expansion quantity.
3. The Kubernetes-based load prediction elastic telescoping method of claim 2, wherein the method comprises the steps of:
the step 1 specifically further includes:
step 1.1: collecting load data of each node and each container in real time by using kube-state-metrics and cAdvisors to obtain service load data;
step 1.2: and deploying Prometaus monitoring service, pulling load data of each node, and storing the load data into an InfluxDB time sequence database.
4. The Kubernetes-based load prediction elastic telescoping method of claim 2, wherein the method comprises the steps of:
the step 2 specifically further includes:
step 2.1: reading load data from a time sequence database, wherein the load data comprises CPU utilization rate, memory utilization rate, disk I/O and network I/O;
step 2.2: preprocessing load data, and filling with load average values at the front and rear time points if the original load data has a missing value at a specific time; if there is a period of absence, discarding the missing values; if the original load data has abnormal values, rejecting according to the Laida criterion;
step 2.3: defining a comprehensive load rate CLR of the Pod, taking the CLR as a measurement index of Pod expansion and contraction, and calculating the comprehensive load rate CLR corresponding to the moment t t And store the time sequence database.
5. The Kubernetes-based load prediction elastic telescoping method of claim 4, wherein the method comprises the steps of:
calculating the comprehensive load rate CLR corresponding to the moment t in the step 2.3 t The method of (1) is that the use condition of CPU at time t is defined asThe use condition of the memory is defined as +.>The use case of disk I/O is defined as +.>The use case of network I/O is defined as +.>Then the integrated load factor CLR at time t t The calculation formula of (2) is expressed as:
ω cpumemdisknet =1
wherein omega cpu 、ω mean 、ω disk 、ω net The weight of CPU, memory, disk I/O and network I/O in the comprehensive load rate is divided by adopting a principal component analysis method to the historical load data.
6. The Kubernetes-based load prediction elastic telescoping method of claim 2, wherein the method comprises the steps of:
the step 3 specifically further includes:
step 3.1: defining input sequence data as a comprehensive load rate at a plurality of moments; setting the length of the input sequence data as Q, namely the comprehensive load rate of Q seconds, setting the current time point as T, taking the total Q comprehensive load rates of [ T-Q+1, T ] as the input sequence data, dividing the input sequence data into a training set and a verification set according to the time sequence, adopting the first 80% of data as the training set and the later 20% of data as the verification set;
step 3.2: the method comprises the steps of establishing a propset model, wherein the propset is a model of predicted time sequence data based on a self-addition model, the model is integrally formed by overlapping three parts of trend item growth, period item similarity and holiday item holidays, and the basic form of a predicted value y (t) is expressed as follows:
y(t)=g(t)+s(t)+h(t)+ε t
wherein ε t Is a random fluctuation item; s (t) is a periodic term, and the periodic component is expressed by adopting Fourier series approximationThe concrete form is as follows:
wherein p is the period length of the time series; n is the number of cycles; a, a n 、b n Is a smoothing parameter; n is a natural number;
h (t) is a holiday term, the influence of each holiday at different moments is regarded as an independent model, a virtual variable is set for each independent model, and the holiday term h (t) can be expressed as:
h(t)=Z(t)κ
Z(t)=[l(t∈D 1 ),...,l(t∈D i )]
κ∈Normal(0,v 2 )
wherein Z (t) is an exponential function; l is the duration of a holiday or holiday; d (D) i I=1, 2, L for the i-th set of past and future time listings of holidays; kappa is a parameter set for each holiday; v is the influence of holidays, and the larger v is, the larger the influence of holidays is; normal is a Normal distribution function;
g (t) is a trend term, and adopts a logistic growth model, and the basic form is expressed as follows:
wherein, C (t) is a saturation value changing with time, namely bearing capacity; k+a (t) T Delta is the rate of increase over time; s is(s) j Is a turning point; m is the offset; delta is the change of the growth rate at the turning point; a (t) is an indication function; a (t) T A transpose vector of a (t); gamma is s j Smoothing the offset at the location;
inputting the divided training set into a Prophet model, carrying out Prophet model training, determining a preliminary model, then evaluating and adjusting model parameters by using the divided verification set, and establishing a trained Prophet model to obtain a corresponding prediction comprehensive load rate;
step 3.3: establishing an LSTM model, wherein the LSTM is divided into long-term memory and short-term memory by using c t Expressed, i.e. cell state, short term memory h t To represent, i.e. output; LSTM with peephole connection requires input x according to time t t Short-term memory h at time t-1 t-1 And cell state c at time t-1 t-1 To update the cell state c at time t t The updating is realized through a forgetting gate, an input gate and an output gate, and the calculation formulas are respectively as follows:
i t =σ(W xi x t +W hi h t-1 +W ci c t-1 +b i )
f t =σ(W xf x t +W hf h t-1 +W cf c t-1 +b f )
c t =f t c t-1 +i t tanh(W xc x t +W hc h t-1 +b c )
o t =σ(W xo x t +W ho h t-1 +W co c t +b o )
h t =o t tanh(c t )
wherein i is t Is a forgetful door; f (f) t Is an input door; o (o) t Is an output door; sigma and tanh are both activation functions, sigma is a sigmoid function; tanh is a hyperbolic tangent activation function; w (W) xi 、W xf W xo 、W xc Respectively forget gate, input gate, output gate and unit state with respect to input x t Weight coefficient matrix of (a); w (W) hi 、W hf 、W ho 、W hc Respectively a forgetting gate, an input gate, an output gate and a unit state about t-1 time h t-1 Weight coefficient matrix of (a); w (W) ci 、W cf 、W co The left gate, the input gate and the output gate are respectively related to a unit state weight coefficient matrix; b i 、b f 、b o 、b c Bias vectors for forget gate, input gate, output gate and cell states, respectively;
inputting the divided training set into an LSTM model, performing LSTM model training, determining a preliminary model, evaluating and adjusting model parameters by using the divided verification set, and establishing a trained LSTM model to obtain a corresponding predicted comprehensive load rate;
step 3.4: the Prophet-LSTM load prediction model is established, and the prediction comprehensive load rates corresponding to the Prophet and the LSTM at the time t are defined as P respectively 1 (t) and P 2 (t) let Prophet weight be alpha 1 LSTM has a weight of alpha 2 The Prophet model and the LSTM model are linearly weighted, then a Prophet-LSTM load prediction model is constructed, and a final predicted comprehensive load rate at a time t obtained by the Prophet-LSTM load prediction model is defined as P (t):
P(t)=α 1 P 1 (t)+α 2 P 2 (t)
α 12 =1
step 3.5: determination of weights alpha using covariance matrix analysis 1 、α 2 P (t) is expressed in vector form as:
definition P 1 (t) and P 2 And (C) the covariance matrix of (t), then C is expressed as:
C=E[(P 1 (t)-E[P 1 (t)])(P 2 (t)-E[P 2 (t)])]
wherein E [ P ] 1 (t)]And E [ P ] 2 (t)]Respectively P 1 (t) and P 2 The expected value of (t);
the variance var [ P (t) ] of P (t) is expressed as a covariance matrix:
solving for weights alpha using Lagrangian multiplier 1 And alpha 2 Constructing a Lagrange function
Where λ is the Lagrangian multiplier;
solving a solution where the partial derivative of the lagrangian is equal to 0 as follows:
thereby obtaining the weight alpha 1 、α 2 Obtaining a predicted comprehensive load rate;
step 3.6: and storing the predicted integrated load rate into a time sequence database.
7. The Kubernetes-based load prediction elastic telescoping method of claim 2, wherein the method comprises the steps of:
the step 4 specifically further includes:
step 4.1: acquiring a predicted comprehensive load rate and a current comprehensive load rate from a time sequence database;
step 4.2: defining the current comprehensive load rate as Cu (t), judging whether capacity expansion or capacity contraction operation is needed by the Kubernetes scheduler according to whether Cu (t) is in a section range, and defining the predicted comprehensive load rate after m seconds as P (t+m), wherein m is [5,10], and the section is expressed as:
P(t+m)-P(t+m)*10%≤Cu(t)≤p(t+m)+p(t+m)*10%
when Cu (t) is in the interval range, performing no capacity expansion or capacity contraction operation, otherwise, performing capacity expansion or capacity contraction operation;
step 4.3: the calculation DR executes dynamic expansion, the number of the container copies is modified on time, and the calculation formula of the Pod number is expressed as follows:
where DR is the Desired Replicas that refer to the number of Replicas required for the final result; ceil is a rounding function; CR, current Replicas, refers to the Current number of copies.
CN202310617633.6A 2023-05-29 2023-05-29 Load prediction type elastic expansion system and method based on Kubernetes Pending CN116610416A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310617633.6A CN116610416A (en) 2023-05-29 2023-05-29 Load prediction type elastic expansion system and method based on Kubernetes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310617633.6A CN116610416A (en) 2023-05-29 2023-05-29 Load prediction type elastic expansion system and method based on Kubernetes

Publications (1)

Publication Number Publication Date
CN116610416A true CN116610416A (en) 2023-08-18

Family

ID=87677863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310617633.6A Pending CN116610416A (en) 2023-05-29 2023-05-29 Load prediction type elastic expansion system and method based on Kubernetes

Country Status (1)

Country Link
CN (1) CN116610416A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117826966A (en) * 2024-03-06 2024-04-05 北京比格凯特科技有限公司 Power supply control module of double display card modules

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117826966A (en) * 2024-03-06 2024-04-05 北京比格凯特科技有限公司 Power supply control module of double display card modules

Similar Documents

Publication Publication Date Title
CN109102126B (en) Theoretical line loss rate prediction model based on deep migration learning
US11409347B2 (en) Method, system and storage medium for predicting power load probability density based on deep learning
CN110232203B (en) Knowledge distillation optimization RNN short-term power failure prediction method, storage medium and equipment
CN112990556A (en) User power consumption prediction method based on Prophet-LSTM model
CN111027772A (en) Multi-factor short-term load prediction method based on PCA-DBILSTM
CN110826784B (en) Method and device for predicting energy use efficiency, storage medium and terminal equipment
CN111861013A (en) Power load prediction method and device
CN116307652A (en) Artificial intelligent resource allocation method for intelligent power grid
CN112434848A (en) Nonlinear weighted combination wind power prediction method based on deep belief network
CN116562514B (en) Method and system for immediately analyzing production conditions of enterprises based on neural network
CN116610416A (en) Load prediction type elastic expansion system and method based on Kubernetes
CN112834927A (en) Lithium battery residual life prediction method, system, device and medium
CN115513951A (en) Power load prediction method and system based on concept drift detection
CN111525587A (en) Reactive load situation-based power grid reactive voltage control method and system
CN111008790A (en) Hydropower station group power generation electric scheduling rule extraction method
CN117565727B (en) Wireless charging automatic control method and system based on artificial intelligence
CN113742178A (en) Network node health state monitoring method based on LSTM
CN113033898A (en) Electrical load prediction method and system based on K-means clustering and BI-LSTM neural network
CN113434989A (en) Pipe network leakage amount prediction method and system based on attention mechanism and LSTM
CN116859255A (en) Method, device, equipment and medium for predicting state of health of energy storage battery
Zhichao et al. Short-term load forecasting of multi-layer LSTM neural network considering temperature fuzzification
CN110705756B (en) Electric power energy consumption optimization control method based on input convex neural network
CN117035464A (en) Enterprise electricity consumption carbon emission prediction method based on time sequence network improved circulation network
CN111177881A (en) Random production simulation method for power system containing photo-thermal-photovoltaic power generation
CN113762591B (en) Short-term electric quantity prediction method and system based on GRU and multi-core SVM countermeasure learning

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination