Skip to content
Open
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.solr.bench.Docs;
import org.apache.solr.bench.SolrBenchState;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrInputDocument;
Expand Down Expand Up @@ -112,6 +113,9 @@ public void setupTrial(SolrBenchState solrBenchState) throws Exception {
@Param({"false", "true"})
boolean verifyEDRInUse = true;

@Param({"false", "true"})
boolean multiThreaded = false;

private static final String matchExpression = "ExitableTermsEnum:-1";

@Setup(Level.Iteration)
Expand Down Expand Up @@ -151,17 +155,20 @@ public void tearDownTrial() throws Exception {
}
}

private static ModifiableSolrParams createInitialParams() {
private static ModifiableSolrParams createInitialParams(BenchState state) {
ModifiableSolrParams params =
SolrBenchState.params("rows", "100", "timeAllowed", "1000", "fl", "*");
if (state.multiThreaded) {
params.set(CommonParams.MULTI_THREADED, "true");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arup-chauhan As statet on the Jira-ticket, I don't think just setting this flag is enough, I belief you also need to set solr.searchThreads e.g. like this:
System.setProperty("solr.searchThreads", String.valueOf(searchThreads))

}
return params;
}

@Benchmark
public void testShortQuery(SolrBenchState solrBenchState, Blackhole bh, BenchState state)
throws Exception {
SolrInputDocument queryDoc = state.queryFields.inputDocument();
ModifiableSolrParams params = createInitialParams();
ModifiableSolrParams params = createInitialParams(state);
params.set("q", "f1_ts:" + queryDoc.getFieldValue("f1_ts").toString());
QueryRequest queryRequest = new QueryRequest(params);
QueryResponse rsp = queryRequest.process(solrBenchState.client, COLLECTION);
Expand All @@ -172,7 +179,7 @@ public void testShortQuery(SolrBenchState solrBenchState, Blackhole bh, BenchSta
public void testLongQuery(SolrBenchState solrBenchState, Blackhole bh, BenchState state)
throws Exception {
SolrInputDocument queryDoc = state.queryFields.inputDocument();
ModifiableSolrParams params = createInitialParams();
ModifiableSolrParams params = createInitialParams(state);
StringBuilder query = new StringBuilder();
for (int i = 2; i < 10; i++) {
if (query.length() > 0) {
Expand All @@ -186,4 +193,14 @@ public void testLongQuery(SolrBenchState solrBenchState, Blackhole bh, BenchStat
QueryResponse rsp = queryRequest.process(solrBenchState.client, COLLECTION);
bh.consume(rsp);
}

@Benchmark
public void testRangeQuery(SolrBenchState solrBenchState, Blackhole bh, BenchState state)
throws Exception {
ModifiableSolrParams params = createInitialParams(state);
params.set("q", "id:[0 TO 250000]");
QueryRequest queryRequest = new QueryRequest(params);
QueryResponse rsp = queryRequest.process(solrBenchState.client, COLLECTION);
bh.consume(rsp);
}
}