activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <gary.tu...@gmail.com>
Subject Re: Usage Manager memory limit reached
Date Tue, 28 Aug 2012 12:49:40 GMT
for translating xml config into programatic constructs, check out the
unit tests, 90% of them are programatic. Do a find or grep or google
search to find a relevant test.

http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/

On 27 August 2012 23:49, Steve Angelovich <SAngelovich@lgc.com> wrote:
> 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.



-- 
http://fusesource.com
http://blog.garytully.com

Mime
View raw message