Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-3049

Reduce live page lookup cost

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.16.0
    • 2.17.0
    • Broker
    • None

    Description

      LivePageCacheImpl::getMessage is performing a linked-list-like lookup that can be rather slow if compared to an array lookup.

      https://github.com/apache/activemq-artemis/pull/2494#issuecomment-455086939 clearly show the issue with the current implementation.

      The ideal approaches to improve it could be:

      1. to replace the chunked list with a copy on write array list
      2. to use cursor/iterator API over the chunk list, binding one to each consumer, in order to get a linear stride over the live paged messages

      Sadly, the latter approach seems not doable because the live page cache is accessed for each message lookup in an anonymous way, making impossible to have a 1:1 binding with the consumers, while the former seems not doable, because of the array copy cost on appending.

       

      There is still one case that could be improved using the former approach, instead, delivering a huge speedup on lookup cost: while reloading live pages.

      A reloaded live page already knows the amount of the loaded live paged messages, making possible to store them in a simple array, allowing a much faster lookup.

       

      Attachments

        Issue Links

          Activity

            People

              nigrofranz Francesco Nigro
              nigrofranz Francesco Nigro
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 50m
                  3h 50m