Class DatacenterBrokerHeuristic
- All Implemented Interfaces:
Cloneable
,Comparable<SimEntity>
,Runnable
,DatacenterBroker
,Identifiable
,Nameable
,SimEntity
A simple implementation of DatacenterBroker
that uses some heuristic
to get a suboptimal mapping among submitted cloudlets and Vm's.
Such heuristic can be, for instance, the CloudletToVmMappingSimulatedAnnealing
that implements a Simulated Annealing algorithm.
The Broker then places the submitted Vm's at the first Datacenter found.
If there isn't capacity in that one, it will try the other ones.
- Author:
- Manoel Campos da Silva Filho
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cloudbus.cloudsim.core.SimEntity
SimEntity.State
-
Field Summary
Fields inherited from interface org.cloudbus.cloudsim.brokers.DatacenterBroker
DEF_VM_DESTRUCTION_DELAY, LOGGER, NULL
-
Constructor Summary
ConstructorDescriptionDatacenterBrokerHeuristic
(CloudSim simulation) Creates a new DatacenterBroker object. -
Method Summary
Modifier and TypeMethodDescriptiondefaultVmMapper
(Cloudlet cloudlet) The default policy used to select a VM to execute a given Cloudlet.protected void
Request Datacenters to create the Cloudlets in theCloudlets waiting list
.setHeuristic
(CloudletToVmMappingHeuristic heuristic) Sets a heuristic to be used to find a sub-optimal mapping between Cloudlets and Vm's.Methods inherited from class org.cloudbus.cloudsim.brokers.DatacenterBrokerSimple
defaultDatacenterMapper
Methods inherited from class org.cloudbus.cloudsim.brokers.DatacenterBrokerAbstract
addOnVmsCreatedListener, bindCloudletToVm, closestDatacenterMapper, destroyVm, getCloudletCreatedList, getCloudletFinishedList, getCloudletSubmittedList, getCloudletWaitingList, getDatacenter, getDatacenterList, getFailedVmsRetryDelay, getVmCreatedList, getVmCreationRequests, getVmDestructionDelayFunction, getVmExecList, getVmFailedList, getVmFromCreatedList, getVmsNumber, getVmWaitingList, getWaitingVm, isRetryFailedVms, isSelectClosestDatacenter, isShutdownWhenIdle, processEvent, removeOnVmsCreatedListener, requestIdleVmDestruction, requestShutdownWhenIdle, setCloudletComparator, setDatacenterMapper, setFailedVmsRetryDelay, setSelectClosestDatacenter, setShutdownWhenIdle, setVmComparator, setVmDestructionDelay, setVmDestructionDelayFunction, setVmMapper, shutdown, startInternal, submitCloudlet, submitCloudletList, submitCloudletList, submitCloudletList, submitCloudletList, submitVm, submitVmList, submitVmList, toString
Methods inherited from class org.cloudbus.cloudsim.core.CloudSimEntity
cancelEvent, clone, compareTo, equals, getId, getName, getNextEvent, getNextEvent, getShutdownTime, getSimulation, getStartTime, getState, hashCode, isAlive, isFinished, isStarted, pause, run, run, schedule, schedule, schedule, schedule, schedule, schedule, scheduleFirst, scheduleFirst, scheduleFirstNow, scheduleFirstNow, scheduleNow, scheduleNow, selectEvent, send, send, sendNow, sendNow, setEventBuffer, setId, setName, setSimulation, setState, start, waitForEvent
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface org.cloudbus.cloudsim.core.Identifiable
getId
Methods inherited from interface org.cloudbus.cloudsim.core.SimEntity
getShutdownTime, getSimulation, getStartTime, getState, isAlive, isFinished, isStarted, run, schedule, schedule, schedule, schedule, schedule, schedule, schedule, setName, setSimulation, setState, start
-
Constructor Details
-
DatacenterBrokerHeuristic
Creates a new DatacenterBroker object.- Parameters:
simulation
- the CloudSim instance that represents the simulation the Entity is related to- See Also:
-
-
Method Details
-
requestDatacentersToCreateWaitingCloudlets
protected void requestDatacentersToCreateWaitingCloudlets()Description copied from class:DatacenterBrokerAbstract
Request Datacenters to create the Cloudlets in theCloudlets waiting list
. If there aren't available VMs to host all cloudlets, the creation of some ones will be postponed.This method is called after all submitted VMs are created in some Datacenter.
- Overrides:
requestDatacentersToCreateWaitingCloudlets
in classDatacenterBrokerAbstract
- See Also:
-
defaultVmMapper
Description copied from class:DatacenterBrokerSimple
The default policy used to select a VM to execute a given Cloudlet. The method defines the default policy used to map VMs for Cloudlets that are waiting to be created.Since this policy can be dynamically changed by calling
DatacenterBrokerAbstract.setVmMapper(Function)
, this method will always return the default policy provided by the subclass where the method is being called.It applies a Round-Robin policy to cyclically select the next Vm from the
list of waiting VMs
.- Overrides:
defaultVmMapper
in classDatacenterBrokerSimple
- Parameters:
cloudlet
- the cloudlet that needs a VM to execute- Returns:
- the selected Vm for the cloudlet or
Vm.NULL
if no suitable VM was found - See Also:
-
getHeuristic
- Returns:
- the heuristic used to find a sub-optimal mapping between Cloudlets and Vm's
-
setHeuristic
Sets a heuristic to be used to find a sub-optimal mapping between Cloudlets and Vm's. The list of Cloudlets and Vm's to be used by the heuristic will be set automatically by the DatacenterBroker. Accordingly, the developer don't have to set these lists manually, once they will be overridden.
The time taken to find a suboptimal mapping of Cloudlets to Vm's depends on the heuristic parameters that have to be set carefully.
- Parameters:
heuristic
- the heuristic to be set- Returns:
- the DatacenterBrokerHeuristic instance
-