[ISSUE #10197] Add traffic size distribution per requestCode in RemotingCodeDistributionHandler#10198
Open
RongtongJin wants to merge 3 commits intoapache:developfrom
Open
[ISSUE #10197] Add traffic size distribution per requestCode in RemotingCodeDistributionHandler#10198RongtongJin wants to merge 3 commits intoapache:developfrom
RongtongJin wants to merge 3 commits intoapache:developfrom
Conversation
…deDistributionHandler
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #10198 +/- ##
=============================================
- Coverage 48.93% 48.86% -0.08%
+ Complexity 13384 13369 -15
=============================================
Files 1373 1373
Lines 99924 99940 +16
Branches 12908 12913 +5
=============================================
- Hits 48898 48835 -63
- Misses 45098 45161 +63
- Partials 5928 5944 +16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
lizhimins
reviewed
Mar 25, 2026
remoting/src/main/java/org/apache/rocketmq/remoting/netty/RemotingCodeDistributionHandler.java
Outdated
Show resolved
Hide resolved
lizhimins
requested changes
Mar 25, 2026
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.
Which Issue(s) This PR Fixes
Brief Description
Add per-requestCode traffic size (bytes) distribution to
RemotingCodeDistributionHandler, in addition to the existing request count distribution.Key changes:
ConcurrentHashMaps with 2 using a compositeTrafficStatsclass (LongAdder count+LongAdder trafficSize)calcCommandSize()default path: fixed overhead (29 bytes) + body length — O(1), no iteration on hot pathenableDetailedTrafficSizeinNettyServerConfig: when enabled, also counts remark + extFields byte lengths. Togglable at runtime viaupdateBrokerConfigNettyRemotingServer.printRemotingCodeDistribution()now logs inbound/outbound traffic snapshotsHow Did You Test This Change?
RemotingCodeDistributionHandlerTestwith 10 unit test cases covering: count, traffic with/without body, detailed mode on/off, snapshot reset, multiple requestCodes, non-RemotingCommand passthrough, concurrent correctness, and runtime toggleRemotingCodeDistributionBenchmark(JMH) comparing detail-off vs detail-on across 1/4/8 threads.recordInbound()is called directly (package-private) to isolate recording overhead from Netty pipeline cost