gpt4 book ai didi

org.apache.helix.controller.rebalancer.constraint.dataprovider.ZkBasedCapacityProvider.updateCapacity()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:48:10 27 4
gpt4 key购买 nike

本文整理了Java中org.apache.helix.controller.rebalancer.constraint.dataprovider.ZkBasedCapacityProvider.updateCapacity()方法的一些代码示例,展示了ZkBasedCapacityProvider.updateCapacity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkBasedCapacityProvider.updateCapacity()方法的具体详情如下:
包路径:org.apache.helix.controller.rebalancer.constraint.dataprovider.ZkBasedCapacityProvider
类名称:ZkBasedCapacityProvider
方法名:updateCapacity

ZkBasedCapacityProvider.updateCapacity介绍

[英]Update capacity information.
[中]更新容量信息。

代码示例

代码示例来源:origin: apache/helix

capacityProvider.updateCapacity(capacity, usage, 0);

代码示例来源:origin: apache/helix

@Test
public void testRebalanceUsingZkDataProvider() {
 // capacity / weight
 Map<String, Integer> capacity = new HashMap<>();
 for (String instance : instanceNames) {
  capacity.put(instance, defaultCapacity);
 }
 ZkBasedPartitionWeightProvider weightProvider =
   new ZkBasedPartitionWeightProvider(ZK_ADDR, CLUSTER_NAME, "QPS");
 weightProvider.updateWeights(Collections.EMPTY_MAP, Collections.EMPTY_MAP, resourceWeight);
 ZkBasedCapacityProvider capacityProvider =
   new ZkBasedCapacityProvider(ZK_ADDR, CLUSTER_NAME, "QPS");
 capacityProvider.updateCapacity(capacity, Collections.EMPTY_MAP, 0);
 TotalCapacityConstraint capacityConstraint =
   new TotalCapacityConstraint(weightProvider, capacityProvider);
 PartitionWeightAwareEvennessConstraint evenConstraint =
   new PartitionWeightAwareEvennessConstraint(weightProvider, capacityProvider);
 WeightAwareRebalanceUtil util = new WeightAwareRebalanceUtil(clusterConfig, instanceConfigs);
 ResourcesStateMap assignment = util.buildIncrementalRebalanceAssignment(resourceConfigs, null,
   Collections.<AbstractRebalanceHardConstraint>singletonList(capacityConstraint),
   Collections.<AbstractRebalanceSoftConstraint>singletonList(evenConstraint));
 Map<String, Integer> weightCount = checkPartitionUsage(assignment, weightProvider);
 int max = Collections.max(weightCount.values());
 int min = Collections.min(weightCount.values());
 // Since the accuracy of Default evenness constraint is 0.01, diff should be 1/100 of participant capacity in max.
 Assert.assertTrue((max - min) <= defaultCapacity / 100);
}

代码示例来源:origin: apache/helix

capacityProvider.updateCapacity(capacity, usage, defaultCapacity);
capacityProvider.updateCapacity(Collections.EMPTY_MAP,
  Collections.singletonMap(targetInstanceName, newUsgae), defaultCapacity);
Assert.assertEquals(capacityProvider.getParticipantUsage(targetInstanceName), newUsgae);
capacityProvider.updateCapacity(Collections.EMPTY_MAP, Collections.EMPTY_MAP, -1);
try {
 capacityProvider.persistCapacity();

代码示例来源:origin: org.apache.helix/helix-core

ZkBasedCapacityProvider qpsCapacityProvider =
  new ZkBasedCapacityProvider(ZK_ADDRESS, CLUSTER_NAME, "QPS");
qpsCapacityProvider.updateCapacity(Collections.EMPTY_MAP, Collections.EMPTY_MAP, defaultCapacity);
ZkBasedCapacityProvider memoryCapacityProvider =
  new ZkBasedCapacityProvider(ZK_ADDRESS, CLUSTER_NAME, "MEM");
memoryCapacityProvider.updateCapacity(Collections.EMPTY_MAP, Collections.EMPTY_MAP, defaultCapacity);

代码示例来源:origin: apache/helix

ZkBasedCapacityProvider qpsCapacityProvider =
  new ZkBasedCapacityProvider(ZK_ADDRESS, CLUSTER_NAME, "QPS");
qpsCapacityProvider.updateCapacity(Collections.EMPTY_MAP, Collections.EMPTY_MAP, defaultCapacity);
ZkBasedCapacityProvider memoryCapacityProvider =
  new ZkBasedCapacityProvider(ZK_ADDRESS, CLUSTER_NAME, "MEM");
memoryCapacityProvider.updateCapacity(Collections.EMPTY_MAP, Collections.EMPTY_MAP, defaultCapacity);

代码示例来源:origin: apache/helix

capacityProvider.updateCapacity(capacity, Collections.EMPTY_MAP, 0);

代码示例来源:origin: apache/helix

capacityProvider.updateCapacity(capacity, Collections.EMPTY_MAP, 0);

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com