lucastetreault opened a new pull request, #908: URL: https://github.com/apache/activemq/pull/908
Running a profiler while executing the sample code attached to [AMQ-9107](https://issues.apache.org/jira/browse/AMQ-9107) identified ManagedRegionBroker.removeConsumer as the bottleneck. The existing implementation loops over all the subscriptions to find the subscription for the consumer we want to close. When we have n consumers and we want to close them all this for loop is O(n^2) and when n is big enough it creates a serious performance issue. With 188,000 consumers we observe the CPU at 100% for ~40 minutes while all the connections are closed: <img width="1217" alt="image" src="https://user-images.githubusercontent.com/7095337/195011857-a6971abb-b73c-41fd-bd88-9ab376388949.png"> After this PR, running the same test case we observe a spike in CPU of only one minute or less, similar to what it took to create the consumers: <img width="968" alt="image" src="https://user-images.githubusercontent.com/7095337/195017869-c17c8b4a-fabc-4c2c-a909-6073955613a1.png"> I ran the full suite of tests and everything is passing. -- 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]
