NetworkCloudlet length is ignored
JabobKrauskopf opened this issue · comments
Expected behaviour:
A NetworkCloudlet
s length is the maximum number of instructions this Cloudlet
will execute.
Actual behaviour:
A NetworkCloudlet
s length does not directly determine the finish time of the Cloudlet
.
When not adding any tasks to the Cloudlet
the simulation will end prematurely with a warning.
When the length of the Cloudlet
exceeds the combined length of the tasks, the Cloudlet
will continue to run forever.
I would expect the Cloudlet
to either finish once all the tasks are finished or the length of the Cloudlet
has been "reached".
I'd maybe suggest using a specific value similar to NOT_ASSIGNED
or -1
for a Cloudlet
that will run as long as all of its tasks.
If this is the expected behaviour, I'd suggest adding this information to the documentation
Minimum code for error:
import org.cloudsimplus.brokers.DatacenterBrokerSimple;
import org.cloudsimplus.builders.tables.CloudletsTableBuilder;
import org.cloudsimplus.cloudlets.network.CloudletExecutionTask;
import org.cloudsimplus.core.CloudSimPlus;
import org.cloudsimplus.datacenters.network.NetworkDatacenter;
import org.cloudsimplus.hosts.network.NetworkHost;
import org.cloudsimplus.resources.PeSimple;
import org.cloudsimplus.vms.network.NetworkVm;
import java.util.List;
public class Simulation {
public static void main(String[] args) {
var simulation = new CloudSimPlus();
var broker0 = new DatacenterBrokerSimple(simulation);
long ram = 10000;
long storage = 100000;
long bw = 100000;
var host0 = new NetworkHost(ram, bw, storage, List.of(new PeSimple(20000)));
var dc0 = new NetworkDatacenter(simulation, List.of(host0));
var vm0 = new NetworkVm(1000, 1);
vm0.setRam(1000).setBw(1000).setSize(1000);
var cloudlet0 = new NetworkCloudletFixed(10000, 1);
var cloudletList = List.of(cloudlet0);
var ex0 = new CloudletExecutionTask(0, 1000);
cloudlet0.addTask(ex0);
broker0.submitVmList(List.of(vm0));
broker0.submitCloudletList(cloudletList);
simulation.start();
new CloudletsTableBuilder(broker0.getCloudletFinishedList()).build();
}
}
runs forever because the NetworkCloudlet
s length is bigger than the length of the ExecutionTask
.
import org.cloudsimplus.brokers.DatacenterBrokerSimple;
import org.cloudsimplus.builders.tables.CloudletsTableBuilder;
import org.cloudsimplus.cloudlets.network.CloudletExecutionTask;
import org.cloudsimplus.core.CloudSimPlus;
import org.cloudsimplus.datacenters.network.NetworkDatacenter;
import org.cloudsimplus.hosts.network.NetworkHost;
import org.cloudsimplus.resources.PeSimple;
import org.cloudsimplus.vms.network.NetworkVm;
import java.util.List;
public class Test {
public static void main(String[] args) {
var simulation = new CloudSimPlus();
var broker0 = new DatacenterBrokerSimple(simulation);
long ram = 10000;
long storage = 100000;
long bw = 100000;
var host0 = new NetworkHost(ram, bw, storage, List.of(new PeSimple(20000)));
var dc0 = new NetworkDatacenter(simulation, List.of(host0));
var vm0 = new NetworkVm(1000, 1);
vm0.setRam(1000).setBw(1000).setSize(1000);
var cloudlet0 = new NetworkCloudletFixed(10000, 1);
var cloudletList = List.of(cloudlet0);
broker0.submitVmList(List.of(vm0));
broker0.submitCloudletList(cloudletList);
simulation.start();
new CloudletsTableBuilder(broker0.getCloudletFinishedList()).build();
}
}
stops with the following warning
WARN 0,10: NetworkDatacenter: Vm 0 destroyed on Host 0/DC 2. It had a total of 1 cloudlets (running + waiting). Some events may have been missed. You can try:
(a) decreasing CloudSim's minTimeBetweenEvents and/or Datacenter's schedulingInterval attribute;
(b) increasing broker's Vm destruction delay for idle VMs if you set it to zero;
(c) defining Cloudlets with smaller length (your Datacenter's scheduling interval may be smaller than the time to finish some Cloudlets).
The examples use the NetworkCloudletFixed
imlementation I mentioned in #455
Hey @JabobKrauskopf
Thanks for reporting the issue. Could you please check if the issue persists with the latest version on master?
Hey @JabobKrauskopf, I've just fixed the issue. Sorry for the delay.
Notice that the NetworkCloudlet constructors don't have a length parameter anymore,
since the length is defined by the tasks length.