+++ This bug was initially created as a clone of Bug #1088600 +++
The method ScheduledDeliveryHandlerImpl$ScheduledDeliveryRunnable.run() unnecessarily does a full traversal of the scheduledReferences linked list on each and every call.
When the number of scheduled messages is very large, this traversal severely impacts HornetQ's performance when consuming scheduled messages.
We are using HornetQ 2.2.24 in an application where we schedule ~400,000 messages in a single queue to be consumed several hours into the future, with large bursts of messages to be consumed as quickly as possible. In this application, we have found that HornetQ's rate of consuming scheduled messages is limited by CPU. From performance profiling, we found that the method
is consuming approximately 70-80% of the CPU cycles during bursts. Looking at the code, this is due to the full traversal of the scheduledReferences linked list on every call to run():
Should be fixed by upgrade https://bugzilla.redhat.com/show_bug.cgi?id=1064596 for DR2
Verified using provided ScheduledDeliveryHandlerTest during EAP 6.3.0.ER7. Thanks!