Skip to content

Commit

Permalink
tentative: add indexSearcherExecutorThreads element to solr.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
cpoerschke committed Feb 7, 2024
1 parent 50160dc commit dbd2d8a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
4 changes: 3 additions & 1 deletion solr/core/src/java/org/apache/solr/core/CoreContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,9 @@ public CoreContainer(NodeConfig config, CoresLocator locator, boolean asyncSolrC

this.collectorExecutor =
ExecutorUtil.newMDCAwareCachedThreadPool(
6, 6, new SolrNamedThreadFactory("searcherCollector"));
cfg.getIndexSearcherExecutorThreads(), // thread count
cfg.getIndexSearcherExecutorThreads(), // queue size
new SolrNamedThreadFactory("searcherCollector"));
}

@SuppressWarnings({"unchecked"})
Expand Down
18 changes: 18 additions & 0 deletions solr/core/src/java/org/apache/solr/core/NodeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public class NodeConfig {

private final int replayUpdatesThreads;

private final int indexSearcherExecutorThreads;

@Deprecated private final int transientCacheSize;

private final boolean useSchemaCache;
Expand Down Expand Up @@ -144,6 +146,7 @@ private NodeConfig(
CloudConfig cloudConfig,
Integer coreLoadThreads,
int replayUpdatesThreads,
int indexSearcherExecutorThreads,
int transientCacheSize,
boolean useSchemaCache,
String managementPath,
Expand Down Expand Up @@ -183,6 +186,7 @@ private NodeConfig(
this.cloudConfig = cloudConfig;
this.coreLoadThreads = coreLoadThreads;
this.replayUpdatesThreads = replayUpdatesThreads;
this.indexSearcherExecutorThreads = indexSearcherExecutorThreads;
this.transientCacheSize = transientCacheSize;
this.useSchemaCache = useSchemaCache;
this.managementPath = managementPath;
Expand Down Expand Up @@ -335,6 +339,10 @@ public int getReplayUpdatesThreads() {
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
Expand Down Expand Up @@ -597,6 +605,7 @@ public static class NodeConfigBuilder {
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;
Expand All @@ -618,6 +627,9 @@ public static class NodeConfigBuilder {
// 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";
Expand Down Expand Up @@ -755,6 +767,11 @@ public NodeConfigBuilder setReplayUpdatesThreads(int replayUpdatesThreads) {
return this;
}

public NodeConfigBuilder setIndexSearcherExecutorThreads(int indexSearcherExecutorThreads) {
this.indexSearcherExecutorThreads = indexSearcherExecutorThreads;
return this;
}

// Remove in Solr 10.0

@Deprecated
Expand Down Expand Up @@ -904,6 +921,7 @@ public NodeConfig build() {
cloudConfig,
coreLoadThreads,
replayUpdatesThreads,
indexSearcherExecutorThreads,
transientCacheSize,
useSchemaCache,
managementPath,
Expand Down
3 changes: 3 additions & 0 deletions solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ private static NodeConfig fillSolrSection(NodeConfig.NodeConfigBuilder builder,
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));
Expand Down
1 change: 1 addition & 0 deletions solr/core/src/test-files/solr/solr-50-all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
1 change: 1 addition & 0 deletions solr/core/src/test/org/apache/solr/core/TestSolrXml.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void testAllInfoPresent() throws IOException {
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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit dbd2d8a

Please sign in to comment.