Commit d202dbca authored by Rafael Vieira Falcão's avatar Rafael Vieira Falcão
Browse files

Finishing simulation configuration

parent d10dd7a0
......@@ -17,6 +17,7 @@ import org.cloudbus.cloudsim.hosts.Host;
import org.cloudbus.cloudsim.hosts.HostSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.ResourceProvisioner;
import org.cloudbus.cloudsim.provisioners.ResourceProvisionerShared;
import org.cloudbus.cloudsim.provisioners.ResourceProvisionerSimple;
import org.cloudbus.cloudsim.resources.Pe;
import org.cloudbus.cloudsim.resources.PeSimple;
......@@ -32,6 +33,7 @@ import org.cloudbus.cloudsim.vms.VmWithMetadata;
import org.cloudbus.cloudsim.vms.VmWithMetadata.VmData;
import org.cloudbus.cloudsim.vms.VmWithMetadata.VmLabel;
import org.cloudsimplus.builders.tables.CloudletsTableBuilder;
import org.cloudsimplus.listeners.CloudletVmEventInfo;
import org.cloudsimplus.listeners.EventInfo;
public class InfoAwareSimulation {
......@@ -50,10 +52,32 @@ public class InfoAwareSimulation {
private static final int NUMBER_VMS = 2; // Initial Setup
/*
* Vm toy (Setted to finish at the time to launched the IO-Bound (grep) vms)
*/
private static final int VM_TOY_ID = 0;
private static final double VM_TOY_DELAY = 0;
private static final int VM_TOY_PES = 1; // 1 VCPU
private static final long VM_TOY_RAM = 0; // 1 GB of RAM
private static final long VM_TOY_STORAGE = 0; // 10 GB of Disk
private static final long VM_TOY_BW = 100; // High value of bandwidth
private static final long VM_TOY_MIPS = 1;
private static final long VM_TOY_IOPS = 0;
/*
* Cloudlet of the Vm Toy.
*/
private static final int CLOUDLET_TOY_ID = 0;
private static final double CLOUDLET_TOY_DELAY = 0;
private static final int CLOUDLET_TOY_LENGTH = 1; // Toy workload.
private static final int CLOUDLET_TOY_PES = 1;
private static final int CLOUDLET_TOY_IOPS = 0;
/*
* Vm CPU-Bound configuration
*/
private static final int VM_CPU_BOUND_ID = 1;
private static final double VM_CPU_BOUND_DELAY = 0.0;
private static final int VM_CPU_BOUND_PES = 1; // 1 VCPU
private static final long VM_CPU_BOUND_RAM = 1024; // 1 GB of RAM
private static final long VM_CPU_BOUND_STORAGE = 10240; // 10 GB of Disk
......@@ -67,7 +91,8 @@ public class InfoAwareSimulation {
* Cloudlet of the vm CPU-Bound
*/
private static final int CLOUDLET_CPU_BOUND_ID = 1;
private static final int CLOUDLET_CPU_BOUND_LENGTH = 1000000; // CPU-Bound workload (Set a high duration time)
private static final double CLOUDLET_CPU_BOUND_DELAY = 0.0;
private static final int CLOUDLET_CPU_BOUND_LENGTH = 50000000; // CPU-Bound workload (Set a high duration time)
private static final int CLOUDLET_CPU_BOUND_PES = 1;
private static final int CLOUDLET_CPU_BOUND_IOPS = 2;
......@@ -76,6 +101,7 @@ public class InfoAwareSimulation {
* Vm IO-Bound configuration
*/
private static final int VM_IO_BOUND_ID = 2;
private static final double VM_IO_BOUND_DELAY = 0.0;
private static final int VM_IO_BOUND_PES = 1; // 1 VCPU
private static final int VM_IO_BOUND_RAM = 400; // 400 MB of RAM
private static final int VM_IO_BOUND_STORAGE = 10240; // 10 GB of Disk
......@@ -87,9 +113,10 @@ public class InfoAwareSimulation {
* Cloudlet of the vm IO-Bound
*/
private static final int CLOUDLET_IO_BOUND_ID = 2;
private static final double CLOUDLET_IO_BOUND_DELAY = 0.0;
private static final int CLOUDLET_IO_BOUND_LENGTH = 0;
private static final int CLOUDLET_IO_BOUND_PES = 1;
private static final int CLOUDLET_IO_BOUND_IOPS = 500; // IO-Bound workload
private static final int CLOUDLET_IO_BOUND_IOPS = 250000; // IO-Bound workload
private static final int NUMBER_VMS_LAUNCHED = 4;
......@@ -97,6 +124,7 @@ public class InfoAwareSimulation {
* Vm about to be launched (Grep)
*/
private static final int VM_LAUNCHED_PES = 2; // 2 VCPU's
private static final double VM_LAUNCHED_DELAY = 0;
private static final int VM_LAUNCHED_RAM = 3072; // 3 GB of RAM
private static final int VM_LAUNCHED_DISK = 40960; // 40 GB of Disk
private static final int VM_LAUNCHED_BW = 10000; // High value of bandwidth
......@@ -108,6 +136,7 @@ public class InfoAwareSimulation {
/*
* Cloudlet of the grep vms
*/
private static final double CLOUDLET_LAUNCHED_DELAY = 0;
private static final int CLOUDLET_LAUNCHED_LENGTH = 11250;
private static final int CLOUDLET_LAUNCHED_PES = 4;
private static final int CLOUDLET_LAUNCHED_IOPS = 500; // IO-Bound workload
......@@ -130,21 +159,26 @@ public class InfoAwareSimulation {
//Creates a broker that is a software acting on behalf a cloud customer to manage his/her VMs and Cloudlets
broker = new DatacenterBrokerSimple(simulation);
// Setting Initial Setup
vmList = new ArrayList<>(NUMBER_VMS);
vmList.add(createVmsSimple(VM_CPU_BOUND_ID, VM_CPU_BOUND_PES, VM_CPU_BOUND_MIPS, VM_CPU_BOUND_RAM,
VM_CPU_BOUND_BW, VM_CPU_BOUND_STORAGE, VM_CPU_BOUND_IOPS));
vmList.add(createVmsSimple(VM_IO_BOUND_ID, VM_IO_BOUND_PES, VM_IO_BOUND_MIPS, VM_IO_BOUND_RAM,
VM_IO_BOUND_BW, VM_IO_BOUND_STORAGE, VM_IO_BOUND_IOPS));
vmList.add(createVmSimple(VM_CPU_BOUND_ID, VM_CPU_BOUND_DELAY, VM_CPU_BOUND_PES, VM_CPU_BOUND_MIPS, VM_CPU_BOUND_RAM,
VM_CPU_BOUND_BW, VM_CPU_BOUND_STORAGE, VM_CPU_BOUND_IOPS));
vmList.add(createVmSimple(VM_IO_BOUND_ID, VM_IO_BOUND_DELAY, VM_IO_BOUND_PES, VM_IO_BOUND_MIPS, VM_IO_BOUND_RAM,
VM_IO_BOUND_BW, VM_IO_BOUND_STORAGE, VM_IO_BOUND_IOPS));
vmList.add(createVmSimple(VM_TOY_ID, VM_TOY_DELAY, VM_TOY_PES, VM_TOY_MIPS, VM_TOY_RAM,
VM_TOY_BW, VM_TOY_STORAGE, VM_TOY_IOPS));
broker.submitVmList(vmList);
cloudletList = new ArrayList<>(NUMBER_CLOUDLETS);
cloudletList.add(createCloudlets(CLOUDLET_CPU_BOUND_ID, CLOUDLET_CPU_BOUND_LENGTH,
cloudletList.add(createCloudlets(CLOUDLET_CPU_BOUND_ID, CLOUDLET_CPU_BOUND_DELAY, CLOUDLET_CPU_BOUND_LENGTH,
CLOUDLET_CPU_BOUND_PES, CLOUDLET_CPU_BOUND_IOPS));
cloudletList.add(createCloudlets(CLOUDLET_IO_BOUND_ID, CLOUDLET_IO_BOUND_LENGTH,
cloudletList.add(createCloudlets(CLOUDLET_IO_BOUND_ID, CLOUDLET_IO_BOUND_DELAY, CLOUDLET_IO_BOUND_LENGTH,
CLOUDLET_IO_BOUND_PES, CLOUDLET_IO_BOUND_IOPS));
cloudletList.add(createCloudlets(CLOUDLET_TOY_ID, CLOUDLET_TOY_DELAY, CLOUDLET_TOY_LENGTH,
CLOUDLET_TOY_PES, CLOUDLET_TOY_IOPS));
broker.submitCloudletList(cloudletList);
......@@ -179,6 +213,7 @@ public class InfoAwareSimulation {
.setCloudletScheduler(new CloudletSchedulerTimeShared());
((VmWithMetadata) vm).putMetadata(VmLabel.TYPE, VmData.IO);
vm.setSubmissionDelay(VM_LAUNCHED_DELAY);
listVmsLaunched.add(vm);
}
......@@ -187,20 +222,20 @@ public class InfoAwareSimulation {
for (int i = 3; i < NUMBER_CLOUDLET_LAUNCHED + 3; i++) {
Cloudlet cloudlet = createCloudlets(i, CLOUDLET_LAUNCHED_LENGTH,
Cloudlet cloudlet = createCloudlets(i, CLOUDLET_LAUNCHED_DELAY, CLOUDLET_LAUNCHED_LENGTH,
CLOUDLET_LAUNCHED_PES, CLOUDLET_LAUNCHED_IOPS);
listCloudletLaunched.add(cloudlet);
}
Log.printLine(info.getTime() + ": # Submiting Vms Launched (Grep)\n");
Log.printLine(info.getTime() + ": # Submiting Vms and Cloudlets Launched (Grep)\n");
broker.submitVmList(listVmsLaunched);
Log.printLine(info.getTime() + ": # Submiting Cloudlets Launched (Grep)\n");
broker.submitCloudletList(listCloudletLaunched);
simulation.removeOnClockTickListener(info.getListener());
}
}
private Datacenter createDatacenter(int numberOfHosts) {
final List<Host> hostList = new ArrayList<>(numberOfHosts);
for(int i = 0; i < numberOfHosts; i++) {
......@@ -219,9 +254,9 @@ public class InfoAwareSimulation {
peList.add(new PeSimple(mipsPerPe, new PeProvisionerSimple()));
}
ResourceProvisioner ramProvisioner = new ResourceProvisionerSimple();
ResourceProvisioner bwProvisioner = new ResourceProvisionerSimple();
ResourceProvisioner iopsProvisioner = new ResourceProvisionerSimple();
ResourceProvisioner ramProvisioner = new ResourceProvisionerShared();
ResourceProvisioner bwProvisioner = new ResourceProvisionerShared();
ResourceProvisioner iopsProvisioner = new ResourceProvisionerShared();
VmScheduler vmScheduler = new VmSchedulerTimeShared();
Host host = new HostSimple(ram, iops, bw, storage, peList);
host
......@@ -232,17 +267,19 @@ public class InfoAwareSimulation {
return host;
}
private Vm createVmsSimple(int id, int pes, long mipsCapacity, long ram, long bw, long storage, long iops) {
private Vm createVmSimple(int id, double delayTime, int pes, long mipsCapacity, long ram, long bw, long storage, long iops) {
Vm vm =
new VmSimple(id, mipsCapacity, pes)
.setRam(ram).setBw(bw).setSize(storage)
.setCloudletScheduler(new CloudletSchedulerTimeShared())
.setIops(iops);
vm.setSubmissionDelay(delayTime);
return vm;
}
private Cloudlet createCloudlets(int id, long length, long pes, long iops) {
private Cloudlet createCloudlets(int id, double delayTime, long length, long pes, long iops) {
UtilizationModel utilization = new UtilizationModelFull();
Cloudlet cloudlet =
new CloudletSimple(id, length, pes)
......@@ -251,7 +288,9 @@ public class InfoAwareSimulation {
.setUtilizationModel(utilization)
.setIops(iops);
cloudlet.setSubmissionDelay(delayTime);
return cloudlet;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment