RockteMQ-AI commented on issue #10512: URL: https://github.com/apache/rocketmq/issues/10512#issuecomment-4704223696
**Issue Evaluation** Category: `type/enhancement` | Status: **Evaluated** **Feasibility:** Feasible **Scope:** `remoting` module — `RemotingCommand`, `NettyRemotingServer`, `NettyDecoder`, `TopicQueueMappingContext` **Compatibility:** Fully backward compatible, internal implementation changes only **Code Verification (all claims confirmed):** 1. ✅ **Stopwatch allocation** — `RemotingCommand.java:100` uses `private transient Stopwatch processTimer;`, `NettyDecoder.java:42` calls `Stopwatch.createStarted()` per decode. Replacing with `System.nanoTime()` eliminates one object allocation per RPC. 2. ✅ **Constructor reflection** — `RemotingCommand.java:162,286` calls `classHeader.getDeclaredConstructor().newInstance()` without caching. ~237 allocation events per 60s as reported. `ConcurrentHashMap` cache is the correct fix. 3. ✅ **channelWritabilityChanged logging** — `NettyRemotingServer.java:579-592` logs at INFO/WARN on every writability change with `parseChannelRemoteAddr()` + string concat. 81,434 lines in 90s confirms the hot path problem. Downgrade to DEBUG with `isDebugEnabled()` guard is appropriate. 4. ✅ **TopicQueueMappingContext.EMPTY** — No static singleton exists. Only a parameterized constructor is available. Adding an `EMPTY` singleton for non-static-topic traffic (>99% of messages) is a valid optimization. **Assessment:** Well-researched issue backed by JFR profiling data. Each optimization targets a real allocation hotspot in the remoting layer. The changes are low-risk, self-contained, and backward compatible. Combined effect should measurably reduce GC pressure under high throughput. --- *Automated evaluation by RockteMQ-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]
