@Override
  void prepare(BalancerClusterState cluster) {
    super.prepare(cluster);
    cost.prepare(cluster.numServers);
    cost.applyCostsChange(costs -> {
      for (int i = 0; i < cluster.numServers; i++) {
        costs[i] = cluster.regionsPerServer[i].length;
      }
    });
  }
Compute the cost of a potential cluster state from skew in number of regions on a cluster.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionCountSkewCostFunction.java