[ 
https://issues.apache.org/jira/browse/ARTEMIS-1383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16153210#comment-16153210
 ] 

ASF GitHub Bot commented on ARTEMIS-1383:
-----------------------------------------

Github user franz1981 commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1505
  
    @clebertsuconic In the meantime I've done some experiments with [Java 
Object Layout](http://openjdk.java.net/projects/code-tools/jol/), a tool that 
compute the deep size of any instance on the heap, to evaluate the difference 
(memory wise) between `LinkedListImpl` and `ChunkedQueue`.
    I've used a very small chunk size of 32 (ie with arrays of 33 elements for 
each chunk), to compare with `LinkedListImpl`.
    With no instances:
    ```
    org.apache.activemq.artemis.utils.collections.LinkedListImpl@7ba4f24fd 
footprint:
         COUNT       AVG       SUM   DESCRIPTION
             1        56        56   
[Lorg.apache.activemq.artemis.utils.collections.LinkedListImpl$Iterator;
             1        40        40   
org.apache.activemq.artemis.utils.collections.LinkedListImpl
             1        32        32   
org.apache.activemq.artemis.utils.collections.LinkedListImpl$Node
             3                 128   (total)
    
    
    org.apache.activemq.load.generator.ChunkedQueue@6ed3ef1d footprint:
         COUNT       AVG       SUM   DESCRIPTION
             1       152       152   [Ljava.lang.Object;
             1        40        40   
org.apache.activemq.load.generator.ChunkedQueue
             2                 192   (total)
    ```
    With 31 instances:
    ```
    org.apache.activemq.artemis.utils.collections.LinkedListImpl@7ba4f24fd 
footprint:
         COUNT       AVG       SUM   DESCRIPTION
             1        56        56   
[Lorg.apache.activemq.artemis.utils.collections.LinkedListImpl$Iterator;
             1        24        24   java.lang.Long
             1        40        40   
org.apache.activemq.artemis.utils.collections.LinkedListImpl
            32        32      1024   
org.apache.activemq.artemis.utils.collections.LinkedListImpl$Node
            35                1144   (total)
    
    
    org.apache.activemq.load.generator.ChunkedQueue@57fa26b7d footprint:
         COUNT       AVG       SUM   DESCRIPTION
             1       152       152   [Ljava.lang.Object;
             1        24        24   java.lang.Long
             1        40        40   
org.apache.activemq.load.generator.ChunkedQueue
             3                 216   (total)
    ```
    With 10000 instance:
    ```
    org.apache.activemq.artemis.utils.collections.LinkedListImpl@7ba4f24fd 
footprint:
         COUNT       AVG       SUM   DESCRIPTION
             1        56        56   
[Lorg.apache.activemq.artemis.utils.collections.LinkedListImpl$Iterator;
             1        24        24   java.lang.Long
             1        40        40   
org.apache.activemq.artemis.utils.collections.LinkedListImpl
         10001        32    320032   
org.apache.activemq.artemis.utils.collections.LinkedListImpl$Node
         10004              320152   (total)
    
    
    org.apache.activemq.load.generator.ChunkedQueue@1894593ad footprint:
         COUNT       AVG       SUM   DESCRIPTION
           323       152     49096   [Ljava.lang.Object;
             1        24        24   java.lang.Long
             1        16        16   java.lang.Object
             1        40        40   
org.apache.activemq.load.generator.ChunkedQueue
           326               49176   (total)
    ```
    Totals are pretty explicative, the `ChunkedQueue` (even with very small 
chunk size) tends to have a 10X smaller memory footprint than a 
`LinkedListImpl`.
    
    
    



> Improved Priority queue
> -----------------------
>
>                 Key: ARTEMIS-1383
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1383
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>          Components: Broker
>            Reporter: Francesco Nigro
>            Assignee: Francesco Nigro
>
> The original PriorityLinkedList implementation is based on a double linked 
> list implementation that suffer of:
> * fragmentation along the heap
> * pointer chasing due to the presence of nodes
> * allocation heavy (ie each add operation forces allocation of nodes)
> * high hidden (ie the nodes) memory footprint that lead to wrong memory 
> estimations
> It is possible to provide a specialized chunked implementation that can 
> address all these issues while providing a better performance (throughput, 
> latency and memory footprint wise).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to