public interface VerticalVmScaling extends VmScaling
DatacenterBroker
to request the dynamic scale of VM resources up or down, according to the current resource usage.
For each resource supposed to be scaled, a different VerticalVmScaling
instance should be provided.
If a scaling object is going to be set to a Vm, it has to be exclusive of that Vm.
Different Vms must have different instances of a scaling object.
A Vm
runs a set of Cloudlet
s. When a VerticalVmScaling
object is attached to a Vm
,
it's required to define which resource will be scaled
(Ram
, Bandwidth
, etc)
when it's under
or overloaded
.
The scaling request follows this path:
Vm
that has a VerticalVmScaling
object set monitors its own resource usage
using an EventListener
, to check if an under
or
overload
condition is met;DatacenterBroker
;Datacenter
where the Vm is hosted;VmAllocationPolicy
;UtilizationModel
of some of these Cloudlets
is defined as ABSOLUTE
. Defining the UtilizationModel
of all Cloudlets
running inside the Vm
as PERCENTAGE
causes these Cloudlets
to automatically increase/decrease their resource usage when the
Vm
resource is vertically scaled. This is not a CloudSim Plus issue, but the natural and
maybe surprising effect that may trap researchers trying to implement and assess VM scaling policies.
Consider the following example: a VerticalVmScaling
is attached to a Vm
to double
its Ram
when its usage reaches 50%. The Vm
has 10GB of RAM.
All Cloudlets
running inside this Vm
have a UtilizationModel
for their RAM utilization define in PERCENTAGE
. When the RAM utilization of all these
Cloudlets
reach the 50% (5GB), the Vm
Ram
will be doubled.
However, as the RAM usage of the running Cloudlets
is defined in percentage, they will
continue to use 50% of Vm
's RAM, that now represents 10GB from the 20GB capacity.
This way, the vertical scaling will have no real benefit.
Modifier and Type | Field and Description |
---|---|
static VerticalVmScaling |
NULL
An attribute that implements the Null Object Design Pattern for
VerticalVmScaling
objects. |
Modifier and Type | Method and Description |
---|---|
long |
getAllocatedResource()
Gets the current amount allocated to the
resource managed by this scaling object. |
Function<Vm,Double> |
getLowerThresholdFunction()
|
Resource |
getResource()
Gets the actual Vm
Resource this scaling object is in charge of scaling. |
double |
getResourceAmountToScale()
Gets the absolute amount of the Vm resource which has to be
scaled up or down, based on the
scaling factor . |
Class<? extends ResourceManageable> |
getResourceClass()
Gets the class of Vm resource this scaling object will request up or down scaling.
|
Function<Vm,Double> |
getResourceUsageThresholdFunction()
Gets the lower or upper resource utilization threshold
Function ,
depending if the Vm resource is under or overloaded, respectively. |
double |
getScalingFactor()
Gets the factor that will be used to scale a Vm resource up or down,
whether such a resource is over or underloaded, according to the
defined predicates.
|
Function<Vm,Double> |
getUpperThresholdFunction()
|
boolean |
isVmOverloaded()
Checks if the Vm is overloaded or not, based on the
getUpperThresholdFunction() . |
boolean |
isVmUnderloaded()
Checks if the Vm is underloaded or not, based on the
getLowerThresholdFunction() . |
boolean |
requestUpScalingIfPredicateMatches(VmHostEventInfo evt)
Performs the vertical scale if the Vm is overloaded, according to the
getUpperThresholdFunction() predicate,
increasing the Vm resource to which the scaling object is linked to (that may be RAM, CPU, BW, etc),
by the factor defined a scaling factor. |
VerticalVmScaling |
setLowerThresholdFunction(Function<Vm,Double> lowerThresholdFunction)
|
VerticalVmScaling |
setResourceClass(Class<? extends ResourceManageable> resourceClass)
Sets the class of Vm resource that this scaling object will request up or down scaling.
|
VerticalVmScaling |
setResourceScaling(ResourceScaling resourceScaling)
Sets the
ResourceScaling that defines how the resource has to be resized. |
VerticalVmScaling |
setScalingFactor(double scalingFactor)
Sets the factor that will be used to scale a Vm resource up or down,
whether such a resource is over or underloaded, according to the
defined predicates.
|
VerticalVmScaling |
setUpperThresholdFunction(Function<Vm,Double> upperThresholdFunction)
|
static final VerticalVmScaling NULL
VerticalVmScaling
objects.Class<? extends ResourceManageable> getResourceClass()
Ram
.class, Bandwidth
.class or Pe
.class.getResource()
VerticalVmScaling setResourceClass(Class<? extends ResourceManageable> resourceClass)
Ram
.class, Bandwidth
.class or Pe
.class.resourceClass
- the resource class to setdouble getScalingFactor()
If the resource to scale is a Pe
, this is the number of PEs
to request adding or removing when the VM is over or underloaded, respectively.
For any other kind of resource, this is a percentage value in scale from 0 to 1. Every time the
VM needs to be scaled up or down, this factor will be applied
to increase or reduce a specific VM allocated resource.
Pe
scaling)
or percentage (for scaling other resources)getUpperThresholdFunction()
VerticalVmScaling setScalingFactor(double scalingFactor)
If the resource to scale is a Pe
, this is the number of PEs
to request adding or removing when the VM is over or underloaded, respectively.
For any other kind of resource, this is a percentage value in scale from 0 to 1. Every time the
VM needs to be scaled up or down, this factor will be applied
to increase or reduce a specific VM allocated resource.
scalingFactor
- the scaling factor to set which may be an absolute value (for Pe
scaling)
or percentage (for scaling other resources)getUpperThresholdFunction()
Function<Vm,Double> getResourceUsageThresholdFunction()
Function
,
depending if the Vm resource is under or overloaded, respectively.getLowerThresholdFunction()
,
getUpperThresholdFunction()
boolean isVmUnderloaded()
getLowerThresholdFunction()
.boolean isVmOverloaded()
getUpperThresholdFunction()
.Resource getResource()
Resource
this scaling object is in charge of scaling.
This resource is defined after calling the setResourceClass(Class)
.double getResourceAmountToScale()
scaling factor
.getResourceClass()
boolean requestUpScalingIfPredicateMatches(VmHostEventInfo evt)
getUpperThresholdFunction()
predicate,
increasing the Vm resource to which the scaling object is linked to (that may be RAM, CPU, BW, etc),
by the factor defined a scaling factor.
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.
requestUpScalingIfPredicateMatches
in interface VmScaling
evt
- current simulation timegetScalingFactor()
Function<Vm,Double> getUpperThresholdFunction()
Function
that defines the upper utilization threshold for a Vm
which indicates if it is overloaded or not.
If it is overloaded, the Vm's DatacenterBroker
will request to up scale the VM.
The up scaling is performed by increasing the amount of the resource
the scaling is associated to.
This function must receive a Vm
and return the upper utilization threshold
for it as a percentage value between 0 and 1 (where 1 is 100%).
The VM will be defined as overloaded if the utilization of the Resource
this scaling object is related to is higher than the value returned by the Function
returned by this method.
setUpperThresholdFunction(Function)
VerticalVmScaling setUpperThresholdFunction(Function<Vm,Double> upperThresholdFunction)
Function
that defines the upper utilization threshold for a Vm
which indicates if it is overloaded or not.
If it is overloaded, the Vm's DatacenterBroker
will request to up scale the VM.
The up scaling is performed by increasing the amount of the resource
the scaling is associated to.
This function must receive a Vm
and return the upper utilization threshold
for it as a percentage value between 0 and 1 (where 1 is 100%).
By setting the upper threshold as a Function
instead of a directly
storing a Double
value which represent the threshold, it is possible
to define the threshold dynamically instead of using a static value.
Furthermore, the threshold function can be reused for scaling objects of
different VMs.
Function<Vm,Double> getLowerThresholdFunction()
Function
that defines the lower utilization threshold for a Vm
which indicates if it is underloaded or not.
If it is underloaded, the Vm's DatacenterBroker
will request to down scale the VM.
The down scaling is performed by decreasing the amount of the resource
the scaling is associated to.
This function must receive a Vm
and return the lower utilization threshold
for it as a percentage value between 0 and 1 (where 1 is 100%).
The VM will be defined as underloaded if the utilization of the Resource
this scaling object is related to is lower than the value returned by the Function
returned by this method.
setLowerThresholdFunction(Function)
VerticalVmScaling setLowerThresholdFunction(Function<Vm,Double> lowerThresholdFunction)
Function
that defines the lower utilization threshold for a Vm
which indicates if it is underloaded or not.
If it is underloaded, the Vm's DatacenterBroker
will request to down scale the VM.
The down scaling is performed by decreasing the amount of the resource
the scaling is associated to.
This function must receive a Vm
and return the lower utilization threshold
for it as a percentage value between 0 and 1 (where 1 is 100%).
By setting the lower threshold as a Function
instead of a directly
storing a Double
value which represent the threshold, it is possible
to define the threshold dynamically instead of using a static value.
Furthermore, the threshold function can be reused for scaling objects of
different VMs.
VerticalVmScaling setResourceScaling(ResourceScaling resourceScaling)
ResourceScaling
that defines how the resource has to be resized.resourceScaling
- the ResourceScaling
to setlong getAllocatedResource()
resource
managed by this scaling object.
It is just a shortcut to getVmResourceToScale.getAllocatedResource()
.Copyright © 2015–2019 Systems, Security and Image Communication Lab - Instituto de Telecomunica����es (IT) - Universidade da Beira Interior (UBI) - Instituto Federal de Educa����o Ci��ncia e Tecnologia do Tocantins (IFTO). All rights reserved.