private Pair<Double, Long> generateAndFlushData(Table table) throws IOException {
    // Internally, throughput is controlled after every cell write, so keep value size less for
    // better control.
    final int NUM_FLUSHES = 3, NUM_PUTS = 50, VALUE_SIZE = 200 * 1024;
    long duration = 0;
    for (int i = 0; i < NUM_FLUSHES; i++) {
      // Write about 10M (10 times of throughput rate) per iteration.
      for (int j = 0; j < NUM_PUTS; j++) {
        byte[] value = new byte[VALUE_SIZE];
        Bytes.random(value);
        table.put(new Put(Bytes.toBytes(i * 10 + j)).addColumn(family, qualifier, value));
      }
      long startTime = System.nanoTime();
      hbtu.getHBaseCluster().getRegions(tableName).stream().findFirst().ifPresent(r -> {
        try {
          r.flush(true);
        } catch (IOException e) {
          LOG.error("Failed flush region {}", r, e);
          fail("Failed flush region " + r.getRegionInfo().getRegionNameAsString());
        }
      });
      duration += System.nanoTime() - startTime;
    }
    HStore store = getStoreWithName(tableName);
    assertEquals(NUM_FLUSHES, store.getStorefilesCount());
    double throughput =
      (double) store.getStorefilesSize() / TimeUnit.NANOSECONDS.toSeconds(duration);
    return new Pair<>(throughput, duration);
  }
Writes Puts to the table and flushes few times.
@return {@link Pair} of (throughput, duration).
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/throttle/TestFlushWithThroughputController.java