You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by do...@apache.org on 2021/01/21 22:52:11 UTC

[geode] branch support/1.13 updated: GEODE-8799: Increase defaults for MAX_THREADS and MAX_PR_THREADS (#5862)

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

donalevans pushed a commit to branch support/1.13
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/support/1.13 by this push:
     new 2915ed3  GEODE-8799: Increase defaults for MAX_THREADS and MAX_PR_THREADS (#5862)
2915ed3 is described below

commit 2915ed3059b8b6aeb4af1259d7e4e63cd0aa0b6a
Author: Donal Evans <do...@pivotal.io>
AuthorDate: Fri Jan 8 13:26:51 2021 -0800

    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))
    - Correct default values in properties.html
    
    Authored-by: Donal Evans <do...@vmware.com>
    (cherry picked from commit 86693d5170bb7ea85dabe15bf67c32ba875abef9)
---
 .../internal/ClusterOperationExecutors.java        |  3 +-
 .../distributed/internal/OperationExecutors.java   |  2 +-
 .../apache/geode/internal/cache/properties.html    |  6 +-
 .../internal/ClusterOperationExecutorsTest.java    | 70 ++++++++++++++++++++++
 4 files changed, 75 insertions(+), 6 deletions(-)

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 7ea6532..606457c 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 @@ public class ClusterOperationExecutors implements OperationExecutors {
       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 c4bc0c8..ad2ae2b 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 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
  */
 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() * 4, 16));
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 0419553..03a878c 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 @@ TBA
 <dd>
 <em>Public:</em> false
 <p>
-<em>Integer:</em> (default is 16)
+<em>Integer:</em> (default is 16 or 4 * number of processors, whichever is larger)
 <p>
 Maximum function execution threads.
 <p>
@@ -383,7 +383,7 @@ See <code>org.apache.geode.distributed.internal.DistributionManager#MAX_FE_THREA
 <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 @@ TBA
 <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
new file mode 100644
index 0000000..73f3377
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/ClusterOperationExecutorsTest.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+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;
+
+  @Before
+  public void setup() {
+    stats = mock(DistributionStats.class);
+    system = mock(InternalDistributedSystem.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 numOfFEThreadsIsAtLeast16() {
+    int minNumberOfFunctionExecutionThreads = 16;
+
+    ClusterOperationExecutors executors = new ClusterOperationExecutors(stats, system);
+
+    assertThat(executors.MAX_FE_THREADS)
+        .isGreaterThanOrEqualTo(minNumberOfFunctionExecutionThreads);
+  }
+
+  @Test
+  public void numOfPRThreadsIsAtLeast200() {
+    int minNumberOfPartitionedRegionThreads = 200;
+
+    ClusterOperationExecutors executors = new ClusterOperationExecutors(stats, system);
+    int threads = ((ThreadPoolExecutor) executors.getExecutor(PARTITIONED_REGION_EXECUTOR,
+        mock(InternalDistributedMember.class))).getMaximumPoolSize();
+
+    assertThat(threads).isGreaterThanOrEqualTo(minNumberOfPartitionedRegionThreads);
+  }
+}