RockteMQ-AI commented on issue #10515: URL: https://github.com/apache/rocketmq/issues/10515#issuecomment-4704443448
**Issue Evaluation** Category: `type/enhancement` | Status: **Evaluated** **Feasibility:** feasible | **Scope:** broker (ConsumerOffsetManager, PullRequestHoldService, TransactionMetricsFlushService) | **Compatibility:** no breaking changes Three well-scoped optimizations backed by JFR profiling data: 1. **ConsumerOffsetManager key caching** — Valid. `topic + "@" + group` is called on every `commitOffset()` with a stable (topic, group) pair set. Caching eliminates repeated `StringBuilder` allocation. The proposed 2-level `ConcurrentHashMap` approach is sound, though consider using `ConcurrentHashMap.computeIfAbsent` for atomicity. 2. **PullRequestHoldService buildKey caching** — Valid. Per-topic `String[]` indexed by queueId is efficient for the typical queue count range. Ensure bounds checking for dynamic queue expansion. 3. **TransactionMetricsFlushService busy-spin fix** — This is a **correctness bug**, not just an optimization. `waitForRunning()` inside the `if` branch means the `while` loop spins without sleep when the interval hasn't elapsed. The fix to move it outside the `if` is correct and should be prioritized. Recommendation: Item 3 (busy-spin fix) should be split into a separate PR as a bug fix. Items 1-2 can be bundled as a performance enhancement PR. --- *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]
