f1amingo opened a new issue, #11579:
URL: https://github.com/apache/rocketmq/issues/11579

   ### Before Creating the Enhancement Request
   - [x] I have confirmed this should be classified as an enhancement.
   
   ### Summary
   When `persistConsumerOffsetIncrementally` is enabled, the V1 RocksDB 
consumer offset manager writes every `commitOffset` to RocksDB synchronously 
with WAL. With a large number of LMQs (e.g. LiteTopic), this per-commit write 
path dominates broker CPU and commit latency.
   
   ### Motivation
   A component benchmark (1M LMQs, 10k active, 10k commits/s, JDK 21, G1, 6g 
heap) shows that batching the incremental writes reduces process CPU by about 
41%, commit p99 from 17.28μs to 2.14μs, and RocksDB write calls from 601,211 to 
4,156, with the same offsets persisted.
   
   ### Describe the Solution You'd Like
   - Keep the in-memory offset update synchronous and only register the dirty 
key in a deduplicated pending set.
   - A single background thread flushes pending keys every 20ms in batches of 
at most 500 keys or 256KB.
   - `persist()` and `stop()` drain pending keys and sync the WAL; deleting an 
offset cancels its pending write.
   - On shutdown, persist all config managers before any of them closes the 
shared RocksDB.
   - Reuse the existing `persistConsumerOffsetIncrementally` switch; `false` 
keeps the periodic full persistence unchanged.
   
   ### Describe Alternatives You've Considered
   - Periodic full persistence (`persistConsumerOffsetIncrementally=false`): 
each persist takes about 2.7s with 1M LMQs.
   - A new switch for asynchronous batching: rejected to avoid keeping the 
per-commit write path that causes the overhead.
   
   ### Additional Context
   On a crash, offset updates within the last batch interval may be lost, which 
only leads to duplicate consumption; the at-least-once semantics are unchanged.
   


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