void selectReplica() {
    Random random = new Random();
    List<? extends ReplicaId> allReplicaIds = clusterMap.getReplicaIds(dataNodeId);

    Map<DiskId, List<ReplicaId>> diskIdToReplicaIds = new HashMap<>();
    allReplicaIds.forEach(replicaId -> {
      diskIdToReplicaIds.putIfAbsent(replicaId.getDiskId(), new ArrayList<>());
      if (!replicaId.isUnsealed()) {
        return;
      }
      diskIdToReplicaIds.get(replicaId.getDiskId()).add(replicaId);
    });

    diskIdToReplicaIds.keySet().forEach(diskId -> {
      List<ReplicaId> replicaIds = diskIdToReplicaIds.get(diskId);

      if (replicaIds.size() < config.serverPerformancePutTestPartitionCountPerDisk) {
        throw new IllegalArgumentException("disk does not have enough replicas " + diskId);
      }

      for (int i = 0; i < config.serverPerformancePutTestPartitionCountPerDisk; i++) {
        int randomIndex = random.nextInt(replicaIds.size());
        replicaIdsSelected.add(replicaIds.get(randomIndex));
        replicaIds.set(randomIndex, replicaIds.get(replicaIds.size() - 1));
        replicaIds.remove(replicaIds.size() - 1);
      }
    });
  }
Selects {@link ServerPerformanceConfig#serverPerformancePutTestPartitionCountPerDisk} unsealed replicas randomly for
each disk in the {@link #dataNodeId} and stores these in {@link #replicaIdsSelected}
ambry-tools/src/main/java/com/github/ambry/tools/perf/serverperf/PutLoadProducerConsumer.java