Skip to content

Commit 4902c08

Browse files
committed
HBASE-27565 Make the initial corePoolSize configurable for ChoreService (#4958)
Signed-off-by: Duo Zhang <[email protected]>
1 parent 56ebf93 commit 4902c08

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
@@ -58,6 +58,12 @@ public class ChoreService {
5858
*/
5959
@InterfaceAudience.Private
6060
public final static int MIN_CORE_POOL_SIZE = 1;
61+
/**
62+
* The initial number of threads in the core pool for the {@link ChoreService}.
63+
*/
64+
public static final String CHORE_SERVICE_INITIAL_POOL_SIZE =
65+
"hbase.choreservice.initial.pool.size";
66+
public static final int DEFAULT_CHORE_SERVICE_INITIAL_POOL_SIZE = 1;
6167

6268
/**
6369
* 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.HBASE_SPLIT_WAL_COORDINATED_BY_ZK;
@@ -681,7 +683,9 @@ public HRegionServer(final Configuration conf) throws IOException {
681683
// and M (An M IS A HRS now). Need to refactor so less duplication between M and its super
682684
// Master expects Constructor to put up web servers. Ugh.
683685
// class HRS. TODO.
684-
this.choreService = new ChoreService(getName(), true);
686+
int choreServiceInitialSize =
687+
conf.getInt(CHORE_SERVICE_INITIAL_POOL_SIZE, DEFAULT_CHORE_SERVICE_INITIAL_POOL_SIZE);
688+
this.choreService = new ChoreService(getName(), choreServiceInitialSize, true);
685689
this.executorService = new ExecutorService(getName());
686690
putUpWebUI();
687691
} catch (Throwable t) {

0 commit comments

Comments
 (0)