Search in sources :

Example 61 with Benchmark

use of org.openjdk.jmh.annotations.Benchmark in project druid by druid-io.

the class SearchBenchmark method querySingleQueryableIndex.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndex(Blackhole blackhole) throws Exception {
    final QueryRunner<Result<SearchResultValue>> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex", new QueryableIndexSegment("qIndex", qIndexes.get(0)));
    List<Result<SearchResultValue>> results = SearchBenchmark.runQuery(factory, runner, query);
    List<SearchHit> hits = results.get(0).getValue().getValue();
    for (SearchHit hit : hits) {
        blackhole.consume(hit);
    }
}
Also used : QueryableIndexSegment(io.druid.segment.QueryableIndexSegment) SearchHit(io.druid.query.search.search.SearchHit) Result(io.druid.query.Result) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Example 62 with Benchmark

use of org.openjdk.jmh.annotations.Benchmark in project druid by druid-io.

the class SelectBenchmark method queryIncrementalIndex.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void queryIncrementalIndex(Blackhole blackhole) throws Exception {
    SelectQuery queryCopy = query.withPagingSpec(PagingSpec.newSpec(pagingThreshold));
    String segmentId = "incIndex";
    QueryRunner<Row> runner = QueryBenchmarkUtil.makeQueryRunner(factory, segmentId, new IncrementalIndexSegment(incIndexes.get(0), segmentId));
    boolean done = false;
    while (!done) {
        List<Result<SelectResultValue>> results = SelectBenchmark.runQuery(factory, runner, queryCopy);
        SelectResultValue result = results.get(0).getValue();
        if (result.getEvents().size() == 0) {
            done = true;
        } else {
            for (EventHolder eh : result.getEvents()) {
                blackhole.consume(eh);
            }
            queryCopy = incrementQueryPagination(queryCopy, result);
        }
    }
}
Also used : SelectQuery(io.druid.query.select.SelectQuery) SelectResultValue(io.druid.query.select.SelectResultValue) IncrementalIndexSegment(io.druid.segment.IncrementalIndexSegment) InputRow(io.druid.data.input.InputRow) Row(io.druid.data.input.Row) EventHolder(io.druid.query.select.EventHolder) Result(io.druid.query.Result) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Example 63 with Benchmark

use of org.openjdk.jmh.annotations.Benchmark in project druid by druid-io.

the class SelectBenchmark method queryQueryableIndex.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void queryQueryableIndex(Blackhole blackhole) throws Exception {
    SelectQuery queryCopy = query.withPagingSpec(PagingSpec.newSpec(pagingThreshold));
    String segmentId = "qIndex";
    QueryRunner<Result<SelectResultValue>> runner = QueryBenchmarkUtil.makeQueryRunner(factory, segmentId, new QueryableIndexSegment(segmentId, qIndexes.get(0)));
    boolean done = false;
    while (!done) {
        List<Result<SelectResultValue>> results = SelectBenchmark.runQuery(factory, runner, queryCopy);
        SelectResultValue result = results.get(0).getValue();
        if (result.getEvents().size() == 0) {
            done = true;
        } else {
            for (EventHolder eh : result.getEvents()) {
                blackhole.consume(eh);
            }
            queryCopy = incrementQueryPagination(queryCopy, result);
        }
    }
}
Also used : SelectQuery(io.druid.query.select.SelectQuery) QueryableIndexSegment(io.druid.segment.QueryableIndexSegment) SelectResultValue(io.druid.query.select.SelectResultValue) EventHolder(io.druid.query.select.EventHolder) Result(io.druid.query.Result) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Example 64 with Benchmark

use of org.openjdk.jmh.annotations.Benchmark in project druid by druid-io.

the class TopNBenchmark method querySingleIncrementalIndex.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleIncrementalIndex(Blackhole blackhole) throws Exception {
    QueryRunner<Result<TopNResultValue>> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "incIndex", new IncrementalIndexSegment(incIndexes.get(0), "incIndex"));
    List<Result<TopNResultValue>> results = TopNBenchmark.runQuery(factory, runner, query);
    for (Result<TopNResultValue> result : results) {
        blackhole.consume(result);
    }
}
Also used : TopNResultValue(io.druid.query.topn.TopNResultValue) IncrementalIndexSegment(io.druid.segment.IncrementalIndexSegment) Result(io.druid.query.Result) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Example 65 with Benchmark

use of org.openjdk.jmh.annotations.Benchmark in project druid by druid-io.

the class SqlBenchmark method queryNative.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void queryNative(Blackhole blackhole) throws Exception {
    final Sequence<Row> resultSequence = groupByQuery.run(walker, Maps.<String, Object>newHashMap());
    final ArrayList<Row> resultList = Sequences.toList(resultSequence, Lists.<Row>newArrayList());
    for (Row row : resultList) {
        blackhole.consume(row);
    }
}
Also used : InputRow(io.druid.data.input.InputRow) Row(io.druid.data.input.Row) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Aggregations

Benchmark (org.openjdk.jmh.annotations.Benchmark)142 BenchmarkMode (org.openjdk.jmh.annotations.BenchmarkMode)96 OutputTimeUnit (org.openjdk.jmh.annotations.OutputTimeUnit)93 QueryableIndexSegment (io.druid.segment.QueryableIndexSegment)37 Result (io.druid.query.Result)27 InputRow (io.druid.data.input.InputRow)25 Row (io.druid.data.input.Row)21 ArrayList (java.util.ArrayList)17 TopNResultValue (io.druid.query.topn.TopNResultValue)15 Cursor (io.druid.segment.Cursor)15 ImmutableBitmap (io.druid.collections.bitmap.ImmutableBitmap)13 QueryableIndexStorageAdapter (io.druid.segment.QueryableIndexStorageAdapter)13 StorageAdapter (io.druid.segment.StorageAdapter)13 List (java.util.List)13 BoundDimFilter (io.druid.query.filter.BoundDimFilter)9 DimFilter (io.druid.query.filter.DimFilter)9 OperationsPerInvocation (org.openjdk.jmh.annotations.OperationsPerInvocation)9 Page (com.facebook.presto.spi.Page)8 OrDimFilter (io.druid.query.filter.OrDimFilter)8 SelectorDimFilter (io.druid.query.filter.SelectorDimFilter)8