lizhimins opened a new pull request, #10523:
URL: https://github.com/apache/rocketmq/pull/10523

   ## What is the purpose of the change
   
   close #10521
   
   `ConsumeQueue.correctMinOffset` performs binary search on mmap files (random 
access pattern). The Linux kernel default `read_ahead_kb` on NVMe devices is 
aggressively large, so each page fault during binary search pulls in far more 
data than actually needed, producing periodic disk read pulses.
   
   On cloud disks where read/write bandwidth share a single quota, these read 
pulses squeeze CommitLog writes and cause periodic send-RT spikes.
   
   ## Brief changelog
   
   - Call `madvise(MADV_RANDOM)` before binary search to disable read-ahead, 
restore `madvise(MADV_NORMAL)` in the finally block
   - Add config switch `correctMinOffsetMadviseEnable` (default: off)
   - Skip on Windows where `madvise` is not available
   - Platform check cached as `static final` to avoid repeated evaluation
   
   ## Verifying this change
   
   - Added unit tests covering large dataset (5000 entries), small dataset (10 
entries), and empty queue scenarios
   - Production validation: send p99 stabilized at ~4ms with zero pulses over 
60 minutes (previously 7 pulses/hour with p99 spikes to 26ms)


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