crazywen opened a new pull request, #1213:
URL: https://github.com/apache/rocketmq-clients/pull/1213

   ## Motivation
   
     When using `SimpleConsumer` with long-polling, if message distribution 
across queues
     is uneven (some queues empty, others with messages), the consumer gets 
blocked by
     long-polling on empty queues, causing significant delay in receiving 
messages from
     queues that actually have data.
   
     This is especially problematic in production with multiple queues where 
message
     traffic is bursty.
   
     ## Modification
   
     Enhanced `SubscriptionLoadBalancer` with empty-queue skip scheduling:
   
     - After each `receiveMessage` call, the result (empty or not) is fed back 
to the
       `SubscriptionLoadBalancer` via `markEmptyResult()`/`markNonEmptyResult()`
     - Queues that consecutively return empty are temporarily skipped in 
`takeMessageQueue()`
     - Skip duration is proportional to consecutive empty count (capped at 1000 
rounds)
     - When a queue returns messages again, its empty counter resets immediately
     - Uses `AtomicIntegerFieldUpdater` for thread-safe state updates
     - Fully backward-compatible: no API changes, no configuration required
   
     ## Result
   
     - Queues with messages are polled more frequently
     - Overall message reception latency reduced in uneven-distribution 
scenarios
     - Zero overhead when all queues have messages (skip map stays empty)
     - Added unit tests for `SubscriptionLoadBalancer`
   
     ## Type
   
     - [x] Enhancement


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