Improve TopologyService and HeartbeatService scalability for large clusters#17595
Draft
CRZbulabula wants to merge 3 commits intomasterfrom
Draft
Improve TopologyService and HeartbeatService scalability for large clusters#17595CRZbulabula wants to merge 3 commits intomasterfrom
CRZbulabula wants to merge 3 commits intomasterfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #17595 +/- ##
=========================================
Coverage 40.05% 40.05%
Complexity 2554 2554
=========================================
Files 5176 5176
Lines 348528 348594 +66
Branches 44558 44557 -1
=========================================
+ Hits 139595 139626 +31
- Misses 208933 208968 +35 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
max(base, base × N / refN)), preventing fixed-interval overhead from dominating large clusters. Configurable viatopology_probing_base_interval_in_ms,topology_probing_reference_node_count, andtopology_probing_timeout_ratio.ceil(√N)DataNodes as probers (instead of all N), rotating across cycles for full coverage. Reduces per-cycle RPC fan-out from O(N) to O(√N) and total connection tests from O(N²) to O(N√N).TopologyServicepushes updates directly to DataNodes via dedicated heartbeat RPC, only when a DataNode's reachable set changes. Eliminates O(N²) per-heartbeat payload and thecompareAndSet-based update-loss issue.submitInternalTestConnectionTaskandsubmitTestConnectionTaskon DataNode now use bounded timeouts (dnConnectionTimeoutInMS) instead of unboundedCountDownLatch.await(). Prevents internal RPC threads from blocking indefinitely when target nodes are unreachable.submitInternalTestConnectionTaskhandler offloads blocking work to a dedicated 2-threadTOPOLOGY_PROBING_EXECUTORwithFuture.get(timeout), so theDataNodeInternalRPCServicethread pool (shared withsendFragmentInstance, consensus, etc.) is no longer held hostage by slow probes.AsyncDataNodeHeartbeatServiceClientPoolFactoryandAsyncConfigNodeHeartbeatServiceClientPoolFactorynow use a dedicatedheartbeat_selector_num_of_client_managerconfig (default 4, up from 1), preventing the single NIO selector thread from becoming a serial bottleneck when processing N heartbeat responses.collectPipeMetaListlock timeout: Changed fromdnConnectionTimeoutInMS * 2/3(≈ 40000 seconds due to unit mismatch — effectively 11 hours) to 2 seconds. If the pipe meta lock cannot be acquired within 2s, the collection is skipped for this heartbeat cycle and retried in the next (every ~100 heartbeats).LoadCache.updateTopology()andClusterTopology.updateTopology()both had copy-paste bugs whereoriginReachableread fromlatestTopologyinstead of the old topology, making the diff comparison always equal and the change-log dead code.Test plan
TopologyServiceadaptive interval: deploy a 3-node cluster, confirm probing interval equalsbase_interval; add nodes beyondreference_node_count, confirm interval scales proportionallyceil(√N)probers are selected per cycle via[Topology]log lines; confirm all nodes rotate through as probers over multiple cycles[Topology] latest view from config-nodeappears on DataNode logs only when reachable set changes, not every heartbeatdnConnectionTimeoutInMScollectPipeMetaListtimeout: create a pipe, confirm heartbeat handler does not block for more than 2 seconds even under pipe lock contention[Topology] Topology of DataNode X is now unreachable to DataNode Ylog entries appear correctly🤖 Generated with Claude Code