activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Angelovich <SAngelov...@lgc.com>
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
Topic.

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 http://activemq.apache.org/producer-flow-control.html for more
info
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 http://activemq.apache.org/producer-flow-control.html for more info
        at org.apache.activemq.broker.region.BaseDestination.waitForSpace(BaseDestination.java:584)
        at org.apache.activemq.broker.region.BaseDestination.waitForSpace(BaseDestination.java:573)
        at org.apache.activemq.broker.region.Topic.send(Topic.java:379)
        at org.apache.activemq.broker.region.AbstractRegion.send(AbstractRegion.java:365)


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,
Steve


    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() ;
    LOG.info("Name of ActiveMq Broker: "+_broker.getBrokerName());
    _broker.setDataDirectory(new File(_logdir, DATA_DIRECTORY).getAbsolutePath());
    _broker.setPersistent(false);

    //set some of the memory limits for the broker
    long maxHeapSize = Runtime.getRuntime().maxMemory();
    long brokerHeapSize = (long) (maxHeapSize * .5) ;
    LOG.info("Maximum heap size = " + UtilFile.prettySize(maxHeapSize));
    LOG.info("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) ;

    LOG.info(_broker.getSystemUsage().getMemoryUsage().toString() + " " + UtilFile.prettySize(_broker.getSystemUsage().getMemoryUsage().getLimit()))
;
    LOG.info(_broker.getSystemUsage().getStoreUsage().toString() + " " + UtilFile.prettySize(_broker.getSystemUsage().getStoreUsage().getLimit()))
;
    LOG.info(_broker.getSystemUsage().getTempUsage().toString() + " " + 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.setProducerFlowControl(true);
    policy.setPrioritizedMessages(true) ;
    policy.setMemoryLimit(DESTINATION_MEMORY_LIMIT) ;
    policy.setPendingQueuePolicy(new FilePendingQueueMessageStoragePolicy()) ;
    policy.setPendingSubscriberPolicy(new FilePendingSubscriberMessageStoragePolicy()) ;

    PolicyMap destinationPolicy = new PolicyMap();
    destinationPolicy.setDefaultEntry(policy);
    _broker.setDestinationPolicy(destinationPolicy);
    LOG.info("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.

Mime
View raw message