You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by franz1981 <gi...@git.apache.org> on 2018/01/19 08:52:29 UTC

[GitHub] activemq-artemis issue #1791: ARTEMIS-1622 Reduce memory footprint of QueueI...

Github user franz1981 commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1791
  
    I've already run CI on it and it seems to be safe.
    Just few numbers to justify it...
    On master:
    ![image](https://user-images.githubusercontent.com/13125299/35141654-e8d5cbfc-fcfb-11e7-9762-6839d3cd67ca.png)
    
    While with this PR:
    ![image](https://user-images.githubusercontent.com/13125299/35141669-fd042466-fcfb-11e7-8ea1-b1f62983b38e.png)
    800 MB vs 640 MB = 160 MB saved bytes 
    Given the default broker settings for the JVM the math is:
    
    - each `Node` instance is 32 bytes = 12 bytes obj header + 16 bytes of fields + 4 bytes of padding to have 8 byte alignment
    - the original `MessageReferenceImpl` was 48 bytes, including a 12 bytes header
    - this PR `MessageReferenceImpl` is 64 bytes = 48 bytes (of the original) + 16 bytes (of `Node`) + 0 bytes of padding (64 is already 8 bytes aligned)
    
    We're saving 4 bytes of padding and 12 bytes of Object header from `Node` = 16 bytes for each message entry.
    If we have 10_000_000 messages we're saving 160 Megabytes.
    
    IMO there are few other checks to be performed and need anyone that knows how the original LinkedListImpl works, but the change is easy to be reverted: I've already checked that there aren't evident memory leaks, but any feedback is appreciated :+1: 



---