Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making force merge threadpool 1/8th of total cores #17255

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Use the correct type to widen the sort fields when merging top docs ([#16881](https://github.com/opensearch-project/OpenSearch/pull/16881))
- Limit reader writer separation to remote store enabled clusters [#16760](https://github.com/opensearch-project/OpenSearch/pull/16760)
- Optimize innerhits query performance [#16937](https://github.com/opensearch-project/OpenSearch/pull/16937)
- Increase force merge threads to 1/8th of cores [#17255](https://github.com/opensearch-project/OpenSearch/pull/17255)

### Deprecated
- Performing update operation with default pipeline or final pipeline is deprecated ([#16712](https://github.com/opensearch-project/OpenSearch/pull/16712))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ public ThreadPool(
Names.FETCH_SHARD_STARTED,
new ScalingExecutorBuilder(Names.FETCH_SHARD_STARTED, 1, 2 * allocatedProcessors, TimeValue.timeValueMinutes(5))
);
builders.put(Names.FORCE_MERGE, new FixedExecutorBuilder(settings, Names.FORCE_MERGE, 1, -1));
builders.put(
Names.FORCE_MERGE,
new FixedExecutorBuilder(settings, Names.FORCE_MERGE, oneEighthAllocatedProcessors(allocatedProcessors), -1)
);
builders.put(
Names.FETCH_SHARD_STORE,
new ScalingExecutorBuilder(Names.FETCH_SHARD_STORE, 1, 2 * allocatedProcessors, TimeValue.timeValueMinutes(5))
Expand Down Expand Up @@ -678,6 +681,10 @@ static int boundedBy(int value, int min, int max) {
return Math.min(max, Math.max(min, value));
}

static int oneEighthAllocatedProcessors(final int allocatedProcessors) {
return boundedBy(allocatedProcessors / 8, 1, Integer.MAX_VALUE);
gbbafna marked this conversation as resolved.
Show resolved Hide resolved
}

static int halfAllocatedProcessors(int allocatedProcessors) {
return (allocatedProcessors + 1) / 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,12 @@ public void testThreadPoolResizeFail() {
terminate(threadPool);
}
}

public void testOneEighthAllocatedProcessors() {
assertThat(ThreadPool.oneEighthAllocatedProcessors(1), equalTo(1));
assertThat(ThreadPool.oneEighthAllocatedProcessors(4), equalTo(1));
assertThat(ThreadPool.oneEighthAllocatedProcessors(8), equalTo(1));
assertThat(ThreadPool.oneEighthAllocatedProcessors(32), equalTo(4));
assertThat(ThreadPool.oneEighthAllocatedProcessors(128), equalTo(16));
}
}
Loading