Tuesday, June 17, 2014

Simulation of Provisioning algorithm

Algorithm for provisioning in cloudsim

(Understanding code to modify the broker policies)

First, i thought I'll see what are the models that cloudsim uses by default and the meaning of those modules.

The cloudlet is set to utilizationModelFull
The UtilizationModelFull class is a simple model, according to which a Cloudlet always utilize all the available CPU capacity.
Other models available are:

UtilizationModelNull
The UtilizationModelNull class is a simple model, according to which a Cloudlet always require zero capacity.

UtilizationModelStochastic
The UtilizationModelStochastic class implements a model, according to which a Cloudlet generates random CPU utilization every time frame.

Vm

It takes id, user id, mips, no. of pe's, ram, b/w, size, name and cloudlet sheduler.
eg.,  Vm vm = new Vm(0, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
  • CloudletScheduler is an abstract class that represents the policy of scheduling performed by a virtual machine. 
    • space shared, time shared and n/w cloudlet space shared. 

Host 

RamProvisionerSimple is an extension of RamProvisioner which uses a best-effort policy to allocate memory to a VM.
BwProvisionerSimple is a class that implements a simple best effort allocation policy: if there is bw available to request, it allocates; otherwise, it fails.
VmSchedulerSpaceShared is a VMM allocation policy that allocates one or more Pe to a VM, and doesn't allow sharing of PEs. If there is no free PEs to the VM, allocation fails. Free PEs are not allocated to VMs

Other VMM allocation policies available
VmSchedulerTimeShared is a VMM allocation policy that allocates one or more Pe to a VM, and allows sharing of PEs by multiple VMs. This class also implements 10% performance degradation due to VM migration. This scheduler does not support over-subscription.

Datacenter

We used VmAllocationPolicySimple(hostList) in the data center characteristics, this means that it  chooses, as the host for a VM, the host with less PEs in use.

Changing the broker policies

 to submit cloudlets and vm's according to user given policies.
Modified cloudlet by adding start time.

Got some code courtesy of Mario Henrique to change the broker policies, don't know how it works.
submitCloudlets() method is modified.
if cloudlet is not assigned a VM, a VM ID is obtained from the VM's created list
 if (cloudlet.getVmId() == -1) { //if user didn't bind this cloudlet and it has not been executed yet
                vm = getVmsCreatedList().get(vmIndex)
;
(understood this part...)
Now there is something called the SimEntity which represents a simulation entity. An entity handles events and can send events to other entities.
Direct subclasses are Datacenter, DatacenterBroker, so these classes directly inherit the SimEntity and thus invoke the methods in SimEntity.
Some methods are
  •  getName(): gets the name of the entity.
  • getNumEventsWaiting() : Count how many events are waiting in the entity's deferred queue.
  • pause(): 
  • schedule(String dest, double delay, int tag, Object data )
  • send(int entityId, double delay, int cloudSimTag, Object data) - Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.
    • entityName - the name of the destination entity
      delay - how long from the current simulation time the event should be sent. If delay is a negative number, then it will be changed to 0
      cloudSimTag - an user-defined number representing the type of an event/message
      data - A reference to data to be sent with the event
       
Another class of interest is the Vm classs, some methods are
  • VmList : 
  • VmcreatedList: 
In our program we are creating all VM's at once so VmList and VmcreatedList are the same.
  • getVmList - method is available for DatacenterBroker, Host and Datacenter.
Then under the DatacenterBroker class certain methods are available such as:
  • setCloudletList(List<T> Cloudlet);
  • setCloudletSubmittedList(Lis<T> Cloudlet);
  • setcloudletReceivedList(List<T> Cloudlet)
So in this piece of code
send(getVmsToDatacentersMap().get(vm.getId()),myCloudlet.getStartTime() CloudSimTags.CLOUDLET_SUBMIT, myCloudlet);
  • Entity name : refers to the datacenterid that the given vm is present in, in our work only one datacenter is there so it is always 2
  • Delay : we will give the start time because the delay refers to the time from beginning when the cloudlet is supposed to start
  • CloudSimTag is set to CLOUDLET_SUBMIT which is 21.
  • Then the Object that is sent to the particular datacenter is the cloudlet.
Output:
Sent-  Entity Name: 2  Delay: 35.0  CloudSimTag: 21
2 : org.cloudbus.cloudsim.Vm@1c1c92b            


Then this particular piece of code
vmIndex = (vmIndex + 1) % getVmsCreatedList().size();
assigns by incrementing vmIndex within 0 to 10 because we have 10 VMs created.

Work done so far:

Simulation works for 10,000 cloudlets.
(There are 1 lakh cloudlets in the LCG workload for which my simulation does not execute.)
have understood basics of modifying code to cloudlet and datacenterbroker.

Work to be done:

figure out how to measure performance,
how to categorize the workload by analyzing it.

No comments:

Post a Comment