Class HorizontalVmScalingSimple
- All Implemented Interfaces:
HorizontalVmScaling
,VmScaling
public class HorizontalVmScalingSimple extends VmScalingAbstract implements HorizontalVmScaling
A HorizontalVmScaling
implementation that allows defining the condition
to identify an overloaded VM, based on any desired criteria, such as
current RAM, CPU and/or Bandwidth utilization.
A DatacenterBroker
monitors the VMs that have
an HorizontalVmScaling object in order to create or destroy VMs on demand.
The overload condition has to be defined
by providing a Predicate
using the setOverloadPredicate(Predicate)
method.
Check the HorizontalVmScaling
documentation for details on how to enable horizontal down scaling
using the DatacenterBroker
.
- Since:
- CloudSim Plus 1.0
- Author:
- Manoel Campos da Silva Filho
- See Also:
HorizontalVmScaling
-
Field Summary
Fields inherited from interface org.cloudsimplus.autoscaling.HorizontalVmScaling
FALSE_PREDICATE, NULL
-
Constructor Summary
Constructors Constructor Description HorizontalVmScalingSimple()
-
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.protected boolean
requestUpScaling(double time)
Performs the actual request to scale the Vm up or down, depending if it is over or underloaded, respectively.boolean
requestUpScalingIfPredicateMatches(VmHostEventInfo evt)
Requests a horizontal scale if the Vm is overloaded, according to theHorizontalVmScaling.getOverloadPredicate()
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.Methods inherited from class org.cloudsimplus.autoscaling.VmScalingAbstract
getVm, isTimeToCheckPredicate, setLastProcessingTime, setVm
-
Constructor Details
-
HorizontalVmScalingSimple
public HorizontalVmScalingSimple()
-
-
Method Details
-
getVmSupplier
Description copied from interface:HorizontalVmScaling
Gets aSupplier
that will be used to create VMs when the Load Balancer detects that the current Broker's VMs are overloaded.- Specified by:
getVmSupplier
in interfaceHorizontalVmScaling
- Returns:
-
setVmSupplier
Description copied from interface:HorizontalVmScaling
Sets aSupplier
that will be used to create VMs when the Load Balancer detects that Broker's VMs are overloaded.- Specified by:
setVmSupplier
in interfaceHorizontalVmScaling
- Parameters:
supplier
- the supplier to set- Returns:
-
getOverloadPredicate
Description copied from interface:HorizontalVmScaling
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.- Specified by:
getOverloadPredicate
in interfaceHorizontalVmScaling
- Returns:
- See Also:
HorizontalVmScaling.setOverloadPredicate(Predicate)
-
setOverloadPredicate
Description copied from interface:HorizontalVmScaling
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.- Specified by:
setOverloadPredicate
in interfaceHorizontalVmScaling
- 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:
-
requestUpScaling
protected boolean requestUpScaling(double time)Description copied from class:VmScalingAbstract
Performs the actual request to scale the Vm up or down, depending if it is over or underloaded, respectively. This method is automatically called byVmScaling.requestUpScalingIfPredicateMatches(org.cloudsimplus.listeners.VmHostEventInfo)
when it is verified that the Vm is over or underloaded.- Specified by:
requestUpScaling
in classVmScalingAbstract
- Parameters:
time
- current simulation time- Returns:
- true if the request was actually sent, false otherwise
-
requestUpScalingIfPredicateMatches
Description copied from interface:HorizontalVmScaling
Requests a horizontal scale if the Vm is overloaded, according to theHorizontalVmScaling.getOverloadPredicate()
predicate. The scaling is performed by creating a new Vm using theHorizontalVmScaling.getVmSupplier()
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 interfaceHorizontalVmScaling
- 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
-