Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8fd71b5
Benchmarks: New SqlBenchmark, add caching & vectorization to some oth…
gianm Jan 1, 2019
d3731fd
Query vectorization.
gianm Jan 2, 2019
f872d70
WIP
gianm Jan 2, 2019
8ebe268
Adjustments for unused things.
gianm Jan 2, 2019
76c573a
Adjust javadocs.
gianm Jan 2, 2019
27af43d
DimensionDictionarySelector adjustments.
gianm Jan 3, 2019
b736cff
Merge branch 'master' into vectoreyes
gianm Jan 14, 2019
7137f8b
Add "clone" to BatchIteratorAdapter.
gianm Jan 14, 2019
021db8b
Merge branch 'master' into vectoreyes
gianm Jan 21, 2019
d5a5d3e
Merge branch 'master' into vectoreyes
gianm Jan 21, 2019
4a58ce9
Merge branch 'master' into vectoreyes
gianm Jan 27, 2019
95fc06d
Merge branch 'master' into vectoreyes
gianm Feb 18, 2019
5a7f6c2
ValueMatcher javadocs.
gianm Feb 18, 2019
94b903e
Fix benchmark.
gianm Feb 18, 2019
1d5c3e0
Merge branch 'master' into vectoreyes
gianm Jul 5, 2019
7395a0a
Fixups post-merge.
gianm Jul 5, 2019
360bb6d
Expect exception on testGroupByWithStringVirtualColumn for Incrementa…
gianm Jul 5, 2019
ec3abee
BloomDimFilterSqlTest: Tag two non-vectorizable tests.
gianm Jul 5, 2019
8d4f349
Minor adjustments.
gianm Jul 5, 2019
c741777
Update surefire, bump up Xmx in Travis.
gianm Jul 5, 2019
ed0a1bc
Merge branch 'master' into vectoreyes
gianm Jul 5, 2019
e633cd5
Some more adjustments.
gianm Jul 9, 2019
496484b
Javadoc adjustments
gianm Jul 9, 2019
f1a4667
AggregatorAdapters adjustments.
gianm Jul 9, 2019
e6e7b49
Merge branch 'master' into vectoreyes
gianm Jul 10, 2019
791c3c9
Additional comments.
gianm Jul 10, 2019
b2de180
Merge branch 'master' into vectoreyes
gianm Jul 11, 2019
8156fd3
Remove switching search.
gianm Jul 11, 2019
f2e6392
Only missiles.
gianm Jul 11, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ matrix:
before_script: unset _JAVA_OPTIONS
script:
# Set MAVEN_OPTS for Surefire launcher
- MAVEN_OPTS='-Xmx512m' mvn test -B -pl processing
- MAVEN_OPTS='-Xmx800m' mvn test -B -pl processing
- sh -c "dmesg | egrep -i '(oom|out of memory|kill process|killed).*' -C 1 || exit 0"
- free -m

Expand All @@ -71,7 +71,7 @@ matrix:
before_script: unset _JAVA_OPTIONS
script:
# Set MAVEN_OPTS for Surefire launcher
- MAVEN_OPTS='-Xmx512m' mvn test -B -Ddruid.generic.useDefaultValueForNull=false -pl processing
- MAVEN_OPTS='-Xmx800m' mvn test -B -Ddruid.generic.useDefaultValueForNull=false -pl processing
- sh -c "dmesg | egrep -i '(oom|out of memory|kill process|killed).*' -C 1 || exit 0"
- free -m

Expand All @@ -82,7 +82,7 @@ matrix:
before_script: unset _JAVA_OPTIONS
script:
# Set MAVEN_OPTS for Surefire launcher
- MAVEN_OPTS='-Xmx512m' mvn test -B -pl server
- MAVEN_OPTS='-Xmx800m' mvn test -B -pl server

# server module test with SQL Compatibility enabled
- env:
Expand All @@ -91,7 +91,7 @@ matrix:
before_script: unset _JAVA_OPTIONS
script:
# Set MAVEN_OPTS for Surefire launcher
- MAVEN_OPTS='-Xmx512m' mvn test -B -pl server -Ddruid.generic.useDefaultValueForNull=false
- MAVEN_OPTS='-Xmx800m' mvn test -B -pl server -Ddruid.generic.useDefaultValueForNull=false


# other modules test
Expand All @@ -101,7 +101,7 @@ matrix:
before_script: unset _JAVA_OPTIONS
script:
# Set MAVEN_OPTS for Surefire launcher
- MAVEN_OPTS='-Xmx512m' mvn test -B -pl '!processing,!server'
- MAVEN_OPTS='-Xmx800m' mvn test -B -pl '!processing,!server'
- sh -c "dmesg | egrep -i '(oom|out of memory|kill process|killed).*' -C 1 || exit 0"
- free -m

Expand All @@ -112,7 +112,7 @@ matrix:
before_script: unset _JAVA_OPTIONS
script:
# Set MAVEN_OPTS for Surefire launcher
- MAVEN_OPTS='-Xmx512m' mvn test -B -Ddruid.generic.useDefaultValueForNull=false -pl '!processing,!server'
- MAVEN_OPTS='-Xmx800m' mvn test -B -Ddruid.generic.useDefaultValueForNull=false -pl '!processing,!server'
- sh -c "dmesg | egrep -i '(oom|out of memory|kill process|killed).*' -C 1 || exit 0"
- free -m

Expand Down
12 changes: 12 additions & 0 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,24 @@
<version>${project.parent.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.druid</groupId>
<artifactId>druid-core</artifactId>
<version>${project.parent.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.druid</groupId>
<artifactId>druid-processing</artifactId>
<version>${project.parent.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.druid</groupId>
<artifactId>druid-server</artifactId>
<version>${project.parent.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.druid</groupId>
<artifactId>druid-sql</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.druid.java.util.common.Intervals;
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.java.util.common.guava.Sequence;
import org.apache.druid.java.util.common.io.Closer;
import org.apache.druid.js.JavaScriptConfig;
import org.apache.druid.query.aggregation.BufferAggregator;
import org.apache.druid.query.aggregation.DoubleSumAggregatorFactory;
Expand Down Expand Up @@ -73,15 +74,17 @@ public class ExpressionAggregationBenchmark
@Param({"1000000"})
private int rowsPerSegment;

private SegmentGenerator segmentGenerator;
private QueryableIndex index;
private JavaScriptAggregatorFactory javaScriptAggregatorFactory;
private DoubleSumAggregatorFactory expressionAggregatorFactory;
private ByteBuffer aggregationBuffer = ByteBuffer.allocate(Double.BYTES);
private Closer closer;

@Setup(Level.Trial)
public void setup()
{
this.closer = Closer.create();

final BenchmarkSchemaInfo schemaInfo = new BenchmarkSchemaInfo(
ImmutableList.of(
BenchmarkColumnSchema.makeNormal("x", ValueType.FLOAT, false, 1, 0d, 0d, 10000d, false),
Expand All @@ -99,8 +102,10 @@ public void setup()
.shardSpec(new LinearShardSpec(0))
.build();

this.segmentGenerator = new SegmentGenerator();
this.index = segmentGenerator.generate(dataSegment, schemaInfo, Granularities.NONE, rowsPerSegment);
final SegmentGenerator segmentGenerator = closer.register(new SegmentGenerator());
this.index = closer.register(
segmentGenerator.generate(dataSegment, schemaInfo, Granularities.NONE, rowsPerSegment)
);
this.javaScriptAggregatorFactory = new JavaScriptAggregatorFactory(
"name",
ImmutableList.of("x", "y"),
Expand All @@ -120,15 +125,7 @@ public void setup()
@TearDown(Level.Trial)
public void tearDown() throws Exception
{
if (index != null) {
index.close();
index = null;
}

if (segmentGenerator != null) {
segmentGenerator.close();
segmentGenerator = null;
}
closer.close();
}

@Benchmark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.druid.java.util.common.Intervals;
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.java.util.common.guava.Sequence;
import org.apache.druid.java.util.common.io.Closer;
import org.apache.druid.query.dimension.DefaultDimensionSpec;
import org.apache.druid.query.dimension.ExtractionDimensionSpec;
import org.apache.druid.query.expression.TestExprMacroTable;
Expand Down Expand Up @@ -72,12 +73,14 @@ public class ExpressionSelectorBenchmark
@Param({"1000000"})
private int rowsPerSegment;

private SegmentGenerator segmentGenerator;
private QueryableIndex index;
private Closer closer;

@Setup(Level.Trial)
public void setup()
{
this.closer = Closer.create();

final BenchmarkSchemaInfo schemaInfo = new BenchmarkSchemaInfo(
ImmutableList.of(
BenchmarkColumnSchema.makeZipf(
Expand Down Expand Up @@ -113,22 +116,16 @@ public void setup()
.shardSpec(new LinearShardSpec(0))
.build();

this.segmentGenerator = new SegmentGenerator();
this.index = segmentGenerator.generate(dataSegment, schemaInfo, Granularities.HOUR, rowsPerSegment);
final SegmentGenerator segmentGenerator = closer.register(new SegmentGenerator());
this.index = closer.register(
segmentGenerator.generate(dataSegment, schemaInfo, Granularities.HOUR, rowsPerSegment)
);
}

@TearDown(Level.Trial)
public void tearDown() throws Exception
{
if (index != null) {
index.close();
index = null;
}

if (segmentGenerator != null) {
segmentGenerator.close();
segmentGenerator = null;
}
closer.close();
}

@Benchmark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.apache.druid.benchmark;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.Files;
import org.apache.commons.io.FileUtils;
import org.apache.druid.benchmark.datagen.BenchmarkDataGenerator;
Expand All @@ -32,7 +33,6 @@
import org.apache.druid.java.util.common.granularity.Granularities;
import org.apache.druid.java.util.common.guava.Sequence;
import org.apache.druid.java.util.common.logger.Logger;
import org.apache.druid.js.JavaScriptConfig;
import org.apache.druid.query.Druids;
import org.apache.druid.query.FinalizeResultsQueryRunner;
import org.apache.druid.query.Query;
Expand All @@ -48,7 +48,6 @@
import org.apache.druid.query.filter.BoundDimFilter;
import org.apache.druid.query.filter.DimFilter;
import org.apache.druid.query.filter.InDimFilter;
import org.apache.druid.query.filter.JavaScriptDimFilter;
import org.apache.druid.query.filter.OrDimFilter;
import org.apache.druid.query.filter.RegexDimFilter;
import org.apache.druid.query.filter.SearchQueryDimFilter;
Expand Down Expand Up @@ -107,6 +106,9 @@ public class FilteredAggregatorBenchmark
@Param({"basic"})
private String schema;

@Param({"false", "true"})
private String vectorize;

private static final Logger log = new Logger(FilteredAggregatorBenchmark.class);
private static final int RNG_SEED = 9999;
private static final IndexMergerV9 INDEX_MERGER_V9;
Expand Down Expand Up @@ -161,12 +163,6 @@ public void setup() throws IOException
filter = new OrDimFilter(
Arrays.asList(
new BoundDimFilter("dimSequential", "-1", "-1", true, true, null, null, StringComparators.ALPHANUMERIC),
new JavaScriptDimFilter(
"dimSequential",
"function(x) { return false }",
null,
JavaScriptConfig.getEnabledInstance()
),
new RegexDimFilter("dimSequential", "X", null),
new SearchQueryDimFilter("dimSequential", new ContainsSearchQuerySpec("X", false), null),
new InDimFilter("dimSequential", Collections.singletonList("X"), null)
Expand Down Expand Up @@ -234,15 +230,18 @@ private IncrementalIndex makeIncIndex(AggregatorFactory[] metrics)
.buildOnheap();
}

private static <T> List<T> runQuery(QueryRunnerFactory factory, QueryRunner runner, Query<T> query)
private static <T> List<T> runQuery(QueryRunnerFactory factory, QueryRunner runner, Query<T> query, String vectorize)
{
QueryToolChest toolChest = factory.getToolchest();
QueryRunner<T> theRunner = new FinalizeResultsQueryRunner<>(
toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner)),
toolChest
);

Sequence<T> queryResult = theRunner.run(QueryPlus.wrap(query), new HashMap<>());
final QueryPlus<T> queryToRun = QueryPlus.wrap(
query.withOverriddenContext(ImmutableMap.of("vectorize", vectorize))
);
Sequence<T> queryResult = theRunner.run(queryToRun, new HashMap<>());
return queryResult.toList();
}

Expand All @@ -269,7 +268,12 @@ public void querySingleIncrementalIndex(Blackhole blackhole)
new IncrementalIndexSegment(incIndex, SegmentId.dummy("incIndex"))
);

List<Result<TimeseriesResultValue>> results = FilteredAggregatorBenchmark.runQuery(factory, runner, query);
List<Result<TimeseriesResultValue>> results = FilteredAggregatorBenchmark.runQuery(
factory,
runner,
query,
vectorize
);
for (Result<TimeseriesResultValue> result : results) {
blackhole.consume(result);
}
Expand All @@ -286,7 +290,12 @@ public void querySingleQueryableIndex(Blackhole blackhole)
new QueryableIndexSegment(qIndex, SegmentId.dummy("qIndex"))
);

List<Result<TimeseriesResultValue>> results = FilteredAggregatorBenchmark.runQuery(factory, runner, query);
List<Result<TimeseriesResultValue>> results = FilteredAggregatorBenchmark.runQuery(
factory,
runner,
query,
vectorize
);
for (Result<TimeseriesResultValue> result : results) {
blackhole.consume(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,26 @@ public static BenchmarkColumnSchema makeEnumerated(
schema.enumeratedProbabilities = enumeratedProbabilities;
return schema;
}

@Override
public String toString()
{
return "BenchmarkColumnSchema{" +
"distributionType=" + distributionType +
", name='" + name + '\'' +
", type=" + type +
", isMetric=" + isMetric +
", rowSize=" + rowSize +
", nullProbability=" + nullProbability +
", enumeratedValues=" + enumeratedValues +
", enumeratedProbabilities=" + enumeratedProbabilities +
", startInt=" + startInt +
", endInt=" + endInt +
", startDouble=" + startDouble +
", endDouble=" + endDouble +
", zipfExponent=" + zipfExponent +
", mean=" + mean +
", standardDeviation=" + standardDeviation +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,15 @@ public boolean isWithRollup()
{
return withRollup;
}

@Override
public String toString()
{
return "BenchmarkSchemaInfo{" +
"columnSchemas=" + columnSchemas +
", aggs=" + aggs +
", dataInterval=" + dataInterval +
", withRollup=" + withRollup +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class BenchmarkSchemas
basicSchemaIngestAggsExpression.add(new DoubleMinAggregatorFactory("minFloatZipf", "metFloatZipf"));
basicSchemaIngestAggsExpression.add(new HyperUniquesAggregatorFactory("hyper", "dimHyperUnique"));

Interval basicSchemaDataInterval = Intervals.utc(0, 1000000);
Interval basicSchemaDataInterval = Intervals.of("2000-01-01/P1D");

BenchmarkSchemaInfo basicSchema = new BenchmarkSchemaInfo(
basicSchemaColumns,
Expand Down
Loading