CloudSim: How to run Simulation in predefined cloudsim architecture?

56 views
Skip to first unread message

shucks

unread,
Jun 21, 2020, 3:26:33 AM6/21/20
to CloudSim Plus
I would like to run a simulation with a predefined structure. I have 7 datacenters each containing 4 hosts. Each host contains 1 VM. Each Cloudlet has to run on a specific VM and therefore also in a specific datacenter.
Short version of my code so far:
------------------------------------------------------------------------------------------
create simulation: final CloudSim simulation = new CloudSim();
create one single broker: final DatacenterBroker broker = new DatacenterBrokerSimple(simulation);
Done multiple times for the 7 datacenters:
- create hosts: Host host = new HostSimple(...);
- create 1 Vm for 1 host: Vm vm = new VmSimple(....);
- add vm to host: host.createVm(vm);
- add vm to vmList (one list for all vms over all datacenters)
- add host to hostList
- create datacenter: Datacenter dc = new DatacenterSimple(simulation, hostList);
Done for each Cloudlet:
- create Cloudlet: Cloudlet cl = new CloudletSimple(...);
- set starttime of cloudlet: cl.setExecStartTime(starttime);
- add cloudlet to cloudletList
Connect cloudlets with vms:
- broker.submitVmList(vmList); - broker.submitCloudletList(cloudletList); - bind each cloudlet to its vm: broker.bindCloudletToVm(vm, cloudlet); ------------------------------------------------------------------------------------------
Problems:
When simulation is started the broker tries to create all vms in the same datacenter. As I already passed vms to hosts and hosts to a datacenter, shouldn't the vms already be allocated to the correct datacenter?
INFO DatacenterBrokerSimple1 is starting...
INFO DatacenterSimple2 is starting...
INFO DatacenterSimple3 is starting...
INFO DatacenterSimple4 is starting...
INFO DatacenterSimple5 is starting...
INFO DatacenterSimple6 is starting...
INFO DatacenterSimple7 is starting...
INFO DatacenterSimple8 is starting...
INFO Entities started.
INFO 0.00: DatacenterBrokerSimple1: List of 7 datacenters(s) received.
INFO 0.00: DatacenterBrokerSimple1: Trying to create Vm 0 in DatacenterSimple2
INFO 0.00: DatacenterBrokerSimple1: Trying to create Vm 1 in DatacenterSimple2
INFO 0.00: DatacenterBrokerSimple1: Trying to create Vm 2 in DatacenterSimple2
INFO 0.00: DatacenterBrokerSimple1: Trying to create Vm 3 in DatacenterSimple2
INFO 0.00: DatacenterBrokerSimple1: Trying to create Vm 4 in DatacenterSimple2
INFO 0.00: DatacenterBrokerSimple1: Trying to create Vm 5 in DatacenterSimple2
....
INFO 0.00: DatacenterBrokerSimple1: Trying to create Vm 21 in DatacenterSimple2
....
INFO 0.00: DatacenterBrokerSimple1: Trying to create Vm 26 in DatacenterSimple2
------------------------------------------------------------------------------------------
Cloudlets seem to be sent to correct VM, but Host 1/DC 6 is located in wrong Datacenter (DC 2 instead of DC 6) -> see info above
INFO 0.10: DatacenterBrokerSimple1: Sending Cloudlet 111 to Vm 21 in Host 1/DC 6.
------------------------------------------------------------------------------------------
DatacenterSimple uses VmAllocationPolicySimple as default allocation policy. Could this cause the problem of allocating all vms to the same datacenter? And how could one implement an allocation policy that does the correct allocation?

Manoel Campos

unread,
Jun 23, 2020, 5:39:28 PM6/23/20
to clouds...@googlegroups.com
 
When simulation is started the broker tries to create all vms in the same datacenter. As I already passed vms to hosts and hosts to a datacenter, shouldn't the vms already be allocated to the correct datacenter?
 
- add vm to host: host.createVm(vm);

It doesn't work this way. The host.createVm method (and some other ones) is just available due to some design issues.
If you check the available examples, that method is not called anywhere inside the user simulation code.
The DatacenterBroker is accountable to select the datacenter where to place VMs. You can even implement your own datacenter selection policy by calling broker.setDatacenterMapper() or even creating a subclass of DatacenterBroker that overrides the defaultDatacenterMapper method. The default implementation will select the first datacenter for every submitted VM. It only tries the next DC if the allocation of some VM fails. If you call broker.setSelectClosestDatacenter(true), it will use different policy that selects the closest DC for each VM, considering the DC and VM timezone.
 
------------------------------------------------------------------------------------------
Cloudlets seem to be sent to correct VM, but Host 1/DC 6 is located in wrong Datacenter (DC 2 instead of DC 6) -> see info above
Hosts belong to the datacenter you submit them. If your Host 1 is included into a list that is passed when creating DC 6, then it will belong to DC 6. You just have to make sure you don't share Hosts in lists for different datacenters. Each Host must belong to a single list.
 
DatacenterSimple uses VmAllocationPolicySimple as default allocation policy. Could this cause the problem of allocating all vms to the same datacenter? And how could one implement an allocation policy that does the correct allocation?
Each VmAllocationPolicy instance must be assigned to a single datacenter. If you try to reuse the policy, an exception is thrown. The policy just selects which PM will host each VM for that datacenter. The broker is the one accountable to select the datacenter.
So, the allocation policy has nothing to do with the datacenter selection.

I hope it helps.

Reply all
Reply to author
Forward
0 new messages