Skip to content

Commit 655a436

Browse files
committed
HBASE-27565 Make the initial corePoolSize configurable for ChoreService (#4958)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
1 parent a7d60ce commit 655a436

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public class ChoreService {
5959
*/
6060
@InterfaceAudience.Private
6161
public final static int MIN_CORE_POOL_SIZE = 1;
62+
/**
63+
* The initial number of threads in the core pool for the {@link ChoreService}.
64+
*/
65+
public static final String CHORE_SERVICE_INITIAL_POOL_SIZE =
66+
"hbase.choreservice.initial.pool.size";
67+
public static final int DEFAULT_CHORE_SERVICE_INITIAL_POOL_SIZE = 1;
6268

6369
/**
6470
* This thread pool is used to schedule all of the Chores

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
package org.apache.hadoop.hbase.regionserver;
1919

20+
import static org.apache.hadoop.hbase.ChoreService.CHORE_SERVICE_INITIAL_POOL_SIZE;
21+
import static org.apache.hadoop.hbase.ChoreService.DEFAULT_CHORE_SERVICE_INITIAL_POOL_SIZE;
2022
import static org.apache.hadoop.hbase.HConstants.DEFAULT_HBASE_SPLIT_COORDINATED_BY_ZK;
2123
import static org.apache.hadoop.hbase.HConstants.DEFAULT_HBASE_SPLIT_WAL_MAX_SPLITTER;
2224
import static org.apache.hadoop.hbase.HConstants.DEFAULT_SLOW_LOG_SYS_TABLE_CHORE_DURATION;
@@ -728,7 +730,9 @@ public HRegionServer(final Configuration conf) throws IOException {
728730
// and M (An M IS A HRS now). Need to refactor so less duplication between M and its super
729731
// Master expects Constructor to put up web servers. Ugh.
730732
// class HRS. TODO.
731-
this.choreService = new ChoreService(getName(), true);
733+
int choreServiceInitialSize =
734+
conf.getInt(CHORE_SERVICE_INITIAL_POOL_SIZE, DEFAULT_CHORE_SERVICE_INITIAL_POOL_SIZE);
735+
this.choreService = new ChoreService(getName(), choreServiceInitialSize, true);
732736
this.executorService = new ExecutorService(getName());
733737
putUpWebUI();
734738
span.setStatus(StatusCode.OK);

0 commit comments

Comments
 (0)