Skip to content
Open
Show file tree
Hide file tree
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
@@ -0,0 +1,8 @@
title: CloudSolrClient now refreshes collection state asynchronously using a dedicated
thread pool, reducing ZooKeeper blocking and improving performance under load.
type: changed
authors:
- name: Mark Miller
links:
- name: SOLR-17947
url: https://issues.apache.org/jira/browse/SOLR-17947
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ public class CloudHttp2SolrClient extends CloudSolrClient {
* client.
*/
protected CloudHttp2SolrClient(Builder builder) {
super(builder.shardLeadersOnly, builder.parallelUpdates, builder.directUpdatesToLeadersOnly);
super(
builder.shardLeadersOnly,
builder.parallelUpdates,
builder.directUpdatesToLeadersOnly,
builder.stateRefreshThreads);
this.clientIsInternal = builder.httpClient == null;
this.myClient = createOrGetHttpClientFromBuilder(builder);
this.stateProvider = createClusterStateProvider(builder);
Expand All @@ -85,11 +89,6 @@ protected CloudHttp2SolrClient(Builder builder) {

this.collectionStateCache.timeToLiveMs =
TimeUnit.MILLISECONDS.convert(builder.timeToLiveSeconds, TimeUnit.SECONDS);

// If caches are expired then they are refreshed after acquiring a lock. Set the number of
// locks.
this.locks = objectList(builder.parallelCacheRefreshesLocks);

this.lbClient = new LBHttp2SolrClient.Builder<>(myClient).build();
}

Expand Down Expand Up @@ -200,7 +199,7 @@ public static class Builder {

private String defaultCollection;
private long timeToLiveSeconds = 60;
private int parallelCacheRefreshesLocks = 3;
private int stateRefreshThreads = CloudSolrClient.DEFAULT_STATE_REFRESH_PARALLELISM;
private int zkConnectTimeout = SolrZkClientTimeout.DEFAULT_ZK_CONNECT_TIMEOUT;
private int zkClientTimeout = SolrZkClientTimeout.DEFAULT_ZK_CLIENT_TIMEOUT;
private boolean canUseZkACLs = true;
Expand Down Expand Up @@ -348,13 +347,12 @@ public Builder withParallelUpdates(boolean parallelUpdates) {
}

/**
* When caches are expired then they are refreshed after acquiring a lock. Use this to set the
* number of locks.
* Configures how many collection state refresh operations may run in parallel.
*
* <p>Defaults to 3.
* <p>Defaults to 5.
*/
public Builder withParallelCacheRefreshes(int parallelCacheRefreshesLocks) {
this.parallelCacheRefreshesLocks = parallelCacheRefreshesLocks;
public Builder withParallelCacheRefreshes(int parallelCacheRefreshes) {
this.stateRefreshThreads = parallelCacheRefreshes;
return this;
}

Expand Down
Loading
Loading