JBoss - Java heap retention in org.jboss.messaging.core.impl.MessagingQueue or other messaging destinations
Environment
- JBoss Enterprise Application Platform (EAP)
- JBoss Messaging (JMS)
- HornetQ
Issue
- "java.lang.OutOfMemoryError: Java heap space" errors are received because the heap is consumed by org.jboss.messaging.core.impl.MessagingQueue or by messages sitting in our queues or topics or the deliveries map of a ServerSessionEndpoint with JBoss Messaging. How could we address this?
- There are many instances of SimpleMessageReference accumulating in MessagingQueue's messageRefs LinkedList.
Resolution
- Resolve any issues contributing to slow message processing.
- Configure the queue's following properties to properly limit it to fit heap constraints as necessary.
- For HornetQ, refer to this This content is not included.HornetQ User Guide
- For JBoss Messaging, look at tuning the "destination paging parameters" (FullSize, PageSize, DownCacheSize) . Reference This content is not included.JMS Guide
- FullSize - this is the maximum number of messages held by the queue or topic subscriptions in memory at any one time. The actual queue or subscription can hold many more messages than this but these are paged to and from storage as necessary as messages are added or consumed. Default value 200000
- PageSize - When loading messages from the queue or subscription this is the maximum number of messages to pre-load in one operation. Default value 2000
- DownCacheSize - When paging messages to storage from the queue they first go into a "Down Cache" before being written to storage. This enables the write to occur as a single operation thus aiding performance. This setting determines the max number of messages that the Down Cache will hold before they are flushed to storage. Default value 2000
Root Cause
- Messages are processing slowly, causing them to build up in the queue.
- Without proper configurations and large message sizes, the message build up here could easily lead to a very large queue in memory.
- Heap is too small for the amount of message data received and paging is not configured to keep that data stored in memory within reasonable limits for the heap size used
Diagnostic Steps
- Check for message build up and/or slow processing
- Troubleshoot with a heap dump as described in Java application "java.lang.OutOfMemoryError: Java heap space" to identify the source of retention.
Components
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.