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

   This PR enhances the performance of ConsumerOffsetManager by reducing 
unnecessary iterations and optimizing key lookups in offset-related methods.
   
   Key Optimizations :
   
   1) Faster Lookups
   - Replaced O(N) iterations in whichTopicByConsumer() and whichGroupByTopic() 
with O(1) HashMap lookups using precomputed mappings (groupToTopics & 
topicToGroups).
   
   2) Efficient Cleanup Methods
   - cleanOffset() and cleanOffsetByTopic() now use temporary HashSets to track 
keys to remove, preventing concurrent modification issues.
   - Eliminated incorrect matches caused by contains() checks.
   
   3)Optimized Offset Scanning
   - scanUnsubscribedTopic() avoids unnecessary split() calls and uses bulk 
removal instead of modifying offsetTable inside the loop.
   
   4)Maintains Offset-Topic Consistency
   - Added updateOffsetTable() to ensure groupToTopics & topicToGroups mappings 
stay in sync with offsetTable.
   
   This results in faster topic-group lookups, reduced memory overhead, and 
improved efficiency when managing consumer offsets. 
   
   Fixes #9240 


-- 
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: commits-unsubscr...@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to