Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-6605: Make ShardHandlerFactory maxConnections configurable (This closes #99)

Shalin Shekhar Mangare7f194c1dca4
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 9440ab6a468..d0d1612cc4a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -156,6 +156,8 @@ New Features
distribution of custom replica properties across nodes making up a
collection, at most one node per slice will have the property.
+* SOLR-6605: Make ShardHandlerFactory maxConnections configurable.
+ (Christine Poerschke via shalin)
Bug Fixes
----------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
index 3f91f172d83..4d469727a69 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
@@ -69,6 +69,7 @@ public class HttpShardHandlerFactory extends ShardHandlerFactory implements org.
int soTimeout = 0;
int connectionTimeout = 0;
int maxConnectionsPerHost = 20;
+ int maxConnections = 10000;
int corePoolSize = 0;
int maximumPoolSize = Integer.MAX_VALUE;
int keepAliveTime = 5;
@@ -122,6 +123,7 @@ public class HttpShardHandlerFactory extends ShardHandlerFactory implements org.
}
this.connectionTimeout = getParameter(args, HttpClientUtil.PROP_CONNECTION_TIMEOUT, connectionTimeout);
this.maxConnectionsPerHost = getParameter(args, HttpClientUtil.PROP_MAX_CONNECTIONS_PER_HOST, maxConnectionsPerHost);
+ this.maxConnections = getParameter(args, HttpClientUtil.PROP_MAX_CONNECTIONS, maxConnections);
this.corePoolSize = getParameter(args, INIT_CORE_POOL_SIZE, corePoolSize);
this.maximumPoolSize = getParameter(args, INIT_MAX_POOL_SIZE, maximumPoolSize);
this.keepAliveTime = getParameter(args, MAX_THREAD_IDLE_TIME, keepAliveTime);
@@ -148,7 +150,7 @@ public class HttpShardHandlerFactory extends ShardHandlerFactory implements org.
ModifiableSolrParams clientParams = new ModifiableSolrParams();
clientParams.set(HttpClientUtil.PROP_MAX_CONNECTIONS_PER_HOST, maxConnectionsPerHost);
- clientParams.set(HttpClientUtil.PROP_MAX_CONNECTIONS, 10000);
+ clientParams.set(HttpClientUtil.PROP_MAX_CONNECTIONS, maxConnections);
clientParams.set(HttpClientUtil.PROP_SO_TIMEOUT, soTimeout);
clientParams.set(HttpClientUtil.PROP_CONNECTION_TIMEOUT, connectionTimeout);
clientParams.set(HttpClientUtil.PROP_USE_RETRY, false);