oss-taishan-ai commented on issue #10441:
URL: https://github.com/apache/rocketmq/issues/10441#issuecomment-4648761444

   **Issue Evaluation**
   
   Category: `type/enhancement` | Status: **Evaluated**
   
   **Feasibility:** feasible
   **Scope:** broker/metrics, remoting/metrics, remoting/netty, 
common/attribute (9 files)
   **Compatibility:** backward compatible (internal optimization, metrics 
output unchanged)
   
   **Assessment:**
   This is a targeted performance optimization addressing unnecessary object 
allocation in the metrics and remoting paths. The JFR heap dump analysis 
clearly identifies the problem:
   - 38,182 `InternalAttributeKeyImpl` instances with only 6 distinct key names
   - At 45k TPS, this creates 135k–180k throwaway objects per second
   
   The proposed solution (caching `AttributeKey` instances as static finals) is 
the standard pattern for OpenTelemetry usage and aligns with best practices. 
The additional optimizations (volatile inline cache for counters, direct lookup 
instead of `values()` iteration) are sound micro-optimizations.
   
   **Recommendation:** This is a low-risk, high-value optimization that could 
measurably reduce GC pressure in production deployments. The scope is 
well-contained to metrics/remoting code paths with no functional impact.
   
   ---
   *Automated evaluation by github-manager-bot*


-- 
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]

Reply via email to