Skip to content

RATIS-1472. make use CachedThreadPool configurable.#566

Merged
szetszwo merged 4 commits intoapache:masterfrom
captainzmc:conf-thread
Dec 18, 2021
Merged

RATIS-1472. make use CachedThreadPool configurable.#566
szetszwo merged 4 commits intoapache:masterfrom
captainzmc:conf-thread

Conversation

@captainzmc
Copy link
Member

What changes were proposed in this pull request?

see: https://issues.apache.org/jira/browse/RATIS-1472

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@captainzmc , thanks for testing the performance. Two minor comments inlined.

interface DataStream {
String PREFIX = RaftServerConfigKeys.PREFIX + ".data-stream";

String USE_CACHED_THREAD_POOL_KEY = PREFIX + ".use.cached.thread.pool";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change it to ".async.request.thread.pool.cached". Then, it is easy to see that this conf and ".async.request.thread.pool.size" are closely related.

this.writeExecutor = ConcurrentUtils.newCachedThreadPool(
RaftServerConfigKeys.DataStream.asyncWriteThreadPoolSize(properties),
ConcurrentUtils.newThreadFactory(name + "-write-"));
this.useCachedThreadPool = RaftServerConfigKeys.DataStream.useCachedThreadPool(properties);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just make it a local variable.

Comment on lines +463 to +468
static boolean useCachedThreadPool(RaftProperties properties) {
return getBoolean(properties::getBoolean, ASYNC_REQUEST_THREAD_POOL_CACHED_KEY,
ASYNC_REQUEST_THREAD_POOL_CACHED_DEFAULT, getDefaultLog());
}

static void setUseCachedThreadPool(RaftProperties properties, boolean useCached) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@captainzmc , thanks for the update. We also need to update the getter and setter method names. Otherwise, TestConfUtils will fail.

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 the change looks good.

@szetszwo szetszwo merged commit 0d8e70b into apache:master Dec 18, 2021
symious pushed a commit to symious/ratis that referenced this pull request Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants