activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Angelovich <>
Subject Usage Manager memory limit reached
Date Mon, 27 Aug 2012 22:49:42 GMT
We just ran into the warning below indicating that we've exceeded the memory available on a

WARNING: Async error occurred: javax.jms.ResourceAllocationException: Usage Manager memory
limit reached. Stopping producer (ID:hoeplx3764-34102-1345832926291-0:2:2:1) to prevent flooding
topic://JOB_UPDATES_TOPIC. See for more
javax.jms.ResourceAllocationException: Usage Manager memory limit reached. Stopping producer
(ID:hoeplx3764-34102-1345832926291-0:2:2:1) to prevent flooding topic://JOB_UPDATES_TOPIC.
See for more info

Our intention was to configure activemq so that if we got a burst of messages they would overflow
and be spooled to disk instead of blocking or running the server out of memory.  We are not
using any persistence and we are specifying a message TTL for messages sent to that topic.

I've looked at some of the docs and I'm sure the answer is in there but I'm not exactly sure
how things like flow control, cursor type etc all work together so I'm not really sure we
are specifying a configuration that makes sense.  We are also running the broker as an embedded
application so sometimes I find it difficult to translate the xlm based configuration to something
we can do programmatic.

Thanks for any feedback,

    private static final long DESTINATION_MEMORY_LIMIT = 50*1024*1024;
    private static final long SEND_FAIL_IF_NO_SPACE_TIMEOUT = 30 * 1000;

    _broker =  new BrokerService() ;"Name of ActiveMq Broker: "+_broker.getBrokerName());
    _broker.setDataDirectory(new File(_logdir, DATA_DIRECTORY).getAbsolutePath());

    //set some of the memory limits for the broker
    long maxHeapSize = Runtime.getRuntime().maxMemory();
    long brokerHeapSize = (long) (maxHeapSize * .5) ;"Maximum heap size = " + UtilFile.prettySize(maxHeapSize));"Setting memory usage for message broker " + UtilFile.prettySize(brokerHeapSize));

    SystemUsage su = _broker.getSystemUsage() ;
    su.setSendFailIfNoSpaceAfterTimeout(SEND_FAIL_IF_NO_SPACE_TIMEOUT) ;
    MemoryUsage mu = su.getMemoryUsage() ;
    mu.setLimit(brokerHeapSize) ;
    _broker.setSystemUsage(su) ; + " " + UtilFile.prettySize(_broker.getSystemUsage().getMemoryUsage().getLimit()))
; + " " + UtilFile.prettySize(_broker.getSystemUsage().getStoreUsage().getLimit()))
; + " " + UtilFile.prettySize(_broker.getSystemUsage().getTempUsage().getLimit()))

    //set memory limit on the size for a topic or queue
    //set the cursor type to something that will allow
    //messages to be saved to disk if required
    PolicyEntry policy = new PolicyEntry();
    policy.setPrioritizedMessages(true) ;
    policy.setMemoryLimit(DESTINATION_MEMORY_LIMIT) ;
    policy.setPendingQueuePolicy(new FilePendingQueueMessageStoragePolicy()) ;
    policy.setPendingSubscriberPolicy(new FilePendingSubscriberMessageStoragePolicy()) ;

    PolicyMap destinationPolicy = new PolicyMap();
    _broker.setDestinationPolicy(destinationPolicy);"Specifing to use FileCursor ProducerFlowControl=true PrioritizedMessages=true");

java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) 64-Bit Server VM (build 17.0-b16, mixed mode)
ActiveMQ 5.5.1

This e-mail, including any attached files, may contain confidential and privileged information
for the sole use of the intended recipient.  Any review, use, distribution, or disclosure
by others is strictly prohibited.  If you are not the intended recipient (or authorized to
receive information for the intended recipient), please contact the sender by reply e-mail
and delete all copies of this message.

View raw message