Skip to content

Migrate gRPC transport executor to ForkJoinPool#19685

Open
jungeunyooon wants to merge 5 commits intoopensearch-project:mainfrom
jungeunyooon:feature/19370-migrate-grpc-to-forkjoinpool
Open

Migrate gRPC transport executor to ForkJoinPool#19685
jungeunyooon wants to merge 5 commits intoopensearch-project:mainfrom
jungeunyooon:feature/19370-migrate-grpc-to-forkjoinpool

Conversation

@jungeunyooon
Copy link
Copy Markdown

@jungeunyooon jungeunyooon commented Oct 20, 2025

Description

This PR migrates the gRPC transport executor from FixedExecutorBuilder to ForkJoinPoolExecutorBuilder to improve performance through work-stealing and better load balancing.

  • Updated GrpcPlugin.java to use ForkJoinPoolExecutorBuilder instead of FixedExecutorBuilder
  • Updated test files to reflect the executor change

Related Issues

Resolves #19370

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@jungeunyooon jungeunyooon requested a review from a team as a code owner October 20, 2025 05:19
@github-actions github-actions bot added enhancement Enhancement or improvement to existing feature or request good first issue Good for newcomers Search:Performance labels Oct 20, 2025
@jungeunyooon jungeunyooon force-pushed the feature/19370-migrate-grpc-to-forkjoinpool branch from 42def60 to cb0269f Compare October 20, 2025 05:26
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for cb0269f: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@jungeunyooon jungeunyooon force-pushed the feature/19370-migrate-grpc-to-forkjoinpool branch from cb0269f to 32618f4 Compare October 20, 2025 05:41
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 32618f4: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Copy Markdown
Contributor

@karenyrx karenyrx left a comment

Choose a reason for hiding this comment

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

Thanks for taking this on!

@jungeunyooon jungeunyooon force-pushed the feature/19370-migrate-grpc-to-forkjoinpool branch from 32618f4 to 06951a4 Compare November 6, 2025 09:21
Signed-off-by: yoonjungeun1 <angal2310@tukorea.ac.kr>
Signed-off-by: yoonjungeun1 <angal2310@tukorea.ac.kr>
Signed-off-by: yoonjungeun1 <angal2310@tukorea.ac.kr>
@jungeunyooon jungeunyooon force-pushed the feature/19370-migrate-grpc-to-forkjoinpool branch from 8f95072 to 96c61de Compare November 6, 2025 10:48
Signed-off-by: jungeun yoon <jungeun.kate@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 6, 2025

❌ Gradle check result for 6fafca3: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@jungeunyooon
Copy link
Copy Markdown
Author

@karenyrx I’ve updated the PR based on your feedback.
I’d appreciate it if you could review it again.

Copy link
Copy Markdown
Contributor

@karenyrx karenyrx left a comment

Choose a reason for hiding this comment

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

Overall LGTM, would be great to see an OSB run with/without this change to see if/how much performance improves

Signed-off-by: Karen X <karenxyr@gmail.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

This change migrates the gRPC transport executor implementation from FixedExecutorBuilder to ForkJoinPoolExecutorBuilder to leverage improved performance benefits such as work-stealing and better load balancing. The migration updates the main plugin code, test files, and changelog documentation.

Changes

Cohort / File(s) Summary
Main Implementation
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/GrpcPlugin.java
Replaced FixedExecutorBuilder with ForkJoinPoolExecutorBuilder; renamed executorCount variable to parallelism; updated import statement and added Javadoc note about ForkJoinPool approach.
Test Files
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/Netty4GrpcServerTransportTests.java, modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/ssl/SecureNetty4GrpcServerTransportTests.java
Replaced executor builder instantiation from FixedExecutorBuilder(settings, "grpc", 4, 1000, "thread_pool.grpc") to ForkJoinPoolExecutorBuilder("grpc", 4, "thread_pool.grpc"); updated imports accordingly.
Documentation
CHANGELOG.md
Added changelog entry documenting the migration to ForkJoinPoolExecutorBuilder for improved gRPC transport performance.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Migrate gRPC transport executor to ForkJoinPool' clearly and concisely summarizes the main objective of the changeset.
Description check ✅ Passed The PR description provides a clear summary of changes, specifies the related issue (#19370), and completes the required checklist items.
Linked Issues check ✅ Passed The PR successfully implements the requirements from issue #19370 by migrating from FixedExecutorBuilder to ForkJoinPoolExecutorBuilder across all relevant files.
Out of Scope Changes check ✅ Passed All changes are directly related to the executor migration objective; the CHANGELOG entry addition is an appropriate administrative change for documenting this migration.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68c2d14 and a81020d.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/GrpcPlugin.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/Netty4GrpcServerTransportTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/ssl/SecureNetty4GrpcServerTransportTests.java
🧰 Additional context used
🧠 Learnings (7)
📚 Learning: 2025-12-12T18:40:08.452Z
Learnt from: reta
Repo: opensearch-project/OpenSearch PR: 20017
File: plugins/transport-reactor-netty4/src/test/java/org/opensearch/http/reactor/netty4/ssl/SecureReactorNetty4HttpServerTransportTests.java:256-256
Timestamp: 2025-12-12T18:40:08.452Z
Learning: In the OpenSearch ReactorNetty4 secure HTTP transport tests (plugins/transport-reactor-netty4/src/test/java/org/opensearch/http/reactor/netty4/ssl/SecureReactorNetty4HttpServerTransportTests.java), URI limit validation has been moved from the protocol layer to the transport layer, making it protocol-agnostic. The random protocol selection in ReactorHttpClient.https(settings) is intentional to ensure all tests validate correct behavior across HTTP/1.1, HTTP/2, and HTTP/3.

Applied to files:

  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/ssl/SecureNetty4GrpcServerTransportTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/Netty4GrpcServerTransportTests.java
📚 Learning: 2025-12-19T21:26:37.090Z
Learnt from: reta
Repo: opensearch-project/OpenSearch PR: 20017
File: modules/transport-netty4/src/main/java/org/opensearch/http/netty4/Netty4QuicServerTransport.java:0-0
Timestamp: 2025-12-19T21:26:37.090Z
Learning: In Netty4QuicServerTransport (modules/transport-netty4/src/main/java/org/opensearch/http/netty4/Netty4QuicServerTransport.java), the secureHttpTransportSettingsProvider parameter is guaranteed to be non-null because the plugin verifies its presence during instantiation, so no explicit null-check is needed in the constructor.

Applied to files:

  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/ssl/SecureNetty4GrpcServerTransportTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/Netty4GrpcServerTransportTests.java
📚 Learning: 2025-12-12T13:31:51.234Z
Learnt from: andriyredko
Repo: opensearch-project/OpenSearch PR: 20017
File: plugins/transport-reactor-netty4/src/test/java/org/opensearch/http/reactor/netty4/ssl/SecureReactorNetty4HttpServerTransportTests.java:642-646
Timestamp: 2025-12-12T13:31:51.234Z
Learning: In the OpenSearch ReactorNetty4 secure HTTP transport tests (plugins/transport-reactor-netty4/src/test/java/org/opensearch/http/reactor/netty4/ssl/SecureReactorNetty4HttpServerTransportTests.java), the createBuilderWithPort() helper intentionally uses randomBoolean() for the HTTP/3 enabled setting to ensure all tests validate correct behavior with both HTTP/3 enabled and disabled configurations.

Applied to files:

  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/ssl/SecureNetty4GrpcServerTransportTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/Netty4GrpcServerTransportTests.java
📚 Learning: 2025-12-13T20:16:15.318Z
Learnt from: reta
Repo: opensearch-project/OpenSearch PR: 20017
File: modules/transport-netty4/src/main/java/org/opensearch/http/netty4/Netty4Http3ServerTransport.java:101-123
Timestamp: 2025-12-13T20:16:15.318Z
Learning: In OpenSearch, only one HTTP transport implementation can be active and loaded at a time, so duplicate setting definitions (such as h3.max_stream_local_length, h3.max_stream_remote_length, and h3.max_streams) across different transport implementations like Netty4Http3ServerTransport and ReactorNetty4HttpServerTransport will not cause setting registration conflicts.

Applied to files:

  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/ssl/SecureNetty4GrpcServerTransportTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/Netty4GrpcServerTransportTests.java
📚 Learning: 2026-01-02T19:23:16.689Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:16.689Z
Learning: In OpenSearch's gRPC transport module, treat removals of previously-unsupported fields (those throwing UnsupportedOperationException) from experimental proto schemas as non-breaking changes. When reviewing changes to proto-related Java code in this module, document that such removals do not count as breaking API changes, and ensure tests reflect compatibility expectations accordingly.

Applied to files:

  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/ssl/SecureNetty4GrpcServerTransportTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/GrpcPlugin.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/Netty4GrpcServerTransportTests.java
📚 Learning: 2026-01-02T19:23:29.698Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: In the transport-grpc module, suggest and aggregations protos were removed from SearchRequestBody in protobufs 1.0.0 because they haven't been vetted for accuracy in the API specification. The URL parameter suggest support (suggest_field, suggest_mode, suggest_size, suggest_text) is a minimized subset and not intended as a replacement for full Suggester functionality.

Applied to files:

  • CHANGELOG.md
📚 Learning: 2026-01-02T19:23:29.698Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: The gRPC search API in OpenSearch is marked as "experimental" in official documentation, so changes to proto schemas that remove previously unsupported fields (those throwing UnsupportedOperationException) are not considered breaking changes.

Applied to files:

  • CHANGELOG.md
🧬 Code graph analysis (2)
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/ssl/SecureNetty4GrpcServerTransportTests.java (1)
server/src/main/java/org/opensearch/threadpool/ForkJoinPoolExecutorBuilder.java (1)
  • ForkJoinPoolExecutorBuilder (31-147)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/GrpcPlugin.java (1)
server/src/main/java/org/opensearch/threadpool/ForkJoinPoolExecutorBuilder.java (1)
  • ForkJoinPoolExecutorBuilder (31-147)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: gradle-check
  • GitHub Check: Mend Security Check
🔇 Additional comments (9)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/GrpcPlugin.java (3)

31-31: LGTM!

Import correctly updated to ForkJoinPoolExecutorBuilder.


299-300: LGTM!

Javadoc accurately documents the rationale for using ForkJoinPool (work-stealing and better load balancing).


305-309: LGTM!

The migration to ForkJoinPoolExecutorBuilder is correctly implemented:

  • Variable appropriately renamed to parallelism to match the ForkJoinPool terminology.
  • Constructor call matches the ForkJoinPoolExecutorBuilder(name, parallelism, prefix) signature.
  • Reuses the existing SETTING_GRPC_EXECUTOR_COUNT setting which is appropriate since it still controls the level of parallelism.
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/ssl/SecureNetty4GrpcServerTransportTests.java (2)

16-16: LGTM!

Import correctly updated to ForkJoinPoolExecutorBuilder.


52-54: LGTM!

Test correctly updated to use ForkJoinPoolExecutorBuilder with matching constructor signature. The parallelism value of 4 is appropriate for testing.

modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/Netty4GrpcServerTransportTests.java (4)

19-19: LGTM!

Import correctly updated to ForkJoinPoolExecutorBuilder.


46-52: LGTM!

Test setup correctly updated to use ForkJoinPoolExecutorBuilder with the same parallelism value (4) as the secure transport tests, ensuring consistency across test suites.


239-241: LGTM!

Comments appropriately updated to reflect that ForkJoinPool encapsulates thread management differently and the executor is managed by OpenSearch's ThreadPool system.

Also applies to: 257-258, 297-298


365-366: LGTM!

Test comments consistently updated throughout to reflect the new ForkJoinPool-based executor behavior.

Also applies to: 470-471, 486-487

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for a81020d: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for a81020d: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement or improvement to existing feature or request good first issue Good for newcomers Search:Performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Migrate gRPC transport executor to ForkJoinPool for improved performance

2 participants