public abstract class CapacityGoal extends AbstractGoal
Constructor and Description |
---|
CapacityGoal()
Constructor for Capacity Goal.
|
Modifier and Type | Method and Description |
---|---|
Resource |
capacityResource()
The resource denoting the capacity of the cluster and brokers.
|
ModelCompletenessRequirements |
clusterModelCompletenessRequirements()
Specify the load requirements for this goal.
|
List<Broker> |
eligibleBrokersReplicaMove(ClusterModel clusterModel,
Resource.CompositeResource compositeResource)
Get a list of sorted (in ascending order by resource) eligible destination brokers having utilization
under: (given utilization threshold) * (broker and/or host capacity (see
Resource#isHostResource and Resource#isBrokerResource).
|
void |
finish()
Signal for finishing the process for rebalance or self-healing for this goal.
|
boolean |
isHardGoal()
True if this is a hard goal, false otherwise.
|
abstract String |
name()
Get the name of this goal.
|
ActionAcceptance |
partitionActionAcceptance(PartitionBalancingAction action,
ClusterModel clusterModel)
Check whether the given action is acceptable by this goal.
|
boolean |
partitionActionSelfSatisfied(ClusterModel clusterModel,
PartitionBalancingAction action)
Check if requirements of this goal are not violated if this partition action is applied
to the given cluster state, false otherwise.
|
ActionAcceptance |
replicaActionAcceptance(ReplicaBalancingAction action,
ClusterModel clusterModel)
Check whether the given action is acceptable by this goal.
|
boolean |
replicaActionSelfSatisfied(ClusterModel clusterModel,
ReplicaBalancingAction action)
This is a hard goal; hence, the proposals are not limited to broken broker replicas in case of self-healing.
|
List<Resource> |
utilizationResources()
Return the list of resources used for determining the total utilization.
|
configure, optimize, selfSatisfied, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
actionAcceptance, canChangeReplicationFactor, clusterModelStatsComparator, optimize
public boolean isHardGoal()
Goal
public final List<Resource> utilizationResources()
MirrorInboundCapacityGoal
considers both Resource.PRODUCE_IN
and Resource.MIRROR_IN
, as they share the same capacity - the Resource.PRODUCE_IN
limit.
Note that the capacityResource()
is guaranteed to be part of this list.public final Resource capacityResource()
resource()
for more details.public ActionAcceptance replicaActionAcceptance(ReplicaBalancingAction action, ClusterModel clusterModel)
DiskCapacityGoal.replicaActionAcceptance(ReplicaBalancingAction, ClusterModel)
and
NetworkInboundCapacityGoal.replicaActionAcceptance(ReplicaBalancingAction, ClusterModel)
).
(1) Check if leadership NW_OUT movement is acceptable: NW_OUT movement carries all of leader's NW_OUT load.
(2) Check if leadership CPU movement is acceptable: In reality, CPU movement carries only a fraction of
leader's CPU load.
To optimize CC performance, we avoid calculation of the expected leadership CPU utilization, and assume that
if (action.balancingAction() == ActionType.LEADERSHIP_MOVEMENT && resource() == Resource.CPU),
then the expected leadership CPU utilization would be the full CPU utilization of the leader.
(3) Check if leadership PRODUCE_IN movement is acceptable; Producers only produce to the leader replica.
## Replica Movement: impacts any resource. ## Replica Swap: impacts any resource.
action
- Action to be checked for acceptance.clusterModel
- The state of the cluster.ActionAcceptance.ACCEPT
if the action is acceptable by this goal,
ActionAcceptance.REPLICA_REJECT
otherwise.public ActionAcceptance partitionActionAcceptance(PartitionBalancingAction action, ClusterModel clusterModel)
action
- Action to be checked for acceptance.clusterModel
- The state of the cluster.ActionAcceptance.ACCEPT
if the action is acceptable by this goal,
ActionAcceptance.REPLICA_REJECT
otherwise.public ModelCompletenessRequirements clusterModelCompletenessRequirements()
Goal
public abstract String name()
name
in interface Goal
name
in class AbstractGoal
public boolean replicaActionSelfSatisfied(ClusterModel clusterModel, ReplicaBalancingAction action)
clusterModel
- The state of the cluster.action
- Action containing information about potential modification to the given cluster model.public boolean partitionActionSelfSatisfied(ClusterModel clusterModel, PartitionBalancingAction action)
GoalBalancingActionAcceptance
clusterModel
- The state of the cluster.action
- Action containing information about potential modification to the given cluster model.public void finish()
Goal
public List<Broker> eligibleBrokersReplicaMove(ClusterModel clusterModel, Resource.CompositeResource compositeResource)
clusterModel
- Current ClusterModel.compositeResource
- The resource for which utlization and capacity is used.