Scientific Programming

Volume 2018 (2018), Article ID 9471356, 10 pages

https://doi.org/10.1155/2018/9471356

## Energy-Aware VM Initial Placement Strategy Based on BPSO in Cloud Computing

^{1}School of Computer Science and Technology, Nanjing University of Posts and Telecommunications, Nanjing 210023, China^{2}Beijing Institute of Control Engineering, Beijing 100190, China

Correspondence should be addressed to Xiong Fu

Received 22 September 2017; Revised 21 December 2017; Accepted 10 January 2018; Published 14 February 2018

Academic Editor: Emiliano Tramontana

Copyright © 2018 Xiong Fu et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

In recent years, high energy consumption has gradually become a prominent problem in a data center. With the advent of cloud computing, computing and storage resources are bringing greater challenges to energy consumption. Virtual machine (VM) initial placement plays an important role in affecting the size of energy consumption. In this paper, we use binary particle swarm optimization (BPSO) algorithm to design a VM placement strategy for low energy consumption measured by proposed energy efficiency fitness, and this strategy needs multiple iterations and updates for VM placement. Finally, the strategy proposed in this paper is compared with other four strategies through simulation experiments. The results show that our strategy for VM placement has better performance in reducing energy consumption than the other four strategies, and it can use less active hosts than others.

#### 1. Introduction

As a new commercial calculation model, cloud computing is the evolution of distributed computing, parallel computing, and grid computing. With the advent of the era of big data, data has become a strategic resource of information society, and cloud computing can be more economical, effective, and efficient for mining data value, which has a revolutionary impact on human economic and social development. However, problems of high energy consumption have been given more and more attentions by enterprises and experts when the scale of data centers is constantly expanding. The increasing scale of data center mainly causes two kinds of serious energy problems. On the one hand, increasing physical servers can bring about more energy consumption; on the other hand, if a server loads few virtual machines or has few demands for resources, it will result in low utilization of server’s resources, which will cause a huge waste of electric power. At present, rapid development of virtualization technology provides a new solution for power consumption in a data center. In particular, when cloud computing becomes a main developing direction in the future, due to its own server consolidation, online migration, isolation, high availability, flexible deployment, low administrative overhead, and other advantages, there is more space for the development of virtualization. Cloud computing uses mature virtualization technology, which makes resources it uses required in the form of virtual machines and then allocates servers’ part resources to them to perform corresponding tasks, so resource-scheduling process can be converted into the search process of virtual machines [1]. Because data centers in cloud computing have begun to widely use virtualization technology, exploring a VM placement strategy for low energy consumption in a cloud data center provides a new research direction for improving energy efficiency in a data center. VM initial placement according to the optimal goal can be used to reduce energy consumption and reduce the number of active servers after the completion of cloud computing platform in a certain degree, and it has a positive effect on the operation and subsequent optimization for VM consolidation of the cloud computing platform.

In this paper, we use binary particle swarm optimization (BPSO) to implement VM initial placement with comprehensive consideration of CPU and disk, then we use model of energy efficiency fitness to adjust each particle’s velocity and displacement within the scope of certain iterations, update each particle’s VM placement according to consideration of the globally optimal displacement and locally optimal displacement, and finally we can get a best VM placement which has the minimum energy consumption.

The rest of this paper is organized as follows: Section 2 discusses related work of VM placement. Section 3 discusses proposed model of energy efficiency fitness. Section 4 discusses VM placement strategy based on BPSO. Section 5 contains details of our algorithm. Section 6 is experiments. At last, Section 7 is the summary of this paper.

#### 2. Related Work

With the rapid development of cloud computing, data centers also expand, as well as the energy consumption caused by data centers, which results in high operation costs. Therefore, reducing energy consumption of data centers is a problem that needs to be solved urgently. The energy consumption in a data center has a close relationship with utilization of resources; thus we should improve the utilization of resources to reduce energy consumption in order to reduce operation cost of data centers. At present, the most effective method to achieve the goal is to use virtualization technology, which can make better use of server resources.

Improving utilization of resources by using virtualization technology is mainly divided into two types: initial placement [2, 3] and dynamic VM consolidation [4, 5]. A lot of research on VM placement has been done by domestic and overseas scholars. Many studies have modeled VM placement as packing problems [6, 7]. The purpose of optimization of VM placement is to use the least amount of physical resources to meet demands of all virtual machines, which can improve efficiency and reduce energy consumption. Many works consider load condition or resource competition in terms of servers of CPU, memory, disk, network bandwidth, and so on. Because various factors should be considered to obtain the optimal solution of multiple dimensions, VM placement has been proved to be an NP-hard problem. The most basic method of VM placement is to use heuristic algorithms, such as best fit algorithm and first fit algorithm. Beloglazov and Buyya [8] have put forward MBFD (modified best fit decrease) algorithm which is used to consolidate virtual machines; the main idea of this literature is reallocating virtual machines which need to be migrated to servers to minimize the energy consumption. These simple methods fall into locally optimal solution because of less thought, resulting in extra waste of resources and increasing SLA violation, which has an effect on QoS as well. Therefore, we need to improve or replace heuristic algorithm.

Chen et al. [5] have described VM placement as a stochastic optimization problem. However, this approach is too simple, which only considers CPU and does not consider other resources. Li et al. [9] have proposed heuristic binary search algorithm, which places virtual machines in a few number of servers as far as possible to reduce energy consumption of the whole data center, and virtual machines of the same tenant are placed in the same server that can reduce the network consumption. The practicality of this algorithm is not good because only one resource type is considered.

Some scholars adopt intelligent algorithm to solve the problem of VM placement. Xu and Fortes [10] have used genetic algorithm to solve the problem of VM placement, but this method does not consider the overhead of VM migration, so it does not have good practicability. Li et al. [11] have proposed a strategy for VM placement that is based on multiobjective genetic algorithm; however the strategy cannot be applied to solve the problem of power consumption. In addition, it does not combine resource control and energy consumption. Farahnakian et al. [12] have used ant colony algorithm for VM consolidation, which can ensure the relatively better original performance and reduce energy consumption at the same time, but this algorithm is too complex, and the speed of its convergence is slow; therefore it is difficult to be implemented.

In recent years, particle swarm optimization (PSO) algorithm has drawn more and more attention from the researchers, because it is similar to genetic algorithm in terms of function, and it has many other advantages: quicker convergence, less parameters, easier operation. In addition, BPSO can be applied to solve the problem of VM placement. In this article, we present an energy-aware strategy for VM initial placement based on BPSO. We first design a multiresource model of energy efficiency fitness and then use BPSO to place virtual machines based on this model. After comparing BPSO with some heuristic algorithms and GA through experiments, we obtained the experimental results, which show that our proposed VM placement strategy not only effectively reduces energy consumption of servers, but also reduces the number of active physical machines as well as the proportion of SLA violation in a certain extent.

#### 3. Energy Efficiency Fitness Model

##### 3.1. Fitting Distance

Every cloud data center will hold the pool of servers, where there are a large number of physical machines. And each physical machine can load virtual machines of different numbers and different specifications; task requests from users and applications are sent by virtual machines. In a data center, utilization of resources such as CPU, disk, memory, bandwidth has an important implication to servers. Because user requests and the sizes of applications are different, their consumption of different types of resources varies, some requests need to consume more CPU resources, and some tasks need more disk utilization, while others consume more bandwidth. In this article, we consider two types of resources: CPU and disk.

Current CPU utilization in a server can be achieved by calculating the sum of CPU utilization in virtual machines running on the server. Similarly, utilization of disk in a server can be achieved by calculating the sum of used disk in virtual machines running on the server. The utilization of CPU and disk affects the energy consumption. Srikantaiah et al. [13] have studied the relationship between energy consumption and utilization of resources. In the literature, results of many experiment shows that, when CPU utilization rate of a server reaches 70% and disk utilization rate reaches 50% at the same time, servers can not only get the minimum value of energy consumption, but also ensure a good performance. Therefore, in this literature, 70% and 50% can be seen as the optimal point for CPU utilization rate and disk utilization rate, respectively, in a server. Two values in the optimal point here are different from that considered separately, so we need to combine two parameters together when solving the problem of VM placement.

Next, we set up a fitness model. We put forward fitness distance (*k* denotes* k* servers) to analyze the fitness of servers quantitatively; fitness distance can be gotten from Euclidean distance of resource utilization between current server and the optimal point. The function is shown as follows:where is th resource utilization rate in server* k*, represents optimal utilization of th resource, and* n* is the number of resource types; since CPU and disk are considered here,* n* is 2. is the fitness distance of server* k*, it is a quantitative representation of energy efficiency fitness. When a server is placed with a running VM, is the Euclidean distance of resource utilization from the optimal point in server* k*. When a server is an idle server, which means no VM is deployed on this server and its fitness distance is 0, then energy efficiency fitness of the whole data center is shown as follows:

It represents the sum of Euclidean distance in each server. Because the model refers to optimal point [13] and this adaptive point has confirmed its high energy efficiency through many experiments, it is of great value to VM placement by using BPSO. And due to the availability of resource parameters, the model is of high practicability.

##### 3.2. Problem Formulation

Since the value of energy efficiency fitness in a whole data center is closely related to VM deployment in servers, to obtain the lowest value of energy efficiency fitness, a strategy for VM placement is proposed to make CPU utilization rate and disk utilization rate of each server with one or more virtual machines run closer to optimal point to a great extent; then we can achieve best energy efficiency in the whole data center. The following is problem formulation.

Suppose that a data center has virtual machines that need to be deployed on* M* servers (, where* K* is the set of servers and* I* is the set of virtual machines), and virtual machines in each server need enough resources to keep a stable state. denotes* n*th resource demand of VM* i*, and denotes the capacity of resource* n* in server* k*. And resources of each server are limited; to guarantee resource utilization of each server in a proper range and ensure that the efficiency of each server is not too bad, we define a set of high and low threshold values of resource utilization: represents the maximum utilization of resource* n* in a server that hosted one or more virtual machines; on the contrary, represents the minimum utilization. The two thresholds play a decisive role in VM placement. Once the value of resource utilization is no longer within these two thresholds, virtual machines need to be migrated. Then we define two binary variables: represents the existence of VM in server* k*, and 1 denotes that VM* i *is placed on server* k*; decides server* k* is idle or not, and if the value is 0, that means server* k* is in the idle state and needs to be adjusted to obtain a state of low energy consumption. The goal of this article is to obtain the minimum energy efficiency fitness; the formula is as follows: and constraints are as follows:where is the optimal point mentioned in the previous section.

#### 4. Energy-Aware VM Initial Placement Strategy Based on BPSO

##### 4.1. Introduction to BPSO

PSO is an intelligent optimization algorithm which was proposed originally by Eberhart and Kennedy according to the laws of some animals’ food-searching [14, 15]. Subsequently, Zhang et al. improved this algorithm, added a dynamic weight to prevent too fast convergence which could lead to locally optimal solution, and then added the exploration of the PSO algorithm [16]. Compared to ant colony algorithm [12, 17, 18], genetic algorithm [7, 19, 20], and many other intelligent algorithm, PSO algorithm has fewer parameters, faster convergence, simpler code, easier operation, and so on, so it is of high practicability.

Standard PSO algorithm is only suitable for solving problems of continuous space; however, the problem of VM placement is a discrete optimization problem, so this algorithm cannot be directly applied to it. Improvement of PSO algorithm is necessary, and this improvement can be applied to solve optimization problems in the discrete space.

Then Kennedy and Eberhart designed corresponding binary version of PSO (BPSO) in 1997 [21], which is used to solve optimization problems in discrete space.

BPSO is similar to the original PSO; the difference is that its particles are composed of binary code. Each particle represents two variables: velocity and displacement. Each particle also stores the two values after each round of iteration: its own locally optimal location () and globally optimal location of the whole particle swarm (). The two values are used to provide the basis of changes for the particle’s velocity; the formula is as follows: is a dynamic weight, which is used to adjust the speed of convergence. And and represent learning factors, which can be called acceleration constants as well, both of which are usually set to 2; is a random number, its value is in the range of . and are, respectively, locally optimal and globally optimal locations of server* d* in particle . In order to guarantee the probability that the value of each bit in displacement is only 1 or 0, the sigmoid function is adopted:Particles change their value by

##### 4.2. VM Initial Placement Based on BPSO

Since BPSO is suitable to solve discrete optimization problems and has advantages over other algorithms, we use it to solve the problem of VM initial placement. In order to better use BPSO, we need to describe the structure of parameters and operation instructions, which can make the strategy of VM initial placement clearer. BPSO has not been used to solve the problem of the energy consumption in cloud data centers by now, so an improved BPSO algorithm is proposed in this article to deal with the problem of high energy consumption, which is a totally new idea.

###### 4.2.1. Parameters Used by BPSO

*① Particle Displacement*. We define a particle swarm that has* L* particles; is the displacement of particle* w* (), and is the number of iterations. is a -bit vector:

Each bit corresponds to the status value of representative server; if one has a value of 1, it means corresponding server is in working status, and there is at least one VM in it; if the value is zero, the corresponding server does not have VMs and is in a state of low energy consumption.

*② Particle Velocity*. It is the same as particle displacement; is the velocity of particle . It is also a -bit vector:

It decides whether the corresponding server of each bit needs to migrate VM or not. The initial state of each bit is 0.

*③ Locally Optimal Displacement and Globally Optimal Displacement*. We use to define locally optimal displacement of particle , which can get the best energy efficiency in particle after iterations, and globally optimal displacement (), which represents the best displacement of all particles that can lead to the best energy efficiency fitness so far. These two parameters play a critical role in changes of particle velocity; in other words, they determine the next step of VM deployment in particles through their locally and globally optimal displacement.

*④ Inertia Weight*. In particle swarm, if there is no inertia weight, the speed of convergence in BPSO will be greatly reduced, so inertia weight in BPSO plays a key role in searching results. However, too fast convergence will easily lead to locally optimal solution rather than globally optimal solution. And in different conditions, appropriate adjustment of inertia weight is extremely important. The start of BPSO carries out a global search ability, where a large inertia weight is needed to quickly find all solutions whose energy efficiency fitness is better than others. After the global search, BPSO should decrease the value of inertia weight and converts from global search to local search, which can get globally optimal solution in these good solutions, so dynamic inertia weight is necessary to improve the search ability of BPSO algorithm. The change rule of inertia weight is shown in

is the lowest limit of inertia weight, is the number of iterations, num is the total number of iterations,* p* is weight coefficient of changes, and* r* is the upper limit of weight adjustment. Overall, inertia weight gradually decreases by the increasing number of iterations, and, if needed, we can control the degree of urgency.

*⑤ Addition Operation and Subtraction Operation*. Since original formula of BPSO algorithm is a one-dimension formula, we need to define some mathematical operations. Addition operation is used to add those variables in the same dimension; similarly, subtraction operation is the subtraction of variables in corresponding dimension. For example, .

*⑥ Function Mapping*. Particle displacement needs a corresponding change according to particle velocity. Original BPSO is unlikely to converge to globally optimal particle, because if it converges to globally optimal particle, its velocity is zero, which will increase the possibility of changes in the corresponding bit; then the search will have more randomness and lack of direction. And original mapping does not conform to the problem of VM placement, because if particle velocity can lead to VM migration, it does not necessarily result in changes of particle displacement. For example, server* A* hosts VM, and server* B* hosts VM; then the value of the status in server* A* and* B* is . If VM3 is migrated from server* A* to* B*, then server* A* hosts VM when server* B *hosts VM; the status still keeps unchanged. We have to improve the sigmoid function.

The following are improvements: is the probability that is 1, and then we use to change particle velocity. If is less than 0,

Otherwise, is the transition of . Next is multiplication operation.

*⑦ Multiplication Operation*. Multiplication operation updates particle displacement and denotes multiplication operation, and the formula isBoth and can only be assigned two values: 0 and 1. When the value of is 1, we do not need to change the displacement of corresponding bit. On the contrary, if the value is 0, we need to observe the value of corresponding bit, namely, ; if the value is 1, we need VM migrations; otherwise, the server can be used as a destination server, and virtual machines can be migrated to this server.

###### 4.2.2. Updating VM Deployment

Based on the above, we can calculate particle velocity of each generation and determine the adjustment of particle displacement. When the transition of particle displacement takes 1, it means that there is no change in corresponding bit of particle displacement; on the contrary, if some bit of the transition is zero, corresponding bit of particle displacement needs to be adjusted, according to VM reallocation.

In this article, we use an updating strategy based on FFD (first fit decreasing), which can update VM displacement.

In order to get a better updating strategy, we need to adjust the server whose value of displacement is 0, and we get a new collection about the adjusted server, which has a two-dimension parameter.

We need to normalize these two parameters. We list all of virtual machines in and form the collection . And each VM in has a normalized performance; its formula is

is the maximum CPU in , and is the minimum. Similarly, is the maximum disk of VMs in , and is the minimum.

According to this formula, we can receive a collection of normalized performance , then sort the element decreasingly, and, finally, leverage the normalized performance to reallocate VMs in based on BFD; then we will get new VM placement in . However, to prevent local optimum, we just use new VM placement in a certain probability.

We calculate two values of energy efficiency fitness according to formula (3), two values ( and ) denote the fitness of original VM placement and new VM placement in , respectively. The probability of using new VM placement in is as follows:

#### 5. Algorithm

*Data Structure*(1): it represents the total number of the particle swarms.(2): it represents the number of iterations in BPSO.(3): it is a list of servers and stores the information of each server, such as id, CPU and disk, the velocity and displacement, the transitions value, and the collection of virtual machines.(4): it stores all information of virtual machines, such as the label and demands for CPU and disk.(5): it deposits optimal placement of each particle that obtains minimum energy efficiency fitness.(6): it is the minimum energy efficiency fitness of current particle during the current iteration.(7): it is the optimal placement of the particle swarm that obtains minimum energy efficiency fitness.(8): it is the minimum energy efficiency fitness of the particle swarm during the current iteration.

The pseudocode for our proposed strategy is presented in Algorithm 1. Algorithm 1 describes the overall process of initial VM placement. First is the generation of* pnumber* particles, which are* pnumber *server lists based on given size of the particle swarm. Each server list has the same servers, but their deployment of virtual machines is not identical because of randomness. Then according to* pnumber* kinds of VM placement, we determine the globally optimal placement and locally optimal placement which can get the least value of energy efficiency fitness. These complete the preparation for the implementation of BPSO (lines 3–11).