wang-jiahua opened a new pull request, #10443: URL: https://github.com/apache/rocketmq/pull/10443
Cache OpenTelemetry AttributeKey instances as static finals instead of creating new instances per RPC call. Also optimize TopicMessageType lookup, add volatile inline cache for RemotingCodeDistributionHandler, and add Logback NopStatusListener to suppress startup log noise. <!-- Please make sure the target branch is right. In most case, the target branch should be `develop`. --> ### Which Issue(s) This PR Fixes <!-- Please ensure that the related issue has already been created, and [link this pull request to that issue using keywords](<https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>) to ensure automatic closure. --> - Fixes #10441 ### Brief Description <!-- Write a brief description for your pull request to help the maintainer understand the reasons behind your changes. --> Cache OpenTelemetry `AttributeKey` instances as static finals instead of creating new ones per RPC call. JFR heap dump shows 38,182 `AttributeKey` instances with only 6 distinct key names — each RPC allocates 3-4 throwaway key objects. Changes: - `BrokerMetricsConstant` / `RemotingMetricsConstant`: `String` labels → `AttributeKey<T>` static finals - `BrokerMetricsManager` / `RemotingMetricsManager` / `PopMetricsManager`: use `put(AttributeKey, value)` overloads - `RemotingCodeDistributionHandler`: volatile inline cache for counter methods - `TopicMessageType`: direct if-else lookup replacing `values()` iteration - `rmq.broker.logback.xml`: add `NopStatusListener` ### How Did You Test This Change? <!-- In order to ensure the code quality of Apache RocketMQ, we expect every pull request to have undergone thorough testing. --> - JFR profiling (ObjectAllocationSample) on 4×ECS (8c/30G), 128 producer threads, 1KB body, Temurin JDK 21 - Verified all existing metrics report identically before/after - Zero functional change — only metric label construction paths affected -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
