Skip to content
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

Default max concurrent search req. numNodes * 5 #31171

Merged
merged 4 commits into from
Jun 8, 2018
Merged
Changes from 2 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 @@ -340,13 +340,19 @@ private void executeSearch(SearchTask task, SearchTimeProvider timeProvider, Sea
}
return searchTransportService.getConnection(clusterName, discoveryNode);
};
if (searchRequest.isMaxConcurrentShardRequestsSet() == false) {
if (searchRequest.isMaxConcurrentShardRequestsSet() == false && shardIterators.size() > 0) {
/*
* We try to set a default of max concurrent shard requests based on the node count but upper-bound it by 256 by default to keep
* it sane. A single search request that fans out to lots of shards should not hit a cluster too hard while 256 is already a
* lot.
* Yet we are still trying to guarantee some concurrency ie. if you have an index size of N shards and you are searching a
* single index on a single node we still search it concurrently.
*/
searchRequest.setMaxConcurrentShardRequests(Math.min(256, nodeCount));
final int numShards = shardIterators.size();
final int numIndices = remoteClusterIndices.size() + concreteIndices.length;
assert numShards >= numIndices : "found schroedingers index numShards: " + numShards + " vs. numIndices: " + numIndices;
assert numIndices > 0;
searchRequest.setMaxConcurrentShardRequests(Math.min(256, nodeCount * (numShards / numIndices)));
}
boolean preFilterSearchShards = shouldPreFilterSearchShards(searchRequest, shardIterators);
searchAsyncAction(task, searchRequest, shardIterators, timeProvider, connectionLookup, clusterState.version(),
Expand Down