High Memory usage when persist-id-cache is enabled
Environment
- Red Hat AMQ
- 7.x
Issue
- High Memory usage when persist-id-cache is enabled.
Resolution
Class Name | Shallow Heap | Retained Heap | Percentage
-------------------------------------------------------------------------------------------------------------------------------------------------
org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl @ 0x600d0dd28 | 88 B | 1.32 GB | 21.93%
'- java.util.concurrent.ConcurrentHashMap @ 0x600d0e458 | 64 B | 1.32 GB | 21.91%
'- java.util.concurrent.ConcurrentHashMap$Node[1024] @ 0x651bbaea0 | 4.02 KB | 1.32 GB | 21.91%
'- java.util.concurrent.ConcurrentHashMap$Node @ 0x7690288a0 | 32 B | 13.85 MB | 0.23%
|- java.util.concurrent.ConcurrentHashMap$Node @ 0x769083dd0 | 32 B | 13.11 MB | 0.21%
'- org.apache.activemq.artemis.core.postoffice.impl.PersistentDuplicateIDCache @ 0x7690288c0| 40 B | 762.08 KB | 0.01%
-------------------------------------------------------------------------------------------------------------------------------------------------
-
persist-id-cache can be disabled if duplicate detection is not necessary.
-
Disable persist-id-cache as follow:-
<persist-id-cache>false</persist-id-cache>
- persist-id-cache can also be reduced :
<id-cache-size>5000</id-cache-size>
- If duplicate detection is necessary, increase the max heap to accommodate the cached IDs
Root Cause
- One instance of org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl loaded by java.net.URLClassLoader @ 0x6000278b0 occupies 1.32 GB (21.93%) bytes. The memory is accumulated in one instance of java.util.concurrent.ConcurrentHashMap$Node[], loaded by
, which occupies 1.32 GB (21.91%) bytes.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments