You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/10/05 17:21:06 UTC

[lucene-solr] 01/03: @941 Try one more search httpclient.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 32d0029deb2534c102ce248c926f5e3def2a5138
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sun Oct 4 23:24:55 2020 -0500

    @941 Try one more search httpclient.
---
 .../handler/component/ShardHandlerFactory.java     |  2 +-
 .../org/apache/solr/update/UpdateShardHandler.java | 23 ++++++++++++++++++----
 .../org/apache/solr/cloud/ReplaceNodeTest.java     |  2 +-
 .../solr/client/solrj/impl/Http2SolrClient.java    |  4 ++--
 .../solr/client/solrj/impl/HttpClientUtil.java     |  2 +-
 5 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/handler/component/ShardHandlerFactory.java b/solr/core/src/java/org/apache/solr/handler/component/ShardHandlerFactory.java
index 9ecd0e2..a2fd86c 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/ShardHandlerFactory.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/ShardHandlerFactory.java
@@ -50,7 +50,7 @@ public abstract class ShardHandlerFactory implements Closeable {
     try {
       ShardHandlerFactory shf = loader.findClass(info.className, ShardHandlerFactory.class, "handler.component.").getConstructor().newInstance();
       if (shf instanceof HttpShardHandlerFactory) {
-        ((HttpShardHandlerFactory) shf).setHttp2Client(ush.getTheSharedHttpClient());
+        ((HttpShardHandlerFactory) shf).setHttp2Client(ush.getSearchOnlyClient());
       }
       if (PluginInfoInitialized.class.isAssignableFrom(shf.getClass()))
         PluginInfoInitialized.class.cast(shf).init(info);
diff --git a/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java b/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
index 4f6612f..cc48508 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
@@ -58,6 +58,8 @@ public class UpdateShardHandler implements SolrInfoBean {
 
   private final Http2SolrClient updateOnlyClient;
 
+  private final Http2SolrClient searchOnlyClient;
+
   private final Http2SolrClient recoveryOnlyClient;
 
 
@@ -109,7 +111,7 @@ public class UpdateShardHandler implements SolrInfoBean {
           .idleTimeout(cfg.getDistributedSocketTimeout());
     }
     updateOnlyClient = updateOnlyClientBuilder.markInternalRequest().maxThreadPoolSize(ParWork.PROC_COUNT)
-        .maxRequestsQueuedPerDestination(16000).strictEventOrdering(true).build();
+        .maxRequestsQueuedPerDestination(12000).strictEventOrdering(true).build();
     updateOnlyClient.enableCloseLock();
    // updateOnlyClient.addListenerFactory(updateHttpListenerFactory);
     Set<String> queryParams = new HashSet<>(2);
@@ -119,13 +121,20 @@ public class UpdateShardHandler implements SolrInfoBean {
 
 
     Http2SolrClient.Builder recoveryOnlyClientBuilder = new Http2SolrClient.Builder();
-    if (cfg != null) {
-      recoveryOnlyClientBuilder.connectionTimeout(5000).idleTimeout(30000);
-    }
+    recoveryOnlyClientBuilder.connectionTimeout(5000).idleTimeout(30000);
+
 
     recoveryOnlyClient = recoveryOnlyClientBuilder.markInternalRequest().maxThreadPoolSize(ParWork.PROC_COUNT).build();
     recoveryOnlyClient.enableCloseLock();
 
+    Http2SolrClient.Builder searchOnlyClientBuilder = new Http2SolrClient.Builder();
+    searchOnlyClientBuilder.connectionTimeout(5000).idleTimeout(60000);
+
+
+    searchOnlyClient = recoveryOnlyClientBuilder.markInternalRequest().maxThreadPoolSize(ParWork.PROC_COUNT).build();
+    searchOnlyClient.enableCloseLock();
+
+
 //    ThreadFactory recoveryThreadFactory = new SolrNamedThreadFactory("recoveryExecutor");
 //    if (cfg != null && cfg.getMaxRecoveryThreads() > 0) {
 //      if (log.isDebugEnabled()) {
@@ -208,6 +217,10 @@ public class UpdateShardHandler implements SolrInfoBean {
     return recoveryOnlyClient;
   }
 
+  public Http2SolrClient getSearchOnlyClient() {
+    return searchOnlyClient;
+  }
+
   public PoolingHttpClientConnectionManager getDefaultConnectionManager() {
     return defaultConnectionManager;
   }
@@ -224,6 +237,7 @@ public class UpdateShardHandler implements SolrInfoBean {
     assert closeTracker.close();
     if (updateOnlyClient != null) updateOnlyClient.disableCloseLock();
     if (recoveryOnlyClient != null) recoveryOnlyClient.disableCloseLock();
+    if (searchOnlyClient != null) searchOnlyClient.disableCloseLock();
     try (ParWork closer = new ParWork(this, true)) {
       closer.collect("", () -> {
         HttpClientUtil.close(defaultClient);
@@ -231,6 +245,7 @@ public class UpdateShardHandler implements SolrInfoBean {
       });
       closer.addCollect();
       closer.collect(recoveryOnlyClient);
+      closer.collect(searchOnlyClient);
       closer.collect(updateOnlyClient);
       closer.collect(defaultConnectionManager);
       closer.collect("SolrInfoBean", () -> {
diff --git a/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java b/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java
index 8ebb5c7..4243c7a 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ReplaceNodeTest.java
@@ -186,7 +186,7 @@ public class ReplaceNodeTest extends SolrCloudTestCase {
 
     if (tryAgain) {
       collection = cloudClient.getZkStateReader().getClusterState().getCollection(coll);
-      Thread.sleep(500);
+      Thread.sleep(1000);
     }
 
     replicas = collection.getReplicas(emptyNode);
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
index aea6ce9..ce4607f 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
@@ -164,7 +164,7 @@ public class Http2SolrClient extends SolrClient {
       }
       this.serverBaseUrl = serverBaseUrl;
     }
-    Integer moar = 1000;
+    Integer moar = 5000;
     if (builder.maxOutstandingAsyncRequests != null) moar = builder.maxOutstandingAsyncRequests;
     asyncTracker = new AsyncTracker(moar); // nocommit
     this.headers = builder.headers;
@@ -963,7 +963,7 @@ public class Http2SolrClient extends SolrClient {
 
   public static class Builder {
 
-    public int maxThreadPoolSize = Integer.getInteger("solr.maxHttp2ClientThreads", Math.max(64, ParWork.PROC_COUNT));
+    public int maxThreadPoolSize = Integer.getInteger("solr.maxHttp2ClientThreads", Math.max(32, ParWork.PROC_COUNT));
     public int maxRequestsQueuedPerDestination = 2048;
     private Http2SolrClient http2SolrClient;
     private SSLConfig sslConfig = defaultSSLConfig;
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
index 202454b..420ae52 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
@@ -79,7 +79,7 @@ public class HttpClientUtil {
   
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
-  public static final int DEFAULT_CONNECT_TIMEOUT = 10000;
+  public static final int DEFAULT_CONNECT_TIMEOUT = 5000;
   public static final int DEFAULT_SO_TIMEOUT = (int) TimeUnit.MINUTES.toMillis(5);
   public static final int DEFAULT_MAXCONNECTIONSPERHOST = 100000;
   public static final int DEFAULT_MAXCONNECTIONS = 100000;