@Override
  public void perform() throws Exception {
    ClusterMetrics status = this.cluster.getClusterMetrics();
    List<ServerName> victimServers = new ArrayList<>(status.getLiveServerMetrics().keySet());
    Set<ServerName> killedServers = new HashSet<>();
    int liveCount = (int) Math.ceil(FRC_SERVERS_THAT_HOARD_AND_LIVE * victimServers.size());
    int deadCount = (int) Math.ceil(FRC_SERVERS_THAT_HOARD_AND_DIE * victimServers.size());
    Assert.assertTrue("There are not enough victim servers: " + victimServers.size(),
      liveCount + deadCount < victimServers.size());
    Random rand = ThreadLocalRandom.current();
    List<ServerName> targetServers = new ArrayList<>(liveCount);
    for (int i = 0; i < liveCount + deadCount; ++i) {
      int victimIx = rand.nextInt(victimServers.size());
      targetServers.add(victimServers.remove(victimIx));
    }
    unbalanceRegions(status, victimServers, targetServers, HOARD_FRC_OF_REGIONS);
    Thread.sleep(waitForUnbalanceMilliSec);
    ServerName metaServer = cluster.getServerHoldingMeta();
    for (ServerName targetServer : targetServers) {
      // Don't keep killing servers if we're
      // trying to stop the monkey.
      if (context.isStopping()) {
        break;
      }
      if (killedServers.size() >= liveCount) {
        break;
      }

      if (!killMetaRs && targetServer.equals(metaServer)) {
        getLogger().info("Not killing server because it holds hbase:meta.");
      } else {
        killRs(targetServer);
        killedServers.add(targetServer);
      }
    }

    Thread.sleep(waitForKillsMilliSec);
    forceBalancer();
    Thread.sleep(waitAfterBalanceMilliSec);
    for (ServerName server : killedServers) {
      startRs(server);
    }
  }
Waits between calling unbalance and killing servers, kills and rebalance, and rebalance and
restarting the servers; to make sure these events have time to impact the cluster.
hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/UnbalanceKillAndRebalanceAction.java