mwashburn2 opened a new pull request, #2019:
URL: https://github.com/apache/activemq/pull/2019
When a slow-consumer's pending-message buffer exceeds the high-water mark
TopicSubscription.add() calls removeExpiredMessages() on every single message
add. That method iterates every pending message and calls isExpired(), which is
an O(n) scan over the full buffer. When messages carry no TTL (isExpired()
always returns false), this scan provides no benefit -- it iterates the entire
buffer on every add with zero messages removed. With a large pending limit
(e.g. 20,000), this adds up to millions of no-op iterations per second on busy
topics. This commit adds an enableExpiry boolean (default true) to PolicyEntry.
Setting it to false inserts a single guard in TopicSubscription.add():
if (enableExpiry && !matched.isEmpty() && matched.size() > max) {
removeExpiredMessages();
}
Configuration in activemq.xml:
<policyEntry topic=">" enableExpiry="false">
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="20000"/>
</pendingMessageLimitStrategy>
</policyEntry>
Also adds:
- TopicSubscriptionEnableExpiryTest: 11 correctness/propagation/integration
tests
- TopicSubscriptionEnableExpiryThroughputTest: throughput comparison test
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact