@Override
  public void perform() throws Exception {
    getLogger().info(String.format("Performing action: Batch restarting %d%% of region servers",
      (int) (ratio * 100)));
    List<ServerName> selectedServers =
      PolicyBasedChaosMonkey.selectRandomItems(getCurrentServers(), ratio);

    Set<ServerName> killedServers = new HashSet<>();

    for (ServerName server : selectedServers) {
      // Don't keep killing servers if we're
      // trying to stop the monkey.
      if (context.isStopping()) {
        break;
      }
      getLogger().info("Killing region server:" + server);
      cluster.killRegionServer(server);
      killedServers.add(server);
    }

    for (ServerName server : killedServers) {
      cluster.waitForRegionServerToStop(server, PolicyBasedChaosMonkey.TIMEOUT);
    }

    getLogger().info("Killed " + killedServers.size() + " region servers. Reported num of rs:"
      + cluster.getClusterMetrics().getLiveServerMetrics().size());

    sleep(sleepTime);

    for (ServerName server : killedServers) {
      getLogger().info("Starting region server:" + server.getHostname());
      cluster.startRegionServer(server.getHostname(), server.getPort());

    }
    for (ServerName server : killedServers) {
      cluster.waitForRegionServerToStart(server.getHostname(), server.getPort(),
        PolicyBasedChaosMonkey.TIMEOUT);
    }
    getLogger().info("Started " + killedServers.size() + " region servers. Reported num of rs:"
      + cluster.getClusterMetrics().getLiveServerMetrics().size());
  }
Restarts a ratio of the running regionservers at the same time
hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/BatchRestartRsAction.java