Search in sources :

Example 1 with RandomReadTest

use of org.apache.hadoop.hbase.PerformanceEvaluation.RandomReadTest in project hbase by apache.

the class TestPerformanceEvaluation method testZipfian.

@Test
public void testZipfian() throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    TestOptions opts = new PerformanceEvaluation.TestOptions();
    opts.setValueZipf(true);
    final int valueSize = 1024;
    opts.setValueSize(valueSize);
    RandomReadTest rrt = new RandomReadTest(null, opts, null);
    Constructor<?> ctor = Histogram.class.getDeclaredConstructor(com.codahale.metrics.Reservoir.class);
    ctor.setAccessible(true);
    Histogram histogram = (Histogram) ctor.newInstance(new UniformReservoir(1024 * 500));
    for (int i = 0; i < 100; i++) {
        histogram.update(rrt.getValueLength(null));
    }
    Snapshot snapshot = histogram.getSnapshot();
    double stddev = snapshot.getStdDev();
    assertTrue(stddev != 0 && stddev != 1.0);
    assertTrue(snapshot.getStdDev() != 0);
    double median = snapshot.getMedian();
    assertTrue(median != 0 && median != 1 && median != valueSize);
}
Also used : RandomReadTest(org.apache.hadoop.hbase.PerformanceEvaluation.RandomReadTest) Snapshot(com.codahale.metrics.Snapshot) Histogram(com.codahale.metrics.Histogram) TestOptions(org.apache.hadoop.hbase.PerformanceEvaluation.TestOptions) UniformReservoir(com.codahale.metrics.UniformReservoir) RandomReadTest(org.apache.hadoop.hbase.PerformanceEvaluation.RandomReadTest) Test(org.junit.Test)

Aggregations

Histogram (com.codahale.metrics.Histogram)1 Snapshot (com.codahale.metrics.Snapshot)1 UniformReservoir (com.codahale.metrics.UniformReservoir)1 RandomReadTest (org.apache.hadoop.hbase.PerformanceEvaluation.RandomReadTest)1 TestOptions (org.apache.hadoop.hbase.PerformanceEvaluation.TestOptions)1 Test (org.junit.Test)1