public final class DistributionThresholdUtils extends Object
ResourceDistributionGoal
, ReplicaDistributionAbstractGoal
)Constructor and Description |
---|
DistributionThresholdUtils() |
Modifier and Type | Method and Description |
---|---|
static double |
balancePercentage(OptimizationOptions optimizationOptions,
BalancingConstraint balancingConstraint,
double resourceBalancePercentage) |
static double |
balancePercentage(OptimizationOptions optimizationOptions,
BalancingConstraint balancingConstraint,
Resource resource)
In order to avoid churns, apply several adjustments to the requested rebalance threshold to be used by goal
optimization.
|
static double |
clusterUtilizationAverage(ClusterModel clusterModel,
Resource resource)
Computes the average utilization of the cluster for a given resource.
|
static double |
computeBalanceAbsoluteLowerThresholdPercentage(double utilizationPercentage,
OptimizationOptions optimizationOptions,
BalancingConstraint balancingConstraint,
Resource resource)
Calculates the lower percentage threshold of the given resource's total cluster-wide aggregated capacity.
|
static double |
computeBalanceAbsoluteUpperThresholdPercentage(double utilizationPercentage,
OptimizationOptions optimizationOptions,
BalancingConstraint balancingConstraint,
Resource resource)
Calculates the upper percentage threshold of the given resource's total cluster-wide aggregated capacity.
|
static double |
computeBalanceRelativeLowerThresholdPercentage(double utilizationPercentage,
OptimizationOptions optimizationOptions,
BalancingConstraint balancingConstraint,
Resource resource)
Calculates the lower percentage threshold of the given resource's total cluster-wide aggregated capacity.
|
static double |
computeBalanceRelativeUpperThresholdPercentage(double utilizationPercentage,
OptimizationOptions optimizationOptions,
BalancingConstraint balancingConstraint,
Resource resource)
Calculates the upper percentage threshold of the given resource's total cluster-wide aggregated capacity.
|
static double |
validateRatio(double ratioValue,
String name)
Checks a given ratio value, whether it is within [0, 1] interval.
|
public static double validateRatio(double ratioValue, String name)
IllegalArgumentException
if the
check didn't pass.ratioValue
- value to checkname
- name of the valuepublic static double balancePercentage(OptimizationOptions optimizationOptions, BalancingConstraint balancingConstraint, Resource resource)
KafkaCruiseControlConfig.GOAL_VIOLATION_DISTRIBUTION_THRESHOLD_MULTIPLIER_CONFIG
optimizationOptions
- Options to adjust balance percentage in case goal optimization is triggered
by goal violation detector.balancingConstraint
- The balancing constraintsresource
- The resource this calculation is applying topublic static double balancePercentage(OptimizationOptions optimizationOptions, BalancingConstraint balancingConstraint, double resourceBalancePercentage)
public static double clusterUtilizationAverage(ClusterModel clusterModel, Resource resource)
public static double computeBalanceRelativeUpperThresholdPercentage(double utilizationPercentage, OptimizationOptions optimizationOptions, BalancingConstraint balancingConstraint, Resource resource)
Upper threshold calculated by this method is formulated as
upper_threshold = mean_utilization * (1 + balancing_band)
, where balancing_band
is configured in cruise control config.
utilizationPercentage
- the percentage of capacity for the given resource that is currently utilizedoptimizationOptions
- Options to adjust balance upper limit in case goal optimization is triggered by goal
violation detector.resource
(package private for
testing)public static double computeBalanceAbsoluteUpperThresholdPercentage(double utilizationPercentage, OptimizationOptions optimizationOptions, BalancingConstraint balancingConstraint, Resource resource)
Upper threshold calculated by this method is formulated as
upper_threshold = mean_utilization + balancing_band
, where balancing_band
is configured in cruise control config.
utilizationPercentage
- the percentage of capacity for the given resource that is currently utilizedoptimizationOptions
- Options to adjust balance upper limit in case goal optimization is triggered by goal
violation detector.resource
(package private for
testing)public static double computeBalanceRelativeLowerThresholdPercentage(double utilizationPercentage, OptimizationOptions optimizationOptions, BalancingConstraint balancingConstraint, Resource resource)
Lower threshold calculated by this method is formulated as
lower_threshold = mean_utilization * (1 - balancing_band)
, where balancing_band
is configured in cruise control config.
utilizationPercentage
- the percentage of capacity for the given resource that is currently utilizedoptimizationOptions
- Options to adjust balance lower limit in case goal optimization is triggered by goal
violation detector.balancingConstraint
- The balancing constraintsresource
- The resource this calculation is applying toresource
public static double computeBalanceAbsoluteLowerThresholdPercentage(double utilizationPercentage, OptimizationOptions optimizationOptions, BalancingConstraint balancingConstraint, Resource resource)
Lower threshold calculated by this method is formulated as
lower_threshold = mean_utilization - balancing_band
, where balancing_band
is configured in cruise control config.
utilizationPercentage
- the percentage of capacity for the given resource that is currently utilizedoptimizationOptions
- Options to adjust balance lower limit in case goal optimization is triggered by goal
violation detector.balancingConstraint
- The balancing constraintsresource
- The resource this calculation is applying toresource