-
Notifications
You must be signed in to change notification settings - Fork 819
Benchmark fixes #4194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Benchmark fixes #4194
Changes from 7 commits
1be1998
2a7001d
d43c568
9bfb302
309be83
c7f412a
e8366e4
3370506
c8eb02b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,7 +116,7 @@ private static class IntegerMaxCardinalitySolrGen extends SolrGen<Integer> { | |
| private final Gen<Integer> integers; | ||
|
|
||
| /** The Cardinality start. */ | ||
| Integer cardinalityStart; | ||
| volatile Integer cardinalityStart; | ||
|
|
||
| /** | ||
| * Instantiates a new Integer max cardinality solr gen. | ||
|
|
@@ -132,13 +132,18 @@ public IntegerMaxCardinalitySolrGen(int maxCardinality, Gen<Integer> integers) { | |
|
|
||
| @Override | ||
| public Integer generate(SolrRandomnessSource in) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can be called concurrently; needs to be thread-safe |
||
| if (cardinalityStart == null) { | ||
| cardinalityStart = | ||
| SolrGenerate.range(0, Integer.MAX_VALUE - maxCardinality - 1).generate(in); | ||
| Integer localStart = cardinalityStart; | ||
| if (localStart == null) { | ||
| synchronized (this) { | ||
| localStart = cardinalityStart; | ||
| if (localStart == null) { | ||
| localStart = SolrGenerate.range(0, Integer.MAX_VALUE - maxCardinality - 1).generate(in); | ||
| cardinalityStart = localStart; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| long seed = | ||
| SolrGenerate.range(cardinalityStart, cardinalityStart + maxCardinality - 1).generate(in); | ||
| long seed = SolrGenerate.range(localStart, localStart + maxCardinality - 1).generate(in); | ||
| return integers.generate(new SplittableRandomSource(new SplittableRandom(seed))); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,8 @@ | |
| import static org.apache.solr.bench.generators.SourceDSL.strings; | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.io.OutputStream; | ||
| import org.apache.solr.bench.Docs; | ||
| import org.apache.solr.bench.MiniClusterState; | ||
| import org.apache.solr.bench.MiniClusterState.MiniClusterBenchState; | ||
|
|
@@ -30,6 +32,7 @@ | |
| import org.apache.solr.client.solrj.response.InputStreamResponseParser; | ||
| import org.apache.solr.common.params.CommonParams; | ||
| import org.apache.solr.common.params.ModifiableSolrParams; | ||
| import org.apache.solr.common.util.NamedList; | ||
| import org.openjdk.jmh.annotations.Benchmark; | ||
| import org.openjdk.jmh.annotations.BenchmarkMode; | ||
| import org.openjdk.jmh.annotations.Fork; | ||
|
|
@@ -57,7 +60,7 @@ public class QueryResponseWriters { | |
| @State(Scope.Benchmark) | ||
| public static class BenchState { | ||
|
|
||
| @Param({CommonParams.JAVABIN, CommonParams.JSON, "cbor", "smile", "xml", "raw"}) | ||
| @Param({CommonParams.JAVABIN, CommonParams.JSON, "cbor", "smile", "xml"}) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "raw" is special; isn't working (NPE) in this scenario. Don't think it makes sense to benchmark it. |
||
| String wt; | ||
|
|
||
| private int docs = 100; | ||
|
|
@@ -93,6 +96,12 @@ public void setup(MiniClusterBenchState miniClusterState) throws Exception { | |
| public Object query( | ||
| BenchState benchState, MiniClusterState.MiniClusterBenchState miniClusterState) | ||
| throws SolrServerException, IOException { | ||
| return miniClusterState.client.request(benchState.q, collection); | ||
| NamedList<Object> response = miniClusterState.client.request(benchState.q, collection); | ||
| // consume the stream completely | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is necessary since otherwise the InputStreamResponseParser is left unconsumed and in fact it means the benchmark was mostly useless as nothing was transmitted since there was no consumer! wow |
||
| try (InputStream responseStream = | ||
| (InputStream) response.get(InputStreamResponseParser.STREAM_KEY)) { | ||
| responseStream.transferTo(OutputStream.nullOutputStream()); | ||
| } | ||
| return response; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,7 @@ | |
| </fieldType> | ||
|
|
||
| <!-- for versioning --> | ||
| <field name="_version_" type="long" indexed="true" stored="true"/> | ||
| <field name="_version_" type="long" indexed="true" stored="true" docValues="true"/> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need docValues on |
||
| <field name="_root_" type="string" indexed="true" stored="true" multiValued="false" required="false"/> | ||
| <field name="id" type="string" indexed="true" stored="true"/> | ||
| <field name="text" type="text" indexed="true" stored="false"/> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this helped track down 2 issues!