Interface HorizontalVmScaling
- All Superinterfaces:
VmScaling
- All Known Implementing Classes:
HorizontalVmScalingSimple
DatacenterBroker to dynamically create VMs according to the arrival of
Cloudlets, in order to enable load balancing.
Since Cloudlets can be created and submitted to a broker in runtime, the number of arrived Cloudlets can be too much to the existing VMs, requiring the creation of new VMs to balance the load. A HorizontalVmScaling implementation performs such up scaling by creating VMs as needed.
To enable horizontal down-scaling to destroy idle VMs, the DatacenterBroker has to be used
by setting a DatacenterBroker.setVmDestructionDelayFunction(Function).
Since there is no Cloudlet migration mechanism (and it isn't intended to have),
if a VM becomes underloaded, there is nothing that can be done until all Cloudlets
finish executing. When that happens, the vmDestructionDelayFunction
will handle such a situation.
- Since:
- CloudSim Plus 1.0.0
- Author:
- Manoel Campos da Silva Filho
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HorizontalVmScalingAn attribute that implements the Null Object Design Pattern forHorizontalVmScalingobjects. -
Method Summary
Modifier and TypeMethodDescriptionGets thePredicatethat defines when aVmis overloaded or not, that will make the Vm'sDatacenterBrokerto up scale the VM.Returns a Supplier that will be used to create VMs when the Load Balancer detects that the current Broker's VMs are overloaded.booleanRequests a horizontal scale if a Vm is overloaded, according to thegetOverloadPredicate()predicate.setOverloadPredicate(Predicate<Vm> predicate) Sets aPredicatethat defines when aVmis overloaded or not, making theDatacenterBrokerto up scale the VM.setVmSupplier(Supplier<Vm> supplier) Sets aSupplierthat will be used to create VMs when the Load Balancer detects that the current Broker's VMs are overloaded.
-
Field Details
-
FALSE_PREDICATE
-
NULL
An attribute that implements the Null Object Design Pattern forHorizontalVmScalingobjects.
-
-
Method Details
-
getVmSupplier
-
setVmSupplier
Sets aSupplierthat will be used to create VMs when the Load Balancer detects that the current Broker's VMs are overloaded.- Parameters:
supplier- the supplier to set
-
requestUpScalingIfPredicateMatches
Requests a horizontal scale if a Vm is overloaded, according to thegetOverloadPredicate()predicate. The scaling is performed by creating a new Vm using thegetVmSupplier()method and submitting it to the broker.The time interval in which it will be checked if the Vm is overloaded depends on the
Datacenter.getSchedulingInterval()value. Make sure to set such a value to enable the periodic overload verification.The method will check the need to create a new VM at the time interval defined by the
Datacenter.getSchedulingInterval(). A VM creation request is only sent when the VM is overloaded and new Cloudlets were submitted to the broker.- Specified by:
requestUpScalingIfPredicateMatchesin interfaceVmScaling- Parameters:
evt- event information, including the current simulation time and the VM to be scaled- Returns:
- true if the Vm is over or underloaded and up or down scaling request was sent to the broker; false otherwise
-
getOverloadPredicate
Gets thePredicatethat defines when aVmis overloaded or not, that will make the Vm'sDatacenterBrokerto up scale the VM. The up scaling is performed by creating new VMs to run new arrived Cloudlets and then balance the load.- Returns:
- See Also:
-
setOverloadPredicate
Sets aPredicatethat defines when aVmis overloaded or not, making theDatacenterBrokerto up scale the VM. The up scaling is performed by creating new VMs to run new arrived Cloudlets in order to balance the load.- Parameters:
predicate- a predicate that checks certain conditions to define aVmas overloaded. The predicate receives the Vm that has to be checked. Such a condition can be defined, for instance, based on Vm'sCPU usageand/or any other VM resource usage. Despite the VmScaling is already linked to aVm, the Vm parameter for thePredicateenables reusing the same predicate to detect overload of different VMs.
-