Hybrid Algorithm Naive Bayesian Classifier and Random Key Cuckoo Search for Virtual Machine Consolidation Problem

The trade-off between Energy consumption and SLA violation presents a serious challenge in cloud computing environments. A non-aggressive virtual machine consolidation algorithm is a good approach to reduce the consumed energy as well as SLA violation. A well-known strategy to deal with the virtual machine consolidation problem consists of four steps: host overloading detection, host under-loading detection, virtual machine selection and virtual machine placement. In this paper, the previous strategy is modified by merging the last two steps virtual machine selection and virtual machine placement, to avoid any poor solutions caused by solving both steps separately. In the host overloading/under-loading detection steps, we classified host status into five classes: Over-Utilized, Nearly Over-Utilized, Normal Utilized, Under-Utilized and Switched Off, then an algorithm, based on the Naive Bayesian Classifier, was introduced in order to detect the future host state for minimizing the number of virtual machine migrations; as a result, the energy consumption and performance degradation due to migrations will be minimized. In the virtual machine selection and placement steps, we introduced an algorithm based on the Random Key Cuckoo Search to reduce the energy consumption and enhance the SLA violation. To assess the algorithm, real data traces for 10 days, were used to verify the proposed algorithms. The experimental results proved that the proposed algorithms can significantly reduce the consumed energy as well as the SLA violation in data centers.


I. INTRODUCTION
Pay-as-you-go basis [1] [2] has increased demand in Cloud computing (CC), especially after the important role played by big data and the internet of things (IOT). In addition, Cloud datacenters consume huge energy, which is mostly produced by non-green energy, resulting in a lot of carbon emissions as well as a high service cost. According to the United States Data Center Energy Usage Report in 2016, in 2010, the energy consumed by U.S data centers constituted about 2% of the global energy consumption [3]. Additionally, a six-month study that was conducted by Barroso & Hölzle (2007) showed that 5000 physical machines (PMs) used nearly around 10-50% of their total capacity [4].
A non-aggressive virtual machine (VM) consolidation is a good approach for reducing energy consumption with attention to the SLA violation (SLAV). VM consolidation is the technique of reallocating virtual machines (VMs) on PMs, subject to minimizing the used resources while keeping the other resources in the sleep mode. Nonetheless, one problem arises, i.e. the VM consolidation issue is an NP-Hard problem [5]. To solve the VM consolidation problem Beloglazov & Buyya (2012) proposed an effective strategy, consisting of four steps [6]: host overloading detection (HOD), host underloading detection (HUD), VM selection (VMS) and VM placement (VMP). This strategy has been used by most researchers to handle the VM consolidation problem. However, this research found that the week point of this strategy is that it solves both VMS and VMP problems separately, which ultimately produces a poor solution. Therefore, in this study, the aforesaid strategy has been modified through merging the steps of VMS and VMP into a single step. The work in [7], [8] has shown that there is a linear relationship between CPU utilization and power consumption. Thus, in the HOD & HUD detection, it is proposed, using the PM State detection based on the Naive Bayesian classifier (PMSDNBC) [9], to detect the future state of the PM, based on the past CPU historical usage.
Within this study, the PM status is classified into five classes: Over-Utilized (OU), Nearly Over-Utilized (NOU), Normally Utilized (NU), Under-Utilized (UU) and Switched off (SO). The proposed prediction model will help in minimizing the VM migration, resulting in minimizing the energy consumption as well as performance degradation due to migrations. For VMS and VMP, a new algorithm called VM selection and placement using Random Key Cuckoo search (VMSPRKCS), was proposed to handle both VMS and VMP steps. Random Key Cuckoo Search (RKCS) [10] is a novel approach using Cuckoo Search (CS) [11], based on random keys encoding schema (RKES) [12]. CloudSim [13], with a real data set presented from PlanetLab [14], has been used to evaluate the proposed algorithm, and the experimental results showed that the proposed algorithm significantly reduces the consumed energy as well as SLAV.
The rest of the paper is organized as follows: the related work is to be discussed in Section II, a power consumption model in Section III, the Random Key Cuckoo Search concept in Section IV, the proposed overload detection as well as VM selection and placement algorithms in Section V, Simulation Setup and Results in Section VI.

II. RELATED WORK
Since VM consolidation problem is regarded as an NP-Hard problem, it remains an interesting area for researchers, who need to work a lot more towards achieving optimization. Some approaches have used bin-packing optimization algorithms to handle the problem. Shi, Furlong and Wang [15] proposed a greedy algorithm based on the First-fit Decreasing (FFD) algorithm in attempts to reduce the energy consumed by datacenters. FFD has been widely used to find a near optimal solution to the vector pin backing problem. However, the proposed algorithm has a high performance, it can easily be stuck in a local optimum.
Keller, Tighe, Lutfiyya and Bauer [8], proposed new six placement policies based on combinations of order strategies for VMs and PMs. For PMs, they used 3 order strategies: (1) Increasing, which orders the partially-utilized and underutilized PMs in an increasing order according to the CPU utilization; (2) Decreasing, which orders the partiallyutilized and underutilized PMs in a decreasing order according to the CPU utilization; and (3) Mixed, which orders the underutilized PMs in a decreasing order and the partiallyutilized hosts in an increasing order according to the CPU utilization. For VMs, they only used two strategies: (1) the Decreasing strategy to order all VMs in a decreasing order according to the CPU load; and (2) the Increasing strategy to order all VMs in an increasing order according to the CPU load. The DCSim simulator [16], [17] has been used to evaluate the proposed policies, and the results showed that ordering PMs in a decreasing order and VMs in an increasing order according to the CPU utilization performs better in terms of the energy reduction than the other proposed policies.
Some other approaches have used Artificial Intelligence (AI) prediction models to predict the future PM state in attempts to reduce the energy consumption, the number of VM migrations and performance degradation due to migration. Lei Qiao,Bo Liu,Yang Hua,Qing Zhao & Xiong Fu [18], presented an algorithm based on the Genetic Expression Programming (GEP) [19] to consolidate VMs according to historical data. The algorithm focuses only on 2 steps, VM selection and VM placement. The algorithm carries out dynamic VM migrations for overloaded PMs and under loaded PMs, taking into consideration the proposed prediction model. The algorithm is compared to the most common algorithm Power-aware Bestfit Decreasing (PABFD) algorithm [6], and the results showed that the presented algorithm has a significant improvement in Service Level Agreement Time per Active Host (SLATAH) and in minimizing the number of virtual machine consolidations. Lianpeng Li,Jian Dong,Decheng Zuo & Jin Wu [20] built a prediction model based on Robust Simple Linear Regression (RobustSLR) to detect the future CPU utilization of hosts; then, they proposed overload/under load detection and VMP algorithms based on the proposed prediction model. In the VMP, they modified the PABFD algorithm in order to check the future host state using the proposed prediction model; in case, PM future state will be overloaded, and thus no VMs will be migrated to it. The proposed algorithm was assessed by the CloudSim toolkit with a real data presented from PlanetLab, and the results showed that the presented algorithm could reduce the energy consumption by at most 25.43% and SLA violations by at most 99.16%, compared with PABFD and the most common VM state detection & selection policies. Lianpeng Li,Jian Dong,Decheng Zuo & JIaxi Liu [21] proposed a prediction model based on the Simple Bayesian Classifier to detect the future host state. They used the mean function to convert the CPU utilization history for the last hour, and then used them as the Bayes features and the host states (overloaded or not overloaded) as Bayesian Classifier labels. Then, they calculated the posterior probability using the prior probability and condition probability, and then the classifier predicted that that input vector belonged to the class having the highest posterior probability. The algorithm has been compared with the most common PDFA algorithm, and the results showed that the proposed algorithm performed better in terms of energy consumption and SLAV than did PDFA.
Other approaches have used meta-heuristic algorithms to find a near optimal solution. Dabiah Ahmed Alboaneen, Huaglory Tianfield & Yan Zhang [22], applied the Glowworm Swarm Optimization (GSO) Algorithm for the VMP problem. They used a CloudSim toolkit with real data presented from PlanLab to assess the algorithm. The results showed that GSO can perform better than many common placement policies. Khaoula BRAIKI & Habib YOUSSEF [23], proposed a multiobjective algorithm based on the Particle Swarm Optimization (PSO) algorithm to improve resource utilization while minimizing the energy consumption. Sanaz Tavakoli-Someh & Mohammad Hossein Rezvani [24], proposed a multiobjective NSGA-II meta heuristic algorithm to handle the objectives of: (1) maximizing the resources utilization; and (2) minimizing the number of used PMs. The experimental result showed that the proposed algorithm performed better than such basic approaches as the FFD algorithm and the bestfit decreasing (BFD) schemes.
Another statistical analysis approach, based on historical data, has been proposed by Beloglazov and Buyya [6]. It provides four overload host detection policies: Local Regression (LR), Median Absolute Deviation (MAD), Robust Local Regression (RLR) and Interquartile Range (IQR), in addition to 3 selection policies: Minimum Migration Time (MMT), Random Selection (RS) and Maximum Correlation (MC). The CloudSim simulator with PlanetLab traces has been used to evaluate the proposed overload state detection and VM selection policies. As shown by the results, the LR overload detection policy with MMT selection policy significantly surpasses the other policies in reducing SLAV and the number of VM migrations. That is why we considered LR_MMT 1.2 as the benchmark and compared the proposed approach in this research with it using the same traces provided from PlanetLab.

III. POWER CONSUMPTION MODEL
According to different studies, the most energy consumed by servers is mostly consumed by the CPU rather than other resources [7], [25]. Hence, for simplicity, we can represent the PM energy consumption with its CPU utilization. We used a real power consumption data model, illustrated in Table I provided by SPEC power [26] for two servers, HP ProLiant ML110 G4 and HP ProLiant ML110 G5, to calculate the energy consumption.

IV. THE RANDOM KEY CUCKOO SEARCH (RKCS) CONCEPT
The RKCS is a novel approach of Cuckoo Search Metaheuristic algorithms based on a random key encoding schema. It is very effective in the combinatorial problems, as it will be used to apply Lévy flight on the old solution to generate a new cuckoo solution from it.

A. Cuckoo Search (CS)
The CS is a population based meta-heuristic optimization algorithm inspired by the natural behavior of cuckoo birds. It was presented by Xin-She Yang and Suash Deb in 2009. When cuckoo birds want to lay eggs, they do not build their own nests, but they rather use some other birds' nest. In case that other bird discovered that those eggs were not their own, it would either throw them or abandon its nest and build another one elsewhere. Below are the laws CS:

1) Number of hosts is fixed.
2) A nest can host only one egg.
3) Each parasitic egg represents a solution in the search space.
4) The transaction of generating a new solution (Cuckoo one) from old solution is accomplished using Lévy flight.
5) Height quality solutions with good fineness values will be carried forward to the next generation.
6) There is a probability pa [0, 1] to discover the parasitic foreign egg by the host bird. 7) For a cuckoo i, the new parasitic cuckoo (solutions) Xi(t+1) generated by using Lévy flight using Equation #1 where α > 0 is the step size, and product ⊕ means entry-wise multiplication.
8) Lévy flight is a random step length in a random angle in which the random step length is generated from the Lévy distribution using equation #2.

B. Random-Key Encoding Scheme (RKES)
The RKES is a transformation technique which is used to represent a vector in a continuous search space in a combinatorial form. The conception of RKES is to generate a random weight value from [0, 1] to each item in the array vector, and then order it in an ascending order according to the weight values. Table II illustrates a sample RKES. In this research, we merged the steps, VMS and VMP into one to avoid any poor solution resulting from solving both separately. In the HOD & HUD steps, a prediction algorithm based on the Naive Bayesian Classifier is proposed to predict the future host state for minimizing the VMs migrations. In the VMS and VMP steps, we proposed an algorithm based on the RKCS to reduce the energy consumption and SLAV. Solution construction, host state prediction model, and the proposed VM selection as well as placement policy are discussed in the following sections.

A. Solution Construction
Assume that we have n VMs and m PMs; in the context of VM consolidation problem and RKCS, a single egg solution Si is represented by: the VMs random Keys (VMRKi), the PMs random keys (PMRKi) and the VM migrations mappings (VMMMi), which are constructed as shown in Tables III, IV and V, respectively. Each element in VMRKi will have a VM index (VMIi) and VM weight value (VMWi). Each item in PMRKi will have: PM Index (PMIi), PM Status weigh value (PMSWi) and PM weight value (PMWi). Finally, VMMMi represents the placement mappings; each value in the array represents a PM index to which will the VM will be placed. For instance, if the second element of array is 7, then the second VM will be migrated to PM of index 7.   [27], stated that live migration is not free, and that is why predicting the PM future state will play a significant role in minimizing the number of VM migrations, resulting in minimizing energy consumption and performance degradation due to the migration. In this research, a new algorithm called PM state predection using Naive Bayesian classifier (PMSDNBC) was introduced to detect the future host state. The Naive Bayesian classifier is an AI machine learning model used to classify different objects based on certain features. In the current research, the model is used to predict the PM future state according to the past CPU utilization history. For the classifier features, we constructed n+1 dimensional feature vector using the latest CPU utilization history CPUt, CPUt-1, CPUt-2, CPUt-3, CPUt-4.. CPUt-n+1 in the time t, t-1, t-2, t-3, t-4 … t-n+1 for the last n preceding points. Then, we got input vector F = [CPUt, CPUt-1, CPUt-2, CPUt-3, CPUt-4... , CPUt-n+1], and basically, as we need to detect the future state of PM, we used the PM states as the Bayes classifier labels. In most researches the PM status is classified into the following three states: (1) Over-Utilized, (2) Under-Utilized and (3) Switched Off. For the Over-Utilized PMs, some VMs must be migrated from them to other non Over-Utilized PMs in order not to elimnate the SLA. For the Under-Utilized PMs, all PMs must be migrated from them, if possible, in order to switch them to the sleep mode. In this reserach we found the below weak points in this classification:  PMs which will accept migrations from the Over-Utilized PMs and PMs from which all VMs must be migrated, if possible, are both treated as "Under-Utilized".
 In the previous classification, there is no state to describe the PMs which are not Over-Utilized and are not able to accept new migrations, as they are near to be Over-Utilized.
For this reason, in this research we classified the PM statuses into the below five classes:

1) Over-Utilized (OU):
PMs which are over utilized, so some VMs must be migrated from them in order not to violate SLA.
2) Nearly Over-Utilized (NOU): PMs which are near to be over-utilized. These types of PM will not accept any migrations nor migrate VMs from them.

3) Normal Utilized (NU):
PMs which fall between nearly over-utilized and underutilized thresholds. These types of PMs will accept new migrations but not VMS will be migrated from them.

4) Under-Utilized (UU):
PMs which are underutilized; all VMs hosted on these PMs should be migrated away to other suitable PMs if possible, then switch these UU PMs to the sleep mode.

5) Switched Off (SO): Switched off PMs.
Accordingly, classifier labels will be L = {OU, NOU, NU, UU, SO}. Static threshold values based on the experimental results have been used to identify: OU, NOU, NU, UU and SO thresholds; the values are illustrated in Table VI. Classifier dataset is constructed according to the below rules: 1) In case the CPU utilization value equals 0, the value of "SO" label will be set to 1 and the other labels will be set to minimum product effect value (MPEV).
2) In case the CPU utilization value is greater than the over-utilized threshold, the value of the "OU" label will be set to 1 and the other labels will be set to MPEV.
3) Otherwise, we will calculate the percentage of how far the current state from the upper and lower thresholds using equations #3 & #4 and the reset labels are set to MPEV.
Where UPT is the upper threshold value, LWT is the lower threshold value, VUTi is the value of state i for the upper label and VLTi is the value of state i for the lower label.
The value 0.00001 has been used as MPE, first, to avoid zero values generated from product operation and second, because it has lower effect in the product operation.
Finally, for each label l in L, the probability of P (x|l) is calculated using equation #5 and according to the Naive Bayesian Classifier, PM state will be classified as the state with the highest probability.

C. Virtual Machine Selection and Placement using Random Key Cuckoo Search (VMSPRKCS)
VMS & VMP is the process of selecting some VMs from over-utilized and under-utilized PMs and finding a new placement for them. In this research, an algorithm based on RKCS is proposed to handle the two steps VMS & VMP into one step to avoid producing a poor solution resulting from solving both steps separately. First, we detect the state of all PMs using the proposed algorithm PMSDNBC. Then, we added all VMs of over-utilized and under-utilized PMs into one dimensional vector VMs = [V1, V2, V3 … Vn]. For the over-utilized PMs, we will migrate some VMs from them in order to not to violate SLA; for the under-utilized PMs, all VMs will be migrated from them if possible in order to switch them to the sleep mode. Since RKCS is a population based algorithm, we will have n solutions S = [s1, s2, s3 … sn], and for each solution si, we will have VMRKi and PMRKi. The idea behind VMSPRKCS is consists of the below steps: 1) Detect the status of all PMs using PMSDNBC algorithm.
3) Assigning a weight value for each VM in SVMs, either generated randomly between [0-1] or by Lévy using equation #1 when generating a cuckoo egg from an old one. 4) Assigning a weight value and a status weight value for each PM. The PM weight value is either generated randomly between [0-1] or by Lévy using equation #1 from an old solution. The PM status weight value is generated according to Table VII. 5) Sorting VMs in SVMs array in an ascending order by the weight value 6) Sorting PMs in an ascending order by the status weight value then by the weight value. 7) Each VM will be allocated to the first PM fitting for it, which will not be overloaded after the migration. 8) In case the status of the old PM, from which the VM is migrated, changed from "Over-Utilized" to any new status, then the remaining VMs on the old PM added to an excluded list in order to skip their migration. 9) In case the status of the new PM, to which the VM is migrated, changed to any new status, then new PM status weight value is recalculated based on PMSDNBC algorithm and Table VII, then all PMs are reordered in an ascending order by their status weight value then by the weight value. Get a cuckoo randomly solution Si by L´evy flights 5.
Calculate Fi quality of Si 7.
Choose a nest among n (say, j) randomly 8.
Get pm weight status value using PMSDNBC and

A. Performance Metrics
The following metrics have been considered to evaluate the proposed algorithm: 1) Energy consumption: it refers to the total energy consumed by all PMs in the datacenter, where the PM energy consumption is calculated according to a real data power consumption model provided by the SPEC power benchmark. Table I illustrates the energy consumption of two different PMs, HP G4 and HP G5, at different CPU load levels.
2) Service Level Agreement Violation (SLAV): As proposed in [6], SLAV can be measured in IaaS for two main factors: (1) SLA violation time per active host (SLATAH) resulting from the CPU utilization is of 100% and (2) the SLA violations resulting from performance degradation due to migration (PDM). The SLAV factors can be calculated using equations #7.
Where m is the number of PMs, Tok is the total time in which the PM had an over-utilized status, resulting from the 100% CPU utilization and Tak is the total time of the PM for being in the active state.
Where n is the number of VMs, Cdk is the estimated performance degradation of the VM k due to migrations and Crk is the total requested CPU capacity by the VM j.
1) ESV: as the research target is to balance the trade-off between the SLA violation and energy consumption, it is important to consider this metric. It is simply calculated as the product of SLAV and energy consumption 2) Number of VM migrations: it refers to the total number of VM migrations occurred over all the datacenter.
3) Shutdown hosts: it refers to the total number of PMs switched to the switched off mode over all the datacenter.

B. Simulation Setup
To evaluate the proposed algorithm, we used the CloudSim 3.0.3 toolkit simulator. Cloudsim is a well-known common simulator that supports different policies for host overload detection, VM selection and VM placement. It also provides different types of workload as well as several cloud metrics calculation, such as: Energy Consumption, SLAV, number of VM migrations, PDMA, SLATAH and number of host shutdowns. Furthermore, we used real workload traces from a real system (PlanetLab data). PlanetLab is the monitoring part of the CoMon project. It monitored CPU utilizations for more than thousand VMs hosted at more than 500 PMs which were collected during March and April 2011. Each day in the traces has a file for each VM, containing 288 values which represent the VM CPU utilization value [0-100] every 5 minutes during the day. Traces characteristics are represented in Table VIII

C. Experimental Results
Traces with heterogeneous states for real cloud datacenter presented from PlanetLab illustrated in Table VIII have been used to evaluate the algorithm. A study presented by Beloglazov and Buyya [6], stated that lr_MMT 1.2 performs better than other dynamic VM consolidation algorithms, so we considered it as the benchmark and compared our proposed algorithm with it. The results are illustrated in Fig. 1, 2, 3 Finally, we ran the experiment for 10 times and calculated the median value, displaying it in terms of each performance metrics.

VII. CONCLUSION AND FUTURE WORK
In this paper, a hybrid algorithm based on the Naive Bayesian Classifier and the Random Key Cuckoo Search is introduced to balance the tradeoff between the energy consumption and SLA violation. In addition, we modified the most common strategy for handling the VM consolidation by merging VM selection and placement steps into one to avoid any poor solution that may arise due to solving each of the two steps alone. We used Naive Bayesian Classifier to detect the future PM state in order to minimize the VMs migration, resulting in reducing energy, SLAV as well as performance degradation due to migration. We used Random Key Cuckoo Search to handle the VM selection and placement steps. In addition, CloudSim has been used with real traces provided from PlanetLab to evaluate the proposed algorithm compared with the benchmark algorithm lr_MMT 1.2 and the results have shown that the proposed algorithm can reduce the energy consumption by 24.23%, SLAV by 95.35%, ESV by 96.5%, the number of VM migrations by 89.3%, PDM by 86.3%, SLATAH by 71.07% and the number of host shutdowns by 84.38%. In this research, the objective function was considered based data center energy consumption only; in the future we are interested in calculating the objective function according to multiple objective metrics and comparing it with other meta-heuristic algorithms as well as more real datasets.