private void setupThrottleConfig(ClusterConfig clusterConfig, StateTransitionThrottleConfig.RebalanceType rebalanceType, int maxPending) { StateTransitionThrottleConfig resourceThrottle = new StateTransitionThrottleConfig(rebalanceType, StateTransitionThrottleConfig.ThrottleScope.RESOURCE, maxPending); clusterConfig.setStateTransitionThrottleConfigs(Arrays.asList(resourceThrottle)); }
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); }
private void preSetup(StateTransitionThrottleConfig.RebalanceType rebalanceType, Set<String> resourceSet, int numOfLiveInstances, int numOfReplicas) { setupIdealState(numOfLiveInstances, resourceSet.toArray(new String[resourceSet.size()]), numOfLiveInstances, numOfReplicas, IdealState.RebalanceMode.FULL_AUTO, "OnlineOffline"); setupStateModel(); setupLiveInstances(numOfLiveInstances); // Set up cluster configs _clusterConfig = accessor.getProperty(accessor.keyBuilder().clusterConfig()); StateTransitionThrottleConfig throttleConfig = new StateTransitionThrottleConfig(rebalanceType, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, Integer.MAX_VALUE); _clusterConfig.setStateTransitionThrottleConfigs(Collections.singletonList(throttleConfig)); setClusterConfig(_clusterConfig); } }
private void preSetup(StateTransitionThrottleConfig.RebalanceType rebalanceType, Set<String> resourceSet, int numOfLiveInstances, int numOfReplicas, String stateModelName) { setupIdealState(numOfLiveInstances, resourceSet.toArray(new String[resourceSet.size()]), numOfLiveInstances, numOfReplicas, IdealState.RebalanceMode.FULL_AUTO, stateModelName); setupStateModel(); setupLiveInstances(numOfLiveInstances); // Set up cluster configs _clusterConfig = accessor.getProperty(accessor.keyBuilder().clusterConfig()); StateTransitionThrottleConfig throttleConfig = new StateTransitionThrottleConfig(rebalanceType, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, Integer.MAX_VALUE); _clusterConfig.setStateTransitionThrottleConfigs(Collections.singletonList(throttleConfig)); setClusterConfig(_clusterConfig); } }
private void preSetup(StateTransitionThrottleConfig.RebalanceType rebalanceType, Set<String> resourceSet, String priorityField, int numOfLiveInstances, int numOfReplicas) { setupIdealState(numOfLiveInstances, resourceSet.toArray(new String[resourceSet.size()]), numOfLiveInstances, numOfReplicas, IdealState.RebalanceMode.FULL_AUTO, "MasterSlave"); setupStateModel(); setupLiveInstances(numOfLiveInstances); // Set up cluster configs ClusterConfig clusterConfig = accessor.getProperty(accessor.keyBuilder().clusterConfig()); StateTransitionThrottleConfig throttleConfig = new StateTransitionThrottleConfig(rebalanceType, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 1); clusterConfig.setStateTransitionThrottleConfigs(Collections.singletonList(throttleConfig)); clusterConfig.setResourcePriorityField(priorityField); setClusterConfig(clusterConfig); }
private void setupCluster(String clusterName, ZKHelixDataAccessor accessor) throws Exception { TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start port "localhost", // participant name prefix resourceNamePrefix, // resource name prefix 1, // resources 15, // partitions per resource participantCount, // number of nodes 3, // replicas "MasterSlave", IdealState.RebalanceMode.FULL_AUTO, true); // do rebalance 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); }
clusterConfig.getStateTransitionThrottleConfigs(); currentThrottleConfig.add(throttleConfigForLoadRebalance); clusterConfig.setStateTransitionThrottleConfigs(currentThrottleConfig); setClusterConfig(clusterConfig);
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); }
StateTransitionThrottleConfig.RebalanceType.RECOVERY_BALANCE, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 100)); clusterConfig.setStateTransitionThrottleConfigs(throttleConfigs); accessor.setProperty(keyBuilder.clusterConfig(), clusterConfig);