public class GoalOptimizer
extends java.lang.Object
implements java.lang.Runnable
Constructor and Description |
---|
GoalOptimizer(KafkaCruiseControlConfig config,
LoadMonitor loadMonitor,
org.apache.kafka.common.utils.Time time,
DataBalancerMetricsRegistry metricRegistry,
Executor executor)
Constructor for Goal Optimizer takes the goals as input.
|
Modifier and Type | Method and Description |
---|---|
ModelCompletenessRequirements |
defaultModelCompletenessRequirements() |
ModelCompletenessRequirements |
modelCompletenessRequirementsForPrecomputing() |
OptimizerResult |
optimizations(ClusterModel clusterModel,
java.util.List<Goal> goalsByPriority,
OperationProgress operationProgress)
Provides optimization
(1) using
_defaultExcludedTopics , and
(2) does not exclude any brokers for receiving leadership. |
OptimizerResult |
optimizations(ClusterModel clusterModel,
java.util.List<Goal> goalsByPriority,
OperationProgress operationProgress,
java.util.regex.Pattern requestedExcludedTopics,
java.util.Set<java.lang.Integer> excludedBrokersForLeadership,
java.util.Set<java.lang.Integer> excludedBrokersForReplicaMove,
boolean isTriggeredByGoalViolation,
java.util.Set<java.lang.Integer> requestedDestinationBrokerIds,
java.util.Map<org.apache.kafka.common.TopicPartition,java.util.List<ReplicaPlacementInfo>> initReplicaDistributionForProposalGeneration,
boolean onlyMoveImmigrantReplicas)
Depending the existence of dead/broken/decommissioned brokers in the given cluster:
(1) Re-balance: Generates proposals to update the state of the cluster to achieve a final balanced state.
|
OptimizerResult |
optimizations(ClusterModel clusterModel,
OperationProgress operationProgress)
Depending the existence of dead/decommissioned brokers in the given cluster:
(1) Re-balance: Generates proposals to update the state of the cluster to achieve a final balanced state.
|
OptimizerResult |
optimizations(OperationProgress operationProgress,
boolean allowCapacityEstimation)
Get the cached proposals.
|
void |
run() |
void |
shutdown() |
AnalyzerState |
state(MetadataClient.ClusterAndGeneration clusterAndGeneration)
Get the analyzer state from the goal optimizer.
|
public GoalOptimizer(KafkaCruiseControlConfig config, LoadMonitor loadMonitor, org.apache.kafka.common.utils.Time time, DataBalancerMetricsRegistry metricRegistry, Executor executor)
config
- The Kafka Cruise Control Configuration.public void run()
run
in interface java.lang.Runnable
public void shutdown()
public ModelCompletenessRequirements defaultModelCompletenessRequirements()
public ModelCompletenessRequirements modelCompletenessRequirementsForPrecomputing()
public AnalyzerState state(MetadataClient.ClusterAndGeneration clusterAndGeneration)
public OptimizerResult optimizations(OperationProgress operationProgress, boolean allowCapacityEstimation) throws java.lang.InterruptedException, KafkaCruiseControlException
operationProgress
- to report the job progress.allowCapacityEstimation
- Allow capacity estimation in cluster model if the requested broker capacity is unavailable.java.lang.InterruptedException
KafkaCruiseControlException
public OptimizerResult optimizations(ClusterModel clusterModel, OperationProgress operationProgress) throws KafkaCruiseControlException
clusterModel
- The state of the cluster over which the balancing proposal will be applied. Function execution
updates the cluster state with balancing proposals. If the cluster model is specified, the
cached proposal will be ignored.operationProgress
- to report the job progress.KafkaCruiseControlException
public OptimizerResult optimizations(ClusterModel clusterModel, java.util.List<Goal> goalsByPriority, OperationProgress operationProgress) throws KafkaCruiseControlException
_defaultExcludedTopics
, and
(2) does not exclude any brokers for receiving leadership.
(3) does not exclude any brokers for receiving replicas.
(4) assumes that the optimization is not triggered by anomaly detector.
(5) does not specify the destination brokers for replica move explicitly.
See optimizations(ClusterModel, List, OperationProgress, Pattern, Set, Set, boolean, Set, Map, boolean)
.KafkaCruiseControlException
public OptimizerResult optimizations(ClusterModel clusterModel, java.util.List<Goal> goalsByPriority, OperationProgress operationProgress, java.util.regex.Pattern requestedExcludedTopics, java.util.Set<java.lang.Integer> excludedBrokersForLeadership, java.util.Set<java.lang.Integer> excludedBrokersForReplicaMove, boolean isTriggeredByGoalViolation, java.util.Set<java.lang.Integer> requestedDestinationBrokerIds, java.util.Map<org.apache.kafka.common.TopicPartition,java.util.List<ReplicaPlacementInfo>> initReplicaDistributionForProposalGeneration, boolean onlyMoveImmigrantReplicas) throws KafkaCruiseControlException
clusterModel
- The state of the cluster over which the balancing proposal will be applied. Function execution
updates the cluster state with balancing proposals. If the cluster model is specified, the
cached proposal will be ignored.goalsByPriority
- the goals ordered by priority.operationProgress
- to report the job progress.requestedExcludedTopics
- Topics requested to be excluded from partition movement (if null,
use _defaultExcludedTopics
)excludedBrokersForLeadership
- Brokers excluded from receiving leadership upon proposal generation.excludedBrokersForReplicaMove
- Brokers excluded from receiving replicas upon proposal generation.isTriggeredByGoalViolation
- True if optimization of goals is triggered by goal violation, false otherwise.requestedDestinationBrokerIds
- Explicitly requested destination broker Ids to limit the replica movement to
these brokers (if empty, no explicit filter is enforced -- cannot be null).initReplicaDistributionForProposalGeneration
- The initial replica distribution of the cluster. This is only needed
if the passed in clusterModel is not the original cluster model so
that initial replica distribution can not be deducted from that
cluster model, otherwise it is null. One case explicitly specifying
initial replica distribution needed is to increase/decrease specific
topic partition's replication factor, in this case some replicas
are tentatively deleted/added in cluster model before passing it
in to generate proposals.onlyMoveImmigrantReplicas
- Whether restrict replica movement only to immigrant replicas or not.KafkaCruiseControlException