YoWuwuuuw opened a new pull request, #9131: URL: https://github.com/apache/rocketmq/pull/9131
<!-- Please make sure the target branch is right. In most case, the target branch should be `develop`. --> ### Which Issue(s) This PR Fixes Add cache for each client request broker end rebalancing in the pop consumption mode to avoid wasting computing resources of broker end due to repeated calculation of load balancing without changes. The effect is more obvious in theory when there are a large number of queues or consumers <!-- Please ensure that the related issue has already been created, and [link this pull request to that issue using keywords](<https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>) to ensure automatic closure. --> Fixes #9123 ### Brief Description To add caching for broker-end rebalancing under the pop consumption model, use ReentrantLock to maintain consistency and efficiency. Before performing load balancing calculations, attempt to obtain cache entries when the client list and messagequeue list remain unchanged. Only if the cache is not hit will the calculation logic be executed, using minimal space to avoid wasting broker computing resources and ensuring efficient rebalancing requests <!-- Write a brief description for your pull request to help the maintainer understand the reasons behind your changes. --> ### How Did You Test This Change? Start a name serve, a broker, and two consumer clients locally, using the pop mode for consumption. Test the performance of broker-side rebalancing with both the original version and the improved version, covering: 1. consumers default to requesting rebalancing results every 20 seconds 2. active request rebalancing results when the consumer group changes 3. default request rebalancing results when the topic queue changes <!-- In order to ensure the code quality of Apache RocketMQ, we expect every pull request to have undergone thorough testing. --> -- 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