RockteMQ-AI commented on issue #10486:
URL: https://github.com/apache/rocketmq/issues/10486#issuecomment-4679389451

   ## 🤖 Issue Evaluation
   
   **Classification:** Enhancement (Performance)
   **Priority:** Medium
   **Status:** ✅ Valid Enhancement
   
   ### Assessment
   
   Well-identified performance issue. The redundant 
`MessageDecoder.string2messageProperties(...)` call on every send creates 
unnecessary HashMap allocations that are immediately discarded after querying 5 
keys.
   
   **Analysis:**
   - `BrokerMetricsManager.getMessageType(SendMessageRequestHeader)` decodes 
properties String internally
   - `SendMessageProcessor.buildMsgContext` already decoded the same properties 
String just before
   - Result: redundant HashMap + Node[] + String allocations per message send
   
   **Recommendation:**
   Adding a `getMessageType(Map<String, String>)` overload is a clean solution. 
The caller can pass the already-decoded properties map, eliminating the 
redundant decode.
   
   This is a straightforward optimization with clear benefit on the send hot 
path.
   
   **Next Steps:**
   - PR welcome — the change is localized to `BrokerMetricsManager` and its 
callers
   - Should include JMH or JFR before/after comparison to quantify the 
allocation reduction
   
   ---
   *🤖 Automated evaluation by oss-sentinel-ai*


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