use of org.apache.helix.api.config.StateTransitionThrottleConfig in project helix by apache.
the class TestStateTransitionThrottle method setupCluster.
private void setupCluster(String clusterName, ZKHelixDataAccessor accessor) throws Exception {
// participant start port
TestHelper.setupCluster(// participant start port
clusterName, // participant start port
ZK_ADDR, // participant start port
12918, // participant name prefix
"localhost", // resource name prefix
resourceNamePrefix, // resources
1, // partitions per resource
15, // number of nodes
participantCount, // replicas
3, "MasterSlave", IdealState.RebalanceMode.FULL_AUTO, // do rebalance
true);
PropertyKey.Builder keyBuilder = accessor.keyBuilder();
ClusterConfig clusterConfig = accessor.getProperty(accessor.keyBuilder().clusterConfig());
clusterConfig.setResourcePriorityField("Name");
List<StateTransitionThrottleConfig> throttleConfigs = new ArrayList<>();
throttleConfigs.add(new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.LOAD_BALANCE, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 100));
throttleConfigs.add(new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.RECOVERY_BALANCE, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 100));
clusterConfig.setStateTransitionThrottleConfigs(throttleConfigs);
accessor.setProperty(keyBuilder.clusterConfig(), clusterConfig);
}
use of org.apache.helix.api.config.StateTransitionThrottleConfig in project helix by apache.
the class TestPartitionMovementThrottle method setupThrottleConfig.
private void setupThrottleConfig() {
ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME);
StateTransitionThrottleConfig resourceLoadThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.LOAD_BALANCE, StateTransitionThrottleConfig.ThrottleScope.RESOURCE, 2);
StateTransitionThrottleConfig instanceLoadThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.LOAD_BALANCE, StateTransitionThrottleConfig.ThrottleScope.INSTANCE, 2);
StateTransitionThrottleConfig clusterLoadThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.LOAD_BALANCE, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 100);
StateTransitionThrottleConfig resourceRecoveryThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.RECOVERY_BALANCE, StateTransitionThrottleConfig.ThrottleScope.RESOURCE, 3);
StateTransitionThrottleConfig clusterRecoveryThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.RECOVERY_BALANCE, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 100);
clusterConfig.setStateTransitionThrottleConfigs(Arrays.asList(resourceLoadThrottle, instanceLoadThrottle, clusterLoadThrottle, resourceRecoveryThrottle, clusterRecoveryThrottle));
clusterConfig.setPersistIntermediateAssignment(true);
_configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
}
use of org.apache.helix.api.config.StateTransitionThrottleConfig in project helix by apache.
the class TestPartitionMovementThrottle method setSingleThrottlingConfig.
private void setSingleThrottlingConfig(StateTransitionThrottleConfig.RebalanceType rebalanceType, StateTransitionThrottleConfig.ThrottleScope scope, int maxStateTransitions) {
ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME);
StateTransitionThrottleConfig anyTypeInstanceThrottle = new StateTransitionThrottleConfig(rebalanceType, scope, maxStateTransitions);
List<StateTransitionThrottleConfig> currentThrottleConfigs = clusterConfig.getStateTransitionThrottleConfigs();
currentThrottleConfigs.add(anyTypeInstanceThrottle);
clusterConfig.setStateTransitionThrottleConfigs(currentThrottleConfigs);
_configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
}
use of org.apache.helix.api.config.StateTransitionThrottleConfig in project helix by apache.
the class TestRebalancerMetrics method setupThrottleConfig.
private void setupThrottleConfig(ClusterConfig clusterConfig, StateTransitionThrottleConfig.RebalanceType rebalanceType, int maxPending) {
StateTransitionThrottleConfig resourceThrottle = new StateTransitionThrottleConfig(rebalanceType, StateTransitionThrottleConfig.ThrottleScope.RESOURCE, maxPending);
clusterConfig.setStateTransitionThrottleConfigs(Arrays.asList(resourceThrottle));
}
Aggregations