Power-Aware Simulation Scenario in Cloudsim

Support of Power-aware Simulation scenario in cloudsim is one of the major breakthroughs and it has been widely utilized by the research community to publish their optimized results related to their proposed algorithms referring to VM migrations, SLA’s, resource allocation, reducing power consumption, etc. The general questions that are being worked upon are:

How to optimize resource allocation?

How to perform VM migrations?

How to reduce host power consumption?

How to reduce SLA violations?

As a stimulating environment, the cloudsim provides various API which allows you to work around generating a simulating model for answering the questions mentioned above. To effectively utilize the power-aware feature of cloudsim, you should be aware of the API packages that are available at your dispose of and for what purpose you would be able to use it. Following are the three core packages within cloudsim that facilitate the simulation of power-aware scenarios:

  • org.cloudbus.cloudsim.power.models
  • org.cloudbus.cloudsim.power.lists
  • org.cloudbus.cloudsim.power

Let us go through each of these packages one by one, but in case you have bumped in this article directly from search and no clue about the basic structure of cloudsim then you should first read CloudSim Simulation Toolkit: An Introduction and Beginners Guide to Cloudsim Project Structure 

org.cloudbus.cloudsim.power.models

Now the first thing to understand is that we are trying to simulate the real servers to calculate their power consumption.

Generic Power Model Class Hierarchy for power-aware simulation scenario
Generic Power Model Class Hierarchy

There are four generic power models were implemented as class names: PowerModelLinear.java, PowerModelCubic.java, PowerModelSquare.java, and PowerModelSqrt.java. Inherently, all these power models implement the PowerModel.java interface.

Also, the package org.cloudbus.cloudsim.power.models allow you to utilize the existing power model like “PowerModelSpecPowerIbmX3550XeonX5675.java” which models the server machine IBM X3550 with 2 XeonX5675 processors(6 cores each) along with the memory capacity of 16GB. Overall there are six server-based power models were implemented by the cloudsim developer’s team.

Server Power Model Class Hierarchy for power-aware simulation scenario
Server Power Model Class Hierarchy

Following is the code of model mentioned above:

package org.cloudbus.cloudsim.power.models;

public class PowerModelSpecPowerIbmX3550XeonX5675 extends PowerModelSpecPower {

      private final double[] power = { 58.4, 98, 109, 118, 128, 140, 
                                       153, 170, 189, 205, 222 };

      @Override
      protected double getPowerData(int index) {
             return power[index];
      }
}

The SPEC Benchmark is the base for generating these server-based power models. And, On a similar note, you may extend your own server specification power models in cloudsim just by extending the PowerModelSpecPower.java class, which also inherits the PowerModel.java. This is an abstract class containing two methods named getPower() and abstract method getPowerData(). As you can see in the above code the abstract method getPowerData() is been implemented in the simplest way and returns a predefined power against the specified utilization factor.

Now the point is how these models are being utilized while simulation. for this, you should be exploring the “org.cloudbus.cloudsim.examples.power” package and within this check “Constant.java” class. In this, a PowerModel array is declared at line number 60 as follows:

public final static PowerModel[] HOST_POWER = {
		new PowerModelSpecPowerHpProLiantMl110G4Xeon3040(),
		new PowerModelSpecPowerHpProLiantMl110G5Xeon3075()
	};

then the same has been called on logic to choose a random power model in “Helper.java” through createHostList() method at line number 108, while adding a new host to hostlist as follows:

public static List<PowerHost> createHostList(int hostsNumber) {

List<PowerHost> hostList = new ArrayList<PowerHost>();
for (int i = 0; i < hostsNumber; i++) 
{
        //logic to choose the random power model
	int hostType = i % Constants.HOST_TYPES;

	List<Pe> peList = new ArrayList<Pe>();
	for (int j = 0; j < Constants.HOST_PES[hostType]; j++) 
        {
	       peList.add(new Pe(j, new 
               PeProvisionerSimple(Constants.HOST_MIPS[hostType])));
	}
	hostList.add(
           new PowerHostUtilizationHistory(i,
	     new RamProvisionerSimple(Constants.HOST_RAM[hostType]),
	     new BwProvisionerSimple(Constants.HOST_BW),
             Constants.HOST_STORAGE,
             peList,
             new VmSchedulerTimeSharedOverSubscription(peList),

             //Exact place where the power model is specified
             Constants.HOST_POWER[hostType])
         );
}
return hostList;
}

So in case you have worked upon your own custom power model, you should be working around these sets of codes to make it work with your simulation scenario.

org.cloudbus.cloudsim.power.lists

This package contains only one class definition i.e. PowerVmList.java which inherently extends the vmList. As mentioned in cloudsim documentation this class contains the specific operations related to virtual machines and there is only one method defined to perform sorting of VM on the basis of its CPU utilization.

This class is been instantiated from createVmList() method of Helper.java during a power-aware simulation run.

This package can be utilized to addon more lists or adding more relevant operations related to the virtual machines that might be required during the migration process.

org.cloudbus.cloudsim.power

This package contains the core set of power-aware extended models of DataCenter, DataCenter Broker, Host, Vm(virtual machine). Along with this, a new set of classes related to Vm Allocation policy as well as Vm Selection policy were included here. These sets of classes facilitate the power-aware simulation scenario in cloudsim that are related to optimized Vm allocation or migrations.

The PowerDatacenter extends the basic Datacenter class and implements the additional methods that support the virtual machine migration process along with the cloudlet processing.

Class Hierarchy of PowerDatacenter for power-aware simulation scenario
Class Hierarchy of PowerDatacenter

Similarly, the PowerDatacenterBroker extends the basic DatacenterBroker. This new extended class overrides only the processVmCreate() method which is responsible for identifying whether or not the VM create is processed.

Class Hierarchy of PowerDatacenterBroker
Class Hierarchy of PowerDatacenterBroker

The PowerHost extends the HostDynamicWorkload which further extends the classic Host class. It does a really great addition to the overall power-aware simulation and contains the implementation of methods related to power calculation on the basis of the simulated server power model. Apart from this PowerHost class is further extended by PowerHostUtilizationHistory which implements various methods to track and process the host CPU utilization history. This history is further utilized by the allocation and selection policies during VM migration.

Class hierarchy of PowerHost for power-aware simulation scenario
Class Hierarchy of PowerHost

The PowerVm class extends the classic Vm class and one of the major method overrides is of updateVmProcessing() this updates the processing cloudlet by Vm during the simulation run. Apart from this, it contains the implementation for maintaining the utilization history, utilization mean, median, and standard deviation, etc.

Class hierarchy of PowerVm for power-aware simulation scenario
Class Hierarchy of PowerVm

The power-aware package contains the implementation of VM Allocation and Selection policies as classes. This set of classes contains the logic to perform the optimized VM migrations among running hosts on the fly during any simulation scenario. During the realtime VM migration first the hosts are identified(Overutilized/Underutilized) from which the VM to be selected for migration and are kept is a migration list. This is based on the Vm selection policy, few policies are predefined in cloudsim and the class hierarchy for VM selection policies are as follows:

Class hierarchy of Vm Selection Policies  for power-aware simulation scenario
Class Hierarchy of Vm Selection Policies

In case you want to implement your own selection algorithm for VM migration, you are required to extend the PowerVmSelectionPolicy class and should study all the classes mentioned above for better understanding.

Now as the list of identified VMs is ready the next step if to find the suitable host to migrate the selected VM. This is done by the appropriate VM Allocation Policies, just like selection policies there are few VM allocation policies are predefined in cloudsim and the class hierarchy for VM allocation policies are as follows:

Class hierarchy of Vm Allocation Policies for power-aware simulation scenario
Class Hierarchy of Vm Allocation Policies

In case you want to implement your own allocation algorithm for VM migration, you are required to extend the PowerVmAllocationPolicyMigrationAbstract class and should study all the classes mentioned above for better understanding.

The basic utilization of this package is done through the example of a power-aware simulation scenario available in org.cloudbus.cloudsim.examples.power.planetlab as well as org.cloudbus.cloudsim.examples.power.random. These examples have implemented a variety of combinations of VM allocation and selection policies. This helps in recognizing various scenarios in which the overall system optimization related to the VM migration process can be analyzed.

org.cloudbus.cloudsim.examples.power.planetlab VS org.cloudbus.cloudsim.examples.power.random

The basic difference between the org.cloudbus.cloudsim.examples.power.planetlab and org.cloudbus.cloudsim.examples.power.random package is that the org.cloudbus.cloudsim.examples.power.planetlab utilizes a PlanetLab’s VM utilization benchmark data for recognization of the power-aware simulation scenario behavior whereas org.cloudbus.cloudsim.examples.power.random generates its own workload.

Learn More

You may subscribe to an online self-paced course named Learn Basics of Cloudsim, The content for this course which will be updated weekly till August 2021. Click here to get the applicable discount coupon codes.

Leave a Reply

Your email address will not be published. Required fields are marked *