Search code examples
javamemory-leaksactivemq-classicheap-memoryheap-corruption

activeMQ fileQueueCursor (heap size)


I use AcviteMq v 5.9.1 and non-persistent message. My problem is

OutOfMemory: heap size

I know that this kind of issue was on this site, but I can't find my specific issue. I know that non-persistent message are stored in memory, so I get this error. I also know that I can increase Xms/Xmx, but this is not fix the problem (when I get a little bit more messages, I might get this error too).

http://activemq.apache.org/message-cursors.html

I read on activeMq site that there are 3 cursors, and fileQueueCurosr write stored message into file. I set up my configuration for this cursor, but it doesn't work either.

 <policyEntry queue="foo.bar.>">
    <pendingQueuePolicy>
        <fileQueueCursor />
    </pendingQueuePolicy>
  </policyEntry>

Maybe, somebody has similar problem and can help me with it? Or maybe this cursor is not enaugh and I have to set up something else?

-Xmx and Xmx default is set up 1GB/1GB.

////UPDATE 23.04.15 after @kartik answer

<policyEntry queue="foo.bar.>" memoryLimit="10mb" (or 30mb) producerFlowControl="false">
        <pendingQueuePolicy>
            <fileQueueCursor />
        </pendingQueuePolicy>
      </policyEntry>

Solution

    1. Use fileQueueCursor with memoryLimit broker can use. For example in below case, it is 1.5 GB total broker can use out of available RAM. " memoryLimit="1500mb" producerFlowControl="false" >

    2. Set Memory usage %. after that broker will push messages into KahaDB tmp files.