GEODE-8799: Increase defaults for MAX_THREADS and MAX_PR_THREADS (#5862)
- MAX_THREADS new default is 1000
- MAX_PR_THREADS new default is
Math.max(Runtime.getRuntime().availableProcessors() * 32, 200))
- Removed unit test case for setting system property, since it cannot be
cleared afterwards without unloading the class
- Correct default values in properties.html
Authored-by: Donal Evans <doevans@vmware.com>
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java
index dfafc9b..e041f77 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java
@@ -68,8 +68,7 @@
Integer.getInteger("DistributionManager.MAX_PR_META_DATA_CLEANUP_THREADS", 1);
private static final int MAX_PR_THREADS = Integer.getInteger("DistributionManager.MAX_PR_THREADS",
- Math.max(Runtime.getRuntime().availableProcessors() * 4, 16));
-
+ Math.max(Runtime.getRuntime().availableProcessors() * 32, 200));
private static final int INCOMING_QUEUE_LIMIT =
Integer.getInteger("DistributionManager.INCOMING_QUEUE_LIMIT", 80000);
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/OperationExecutors.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/OperationExecutors.java
index 6e22704..5f34af2 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/OperationExecutors.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/OperationExecutors.java
@@ -26,7 +26,7 @@
*/
public interface OperationExecutors {
int MAX_THREADS =
- Integer.getInteger("DistributionManager.MAX_THREADS", 100);
+ Integer.getInteger("DistributionManager.MAX_THREADS", 1000);
int MAX_FE_THREADS = Integer.getInteger("DistributionManager.MAX_FE_THREADS",
Math.max(Runtime.getRuntime().availableProcessors() * 16, 100));
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/properties.html b/geode-core/src/main/java/org/apache/geode/internal/cache/properties.html
index b3ea241..b6e8c02 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/properties.html
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/properties.html
@@ -371,7 +371,7 @@
<dd>
<em>Public:</em> false
<p>
-<em>Integer:</em> (default is 100)
+<em>Integer:</em> (default is 100 or 16 * number of processors, whichever is larger)
<p>
Maximum function execution threads.
<p>
@@ -383,7 +383,7 @@
<dd>
<em>Public:</em> false
<p>
-<em>Integer</em> (default is 1)
+<em>Integer</em> (default is 200 or 32 * number of processors, whichever is larger)
<p>
See <code>org.apache.geode.distributed.internal.DistributionManager#MAX_PR_THREADS</code>.
<p>
@@ -411,7 +411,7 @@
<dd>
<em>Public:</em> false
<p>
-<em>Integer</em> (default is 100)
+<em>Integer</em> (default is 1000)
<p>
See <code>org.apache.geode.distributed.internal.DistributionManager#MAX_THREADS</code>.
<p>
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/ClusterOperationExecutorsTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/ClusterOperationExecutorsTest.java
index c3f5cdf..99a0329 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/ClusterOperationExecutorsTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/ClusterOperationExecutorsTest.java
@@ -14,27 +14,40 @@
*/
package org.apache.geode.distributed.internal;
+import static org.apache.geode.distributed.internal.OperationExecutors.PARTITIONED_REGION_EXECUTOR;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import java.util.concurrent.ThreadPoolExecutor;
+
import org.junit.Before;
import org.junit.Test;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+
public class ClusterOperationExecutorsTest {
private DistributionStats stats;
private InternalDistributedSystem system;
- private DistributionConfig config;
@Before
public void setup() {
stats = mock(DistributionStats.class);
system = mock(InternalDistributedSystem.class);
- config = mock(DistributionConfig.class);
+ DistributionConfig config = mock(DistributionConfig.class);
when(system.getConfig()).thenReturn(config);
}
@Test
+ public void numOfThreadsIsAtLeast300() {
+ int minNumberOfThreads = 300;
+
+ ClusterOperationExecutors executors = new ClusterOperationExecutors(stats, system);
+
+ assertThat(executors.MAX_THREADS).isGreaterThanOrEqualTo(minNumberOfThreads);
+ }
+
+ @Test
public void numOfFEThreadsIsAtLeast100() {
int minNumberOfFunctionExecutionThreads = 100;
@@ -45,18 +58,13 @@
}
@Test
- public void numOfFEThreadsCanBeSet() {
- int numberOfFunctionExecutionThreads = 400;
- String functionExecutionThreadsPropertyName = "DistributionManager.MAX_FE_THREADS";
- System.setProperty(functionExecutionThreadsPropertyName,
- Integer.toString(numberOfFunctionExecutionThreads));
+ public void numOfPRThreadsIsAtLeast200() {
+ int minNumberOfPartitionedRegionThreads = 200;
- try {
- ClusterOperationExecutors executors = new ClusterOperationExecutors(stats, system);
+ ClusterOperationExecutors executors = new ClusterOperationExecutors(stats, system);
+ int threads = ((ThreadPoolExecutor) executors.getExecutor(PARTITIONED_REGION_EXECUTOR,
+ mock(InternalDistributedMember.class))).getMaximumPoolSize();
- assertThat(executors.MAX_FE_THREADS).isEqualTo(numberOfFunctionExecutionThreads);
- } finally {
- System.clearProperty(functionExecutionThreadsPropertyName);
- }
+ assertThat(threads).isGreaterThanOrEqualTo(minNumberOfPartitionedRegionThreads);
}
}