public class BalancingConstraint extends Object
Constructor and Description |
---|
BalancingConstraint(BalancingConstraint original) |
BalancingConstraint(KafkaCruiseControlConfig config)
Constructor for Balancing Constraint.
|
Modifier and Type | Method and Description |
---|---|
double |
allowedCapacityForBroker(Resource resource,
Capacity capacity)
Get the total amount of allowed capacity for one broker, in the respective unit of the given
Resource (MiB, KB, etc.). |
double |
allowedCapacityForBroker(Resource resource,
double totalCapacity)
|
double |
desiredUtilizationLimitForBroker(Resource resource,
Capacity capacity)
Get the desired utilization limit for one broker, in the respective unit of the given
Resource (MiB, KB, etc.). |
Double |
goalViolationDistributionThresholdMultiplier()
Get goal violation distribution threshold multiplier to be used in detection and fixing goal violations.
|
double |
hotPartitionUtilizationThreshold() |
Double |
leaderReplicaBalancePercentage()
Get leader replica balance percentage for
LeaderReplicaDistributionGoal . |
double |
lowUtilizationRatio(Resource resource,
OptimizationOptions options)
Get the low utilization threshold for a resource.
|
Long |
maxReplicasPerBroker()
Get maximum number of replicas per broker.
|
Double |
replicaBalancePercentage()
Get replica balance percentage for
ReplicaDistributionGoal . |
double |
resourceBalancePercentage(Resource resource)
Get the balance percentage for the requested resource.
|
List<Resource> |
resources()
Get the balancing for different resources.
|
void |
setCapacityThreshold(double capacityThreshold)
Set alive resource capacity threshold for all resources.
|
Properties |
setProps(Properties props) |
void |
setResourceBalancePercentage(double resourceBalancePercentage)
Set a common resource balance percentage for all resources.
|
Double |
topicBalancingBalanceThresholdMultiplier()
Get the balance multiplier for topic balancing for
TopicReplicaDistributionGoal . |
Double |
topicBalancingTriggeringThresholdMultiplier()
Get triggering multiplier for topic balancing for
TopicReplicaDistributionGoal . |
String |
toString()
Get string representation of
BalancingConstraint . |
public BalancingConstraint(KafkaCruiseControlConfig config)
public BalancingConstraint(BalancingConstraint original)
public Properties setProps(Properties props)
public Long maxReplicasPerBroker()
public Double replicaBalancePercentage()
ReplicaDistributionGoal
.public Double leaderReplicaBalancePercentage()
LeaderReplicaDistributionGoal
.public Double topicBalancingBalanceThresholdMultiplier()
TopicReplicaDistributionGoal
.
This is used by the goal to balance accordingly the leader and follower replica distributions.
More information at KafkaCruiseControlConfig.TOPIC_BALANCING_BALANCE_THRESHOLD_MULTIPLIER_CONFIG
's documentation.public Double topicBalancingTriggeringThresholdMultiplier()
TopicReplicaDistributionGoal
.
This is used during GVD runs to detect if self-healing should be triggered.
More information at KafkaCruiseControlConfig.TOPIC_BALANCING_TRIGGER_THRESHOLD_MULTIPLIER_CONFIG
's documentation.public Double goalViolationDistributionThresholdMultiplier()
public double resourceBalancePercentage(Resource resource)
resource
- Resource for which the balance percentage will be provided.public double allowedCapacityForBroker(Resource resource, Capacity capacity)
Resource
(MiB, KB, etc.).resource
- The resource for which to find allowed capacity.capacity
- The total capacity for given resource (per broker / host).Capacity.totalCapacityFor(Resource)
,
denoting the total amount of allowed capacity in the respective unit of the given Resource
(MiB, KB, etc.).
In the exceptional cases where the capacity is zero or negative, the same capacity value is returned.public double allowedCapacityForBroker(Resource resource, double totalCapacity)
public double desiredUtilizationLimitForBroker(Resource resource, Capacity capacity)
Resource
(MiB, KB, etc.).
Desired utilization denotes the amount of resource usage we would prefer a broker to be brought under via balancing,
once it goes over its allowed capacity.
For example, if broker throughput limit is 20 MiB and
KafkaCruiseControlConfig.PRODUCER_INBOUND_CAPACITY_THRESHOLD_CONFIG
is 90%,
then allowed will be 18 Mib, and desired utilization will be <= 18 Mib, e.g. 16 Mib.resource
- The resource for which to find desired utilization.capacity
- The total capacity for given resource (per broker / host).allowedCapacityForBroker(Resource, Capacity)
,
denoting the total amount of desired capacity in the respective unit of the given Resource
(MiB, KB, etc.).
In the exceptional cases where the capacity is zero or negative, the same capacity value is returned.public double lowUtilizationRatio(Resource resource, OptimizationOptions options)
resource
- Resource for which the low utilization threshold will be provided.options
- Optimization options for the resource.public double hotPartitionUtilizationThreshold()
public void setResourceBalancePercentage(double resourceBalancePercentage)
resourceBalancePercentage
- Common balance percentage for all resources.public void setCapacityThreshold(double capacityThreshold)
capacityThreshold
- Common capacity threshold for all resources in alive brokers.public String toString()
BalancingConstraint
.