Interface HorizontalVmScaling
- All Superinterfaces:
VmScaling
- All Known Implementing Classes:
HorizontalVmScalingSimple
public interface HorizontalVmScaling extends VmScaling
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 to much to 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.getVmDestructionDelayFunction()
.
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 DatacenterBroker.getVmDestructionDelayFunction()
will handle such a situation.
- Since:
- CloudSim Plus 1.0.0
- Author:
- Manoel Campos da Silva Filho
-
Field Summary
Fields Modifier and Type Field Description static Predicate<Vm>
FALSE_PREDICATE
static HorizontalVmScaling
NULL
An attribute that implements the Null Object Design Pattern forHorizontalVmScaling
objects. -
Method Summary
Modifier and Type Method Description Predicate<Vm>
getOverloadPredicate()
Gets aPredicate
that defines whenVm
is overloaded or not, that will make the Vm'sDatacenterBroker
to up scale the VM.Supplier<Vm>
getVmSupplier()
Gets aSupplier
that will be used to create VMs when the Load Balancer detects that the current Broker's VMs are overloaded.boolean
requestUpScalingIfPredicateMatches(VmHostEventInfo evt)
Requests a horizontal scale if the Vm is overloaded, according to thegetOverloadPredicate()
predicate.VmScaling
setOverloadPredicate(Predicate<Vm> predicate)
Sets aPredicate
that defines when theVm
is overloaded or not, making theDatacenterBroker
to up scale the VM.HorizontalVmScaling
setVmSupplier(Supplier<Vm> supplier)
Sets aSupplier
that will be used to create VMs when the Load Balancer detects that Broker's VMs are overloaded.
-
Field Details
-
FALSE_PREDICATE
-
NULL
An attribute that implements the Null Object Design Pattern forHorizontalVmScaling
objects.
-
-
Method Details
-
getVmSupplier
Gets aSupplier
that will be used to create VMs when the Load Balancer detects that the current Broker's VMs are overloaded.- Returns:
-
setVmSupplier
Sets aSupplier
that will be used to create VMs when the Load Balancer detects that Broker's VMs are overloaded.- Parameters:
supplier
- the supplier to set- Returns:
-
requestUpScalingIfPredicateMatches
Requests a horizontal scale if the 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:
requestUpScalingIfPredicateMatches
in interfaceVmScaling
- Parameters:
evt
- current simulation time- Returns:
- true if the Vm is over or underloaded and up or down scaling request was sent to the broker, false otherwise
-
getOverloadPredicate
Gets aPredicate
that defines whenVm
is overloaded or not, that will make the Vm'sDatacenterBroker
to up scale the VM. The up scaling is performed by creating new VMs to attend new arrived Cloudlets and then balance the load.- Returns:
- See Also:
setOverloadPredicate(Predicate)
-
setOverloadPredicate
Sets aPredicate
that defines when theVm
is overloaded or not, making theDatacenterBroker
to up scale the VM. The up scaling is performed by creating new VMs to attend new arrived Cloudlets in order to balance the load.- Parameters:
predicate
- a predicate that checks certain conditions to define aVm
as overloaded. The predicate receives the Vm that has to be checked. Such a condition can be defined, for instance, based on Vm'sVm.getCpuPercentUtilization(double)
CPU usage} and/or any other VM resource usage. Despite the VmScaling already is already linked to aVm
, the Vm parameter for thePredicate
enables reusing the same predicate to detect overload of different VMs.- Returns:
-