Skip to content

[ISSUE #11153] Remove dedicated NameServer probe workers - #11154

Closed
qianye1001 wants to merge 1 commit into
apache:developfrom
qianye1001:codex/async-namesrv-probe
Closed

[ISSUE #11153] Remove dedicated NameServer probe workers#11154
qianye1001 wants to merge 1 commit into
apache:developfrom
qianye1001:codex/async-namesrv-probe

Conversation

@qianye1001

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Fixes #11153.

Brief Description

NettyRemotingClient currently submits NameServer connection probes to a dedicated pool with 4 core threads, up to 10 workers and a queue of 32 tasks. Those workers wait for connection results that Netty already exposes asynchronously.

Initiate the probes directly from the existing housekeeping timer and update availability through connection-future listeners. Remove the scan executor entirely, including its construction and shutdown, eliminating NettyClientScan_thread_ workers. The existing scan switch and interval are retained.

The scan uses a nonblocking attempt on the existing channel-table lock so that contention defers a probe to the next scan instead of blocking housekeeping. Pending or failed connections are not advertised as available, and callbacks check the current address list, connection and shutdown state before applying results. No new executor, timer or public configuration is added.

How Did You Test This Change?

JDK 11, with Checkstyle and SpotBugs enabled:

mvn -B -pl remoting -am -Dmaven.gitcommitid.skip=true \
  -Dtest=NettyRemotingClientNameServerTest,NettyRemotingClientTest \
  -Dsurefire.failIfNoSpecifiedTests=false test

All 26 tests passed (10 new probe tests and 16 existing client tests). Coverage includes pending connections without blocking housekeeping, connection failure and retry, address removal, replacement connections, channel-lock contention, the disabled scan switch, inactive channels and shutdown. A real TCP test verifies availability after connecting and removal after the server stops.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.33333% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.32%. Comparing base (1a50c6e) to head (108ee0f).

Files with missing lines Patch % Lines
...e/rocketmq/remoting/netty/NettyRemotingClient.java 58.33% 6 Missing and 4 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11154      +/-   ##
=============================================
- Coverage      49.35%   49.32%   -0.04%     
  Complexity     14227    14227              
=============================================
  Files           1390     1390              
  Lines         103123   103130       +7     
  Branches       13484    13488       +4     
=============================================
- Hits           50893    50865      -28     
- Misses         46068    46082      +14     
- Partials        6162     6183      +21     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

This PR removes the dedicated scanExecutor thread pool used for NameServer connection probes and replaces it with an async approach using the existing housekeeping timer and Netty ChannelFutureListener. This is a solid performance optimization that eliminates unnecessary thread blocking.

Key improvements:

  • Eliminates a dedicated thread pool (4 core, 10 max threads) for better resource utilization
  • Non-blocking probe initiation from housekeeping timer
  • Proper async handling with connection-future listeners
  • Comprehensive test coverage (10 test cases) covering edge cases

Code quality:

  • Clean async implementation with proper shutdown guards
  • Handles lock contention gracefully (skips probe if lock unavailable)
  • Prevents stale updates by checking channel wrapper identity
  • Excellent test suite covering async behavior, shutdown, replacements, and integration

LGTM. Well-implemented optimization with thorough testing.


Automated review by github-manager

@qianye1001
qianye1001 marked this pull request as draft September 11, 2026 09:57
@qianye1001 qianye1001 closed this Sep 14, 2026
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.

[Enhancement] Remove the dedicated NameServer probe thread pool

3 participants