HBASE-10511 Add latency percentiles on PerformanceEvaluation

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1567867 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
nkeywal 2014-02-13 09:09:13 +00:00
parent 39fb8c4666
commit d5047681e0
1 changed files with 17 additions and 3 deletions

View File

@ -39,6 +39,7 @@ import java.util.regex.Pattern;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured; import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataInputStream;
@ -1120,7 +1121,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
static class RandomReadTest extends Test { static class RandomReadTest extends Test {
private final int everyN; private final int everyN;
private final boolean reportLatency; private final boolean reportLatency;
private final float[] times; private final double[] times;
int idx = 0; int idx = 0;
RandomReadTest(Configuration conf, TestOptions options, Status status) { RandomReadTest(Configuration conf, TestOptions options, Status status) {
@ -1129,7 +1130,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
LOG.info("Sampling 1 every " + everyN + " out of " + perClientRunRows + " total rows."); LOG.info("Sampling 1 every " + everyN + " out of " + perClientRunRows + " total rows.");
this.reportLatency = options.isReportLatency(); this.reportLatency = options.isReportLatency();
if (this.reportLatency) { if (this.reportLatency) {
times = new float[(int) Math.ceil(this.perClientRunRows * this.sampleRate)]; times = new double[(int) Math.ceil(this.perClientRunRows * this.sampleRate)];
} else { } else {
times = null; times = null;
} }
@ -1158,7 +1159,20 @@ public class PerformanceEvaluation extends Configured implements Tool {
protected void testTakedown() throws IOException { protected void testTakedown() throws IOException {
super.testTakedown(); super.testTakedown();
if (this.reportLatency) { if (this.reportLatency) {
LOG.info("randomRead latency log (ms): " + Arrays.toString(times)); DescriptiveStatistics ds;
Arrays.sort(times);
ds = new DescriptiveStatistics(times);
LOG.info("randomRead latency log (ms), on " + times.length + " measures");
LOG.info("99.9999% = " + ds.getPercentile(99.9999d));
LOG.info(" 99.999% = " + ds.getPercentile(99.999d));
LOG.info(" 99.99% = " + ds.getPercentile(99.99d));
LOG.info(" 99.9% = " + ds.getPercentile(99.9d));
LOG.info(" 99% = " + ds.getPercentile(99d));
LOG.info(" 95% = " + ds.getPercentile(95d));
LOG.info(" 90% = " + ds.getPercentile(90d));
LOG.info(" 80% = " + ds.getPercentile(80d));
LOG.info("Standard Deviation = " + ds.getStandardDeviation());
LOG.info("Mean = " + ds.getMean());
} }
} }
} }