@Override
  void prepare(BalancerClusterState cluster) {
    super.prepare(cluster);
    costsPerTable = new DoubleArrayCost[cluster.numTables];
    for (int tableIdx = 0; tableIdx < cluster.numTables; tableIdx++) {
      costsPerTable[tableIdx] = new DoubleArrayCost();
      costsPerTable[tableIdx].prepare(cluster.numServers);
      final int tableIndex = tableIdx;
      costsPerTable[tableIdx].applyCostsChange(costs -> {
        // Keep a cached deep copy for change-only recomputation
        for (int i = 0; i < cluster.numServers; i++) {
          costs[i] = cluster.numRegionsPerServerPerTable[tableIndex][i];
        }
      });
    }
  }
Compute the cost of a potential cluster configuration based upon how evenly distributed tables
are.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/TableSkewCostFunction.java