You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Steve Angelovich <SA...@lgc.com> on 2012/08/28 00:49:42 UTC
Usage Manager memory limit reached
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.
Re: Pending message limit strategy and memory limits
Posted by Gary Tully <ga...@gmail.com>.
the discarding policy is based on the prefetch being reached so it is
independent of memory limits so long as there is sufficient memory to
reach 2*prefetch.
have a peek at:
org.apache.activemq.broker.region.TopicSubscription#add to see the full detail
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java?view=markup
On 29 August 2012 17:47, Steve Angelovich <SA...@lgc.com> wrote:
> All,
>
> I have a situation where I'd like to discard non-persistent messages if
> necessary. What I'd like to do is discard the oldest messages first for
> slow consumers but only if needed.
>
> So far I've;
> - turned off flow control
> - set the memory limit in my default policy entry
> - added a message limiting strategy
>
> Questions;
>
> Is setting the memory limit on the destinations a good idea if I'm using
> some type of message eviction strategy? I don't know the number of
> producers or consumers so I'm not sure how to specify this limit correctly.
>
> I'm using the ConstantPendingMessageLimitStrategy. Does this strategy
> immediatly start evicting messages based on the limit or is the memory
> limit of the destiation first taken into account? For example if I have
> one very slow consumer but lots of memory available would it allow the
> pending messages to grow beyond the limit I've specified.
>
> My broker is embedded so we don't ship the jars necessary for
> persistence so I don't want overflow to be spooled to temporary disk.
> Should I be specifying the VM cursors?
>
>
>
> Thanks,
> Steve
>
> ----------------------------------------------------------------------
> 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
Pending message limit strategy and memory limits
Posted by Steve Angelovich <SA...@lgc.com>.
All,
I have a situation where I'd like to discard non-persistent messages if
necessary. What I'd like to do is discard the oldest messages first for
slow consumers but only if needed.
So far I've;
- turned off flow control
- set the memory limit in my default policy entry
- added a message limiting strategy
Questions;
Is setting the memory limit on the destinations a good idea if I'm using
some type of message eviction strategy? I don't know the number of
producers or consumers so I'm not sure how to specify this limit correctly.
I'm using the ConstantPendingMessageLimitStrategy. Does this strategy
immediatly start evicting messages based on the limit or is the memory
limit of the destiation first taken into account? For example if I have
one very slow consumer but lots of memory available would it allow the
pending messages to grow beyond the limit I've specified.
My broker is embedded so we don't ship the jars necessary for
persistence so I don't want overflow to be spooled to temporary disk.
Should I be specifying the VM cursors?
Thanks,
Steve
----------------------------------------------------------------------
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.
Re: Usage Manager memory limit reached
Posted by ceposta <ch...@gmail.com>.
This should really be a new thread.
take a look at http://activemq.apache.org/message-cursors.html
you have producer flow control set to true, so your producers will be
throttled if there is no space available. using message cursors, you can get
the messages spooled to disk so the slowest consumer isn't creating a
bottleneck.
-----
http://www.christianposta.com/blog
--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-has-too-many-dependencies-tp4655608p4655693.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Usage Manager memory limit reached
Posted by Gary Tully <ga...@gmail.com>.
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 <SA...@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