rich7420 opened a new pull request, #11113:
URL: https://github.com/apache/ozone/pull/11113

   ## What changes were proposed in this pull request?
   
   `SCMNodeManager` built a `DecimalFormat` per datanode inside the 
node-stats/JMX loops (`convertUnit`, `calculateStoragePercentage`, 
`nodeUsageStatistics`). This caches one per thread (`ThreadLocal`, since 
`DecimalFormat` is not thread-safe) for each of the two patterns (`#0.0`, 
`#0.00`). Same pattern and rounding mode, so the formatted output is unchanged.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16278
   
   ## How was this patch tested?
   
   Existing `TestSCMNodeManager#testCalculateStoragePercentage` asserts the 
exact formatted strings for both patterns and still passes (6/6). checkstyle, 
pmd and findbugs are green on the fork CI.
   
   JMH (out of tree, isolating the formatter acquisition), JDK 21:
   
   | pattern | ns/op (old -> new) | B/op (old -> new) |
   | --- | --- | --- |
   | `#0.0` | 396 -> 147 (-63%) | 1064 -> 160 |
   | `#0.00` | 375 -> 134 (-64%) | 952 -> 160 |
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to