wang-jiahua opened a new pull request, #10528:
URL: https://github.com/apache/rocketmq/pull/10528

   <!-- 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 #10527
   
   ### Brief Description
   
   Reduce allocation in auxiliary store components through five independent 
optimizations:
   
   1. **`QueueOffsetOperator`** — Replace `ConcurrentMap<String, Long>` with 
`ConcurrentMap<String, AtomicLong>`. Eliminates `Long` boxing on every queue 
offset update.
   2. **`BrokerStatsManager`** — Cache 
`buildStatsKey`/`topicQueueKey`/`consumerOffset` string results. Change 
`Integer` parameters to `int` in `incQueue*` methods to eliminate autoboxing.
   3. **`IndexService`** — Reuse `StringBuilder` via ThreadLocal instead of 
allocating per-call.
   4. **`TimerWheel`** — Add volatile `dirty` flag to skip flush when no 
changes occurred since last flush.
   5. **`AppendMessageResult`** — Add constructor with pre-computed fields to 
avoid redundant allocation.
   
   ### How Did You Test This Change?
   
   1. **Unit tests**: All 15 `BrokerStatsManagerTest` tests pass (including 
`testOnTopicDeleted` which exercises all `incQueue*` methods).
   2. **Compilation**: `store` module compiles cleanly on JDK 21.
   3. **Commercial compatibility**: No commercial classes extend 
`QueueOffsetOperator`, `BrokerStatsManager`, `IndexService`, `TimerWheel`, or 
`AppendMessageResult`.
   


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