[
https://issues.apache.org/jira/browse/ARTEMIS-3049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Francesco Nigro updated ARTEMIS-3049:
-------------------------------------
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:
# to replace the chunked list with a copy on write array list
# 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: reloading of live page.
A reloaded live page already knows the amount of the loaded live paged
messages, making possible to store them in a simple array.
was:
LivePageCacheImpl::getMessage is performing a linked-list-like lookup that can
be rather slow if compared to a O(1) lookup on ArrayList-like data structure.
it's possible to speed it up by:
# using a last accessed buffer cache on the append only chunked list used on
LivePageCacheImpl, to speedup the most recent (& nearest) accesses
# using an array with the fresh reloaded paged messages, in case of cache reload
https://github.com/apache/activemq-artemis/pull/2494#issuecomment-455086939
clearly show the issue with the current implementation.
> Reduce live page lookup cost
> ----------------------------
>
> Key: ARTEMIS-3049
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3049
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Components: Broker
> Affects Versions: 2.16.0
> Reporter: Francesco Nigro
> Assignee: Francesco Nigro
> Priority: Major
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> 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:
> # to replace the chunked list with a copy on write array list
> # 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: reloading of live page.
> A reloaded live page already knows the amount of the loaded live paged
> messages, making possible to store them in a simple array.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)