Efficient Virtual Machine migration is the primary task that a researcher considers while framing her research problem. And one of the most haunting tasks is to simulate the proposed algorithm using a cloudsim simulation toolkit.
This article will broadly discuss the basics of virtual machine migration, initial virtual machine allocation to hosts, and then how this initial virtual machine allocation is optimized using specific migration strategies. Throughout the article, I have referred to a couple of important methods(functions) that you should check side by side for better understanding. Now if you have not installed/setup the cloudsim on your computer then you should first follow this step by step guide.
Sequence to allocate a Virtual machine to the simulated host in cloudsim
At the start of the cloudsim simulation scenario, first, the configuration details of the Virtual Machine(VM) and cloudlets are defined and submitted to the DatacenterBroker instance. Now, once the Datacentre instance is up and running in the simulation, the DatacenterBroker instance requests the Datacentre instance to create a virtual machine and allocate it to the desired host. For this, the DatacenterBroker initiates the event using
from the method “createVMInDatacentre()” , where DatacentreID passed as a parameter.
Now, once the Datacentre is processing, its assigned events and reaches the event call assigned by the DatacentreBroker. Then, it allocates the virtual machines through the “processVMCreate()” method, which intern recognizes the attached Virtual Machine allocation policy and utilizes the “allocateHostForVM()” method and sends an acknowledgment to the DatacentreBroker.
Now, let us consider two different scenarios
- If there is a need to map a particular virtual machine to a specific Datacenter, then the method createVMInDatacentre() (defined inside DatacentreBroker) logic is required to be changed as per the need of the scenario. For example, the situation related to the federated Datacentre or failsafe region-based replication. OR
- If there is a requirement for managing the adequate host resource utilization corresponding to the virtual machine to host mapping, then “allocateHostForVM()” method from Datacenter class is required to implement the necessary logic. For this already, a scenario is included in “org.cloudbus.cloudsim.power” packages like “PowerVMAllocationPolicyAbstract” and “VMAllocationPolicysimple“.
Sequence to initiate the VM Migration in cloudsim simulation
Datacentres are responsible for the execution of the workloads, and in cloudsim simulation, the cloudlet is considered as workload; therefore, primarily cloudlet processing performed at every cycle of entity(Datacenter, DatacenterBroker, etc.)event processing which in turn update the VM processing metrics through the host.
The Datacentre instance utilizes the “updateCloudedProcessing()” method for the progress of the simulation run cycle.
Now, because this cloudlet processing cycle is the primary driving force for simulation; therefore, the power-aware package implements the VM utilization checks between these events only.
There is a method named as “optimizeAllocation()” whose implementation is in PowerVMAllocationPolicyMigrationAbstract.Java. This method accepts the list of active VMs and performs the following steps in sequence:
- Get the list of all the over-utilized hosts as per the threshold (w.r.t.) The VM allocation policy used.
- The list of all over-utilized hosts, along with its utilization metrics, are printed on the console.
- Identify the list of virtual machines to be migrated from the over-utilized host, but before doing this, the system takes a backup of the current VM to host mappings.
- A VM placement/allocation mapping to a new suitable host identified and kept in a temporary migration map. During this phase, the search space for a suitable host excludes already identified, overloaded hosts.
- Now the hosts, which are underutilized(utilization below 1%), are also identified to move their virtual machines. It is done to reduce power consumption by idle server machines. Now to reduce the search space overutilized, switched off(previously underutilized) and hosts identified in step 4 are excluded, and the list of VMs from these hosts also marked for migration
- And, finally, the final migration map is prepared, and the current allocation is restored to continue the simulation.
Now Once the migration map is final and is available to Datacentre, then the “updateCloudletProcessing()” method call gets to utilize the migration map. And, for each new VM to host mapping from migration map is scheduled as a new event for the current Datacentre instance with event tag as
This event will also consider an added network delay calculated based on the available network bandwidth, and further cloudlet processing event gets rescheduled.
This event is then further processed in the next simulation cycle of the cloudsim simulation engine through the “processVMMigrate()” method available in Datacentre.Java class.
In this following steps are followed:
- Location of VM from the current host.
- Allocation of VM to the identified suitable host performed, and if acknowledgment is requested, then an acknowledgment is scheduled. Otherwise, confirmation of migration gets printed on the console.
So, overall in every cycle of the simulation run, the Cloudsim simulator performs intense calculations to determine the right migration map to optimize the overall allocation of virtual machines to hosts.
Now, to implement your appropriate Virtual Machine allocation and selection policy, you may consider the study of the proper VM allocation and selection policies available in “org.cloudbus.cloudsim.power” package.
Now, In case you are looking for a comprehensive cloudsim tutorial, you should subscribe to “Learn Basics of Cloudsim.”