# Research on Virtual Machine Response Time Prediction Method Based on GA-BP Neural Network

Authors: Jun Guo; Shu Liu; Bin Zhang; Yongming Yan
Journal: Mathematical Problems in Engineering
 (2014)

---

## Abstract

Cloud application provides access to large pool of virtual machines for building high-quality applications to satisfy customers’ requirements. A difficult issue is how to predict virtual machine response time because it determines when we could adjust dynamic scalable virtual machines. To address the critical issue, this paper proposes a prediction virtual machine response time method which is based on genetic algorithm-back propagation (GA-BP) neural network. First of all, we predict component response time by the past virtual machine component usage experience data: the number of concurrent requests and response time. Then, we could predict virtual machines service response time. The results of large-scale experiments show the effectiveness and feasibility of our method.


---

## Body

## 1. Introduction

A critical issue that must be solved for the cloud application providers is to allocate and manage virtual resources because virtual machines are dynamic scalability in the cloud environment [1]. Cloud application customers expect to receive a certain level service performance as specified in SLA (service level agreement) [2]. Response time is an important indicator in the SLA. Providers dynamically adjust resources by checking whether the service response time exceeds the threshold ruled by SLA. However, it may lead to hysteresis and cause frequent adjustment of resources. Dynamic resource allocation scheme adjusts resources when multiple predicted response time values exceed the threshold of SLA. Therefore, predicting service component response time has high reference value for determining the right time to adjust resources. Traditional service component response time prediction methods do not consider the dynamic scalability of cloud environment [3]; therefore, they are not applicable to service component response time prediction in the cloud environment. It becomes an urgent task to explore an effective virtual machine service component response time prediction method.In this paper, we adopt GA-BP neural network model to predict the virtual machine component response time. It needs not consider the relationship between component concurrent request and response time or mathematical model. The model only requires training to establish the mapping relationship on the network, similar to “black box” method. The BP neural network has several advantages: nonlinear mapping ability, reducing the error between the predicted values and real value, and increasing speed of system processing [4]. GA-BP neural network model overcomes BP algorithm’s problem, such as slow convergence and local optimal solution, and solves genetic algorithm’s problem of approximate optimal in a short period. Thus the model has not only the self-learning ability of neural network but also the global searching ability of genetic algorithm.In this paper, we propose a virtual machine service component response time prediction model based on GA-BP neural network. We collect three kinds of data: the number of components concurrent requests, initialized configuration parameters of virtual machine, and component response time. Then, we predict the total number of components concurrent requests according to the weight of every virtual machine. Finally, we predict service component response time on the virtual machine.The experiments indicate that GA-BP network model is more effective than traditional BP network model, and that service component response time prediction algorithm based on GA-BP network is more accurate than typical algorithms. The algorithm could be used as a reference for time selection in resource adjustment decision.The rest of the paper is organized as follows. Section2 gives a brief overview of existing research related to service response time model and BP neural network. Section 3 presents component response time prediction algorithm in detail. Section 4 shows the experimental results and Section 5 concludes the paper.


## 2. Related Work

At present, the research on service response time prediction is mainly in the field of Web service. In [5], it uses time series achieved good service response time prediction results in the field of Web services and grid computing. However, it does not apply to cloud application because cloud application is dynamic scalability and the number of virtual machines and resources is constantly changing [3]. It will break the development law of service response time. What is more, the method needs to build model of response time and it will degrade performance.In [6], it uses queuing theory to predict response time. Queuing theory is a mathematics theory to study stochastic service system [7]. In [8], it builds the target system model, simplified system, and abstract system. It assumes that the arrival time obeys Poisson process and service time obeys exponential distribution. In fact, the real environment does not completely obey assumption.BP neural network is a common method of training artificial neural networks to predict service response time [4]. In [9], it uses BP neural network to predict time delay. The network learns from many inputs for a desired output. It is effective with nonliner approximation, but the convergence of the algorithm is very slow and may have local minimum problem. Genetic algorithm is a search heuristic that mimics the process of natural selection [10]. It overcomes BP algorithm’s problem of slow speed of convergence and local minimum.Previous studies always used genetic algorithm and BP neural network to predict traffic and futures, but it was not used to predict virtual machine service response time in cloud. Therefore, the paper proposed response time prediction method based on GA-BP neural network. It could overcome the shortages of previous work which could not adapt to resource dynamic scalability and accuracy. Moreover, it could satisfy the service performance as specified in SLA.


## 3. Virtual Machine Response Time Prediction Model

### 3.1. Cloud Application Architecture

Figure1 shows the cloud application architecture. Service can be implemented by combing several virtual machines in the cloud application. The same set of components is deployed on several virtual machines, and balanced workload virtual resource pool is combined with several virtual machines. QOS will be affected by performances of other components on the virtual machine and performances of other virtual machines on the cloud application.Figure 1
Cloud application architecture.


### 3.2. Response Time Prediction Model

In this section, we propose a virtual machine service component response time prediction model which is based on GA-BP neural network to solve random volatility of concurrent requests and virtual machine dynamic scalability. Figure2 shows the response time prediction produce. First of all, we predict every component response time on the virtual machine. Then we predict virtual machine service component total response time.Figure 2
VM response time prediction model.Virtual machine component response time prediction process is divided into two situations.(1)
The collected data could predict response time of the old virtual machine (it has been used before).
(2)
The collected data could not predict response time of the new virtual machine (it has been not used before).There are three steps to predict the new virtual machine component response time.Step 1.
Collect the number of components concurrent requests and components response time.Step 2.
Use the history data to find the old virtual machine which is the most similar to the new virtual machine.Step 3.
The number of component concurrent requests is put into prediction model. Calculate the new virtual machine component response time.The prediction method of the old virtual machine is similar to the new virtual machine. Because the old virtual machine has a lot of history data to predict component response time; we omit the third step. After predicting component response time in the next period, we calculate service response time by weighting every virtual machine component response time.


## 3.1. Cloud Application Architecture

Figure1 shows the cloud application architecture. Service can be implemented by combing several virtual machines in the cloud application. The same set of components is deployed on several virtual machines, and balanced workload virtual resource pool is combined with several virtual machines. QOS will be affected by performances of other components on the virtual machine and performances of other virtual machines on the cloud application.Figure 1
Cloud application architecture.


## 3.2. Response Time Prediction Model

In this section, we propose a virtual machine service component response time prediction model which is based on GA-BP neural network to solve random volatility of concurrent requests and virtual machine dynamic scalability. Figure2 shows the response time prediction produce. First of all, we predict every component response time on the virtual machine. Then we predict virtual machine service component total response time.Figure 2
VM response time prediction model.Virtual machine component response time prediction process is divided into two situations.(1)
The collected data could predict response time of the old virtual machine (it has been used before).
(2)
The collected data could not predict response time of the new virtual machine (it has been not used before).There are three steps to predict the new virtual machine component response time.Step 1.
Collect the number of components concurrent requests and components response time.Step 2.
Use the history data to find the old virtual machine which is the most similar to the new virtual machine.Step 3.
The number of component concurrent requests is put into prediction model. Calculate the new virtual machine component response time.The prediction method of the old virtual machine is similar to the new virtual machine. Because the old virtual machine has a lot of history data to predict component response time; we omit the third step. After predicting component response time in the next period, we calculate service response time by weighting every virtual machine component response time.


## 4. Component Response Time Prediction Model

In this section, we propose a virtual machine component response time prediction model based on GA-BP neural network. In Section4.1, we use similarity calculation model to find out the most similar virtual machine and use the most similar virtual machine to find out the relationship between component current requests and component response time. In Section 4.2, we determine the structure of BP neural network, critical parameters, and genetic operator. In Section 4.3, we set up genetic algorithm parameters to predict accurate component response time. In Section 4.4, service component response time is calculated.


### 4.1.  Virtual Machine Configuration Similarity Computation Model

There aren old virtual machines. If we add a new virtual machine, the configuration data will be put into the database. We choose m performance parameters to calculate similarity. The set of n old virtual machines is denoted as X
=
{
x
1
,
x
2
,
…
,
x
n
}. Performance parameters of virtual machine x
1 are denoted as x
i
=
{
x
i
1
,
x
i
2
,
…
,
x
i
m
},  i
=
1,2
,
…
,
n. The original virtual machine characteristic matrix is denoted as follows:
(1)
V
M
1
V
M
2
V
M
n
[
x
11
x
12
⋯
x
1
m
x
21
x
22
⋯
x
2
m
⋮
⋮
⋮
x
n
1
x
n
2
⋯
x
n
m
]
.Performance parameters include CPU speed, memory capacity, I/O rate, and network bandwidth. We normalize virtual machine performance parameter configuration matrix and use weighted Euclidean distance to calculate two virtual machines similarity. Computation formula is denoted as follows:(2)
d
i
j
=
∥
x
i
-
x
j
∥
w
=
(
x
i
-
x
j
)
W
T
W
(
x
i
-
x
j
)
T
;
W
=
{
w
1
,
w
2
,
…
,
w
m
}
∑
i
=
1
m
w
i
=
1 is weight of m performance parameters set.We calculate similarity to find the most similar virtual machine. We need a lot of data to train the relationship between the number of virtual machine component current requests and component response time.


### 4.2. BP Neural Network Construction

There aren components deployed on the virtual machine. There are N groups sample. The relationship between component current requests and component response time is {
T
(
c
1
)
,
T
(
c
2
)
,
…
,
T
(
c
n
)
}
=
F
{
N
(
c
1
)
,
N
(
c
2
)
,
…
,
N
(
c
n
)
}.The algorithm is multiple inputs and outputs. The input is the number of components current requests and the output is component response time. Hidden layer hasP neurons and the input is A
k
=
(
N
(
c
1
)
,
N
(
c
2
)
,
…
,
N
(
c
n
)
),  k
=
1,2
,
…
,
N
.The weight from input layer to hidden layer is w
i
j. Hidden layer threshold is θ
j; hidden layer weight input is S
k
=
(
s
1
,
s
2
,
…
,
s
p
); and weight output is B
k
=
(
b
1
,
b
2
,
…
,
b
p
). The weight from hidden layer to input layer is v
j
t; output layer threshold is r
t; and output layer weighted value input is B
k
=
(
b
1
,
b
2
,
…
,
b
p
). Expected response time output is Y
k
=
(
T
(
c
1
)
,
T
(
c
2
)
,
…
,
T
(
c
n
)
)
Y
^
k
=
(
T
^
(
c
1
)
,
T
^
(
c
2
)
,
…
,
T
^
(
c
n
)
)
i
=
1,2
,
…
,
n
;
j
=
1,2
,
…
,
p
;
t
=
1,2
,
…
,
N. Hidden layer activation function is f
(
x
); input of hidden layer is s
j
=
∑
i
=
1
n
w
i
j
N
(
c
i
)
+
θ
j; and output is b
j
=
f
(
s
j
), respectively. Output layer activation function is g
(
x
). Input of output layer is l
t
=
∑
j
=
1
p
v
j
t
b
j
+
r
t, and output of BP network neural is
(3)
T
(
c
t
)
=
g
(
l
t
)
.Before building BP neural network for predicting components response time, we need to determine the topology structure and critical parameters of the network.Layer. Hecht-Nielson proved that a hidden layer BP neural network could approximate any continuous function of a closed interval [11]. We use a BP neural network with one hidden layer.Hidden Nodes. The number of hidden layer neurons affects the accuracy and speed of solving problem [12]. We use cut-and-trial method to determine the number of hidden layer neurons, and the empirical formula is
(4)
j
=
m
+
n
+
a
a
∈
(
1,10
)
,
in which m and n are the number of components, and a is a constant.Activation Function. The hidden layer usestansig sigmoid function, and the output layer usespurelin sigmoid function.Tansig is denoted as follows:
(5)
f
(
x
)
=
1
1
+
e
-
x
.Its first-order backward function is denoted as follows:(6)
f
′
(
x
)
=
f
(
x
)
(
1
-
f
(
x
)
)
.Purelin function is denoted as follows:
(7)
g
(
x
)
=
x
.Initial Weight and Threshold. Initial weight and threshold affect convergence ability and training time. In this paper, initial weight and threshold are random numbers between −1 and 1.Learning Rate. Learning rate decides the weight variation in the circuit training. We choose 0.01 as learning rate to ensure network stability.Learning Algorithms. The standard BP algorithm has slow convergence speed problem and local minimum problem. In this paper, we use fast learning algorithm based on L-M (Levenberg-Marquardt) [13].Error index function:(8)
E
(
W
)
=
1
2
∑
k
=
1
N
e
i
2
(
W
)
=
1
2
∑
k
=
1
N
∑
i
=
1
m
(
T
^
(
c
i
)
k
-
T
(
c
i
)
k
)
2
;
W
(
k
) is the k time iterative network weight vector, and the weight adjustment formula is
(9)
W
(
k
+
1
)
=
W
(
k
)
-
[
J
T
J
+
μ
I
]
-
1
J
T
e
.Weighted differential Jacobian Matrix isJ
.Network error vector is e. Unit matrix is I. Coefficient is μ, which is adaptive adjustment.If error index functionE
(
W
) is reduced, we will use μ to calculate W
(
k
+
1
). Then we decrease μ; otherwise we increase μ.The set of the number ofN components current requests and N components response time is {
(
x
k
,
y
k
)
∣
x
∈
R
m, y
∈
R
n, k
=
1,2
,
…
,
N
}. The total samples are divided into training sample ϕ
1 and testing sample ϕ
2:
(10)
ϕ
1
=
{
(
x
k
,
y
k
)
∣
x
∈
R
m
,
y
∈
R
n
,
k
=
1,2
,
…
,
N
1
,
N
1
≤
N
}
,
ϕ
2
=
{
(
x
k
,
y
k
)
∣
x
∈
R
m
,
y
∈
R
n
,
k
=
N
1
+
1
,
N
1
+
2
,
…
,
N
}
.First of all, we trainN
1 groups component current requests and response time sample to establish mapping relation. Then, we use the number of component current requests from the N
1
+
1
th group to the N
th group to predict component response time.The training sample network error is denoted as follows:(11)
e
k
=
1
2
∑
i
=
1
m
(
T
^
(
c
i
)
k
-
T
(
c
i
)
k
)
2
.The network total error is less thanε
1:
(12)
E
1
=
1
2
∑
k
=
1
N
1
∑
i
=
1
m
(
T
^
(
c
i
)
k
-
T
(
c
i
)
k
)
2
≤
ε
1
.Testing sample of mean square error is less thanε
2:
(13)
E
2
=
1
N
-
N
1
∑
k
=
N
1
N
∑
i
=
1
m
(
T
^
(
c
i
)
k
-
T
(
c
i
)
k
)
2
≤
ε
2
.Because we are not sure of the accurate number of concurrent requests and the sample response time. Even ifE
1 is small, we still cannot ensure that E
2 is up to grade.


### 4.3. Genetic Algorithm Parameters Setup

Genetic algorithm optimizes BP network component response time prediction weight to overcome some shortages of BP neural network, so we can accurately predict component response time. Genetic algorithm for optimizing network weight needs to design the main parameters.Encoding System. There are two chromosome encoding methods: binary encoding and real encoding. Real encoding is shorter than binary encoding, and it needs not switch back and forth between encoding and decoding [14, 15]. We use real encoding to improve computation efficiency.Chromosome. Chromosome is the initial connection weight threshold vector of BP neural network. The numbers of hidden layer and input layer unit threshold are p
,
n. The BP network structure is n
-
p
-
n. The length of chromosome is l
=
n
×
p
+
p
+
p
×
n
+
n. The chromosome has l real numbers, and the scope of every real number is (
0
,
l
). Mathematical expression of individual is
(14)
X
=
[
w
11
,
w
12
,
…
,
w
n
p
,
θ
1
,
θ
2
,
…
,
θ
p
,
v
11
,
v
12
,
…
,
v
p
n
,
r
1
,
r
2
…
,
r
n
]
.Number of Initial Population. If the number of initial population M is small, it will not benefit weight threshold crossing and variation and will decrease the diversity of population. But on the contrary, the running efficiency of genetic algorithm will decrease. Therefore, we decide M is 30.Fitness Function. Fitness function is an index to decide the chromosome quality and is the only measure to guide the genetic algorithm search. Training overall error is as small as possible, and genetic algorithm uses the maximum objective function value as the fitness function. We calculate square of components response time error sum in the training sample according to formula (12), and chromosome adaptive value is
(15)
f
i
=
1
E
i
;
i
=
1,2
,
…
,
M is chromosome number.Selection Operator and Selection Probability. We select the most fitness individual to continue genetic manipulation. In this paper, we adopt roulette wheel selection method. Fitness f
i selective probability is P
s:
(16)
p
s
=
f
i
∑
j
=
1
M
f
j
.Crossover Operator and Crossover Probability. We randomly select two chromosomes and choose their weights and thresholds with crossover probability to form two new individuals X
A
t
,
X
B
t. We use arithmetic crossover operation to generate two new individuals:
(17)
X
A
t
+
1
=
α
X
B
t
+
(
1
-
α
)
X
A
t
,
X
B
t
+
1
=
α
X
A
t
+
(
1
-
α
)
X
B
t
;
a
∈
(
0,1
) is a parameter. We adopt nonuniform arithmetic crossover operator a. If the crossover probability value is large, the convergence speed will be fast. On the contrary, if the crossover probability value is small, algorithm performance will be reduced. In this paper, P
c is 0.4.Mutation Operator and Mutation Probability. We randomly select a chromosome, and mutation probability P
m selects weight threshold to achieve mutation. Individual is X
=
(
x
1
x
2
,
…
,
x
k
,
…
,
x
t
). Mutation point is x
k and the value range is [
U
min
⁡
k
,
U
max
⁡
k
]. After mutation operation, we achieve a new individual X
=
(
x
1
x
2
,
…
,
x
k
′
,
…
,
x
t
). The new genetic value x
k
′ is denoted as
(18)
x
k
′
=
x
k
+
(
U
max
⁡
k
-
x
k
)
·
f
(
g
)
r
>
0.5
,
x
k
′
=
x
k
-
(
x
k
-
U
min
⁡
k
)
·
f
(
g
)
r
<
0.5
.
f
(
g
)
=
r
2
·
(
1
-
g
/
G
max
⁡
). Random number is r
2. The number of iterations is g. The max number of evolution is G
max
⁡. The value range of r is [
0,1
].If the mutation probability is too large, algorithm performance will be reduced. Instead, the species diversity will be poor. In this paper,P
m is 0.4.Termination Condition. We adopt maximum evolution algebra as termination condition. In this paper, it is 100.


### 4.4. Service Response Time Calculation

According to the previous sections, Algorithm1 shows the steps of component response time prediction procedure.Algorithm 1:Component response time prediction procedure.
Input: The most similar virtual machine’s number of component current requests and
response time historical sequence is N
i
(
c
1
)
,
N
i
(
c
2
)
,
…
,
N
i
(
c
n
)
T
i
(
c
1
)
,
T
i
(
c
2
)
,
…
,
T
i
(
c
n
)
i
=
1,2
,
…
,
t before time t. The number of component current requests is k.
Output: Component response timeT
i
(
c
1
)
,
T
i
(
c
2
)
,
…
,
T
i
(
c
n
)
i
=
t
+
1
,
t
+
2
,
…
,
t
+
k in the future k time intervals.
(1) Determine the number of concurrent requests, set the related parameters, establish the BP neural network.
(2) Set up population sizeL, chromosome length M, number of iterations M
a
x
g
e
n, crossover probability P
c and mutation
probabilityP
m. Initialize M sets of weighting value of the threshold. Form population.
(3) Train the BP neural network. Calculate individual adaptiveness according to formula (15). Choose the optimal chromosome.
(4) Use roulette wheel selection method to chooseM the most adaptive individuals.
(5) Choose several pairs of chromosomes in Step  4 and random numberr
,
r
∈
[
0,1
] for every pair. If r
<
P
c,
chromosome execute crossover operation.
(6) Choose several pairs of chromosomes in Step  5 and random numberr
,
r
∈
[
0,1
]  for every pair. If r
<
P
m,
chromosome execute mutation operation.
(7) Choose the individual in Step  6 as network weight threshold to train BP network. Compare the optimal individual
with the last generation optimal individual.
If the former is more adaptive, it will replace the last generation optimal individual. Moreover, the last generation optimal
chromosome replace the worst chromosome.
g
e
n
=
g
e
n
+
1, if g
e
n
=
M
a
x
g
e
n, algorithm will be stoped. Then we get optimal weight threshold. Otherwise, go to Step  4.
(8) Decompose the optimal individual to get BP neural network connective weight threshold.
(9) BP network initial iteration valuei
=
1.
(10) Put the amount of component concurrent requests and response time sequences
into model, and calculate component response time according to formula (3).
(11) Formula (12) calculates the first sample component response time prediction error
quadratic sum and formula (9) adjusts weight.
(12) Choose the second sample component current requests amount and response time. Repeat Steps  10 and 11 until
finishing N samples training.
(13)i
=
i
+
1. if i
=
N or the overall error of the network E
<
ε. When training process is ended,
we get future component response time. Otherwise, go to Step  10.
(14) Put the number ofk components current requests into trained network. Then get the new virtual machine
component k response time.There arem components deployed on n virtual machines and q requests which are transmitted to component j on virtual machine k
. Virtual machine response time t
-
j
k is denoted as
(19)
t
-
j
k
=
1
q
∑
i
=
1
q
t
i
.Calculate weighted sum ofn virtual machines component response time. Therefore service response time is
(20)
t
=
∑
k
=
1
n
∑
j
=
1
m
t
-
j
k
m
×
n
.


## 4.1.  Virtual Machine Configuration Similarity Computation Model

There aren old virtual machines. If we add a new virtual machine, the configuration data will be put into the database. We choose m performance parameters to calculate similarity. The set of n old virtual machines is denoted as X
=
{
x
1
,
x
2
,
…
,
x
n
}. Performance parameters of virtual machine x
1 are denoted as x
i
=
{
x
i
1
,
x
i
2
,
…
,
x
i
m
},  i
=
1,2
,
…
,
n. The original virtual machine characteristic matrix is denoted as follows:
(1)
V
M
1
V
M
2
V
M
n
[
x
11
x
12
⋯
x
1
m
x
21
x
22
⋯
x
2
m
⋮
⋮
⋮
x
n
1
x
n
2
⋯
x
n
m
]
.Performance parameters include CPU speed, memory capacity, I/O rate, and network bandwidth. We normalize virtual machine performance parameter configuration matrix and use weighted Euclidean distance to calculate two virtual machines similarity. Computation formula is denoted as follows:(2)
d
i
j
=
∥
x
i
-
x
j
∥
w
=
(
x
i
-
x
j
)
W
T
W
(
x
i
-
x
j
)
T
;
W
=
{
w
1
,
w
2
,
…
,
w
m
}
∑
i
=
1
m
w
i
=
1 is weight of m performance parameters set.We calculate similarity to find the most similar virtual machine. We need a lot of data to train the relationship between the number of virtual machine component current requests and component response time.


## 4.2. BP Neural Network Construction

There aren components deployed on the virtual machine. There are N groups sample. The relationship between component current requests and component response time is {
T
(
c
1
)
,
T
(
c
2
)
,
…
,
T
(
c
n
)
}
=
F
{
N
(
c
1
)
,
N
(
c
2
)
,
…
,
N
(
c
n
)
}.The algorithm is multiple inputs and outputs. The input is the number of components current requests and the output is component response time. Hidden layer hasP neurons and the input is A
k
=
(
N
(
c
1
)
,
N
(
c
2
)
,
…
,
N
(
c
n
)
),  k
=
1,2
,
…
,
N
.The weight from input layer to hidden layer is w
i
j. Hidden layer threshold is θ
j; hidden layer weight input is S
k
=
(
s
1
,
s
2
,
…
,
s
p
); and weight output is B
k
=
(
b
1
,
b
2
,
…
,
b
p
). The weight from hidden layer to input layer is v
j
t; output layer threshold is r
t; and output layer weighted value input is B
k
=
(
b
1
,
b
2
,
…
,
b
p
). Expected response time output is Y
k
=
(
T
(
c
1
)
,
T
(
c
2
)
,
…
,
T
(
c
n
)
)
Y
^
k
=
(
T
^
(
c
1
)
,
T
^
(
c
2
)
,
…
,
T
^
(
c
n
)
)
i
=
1,2
,
…
,
n
;
j
=
1,2
,
…
,
p
;
t
=
1,2
,
…
,
N. Hidden layer activation function is f
(
x
); input of hidden layer is s
j
=
∑
i
=
1
n
w
i
j
N
(
c
i
)
+
θ
j; and output is b
j
=
f
(
s
j
), respectively. Output layer activation function is g
(
x
). Input of output layer is l
t
=
∑
j
=
1
p
v
j
t
b
j
+
r
t, and output of BP network neural is
(3)
T
(
c
t
)
=
g
(
l
t
)
.Before building BP neural network for predicting components response time, we need to determine the topology structure and critical parameters of the network.Layer. Hecht-Nielson proved that a hidden layer BP neural network could approximate any continuous function of a closed interval [11]. We use a BP neural network with one hidden layer.Hidden Nodes. The number of hidden layer neurons affects the accuracy and speed of solving problem [12]. We use cut-and-trial method to determine the number of hidden layer neurons, and the empirical formula is
(4)
j
=
m
+
n
+
a
a
∈
(
1,10
)
,
in which m and n are the number of components, and a is a constant.Activation Function. The hidden layer usestansig sigmoid function, and the output layer usespurelin sigmoid function.Tansig is denoted as follows:
(5)
f
(
x
)
=
1
1
+
e
-
x
.Its first-order backward function is denoted as follows:(6)
f
′
(
x
)
=
f
(
x
)
(
1
-
f
(
x
)
)
.Purelin function is denoted as follows:
(7)
g
(
x
)
=
x
.Initial Weight and Threshold. Initial weight and threshold affect convergence ability and training time. In this paper, initial weight and threshold are random numbers between −1 and 1.Learning Rate. Learning rate decides the weight variation in the circuit training. We choose 0.01 as learning rate to ensure network stability.Learning Algorithms. The standard BP algorithm has slow convergence speed problem and local minimum problem. In this paper, we use fast learning algorithm based on L-M (Levenberg-Marquardt) [13].Error index function:(8)
E
(
W
)
=
1
2
∑
k
=
1
N
e
i
2
(
W
)
=
1
2
∑
k
=
1
N
∑
i
=
1
m
(
T
^
(
c
i
)
k
-
T
(
c
i
)
k
)
2
;
W
(
k
) is the k time iterative network weight vector, and the weight adjustment formula is
(9)
W
(
k
+
1
)
=
W
(
k
)
-
[
J
T
J
+
μ
I
]
-
1
J
T
e
.Weighted differential Jacobian Matrix isJ
.Network error vector is e. Unit matrix is I. Coefficient is μ, which is adaptive adjustment.If error index functionE
(
W
) is reduced, we will use μ to calculate W
(
k
+
1
). Then we decrease μ; otherwise we increase μ.The set of the number ofN components current requests and N components response time is {
(
x
k
,
y
k
)
∣
x
∈
R
m, y
∈
R
n, k
=
1,2
,
…
,
N
}. The total samples are divided into training sample ϕ
1 and testing sample ϕ
2:
(10)
ϕ
1
=
{
(
x
k
,
y
k
)
∣
x
∈
R
m
,
y
∈
R
n
,
k
=
1,2
,
…
,
N
1
,
N
1
≤
N
}
,
ϕ
2
=
{
(
x
k
,
y
k
)
∣
x
∈
R
m
,
y
∈
R
n
,
k
=
N
1
+
1
,
N
1
+
2
,
…
,
N
}
.First of all, we trainN
1 groups component current requests and response time sample to establish mapping relation. Then, we use the number of component current requests from the N
1
+
1
th group to the N
th group to predict component response time.The training sample network error is denoted as follows:(11)
e
k
=
1
2
∑
i
=
1
m
(
T
^
(
c
i
)
k
-
T
(
c
i
)
k
)
2
.The network total error is less thanε
1:
(12)
E
1
=
1
2
∑
k
=
1
N
1
∑
i
=
1
m
(
T
^
(
c
i
)
k
-
T
(
c
i
)
k
)
2
≤
ε
1
.Testing sample of mean square error is less thanε
2:
(13)
E
2
=
1
N
-
N
1
∑
k
=
N
1
N
∑
i
=
1
m
(
T
^
(
c
i
)
k
-
T
(
c
i
)
k
)
2
≤
ε
2
.Because we are not sure of the accurate number of concurrent requests and the sample response time. Even ifE
1 is small, we still cannot ensure that E
2 is up to grade.


## 4.3. Genetic Algorithm Parameters Setup

Genetic algorithm optimizes BP network component response time prediction weight to overcome some shortages of BP neural network, so we can accurately predict component response time. Genetic algorithm for optimizing network weight needs to design the main parameters.Encoding System. There are two chromosome encoding methods: binary encoding and real encoding. Real encoding is shorter than binary encoding, and it needs not switch back and forth between encoding and decoding [14, 15]. We use real encoding to improve computation efficiency.Chromosome. Chromosome is the initial connection weight threshold vector of BP neural network. The numbers of hidden layer and input layer unit threshold are p
,
n. The BP network structure is n
-
p
-
n. The length of chromosome is l
=
n
×
p
+
p
+
p
×
n
+
n. The chromosome has l real numbers, and the scope of every real number is (
0
,
l
). Mathematical expression of individual is
(14)
X
=
[
w
11
,
w
12
,
…
,
w
n
p
,
θ
1
,
θ
2
,
…
,
θ
p
,
v
11
,
v
12
,
…
,
v
p
n
,
r
1
,
r
2
…
,
r
n
]
.Number of Initial Population. If the number of initial population M is small, it will not benefit weight threshold crossing and variation and will decrease the diversity of population. But on the contrary, the running efficiency of genetic algorithm will decrease. Therefore, we decide M is 30.Fitness Function. Fitness function is an index to decide the chromosome quality and is the only measure to guide the genetic algorithm search. Training overall error is as small as possible, and genetic algorithm uses the maximum objective function value as the fitness function. We calculate square of components response time error sum in the training sample according to formula (12), and chromosome adaptive value is
(15)
f
i
=
1
E
i
;
i
=
1,2
,
…
,
M is chromosome number.Selection Operator and Selection Probability. We select the most fitness individual to continue genetic manipulation. In this paper, we adopt roulette wheel selection method. Fitness f
i selective probability is P
s:
(16)
p
s
=
f
i
∑
j
=
1
M
f
j
.Crossover Operator and Crossover Probability. We randomly select two chromosomes and choose their weights and thresholds with crossover probability to form two new individuals X
A
t
,
X
B
t. We use arithmetic crossover operation to generate two new individuals:
(17)
X
A
t
+
1
=
α
X
B
t
+
(
1
-
α
)
X
A
t
,
X
B
t
+
1
=
α
X
A
t
+
(
1
-
α
)
X
B
t
;
a
∈
(
0,1
) is a parameter. We adopt nonuniform arithmetic crossover operator a. If the crossover probability value is large, the convergence speed will be fast. On the contrary, if the crossover probability value is small, algorithm performance will be reduced. In this paper, P
c is 0.4.Mutation Operator and Mutation Probability. We randomly select a chromosome, and mutation probability P
m selects weight threshold to achieve mutation. Individual is X
=
(
x
1
x
2
,
…
,
x
k
,
…
,
x
t
). Mutation point is x
k and the value range is [
U
min
⁡
k
,
U
max
⁡
k
]. After mutation operation, we achieve a new individual X
=
(
x
1
x
2
,
…
,
x
k
′
,
…
,
x
t
). The new genetic value x
k
′ is denoted as
(18)
x
k
′
=
x
k
+
(
U
max
⁡
k
-
x
k
)
·
f
(
g
)
r
>
0.5
,
x
k
′
=
x
k
-
(
x
k
-
U
min
⁡
k
)
·
f
(
g
)
r
<
0.5
.
f
(
g
)
=
r
2
·
(
1
-
g
/
G
max
⁡
). Random number is r
2. The number of iterations is g. The max number of evolution is G
max
⁡. The value range of r is [
0,1
].If the mutation probability is too large, algorithm performance will be reduced. Instead, the species diversity will be poor. In this paper,P
m is 0.4.Termination Condition. We adopt maximum evolution algebra as termination condition. In this paper, it is 100.


## 4.4. Service Response Time Calculation

According to the previous sections, Algorithm1 shows the steps of component response time prediction procedure.Algorithm 1:Component response time prediction procedure.
Input: The most similar virtual machine’s number of component current requests and
response time historical sequence is N
i
(
c
1
)
,
N
i
(
c
2
)
,
…
,
N
i
(
c
n
)
T
i
(
c
1
)
,
T
i
(
c
2
)
,
…
,
T
i
(
c
n
)
i
=
1,2
,
…
,
t before time t. The number of component current requests is k.
Output: Component response timeT
i
(
c
1
)
,
T
i
(
c
2
)
,
…
,
T
i
(
c
n
)
i
=
t
+
1
,
t
+
2
,
…
,
t
+
k in the future k time intervals.
(1) Determine the number of concurrent requests, set the related parameters, establish the BP neural network.
(2) Set up population sizeL, chromosome length M, number of iterations M
a
x
g
e
n, crossover probability P
c and mutation
probabilityP
m. Initialize M sets of weighting value of the threshold. Form population.
(3) Train the BP neural network. Calculate individual adaptiveness according to formula (15). Choose the optimal chromosome.
(4) Use roulette wheel selection method to chooseM the most adaptive individuals.
(5) Choose several pairs of chromosomes in Step  4 and random numberr
,
r
∈
[
0,1
] for every pair. If r
<
P
c,
chromosome execute crossover operation.
(6) Choose several pairs of chromosomes in Step  5 and random numberr
,
r
∈
[
0,1
]  for every pair. If r
<
P
m,
chromosome execute mutation operation.
(7) Choose the individual in Step  6 as network weight threshold to train BP network. Compare the optimal individual
with the last generation optimal individual.
If the former is more adaptive, it will replace the last generation optimal individual. Moreover, the last generation optimal
chromosome replace the worst chromosome.
g
e
n
=
g
e
n
+
1, if g
e
n
=
M
a
x
g
e
n, algorithm will be stoped. Then we get optimal weight threshold. Otherwise, go to Step  4.
(8) Decompose the optimal individual to get BP neural network connective weight threshold.
(9) BP network initial iteration valuei
=
1.
(10) Put the amount of component concurrent requests and response time sequences
into model, and calculate component response time according to formula (3).
(11) Formula (12) calculates the first sample component response time prediction error
quadratic sum and formula (9) adjusts weight.
(12) Choose the second sample component current requests amount and response time. Repeat Steps  10 and 11 until
finishing N samples training.
(13)i
=
i
+
1. if i
=
N or the overall error of the network E
<
ε. When training process is ended,
we get future component response time. Otherwise, go to Step  10.
(14) Put the number ofk components current requests into trained network. Then get the new virtual machine
component k response time.There arem components deployed on n virtual machines and q requests which are transmitted to component j on virtual machine k
. Virtual machine response time t
-
j
k is denoted as
(19)
t
-
j
k
=
1
q
∑
i
=
1
q
t
i
.Calculate weighted sum ofn virtual machines component response time. Therefore service response time is
(20)
t
=
∑
k
=
1
n
∑
j
=
1
m
t
-
j
k
m
×
n
.


## 5. Experimental Evaluation

### 5.1. Experimental Setup

We deploy six virtual machines on the server and two virtual CPUs on the virtual machine. Then, we deploy three procedures on the six virtual machine clients. Load balancer is deployed requests on virtual machine according to ratio and the client sends requests to the load balancer. Finally, we monitor the number of virtual machine current requests and the response time every 30 seconds and put the monitor data into database. After the server runs for several minutes, we add a new virtual machine.


### 5.2. GA-BP Neural Network Structure

When we calculate similarity, the weight vector was{
0.5,0.25,0.15,0.1
}, which represented CPU, memory, I/O, and bandwidth. We found out that the most similarity virtual machine was VM3, and we used the number of VM3 component concurrent requests and response time to predict VM7 (the new VM) service component response time. We predicted VM7 component concurrent time by traditional BP algorithm and GA-BP algorithm and evaluated the new algorithm. There were 300 samples on VM3. 80% of the samples were training samples and 20% of the samples were verification samples. Normalization formula is
(21)
x
^
=
2
(
x
-
x
min
⁡
)
x
max
⁡
-
x
min
⁡
-
1
.Normalization data isx
^, and current data is x.


#### 5.2.1. BP Neural Network Structure

BP network training function istrainlm. Learning rate is 0.1. Performance function is MSE (mean square error). Training target error is 0.0001. The largest number of iterations is 1000. Adopt cut-and-try to determine optimal hidden layer node number. Table 1 shows experiment result. When hidden layer node number is 10, network has minimum error. The network structure is 5
-
10
-
1. Figure 3 shows BP neural network training performance when we train 240 samples. When BP neural network is trained 36 steps, the validation performance is 0.00012949.Table 1
Net error of different hidden layer node number.
Hidden layer
5
6
7
8
9
10
11
12
Network general error
0.6906
0.7012
0.6893
0.3859
0.4984
0.2018
0.4991
0.5274Figure 3
Performance curve of BP neural network training process.


#### 5.2.2. GA-BP Neural Network Structure

We set the genetic algorithm parameters as follows. Population size is 30; evolution algebra is 100; crossover probability is 0.4; the mutation probability is 0.01; BP network structure is5
-
10
-
1; performance function is MSE, and training target error is 0.0001. Figure 4 shows that when GA-BP neural network is trained 8 steps, the validation performance is 0.00012949. Convergence rate is faster than traditional BP neural network.Figure 4
Performance curve of GA-BP neural network training process.


### 5.3. Result Analysis of Comparative Experiment

We use GA-BP neural network model to predict 21 components on 7 virtual machines. The next service response time prediction value is 0.985 s, and the real response time is 0.997 s. Under the same experiment condition, we also use BP neural network, time series, and queuing theory to predict service response time in 60 seconds. Figure5 shows every method prediction error. When prediction time is less than real time, the error is a negative and vice versa. Figure 6 compares GA-BP neural network prediction response time with real response time. Figure 7 shows the differences between BP neural network prediction response time and real response time. Figures 8 and 9 show traditional time series and queuing theory prediction response time in contrast to real response time. Time series and queuing theory are not as accurate as GA-BP neural network and BP neural network, because BP neural network could reduce the error between the predicted values and real value and increasing speed of system processing. What is more, GA-BP neural network overcomes local optimal solution and approximate optimal in a short period. Therefore, it is more stable than other methods in the whole prediction process.Figure 5
Three traditional methods and GA-BP neural network prediction error.Figure 6
Comparison between GA-BP neural network prediction value and real value.Figure 7
Comparison between BP neural network prediction value and real value.Figure 8
Comparison between time series prediction value and real value.Figure 9
Comparison between queuing theory prediction value and real value.


## 5.1. Experimental Setup

We deploy six virtual machines on the server and two virtual CPUs on the virtual machine. Then, we deploy three procedures on the six virtual machine clients. Load balancer is deployed requests on virtual machine according to ratio and the client sends requests to the load balancer. Finally, we monitor the number of virtual machine current requests and the response time every 30 seconds and put the monitor data into database. After the server runs for several minutes, we add a new virtual machine.


## 5.2. GA-BP Neural Network Structure

When we calculate similarity, the weight vector was{
0.5,0.25,0.15,0.1
}, which represented CPU, memory, I/O, and bandwidth. We found out that the most similarity virtual machine was VM3, and we used the number of VM3 component concurrent requests and response time to predict VM7 (the new VM) service component response time. We predicted VM7 component concurrent time by traditional BP algorithm and GA-BP algorithm and evaluated the new algorithm. There were 300 samples on VM3. 80% of the samples were training samples and 20% of the samples were verification samples. Normalization formula is
(21)
x
^
=
2
(
x
-
x
min
⁡
)
x
max
⁡
-
x
min
⁡
-
1
.Normalization data isx
^, and current data is x.


### 5.2.1. BP Neural Network Structure

BP network training function istrainlm. Learning rate is 0.1. Performance function is MSE (mean square error). Training target error is 0.0001. The largest number of iterations is 1000. Adopt cut-and-try to determine optimal hidden layer node number. Table 1 shows experiment result. When hidden layer node number is 10, network has minimum error. The network structure is 5
-
10
-
1. Figure 3 shows BP neural network training performance when we train 240 samples. When BP neural network is trained 36 steps, the validation performance is 0.00012949.Table 1
Net error of different hidden layer node number.
Hidden layer
5
6
7
8
9
10
11
12
Network general error
0.6906
0.7012
0.6893
0.3859
0.4984
0.2018
0.4991
0.5274Figure 3
Performance curve of BP neural network training process.


### 5.2.2. GA-BP Neural Network Structure

We set the genetic algorithm parameters as follows. Population size is 30; evolution algebra is 100; crossover probability is 0.4; the mutation probability is 0.01; BP network structure is5
-
10
-
1; performance function is MSE, and training target error is 0.0001. Figure 4 shows that when GA-BP neural network is trained 8 steps, the validation performance is 0.00012949. Convergence rate is faster than traditional BP neural network.Figure 4
Performance curve of GA-BP neural network training process.


## 5.2.1. BP Neural Network Structure

BP network training function istrainlm. Learning rate is 0.1. Performance function is MSE (mean square error). Training target error is 0.0001. The largest number of iterations is 1000. Adopt cut-and-try to determine optimal hidden layer node number. Table 1 shows experiment result. When hidden layer node number is 10, network has minimum error. The network structure is 5
-
10
-
1. Figure 3 shows BP neural network training performance when we train 240 samples. When BP neural network is trained 36 steps, the validation performance is 0.00012949.Table 1
Net error of different hidden layer node number.
Hidden layer
5
6
7
8
9
10
11
12
Network general error
0.6906
0.7012
0.6893
0.3859
0.4984
0.2018
0.4991
0.5274Figure 3
Performance curve of BP neural network training process.


## 5.2.2. GA-BP Neural Network Structure

We set the genetic algorithm parameters as follows. Population size is 30; evolution algebra is 100; crossover probability is 0.4; the mutation probability is 0.01; BP network structure is5
-
10
-
1; performance function is MSE, and training target error is 0.0001. Figure 4 shows that when GA-BP neural network is trained 8 steps, the validation performance is 0.00012949. Convergence rate is faster than traditional BP neural network.Figure 4
Performance curve of GA-BP neural network training process.


## 5.3. Result Analysis of Comparative Experiment

We use GA-BP neural network model to predict 21 components on 7 virtual machines. The next service response time prediction value is 0.985 s, and the real response time is 0.997 s. Under the same experiment condition, we also use BP neural network, time series, and queuing theory to predict service response time in 60 seconds. Figure5 shows every method prediction error. When prediction time is less than real time, the error is a negative and vice versa. Figure 6 compares GA-BP neural network prediction response time with real response time. Figure 7 shows the differences between BP neural network prediction response time and real response time. Figures 8 and 9 show traditional time series and queuing theory prediction response time in contrast to real response time. Time series and queuing theory are not as accurate as GA-BP neural network and BP neural network, because BP neural network could reduce the error between the predicted values and real value and increasing speed of system processing. What is more, GA-BP neural network overcomes local optimal solution and approximate optimal in a short period. Therefore, it is more stable than other methods in the whole prediction process.Figure 5
Three traditional methods and GA-BP neural network prediction error.Figure 6
Comparison between GA-BP neural network prediction value and real value.Figure 7
Comparison between BP neural network prediction value and real value.Figure 8
Comparison between time series prediction value and real value.Figure 9
Comparison between queuing theory prediction value and real value.


## 6. Conclusion and Future Work

Cloud environment dynamic scalability will break the law of service response time. Traditional method cannot satisfy prediction accuracy requirements. In this paper, we propose a novel method to predict virtual machine response time based on GA-BP neural network. We predict components response time on the VM and calculate virtual machine service response time. The extensive experimental results show the effectiveness and efficiency of our framework.For future work, we will investigate more techniques for improving the prediction accuracy.



---

*Source: 141930-2014-06-17.xml*