Monday, July 23, 2018

Calculating Utilization

Yes, I'm still not done with PhD after 6 long years... I guess this year most would be at the stage of submitting thesis and would've had their research work published in some reputed journal, but here I am, still tryin' to unravel the mysteries of CloudSim... :( :(

Anyways,  I wanted to sense the utilization of CPU in MIPS or percentage at a regular interval... I need to do this to decide when the tasks can be burst to the public cloud.

Fairly straightforward, or so I thought...
I found this function attached with VM: getTotalUtilizationofCpu(double time)
VM: getTotalUtilizationOfCpuMips(double time)

I thought if I got this, then I can add up all the utilization in each VM  to calculate overall utilization in a set of VM,

I had initially set my VM's to be timeshared and cloudlets to be spaceshared.

But irrespective of whether my VM is timeshared or spaceshared, the utilization either returns 0 (I'm assuming 0%) or 1 (100%).
I can't possibly work with that !!!!!

The following is the functionality of these two functions... well, that is exactly what I want but...
  • getTotalUtilizationOfCpu

    public double getTotalUtilizationOfCpu(double time)
    Get utilization created by all clouddlets running on this VM.
    Parameters:
    time - the time
    Returns:
    total utilization
  • getTotalUtilizationOfCpuMips

    public double getTotalUtilizationOfCpuMips(double time)
    Get utilization created by all cloudlets running on this VM in MIPS.
    Parameters:
    time - the time
    Returns:
    total utilization
 the output I get at any interval is...


utilization on 30 :666075.0
utilization on 31 :0.0

utilization on 31 :0.0
Processing cloudletid2464

utilization on 0 :1.0

utilization on 0 :82000.0
utilization on 1 :0.0


_________________________________________________________________________________

I'm trying to reason here but it seems to me if a cloudlet is assigned a VM, then it's utilization is 100% but shouldn't that change if my cloudlet is space shared?
This does not make any sense...


It says I have to use PowerHostUtilizationHistory... wait what????

'n it gets worse...
I found this example in vm migration... (Now since my work does not deal with migration of VM's or cloudlets or energy conservation, I've overlooked that entire part of cloudsim)

 
/**
* The percentage of CPU that a cloudlet will use when
* it starts executing (in scale from 0 to 1, where 1 is 100%).
* For each cloudlet create, this value is used
* as a base to define CPU usage.
* @see #createAndSubmitCloudlets(DatacenterBroker)
*/
private static final double CLOUDLET_INITIAL_CPU_PERCENTAGE = 0.8;
/**
* Defines the speed (in percentage) that CPU usage of a cloudlet
* will increase during the simulation execution.
* (in scale from 0 to 1, where 1 is 100%).
* @see #createCpuUtilizationModel(double, double)
*/
Okay, does tat say that I have to define the CPU usage for each cloudet?? So like my entire code... whatever I've done so far is wrong?? I guess not, 'cos I did not see any such thing in the cloudsim examples that came with the package...

Not lemme find createAndSubmitCloudlets(..)

UtilizationModelDynamic um = createCpuUtilizationModel(CLOUDLET_INITIAL_CPU_PERCENTAGE, 1);
for(Vm vm: vmList){
cloudlet = createCloudlet(vm, broker, um);
list.add(cloudlet);
}
//Changes the CPU usage of the last cloudlet to start at a lower value and increase dynamically up to 100%
cloudlet.setUtilizationModelCpu(createCpuUtilizationModel(0.2, 1));
broker.submitCloudletList(list);
I wonder what utilization Model I'm using...
UtilizationModelFull
 simple model, according to which a Cloudlet always utilize all the available CPU capacity.

Okay, starting to make sense... and the other utilization models available are:
Found this UtilizationModelStochastic
implements a model, according to which a Cloudlet generates random CPU utilization every time frame.


Again, shouldn't CPU utilization of cloudlet be based on the cloudlet length??? I'm not able to grasp these concepts...
Playing along, I'll just change is to Stochastic and find out what kinda output I get.

Ah, interesting, now I get this output:

utilization on 2 :0.9273814162364167

utilization on 2 :24111.916822146835
utilization on 3 :0.0

utilization on 3 :0.0

_________________________________________________________________________

So, let's assume I do write code to tweak the utilization w.r.t. the cloudlet length, does that mean the utilization will increase if two cloudlets are executing in a timeshared basis... it should right??/

Before I get to that, I need to know if the getUtilizationHistory() of the powerHost works... now I've no idea how to call that in the context of my code...

let me just instantiate powerhost and power VM, see if that does the trick in accessing getUtilization History.

kay so I had to change host to PowerHost, there are some power models available, no idea which one to choose so I randomly chose, PowerModelSpecPowerIbmX3550XeonX5675

Next had to change VM to PowerVM, the constructor changes a lot...
looked up some examples on what to set for priority... most examples give 1, so I'm gonna go with that...
.
.
.
A scheduling interval also needs to be set... At this point, I feel, I'm doing something without understanding anything, but no other go...
I tried to get utilizationHistory of vm, but unfortunately that is a protected method.  I can only get Utilization history of host with the powerhostUtilizationHistory...
so I guess creating a power host isn't enough?? I need to create a PowerHostUtilizationHistory??


STOP

I found another code that dosn't completely change the Host and VM to power everything...


will revert to that!

It uses VmSimple, HostSimple...
Okay but this class is in CloudSim Plus... 'n in my installation since it's from ages ago, dosn't work!!

Should I install cloudsim plus now???
I guess... It would make life easier!

But then again... how much of my existing code would I have to rewirte??? :( :(


No comments:

Post a Comment