cshannon commented on PR #2019:
URL: https://github.com/apache/activemq/pull/2019#issuecomment-4483342408

   I think a simpler approach here that avoids turning off the expiration check 
might be to just add a short circuit to the expiration loop. Right now the loop 
runs through all the messages which is the performance problem (as described) 
but I think we could add a short circuit that just aborts the loop as soon as 
the first message is seen that isn't expired.
   
   This approach should work in the vast majority of use cases because most of 
the time messages on the same topic are going to be very similar (ie the same 
producer is setting the same TTL) so if the current message is not expired is 
is pretty unlikely any of the other messages are expired so there is no reason 
to check them. This of course also works well for the use case of never setting 
a TTL (always aborts on the first message) while still working if there's a 
bunch of expired messages in a row.
   
   The downside is this would miss expiration on use cases where data is mixed 
(some messages have TTL and some don't or different TTL times) but that is not 
that common and there is expiration handling in other places in the broker as 
well such as on dispatch so I don't think this is a big downside.
   
   @mattrpav - What do you think?


-- 
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


Reply via email to