You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by cp...@apache.org on 2024/02/07 12:47:57 UTC

(solr) branch jira/solr-13350 updated: tentative: add indexSearcherExecutorThreads element to solr.xml

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

cpoerschke pushed a commit to branch jira/solr-13350
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/jira/solr-13350 by this push:
     new dbd2d8a3961 tentative: add indexSearcherExecutorThreads element to solr.xml
dbd2d8a3961 is described below

commit dbd2d8a39616f21eac1c211d12cd73926bf46efe
Author: Christine Poerschke <cp...@apache.org>
AuthorDate: Wed Feb 7 12:41:30 2024 +0000

    tentative: add indexSearcherExecutorThreads element to solr.xml
---
 .../src/java/org/apache/solr/core/CoreContainer.java   |  4 +++-
 .../core/src/java/org/apache/solr/core/NodeConfig.java | 18 ++++++++++++++++++
 .../src/java/org/apache/solr/core/SolrXmlConfig.java   |  3 +++
 solr/core/src/test-files/solr/solr-50-all.xml          |  1 +
 .../src/test/org/apache/solr/core/TestSolrXml.java     |  1 +
 .../pages/configuring-solr-xml.adoc                    |  9 +++++++++
 6 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index b36f1c18977..fc0fac78156 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -442,7 +442,9 @@ public class CoreContainer {
 
     this.collectorExecutor =
         ExecutorUtil.newMDCAwareCachedThreadPool(
-            6, 6, new SolrNamedThreadFactory("searcherCollector"));
+            cfg.getIndexSearcherExecutorThreads(), // thread count
+            cfg.getIndexSearcherExecutorThreads(), // queue size
+            new SolrNamedThreadFactory("searcherCollector"));
   }
 
   @SuppressWarnings({"unchecked"})
diff --git a/solr/core/src/java/org/apache/solr/core/NodeConfig.java b/solr/core/src/java/org/apache/solr/core/NodeConfig.java
index ef1cbbf2dfd..fa38b70410d 100644
--- a/solr/core/src/java/org/apache/solr/core/NodeConfig.java
+++ b/solr/core/src/java/org/apache/solr/core/NodeConfig.java
@@ -105,6 +105,8 @@ public class NodeConfig {
 
   private final int replayUpdatesThreads;
 
+  private final int indexSearcherExecutorThreads;
+
   @Deprecated private final int transientCacheSize;
 
   private final boolean useSchemaCache;
@@ -144,6 +146,7 @@ public class NodeConfig {
       CloudConfig cloudConfig,
       Integer coreLoadThreads,
       int replayUpdatesThreads,
+      int indexSearcherExecutorThreads,
       int transientCacheSize,
       boolean useSchemaCache,
       String managementPath,
@@ -183,6 +186,7 @@ public class NodeConfig {
     this.cloudConfig = cloudConfig;
     this.coreLoadThreads = coreLoadThreads;
     this.replayUpdatesThreads = replayUpdatesThreads;
+    this.indexSearcherExecutorThreads = indexSearcherExecutorThreads;
     this.transientCacheSize = transientCacheSize;
     this.useSchemaCache = useSchemaCache;
     this.managementPath = managementPath;
@@ -335,6 +339,10 @@ public class NodeConfig {
     return replayUpdatesThreads;
   }
 
+  public int getIndexSearcherExecutorThreads() {
+    return indexSearcherExecutorThreads;
+  }
+
   /**
    * Returns a directory, optionally a comma separated list of directories that will be added to
    * Solr's class path for searching for classes and plugins. The path is either absolute or
@@ -597,6 +605,7 @@ public class NodeConfig {
     private CloudConfig cloudConfig;
     private int coreLoadThreads = DEFAULT_CORE_LOAD_THREADS;
     private int replayUpdatesThreads = Runtime.getRuntime().availableProcessors();
+    private int indexSearcherExecutorThreads = DEFAULT_INDEX_SEARCHER_EXECUTOR_THREADS;
     @Deprecated private int transientCacheSize = -1;
     private boolean useSchemaCache = false;
     private String managementPath;
@@ -618,6 +627,9 @@ public class NodeConfig {
     // No:of core load threads in cloud mode is set to a default of 8
     public static final int DEFAULT_CORE_LOAD_THREADS_IN_CLOUD = 8;
 
+    public static final int DEFAULT_INDEX_SEARCHER_EXECUTOR_THREADS =
+        6; // TODO: what should the default be?
+
     private static final String DEFAULT_CORESLOCATORCLASS =
         "org.apache.solr.core.CorePropertiesLocator";
     private static final String DEFAULT_CORESORTERCLASS = "org.apache.solr.core.CoreSorter";
@@ -755,6 +767,11 @@ public class NodeConfig {
       return this;
     }
 
+    public NodeConfigBuilder setIndexSearcherExecutorThreads(int indexSearcherExecutorThreads) {
+      this.indexSearcherExecutorThreads = indexSearcherExecutorThreads;
+      return this;
+    }
+
     // Remove in Solr 10.0
 
     @Deprecated
@@ -904,6 +921,7 @@ public class NodeConfig {
           cloudConfig,
           coreLoadThreads,
           replayUpdatesThreads,
+          indexSearcherExecutorThreads,
           transientCacheSize,
           useSchemaCache,
           managementPath,
diff --git a/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java b/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
index 4c15cd9b7a9..9e616004ff5 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
@@ -380,6 +380,9 @@ public class SolrXmlConfig {
               case "replayUpdatesThreads":
                 builder.setReplayUpdatesThreads(it.intVal(-1));
                 break;
+              case "indexSearcherExecutorThreads":
+                builder.setIndexSearcherExecutorThreads(it.intVal(-1));
+                break;
               case "transientCacheSize":
                 log.warn("solr.xml transientCacheSize -- transient cores is deprecated");
                 builder.setTransientCacheSize(it.intVal(-1));
diff --git a/solr/core/src/test-files/solr/solr-50-all.xml b/solr/core/src/test-files/solr/solr-50-all.xml
index efa2abd4e6a..53a682050ca 100644
--- a/solr/core/src/test-files/solr/solr-50-all.xml
+++ b/solr/core/src/test-files/solr/solr-50-all.xml
@@ -30,6 +30,7 @@
   <str name="coreSorter">testCoreSorter</str>
   <int name="transientCacheSize">66</int>
   <int name="replayUpdatesThreads">100</int>
+  <int name="indexSearcherExecutorThreads">7</int>
   <int name="maxBooleanClauses">42</int>
   <bool name="hideStackTrace">true</bool>
 
diff --git a/solr/core/src/test/org/apache/solr/core/TestSolrXml.java b/solr/core/src/test/org/apache/solr/core/TestSolrXml.java
index 5454baceb86..9509bb98eb3 100644
--- a/solr/core/src/test/org/apache/solr/core/TestSolrXml.java
+++ b/solr/core/src/test/org/apache/solr/core/TestSolrXml.java
@@ -86,6 +86,7 @@ public class TestSolrXml extends SolrTestCaseJ4 {
     assertEquals("core sorter class", "testCoreSorter", cfg.getCoreSorterClass());
     assertEquals("core load threads", 11, cfg.getCoreLoadThreadCount(false));
     assertEquals("replay update threads", 100, cfg.getReplayUpdatesThreads());
+    assertEquals("index searcher executor threads", 7, cfg.getIndexSearcherExecutorThreads());
     MatcherAssert.assertThat(
         "core root dir",
         cfg.getCoreRootDirectory().toString(),
diff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/configuring-solr-xml.adoc b/solr/solr-ref-guide/modules/configuration-guide/pages/configuring-solr-xml.adoc
index ed169b989e7..d3a8f2a79a5 100644
--- a/solr/solr-ref-guide/modules/configuration-guide/pages/configuring-solr-xml.adoc
+++ b/solr/solr-ref-guide/modules/configuration-guide/pages/configuring-solr-xml.adoc
@@ -178,6 +178,15 @@ Specifies the number of threads that will be assigned to replay updates in paral
 This pool is shared for all cores of the node.
 The default value is equal to the number of processors.
 
+`indexSearcherExecutorThreads`::
++
+[%autowidth,frame=none]
+|===
+|Optional |Default: ???
+|===
++
+Specifies the number of threads that will be assigned to ...
+
 `coreRootDirectory`::
 +
 [%autowidth,frame=none]