ActiveMQ memory consumption through the roof (page

2019-07-22 01:35发布

问题:

We're using an older version of ActiveMQ (5.3.2) (see: Is activemq reliable?)

We've removed persistence because we needed more speed. Our worker can keep up with the messages, but, even though the queue typically is at 0 pending, after about 45000 messages processed (a message is typically 100 chars long), the Page file is 8GB!! It doesn't stop there though, it continues until 15 GB is reached (Our server has 16gb memory)!

Stopping the ActiveMQ process doesn't clean up this pagefile, it remains this huge indefinately.

these are the settings we use:

<policyEntry queue=">" producerFlowControl="false" memoryLimit="2gb">
</policyEntry>

and

<systemUsage>
    <systemUsage>
        <memoryUsage>
            <memoryUsage limit="20 mb"/>
        </memoryUsage>
        <storeUsage>
            <storeUsage limit="1 gb"/>
        </storeUsage>
        <tempUsage>
            <tempUsage limit="100 mb"/>
        </tempUsage>
    </systemUsage>
</systemUsage>

What do we need to do to keep memory usage in 'normal' levels?

Our server: Windows 2003 (64bit). ActivemQ (5.3.2), with Java64 bit (1.6.0__22)

回答1:

If the memory is not being released even after you stop ActiveMQ, I'm tempted to say it's a bug in the JDK. Have you considered downgrading to a more stable version? Also experiment with running this with a 32-bit JDK and see if you can reproduce the problem with smaller max memory setting.



回答2:

I didn't face any issues on a windows 7 machine, with ActiveMQ 5.3.0, jdk1.6.0_18 (64 bit) and a test setup with PHP. With some test scripts I wrote 10.000.000 messages to the queue in 585 seconds. That's about 17000 messages per second. Everything was running on the same machine (my laptop, 4 GB mem, Intel i3 CPU) and using TCP sockets to connect to the queue.



回答3:

Can you post your full ActiveMQ configuration ? Have you set persistent = false on the ActiveMQ broker? I think what is happening is that because you've turned off flow control, and only have allowed 20mb of memory to be used by the broker - your messages are being paged to disk in temporary storage. If persistent=false this shouldn't happen - but do enable flow control - it will help ;)