About implenting dynamic cloudlet arrival and mapping to VMs with defaultVmMapper()

53 views
Skip to first unread message

Chigozie Asikaburu

unread,
Jan 17, 2021, 11:31:01 PMJan 17
to CloudSim Plus: Cloud Computing Simulation Framework
I implemented a policy that dynamically maps cloudlets to VMs by overriding defaultVmMapper() and using a clock tick listener to send cloudlets at a specific time.

I'm working on a scenario where all VMs and hosts have the same specs where they can execute 1000 MIPS per second. I'm also only using space shared policies as well for both the VM Scheduler and Cloudlet Scheduler.

I realized while printing how many mips the cloudlet has remaining to execute in a VM that the information isn't perfectly up to date. For example it may say that a cloudlet has been executing less MIPS than I expect. Like if one second has passed it sometimes says a cloudlet executed 0 MIPS instead of exactly 1000 MIPS. The simulation always makes up for this as sometimes in .5 seconds a cloudlet will execute 1000 MIPS and then another 1000 mips in the other half second.

I have a feeling this behavior is normal. I asked a question relating to the clock tick listener and you mentioned that CloudSim Plus doesn't guarantee the event will be fired exactly at the times you want. Does this also apply to all events in CloudSim Plus? So including ones that execute cloudlets. 

Chigozie Asikaburu

unread,
Jan 17, 2021, 11:48:21 PMJan 17
to CloudSim Plus: Cloud Computing Simulation Framework
This was the Stack post about the clock tick listener I was referring to: https://stackoverflow.com/questions/60688449/how-to-set-non-relative-submission-delay-for-cloudlets-in-cloudsim-plus/60757037#60757037

I also wanted to clarify how I'm printing out how many cloudlets mips are left to execute in a VM. I'm calling these methods I made below in the defaultVmMapper() method in a custom DatacenterBroker class I made. I print out this information in the defaultVmMapper(). I noticed inconsistencies since I expect the total number of cloudlet MIPS in a VM to go down by 1000 MIPS/second. I do know that the simulation is executing everything correctly in the end because of the table that is created in the output when running. Although I feel that this may be an issue with CloudSim Plus not guaranteeing things to happen exactly as I expect so when I print things on the fly (while cloudlets are executing) I won't get the expected results.

public static long getTotalCloudletMips(Vm vm) {
return getTotalWaitingCloudletMips(vm) + getTotalExecutingCloudletMips(vm);
}

public static long getTotalWaitingCloudletMips(Vm vm) {
long totalWaitingCloudletMips = 0;
List<CloudletExecution> cloudletWaitList = vm.getCloudletScheduler().getCloudletWaitingList(); // gets all cloudlets which are executing in a vm

// get the remaining mips of currently waiting cloudlets
for (int i = 0; i < cloudletWaitList.size(); i++) {
// the remaining length of all waiting cloudlets will be the same as the cloudlet length before execution (cloudlet.getLength())
totalWaitingCloudletMips = totalWaitingCloudletMips + cloudletWaitList.get(i).getRemainingCloudletLength();
}

return totalWaitingCloudletMips;
}

public static long getTotalExecutingCloudletMips(Vm vm) {
long totalExecutingCloudletMips = 0;
List<CloudletExecution> cloudletExecList = vm.getCloudletScheduler().getCloudletExecList(); // gets all cloudlets which are executing in a vm

// get the remaining mips of currently executing cloudlets
for (int i = 0; i < cloudletExecList.size(); i++) {
totalExecutingCloudletMips = totalExecutingCloudletMips + cloudletExecList.get(i).getRemainingCloudletLength();
}

return totalExecutingCloudletMips;
}

Chigozie Asikaburu

unread,
Jan 20, 2021, 1:28:25 PMJan 20
to CloudSim Plus: Cloud Computing Simulation Framework
So it turns out I was wrong and the issue had to do with cloudlet processing not being updated as frequently as I'd like. I discovered the updateProcessing() method in CloudletScheduler.java. Using this method I passed in the current simulation time each time along with MIPS share (represents how the current mips capacity from the VM will be made available to the scheduler. The mips share is allocated to Cloudlets as requested). The updated methods are below. Note that the simulationTime variable was a field in the class containing these methods so it wasn't passed into my methods below.

This solved my issue and now every second the cloudlet processing updates exactly as I expect. 1000 MIPS gets executed every second in all VMs (as long as they're is 1000 MIPS to execute in a VM) in all of my datacenters. I add the result of the two methods below to get the total cloudlet mips in a VM. I do it this way instead of doing vm.getCloudletScheduler.getCloudletList() which returns a list of waiting and running cloudlets. Using getCloudletList() returns Cloudlet objects instead of CloudletExecution objects. I preferred the CloudletExecution objects since they have the getRemainingCloudletLength() method saving me from calling multiple methods in Cloudlet.java to achieve the same result.


public static long getTotalWaitingCloudletMips(Vm vm) {

long totalWaitingCloudletMips = 0;
List<Double> mipsShare = new ArrayList<>();
mipsShare.add(1000.0);
CloudletScheduler scheduler = vm.getCloudletScheduler();
scheduler.updateProcessing(currentSimulationTime, mipsShare); // updates cloudlet processing to allow for an effective dynamic mapping of cloudlets to vms
List<CloudletExecution> cloudletWaitList = scheduler.getCloudletWaitingList(); // gets all cloudlets which are waiting in a vm

// get the remaining mips of currently waiting cloudlets
for (int i = 0; i < cloudletWaitList.size(); i++) {
// the remaining length of all waiting cloudlets will be the same as the cloudlet length before execution (cloudlet.getLength())
totalWaitingCloudletMips += cloudletWaitList.get(i).getRemainingCloudletLength();
}

return totalWaitingCloudletMips;
}

public static long getTotalExecutingCloudletMips(Vm vm) {

long totalExecutingCloudletMips = 0;
List<Double> mipsShare = new ArrayList<>();
mipsShare.add(1000.0);
CloudletScheduler scheduler = vm.getCloudletScheduler();
scheduler.updateProcessing(currentSimulationTime, mipsShare); // updates cloudlet processing to allow for an effective dynamic mapping of cloudlets to vms
List<CloudletExecution> cloudletExecList = scheduler.getCloudletExecList(); // gets all cloudlets which are executing in a vm

// get the remaining mips of currently executing cloudlets
for (int i = 0; i < cloudletExecList.size(); i++) {
totalExecutingCloudletMips += cloudletExecList.get(i).getRemainingCloudletLength();
}

return totalExecutingCloudletMips;
}

Prof. Manoel Campos

unread,
Jan 27, 2021, 1:23:35 PMJan 27
to clouds...@googlegroups.com
Hello,
It's not clear what and where exactly you performed the changes,
so that I can check the issue.

Manoel Campos da Silva Filho Software Engineer

Computer Science and Engineering Ph.D. Student at University of Beira Interior (Portugal)

Professor at Federal Institute of Education, Science and Technology of Tocantins (Brazil)

http://manoelcampos.com


 about.me


--
If you received an answer that worked for you, please be kind and reply to let everybody knows it worked.
http://cloudsimplus.org
---
You received this message because you are subscribed to the Google Groups "CloudSim Plus: Cloud Computing Simulation Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloudsim-plu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloudsim-plus/50a89715-f66d-4b5c-b9b4-beef2f10387bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages