activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r996286 - in /websites/production/activemq/content: cache/main.pageCache consumer-dispatch-async.html destination-options.html what-is-the-prefetch-limit-for.html
Date Tue, 30 Aug 2016 16:22:10 GMT
Author: buildbot
Date: Tue Aug 30 16:22:09 2016
New Revision: 996286

Log:
Production update by buildbot for activemq

Modified:
    websites/production/activemq/content/cache/main.pageCache
    websites/production/activemq/content/consumer-dispatch-async.html
    websites/production/activemq/content/destination-options.html
    websites/production/activemq/content/what-is-the-prefetch-limit-for.html

Modified: websites/production/activemq/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/activemq/content/consumer-dispatch-async.html
==============================================================================
--- websites/production/activemq/content/consumer-dispatch-async.html (original)
+++ websites/production/activemq/content/consumer-dispatch-async.html Tue Aug 30 16:22:09
2016
@@ -82,15 +82,15 @@
   <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="ConsumerDispatchAsync-Overview">Overview</h2><p>In
AMQ4, the choice of a broker performing synchronous or asynchronous dispatch to a consumer
has become more configurable. It is now configured as a default value on the <a shape="rect"
href="connection-configuration-uri.html">connection URI, Connection and ConnectionFactory</a>
together with being customizable on a per consumer basis via the <a shape="rect" href="destination-options.html">Destination
Options</a> instead previously just being a transport server setting.</p><p>This
makes more sense since you want to do async message delivery to slower consumers, but do sync
message delivery to faster consumers (to avoid the synchronization and context switching costs
of adding another seda queue). The downside to using sync message delivery is that the producer
is more likely to block if there is a slow consumer that he is dispatching messages to.</p><p>The
default setting is dispatchAsync=
 true which is the best setting for high performance. If you want to deal better with slow
consumers you will want to enable this setting. If you want better thoughput and the chances
of having a slow consumer are low, you may want to change this to false.</p><h3 id="ConsumerDispatchAsync-ConfiguringAsyncDispatchattheConnectionFactoryLevel">Configuring
Async Dispatch at the ConnectionFactory Level</h3><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 id="ConsumerDispatchAsync-Overview">Overview</h2><p>From
ActiveMQ v4: the choice of a broker performing synchronous or asynchronous dispatch to a consumer
has become more configurable. It is now configured as a default value on the <a shape="rect"
href="connection-configuration-uri.html">connection URI, Connection and ConnectionFactory</a>
as well as with being customizable on a per consumer basis via the <a shape="rect" href="destination-options.html">Destination
Options</a> instead previously just being a transport server setting.</p><p>This
makes more sense since you want to do asynchronous message delivery to slower consumers, but
synchronous message delivery for faster consumers (to avoid the synchronization and context
switching costs of adding another SEDA queue). The downside to using synchronous message delivery
is that the producer is more likely to block if there is a slow consumer that he is dispatching
messages to.</p><p>The def
 ault setting is&#160;<strong><code>dispatchAsync=true</code></strong>
which is the best setting for high performance. If you want to deal better with slow consumers
you will want to enable this setting. If you want better throughput and the chances of having
a slow consumer are low, you may want to change this to <strong><code>dispatchAsync=false</code></strong>.</p><h3
id="ConsumerDispatchAsync-ConfiguringAsyncDispatchattheConnectionFactoryLevel">Configuring
Async Dispatch at the ConnectionFactory Level</h3><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">((ActiveMQConnectionFactory)connectionFactory).setDispatchAsync(false);
 </pre>
-</div></div><h3 id="ConsumerDispatchAsync-ConfiguringDispatchAsyncattheConnectionLevel">Configuring
Dispatch Async at the Connection Level</h3><p>Configuring the dispatchAsync setting
at this level overrides the settings at the connection factory level.</p><h3 id="ConsumerDispatchAsync-ConfiguringDispatchAsyncattheConsumerLevelusingtheDestinationURI">Configuring
Dispatch Async at the Consumer Level using the Destination URI</h3><p>Configuring
the dispatchAsync using <a shape="rect" href="destination-options.html">Destination
Options</a> overrides the settings at the connection and connection factory level.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><h3 id="ConsumerDispatchAsync-ConfiguringDispatchAsyncattheConnectionLevel">Configuring
Dispatch Async at the Connection Level</h3><p>Configuring the&#160;<strong><code>dispatchAsync</code></strong>
setting at this level overrides the settings at the connection factory level.</p><h3
id="ConsumerDispatchAsync-ConfiguringDispatchAsyncattheConsumerLevelusingtheDestinationURI">Configuring
Dispatch Async at the Consumer Level using the Destination URI</h3><p>Configuring
the&#160;<strong><code>dispatchAsync</code></strong> using <a
shape="rect" href="destination-options.html">Destination Options</a> overrides the
settings at the connection and connection factory level.</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">queue
= new ActiveMQQueue("TEST.QUEUE?consumer.dispatchAsync=false");
 consumer = session.createConsumer(queue);
 </pre>
-</div></div><h3 id="ConsumerDispatchAsync-DisablingAsyncDispatchonBroker'sTransportConnector">Disabling
Async Dispatch on Broker's Transport Connector</h3><p>It is possible to disable
async dispatch on a specific transport connector via the disableAsyncDispatch property. Once
disabled for this transport, it cannot be enabled by individual clients.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;transportConnector
name="openwire" uri="tcp://0.0.0.0:61616" disableAsyncDispatch="true" /&gt;
+</div></div><h3 id="ConsumerDispatchAsync-DisablingAsyncDispatchonBroker'sTransportConnector">Disabling
Async Dispatch on Broker's Transport Connector</h3><p>It is possible to disable
async dispatch on a specific transport connector via the&#160;<strong><code>disableAsyncDispatch</code></strong>
property. Once disabled for this transport, it cannot be enabled by individual clients.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;transportConnector
name="openwire" uri="tcp://0.0.0.0:61616" disableAsyncDispatch="true"/&gt;
 </pre>
 </div></div><p>&#160;</p><p>&#160;</p><p>&#160;</p></div>
         </td>

Modified: websites/production/activemq/content/destination-options.html
==============================================================================
--- websites/production/activemq/content/destination-options.html (original)
+++ websites/production/activemq/content/destination-options.html Tue Aug 30 16:22:09 2016
@@ -81,24 +81,11 @@
   <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h3 id="DestinationOptions-Background">Background</h3>
-
-<p>Destination Options are a way to provide extended configuration options to a JMS
consumer without having to extend the JMS API.  The options are encoded using URL query syntax
in the destination name that the consumer is created on.</p>
-
-<h3 id="DestinationOptions-ConsumerOptions">Consumer Options</h3>
-
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p>Option Name</p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p> Default Value</p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p> Description</p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>consumer.prefetchSize</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> variable </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> The number of message the consumer
will <a shape="rect" href="what-is-the-prefetch-limit-for.html">prefetch</a>.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>consumer.maximumPendingMessageLimit</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> 0 </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> Use to control if messages for non-durable topics
are dropped if a <a shape="rect" href="slow-consumer-handling.html">slow consumer</a>
situation exists.
 </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>consumer.noLocal
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> false
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Same
as the noLocal flag on a Topic consumer.  Exposed here so that it can be used with a queue.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>consumer.dispatchAsync </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> true </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Should the broker <a shape="rect"
href="consumer-dispatch-async.html">dispatch messages asynchronously</a>  to the
consumer.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>consumer.retroactive</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> false</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Is this a <a shape="rect" href="retroactive-consumer.html">Retroactive
Consumer</a>.</p></td></tr><tr><td colspan="1" r
 owspan="1" class="confluenceTd"><p>consumer.selector</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> null </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> JMS Selector used with the consumer.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>consumer.exclusive</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> false </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Is this an <a shape="rect" href="exclusive-consumer.html">Exclusive
Consumer</a>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>consumer.priority</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> 0 </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Allows you to configure a <a shape="rect" href="consumer-priority.html">Consumer
Priority</a>.</p></td></tr></tbody></table></div>
-
-
-<h3 id="DestinationOptions-Example">Example</h3>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">
-queue = new ActiveMQQueue("TEST.QUEUE?consumer.dispatchAsync=false&amp;consumer.prefetchSize=10");
+<div class="wiki-content maincontent"><h3 id="DestinationOptions-Background">Background</h3><p>Destination
Options are a way to provide extended configuration options to a JMS consumer without having
to extend the JMS API. The options are encoded using URL query syntax in the destination name
that the consumer is created on.</p><h3 id="DestinationOptions-ConsumerOptions">Consumer
Options</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p>Option Name</p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>consumer.prefetchSize</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>n/a</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The number of message the consumer
will <a shape="rect" href="what-is-the-prefetch-li
 mit-for.html">prefetch</a>.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>consumer.maximumPendingMessageLimit</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Use to control if messages for non-durable
topics are dropped if a <a shape="rect" href="slow-consumer-handling.html">slow consumer</a>
situation exists.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>consumer.noLocal</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Same as the&#160;<strong><code>noLocal</code></strong>
flag on a Topic consumer. Exposed here so that it can be used with a queue.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>consumer.dispatchAsync</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><t
 d colspan="1" rowspan="1" class="confluenceTd"><p>Should the broker <a shape="rect"
href="consumer-dispatch-async.html">dispatch messages asynchronously</a> to the consumer.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>consumer.retroactive</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Is this a <a shape="rect" href="retroactive-consumer.html">Retroactive
Consumer</a>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>consumer.selector</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>JMS Selector used with the consumer.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>consumer.exclusive</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td
colspan="1" rowspan="1" class
 ="confluenceTd"><p>Is this an <a shape="rect" href="exclusive-consumer.html">Exclusive
Consumer</a>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>consumer.priority</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Allows you to configure a <a shape="rect"
href="consumer-priority.html">Consumer Priority</a>.</p></td></tr></tbody></table></div><h3
id="DestinationOptions-Example">Example</h3><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">queue
= new ActiveMQQueue("TEST.QUEUE?consumer.dispatchAsync=false&amp;consumer.prefetchSize=10");
 consumer = session.createConsumer(queue);
 </pre>
-</div></div>
-</div>
+</div></div></div>
         </td>
         <td valign="top">
           <div class="navigation">

Modified: websites/production/activemq/content/what-is-the-prefetch-limit-for.html
==============================================================================
--- websites/production/activemq/content/what-is-the-prefetch-limit-for.html (original)
+++ websites/production/activemq/content/what-is-the-prefetch-limit-for.html Tue Aug 30 16:22:09
2016
@@ -81,17 +81,17 @@
   <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><p>One of the aims of ActiveMQ is to be
a high performance message bus. This means using a <a shape="rect" href="seda.html">SEDA</a>
architecture to perform as much work as possible asynchronously. To be able to achieve high
performance it is important to stream messages to consumers as fast as possible so that the
consumer always has a buffer of messages, in RAM, ready to process - rather than have them
explicitly pull messages from the server which adds significant latency per message.</p><p>There
is a danger however that this aggressive pushing of messages to the consumers could flood
a consumer as typically its much faster to deliver messages to the consumer than it often
is to actually process them.</p><div class="confluence-information-macro confluence-information-macro-information"><span
class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>Consumers th
 at are unable to cache prefetched messages dispatched to them by the broker must set the
prefetch to 1. An example of such a consumer would be a client implemented in a dynamic scripting
language like, say, Ruby connecting via STOMP.</p></div></div><p>ActiveMQ
uses the <strong>prefetch limit</strong> to govern how many messages can be streamed
to a consumer at any point in time. Once the prefetch limit is reached, no more messages are
dispatched to the consumer until the consumer starts sending back acknowledgements of messages
(to indicate that the message has been processed). The actual prefetch limit value can be
specified on a per consumer basis.</p><p>It's a good idea to have large values
of the prefetch limit if you want high performance and if you have high message volumes. However,
if you have very few messages and each message takes a very long time to process you might
want to set the prefetch value to 1. That ensures that a consumer is given only one message
at a time. Sp
 ecifying a prefetch limit of zero will cause the consumer to poll for messages, one at a
time, instead of the message being pushed to the consumer.</p><h3 id="WhatisthePrefetchLimitFor?-SpecifyingthePrefetchPolicy">Specifying
the PrefetchPolicy</h3><p>You can specify an instance of the <a shape="rect"
class="external-link" href="http://activemq.apache.org/maven/apidocs/org/apache/activemq/ActiveMQPrefetchPolicy.html">ActiveMQPrefetchPolicy</a>
on an <a shape="rect" class="external-link" href="http://activemq.apache.org/maven/apidocs/org/apache/activemq/ActiveMQConnectionFactory.html">ActiveMQConnectionFactory</a>
or <a shape="rect" class="external-link" href="http://activemq.apache.org/maven/apidocs/org/apache/activemq/ActiveMQConnection.html">ActiveMQConnection</a>.
This allows you to configure all the individual prefetch values; as each different quality
of service has a different value. e.g.</p><ul><li><p>persistent queues
(default value:&#160;<strong><code>1000</code></strong>)<
 /p></li><li><p>non-persistent queues (default value:&#160;<strong><code>1000</code></strong>)</p></li><li><p>persistent
topics (default value:&#160;<strong><code>100</code></strong>)</p></li><li><p>non-persistent
topics (default value:&#160;<strong><code>Short.MAX_VALUE - 1</code></strong>)</p></li></ul><p>It
can also be configured on the connection URI used when establishing a connection the broker:</p><p>To
change the prefetch size for all consumer types you would use a connection URI similar to:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<div class="wiki-content maincontent"><p>One of the design goals of ActiveMQ
is to be a highly performant message bus. This means using a <a shape="rect" href="seda.html">SEDA</a>
architecture to perform as much work as possible asynchronously. To make efficient use of
network resources the broker utilizes a 'push' model to dispatch messages to consumers. This
ensures that a consumer always has a local buffer of messages ready to process. The alternative
would be for consumers to explicitly pull messages from the broker. Pulling messages individually
is not very efficient and can increase the per message latency significantly.</p><p>However,
there is a danger that without limiting the number of messages that are pushed to a consumer
its client-side resources could become exhausted. This is the natural consequence of message
consumption typically being much slower than message delivery. To avoid this situation ActiveMQ
therefore employs a <strong>prefetch limit</strong> to limit the 
 maximum number of messages that can be dispatched to an individual consumer at once. The
consumer in turn uses the prefetch limit to size its prefetch message buffer.</p><p>Once
the broker has dispatched a prefetch limit number of messages to a consumer it will not dispatch
any more messages to that consumer until the consumer has acknowledged at least 50% of the
prefetched messages, e.g., prefetch/2, that it received. When the broker has received said
acknowledgements it will dispatch a further prefetch/2 number of messages to the consumer
to 'top-up', as it were, its prefetch buffer. Note that it's possible to specify a prefetch
limit on a per consumer basis (see below).</p><p>Large prefetch values are recommended
for high performance with high message volumes. However, for lower message volumes, where
each message takes a long time to process, the prefetch should be set to 1. This ensures that
a consumer is only processing one message at a time. Specifying a prefetch limit of zer
 o, however, will cause the consumer to poll for messages, one at a time, instead of the message
being pushed to the consumer.</p><div class="confluence-information-macro confluence-information-macro-information"><p
class="title">What is a Slow Consumer?</p><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>A
slow consumer is one that has more than twice its configured prefetch limit number of messages
pending.</p></div></div><div class="confluence-information-macro confluence-information-macro-warning"><p
class="title">Implementing Consumers Using a Dynamic Language </p><span class="aui-icon
aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>Consumers that are unable to cache prefetched
messages must set their prefetch to 1. An example of such a consumer is one implemented using
a scripting language like Ruby, say,
  that connects via STOMP. In this case there's no notion of a client-side message buffer.</p></div></div><h3
id="WhatisthePrefetchLimitFor?-SpecifyingthePrefetchPolicy">Specifying the PrefetchPolicy</h3><p>You
can specify an instance of the <a shape="rect" class="external-link" href="http://activemq.apache.org/maven/apidocs/org/apache/activemq/ActiveMQPrefetchPolicy.html">ActiveMQPrefetchPolicy</a>
on an <a shape="rect" class="external-link" href="http://activemq.apache.org/maven/apidocs/org/apache/activemq/ActiveMQConnectionFactory.html">ActiveMQConnectionFactory</a>
or <a shape="rect" class="external-link" href="http://activemq.apache.org/maven/apidocs/org/apache/activemq/ActiveMQConnection.html">ActiveMQConnection</a>.
This allows you to configure all the individual prefetch values; as each different quality
of service has a different value. e.g.</p><ul><li><p>persistent queues
(default value:&#160;<strong><code>1000</code></strong>)</p></li><li><p>non-persistent
queues (default 
 value:&#160;<strong><code>1000</code></strong>)</p></li><li><p>persistent
topics (default value:&#160;<strong><code>100</code></strong>)</p></li><li><p>non-persistent
topics (default value:&#160;<strong><code>Short.MAX_VALUE - 1</code></strong>)</p></li></ul><p>The
prefetch limit can also be configured on the connection URI used to establish a connection
the broker. To change the prefetch limit for all consumer types configure a connection URI
as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">tcp://localhost:61616?jms.prefetchPolicy.all=50
 </pre>
-</div></div><p>To change the prefetch size for just queue consumer types
you would use a connection URI similar to:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>To change the prefetch limit for queue consumers only configure
the connection URI as follows:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1
 </pre>
-</div></div><p>It can also be configured on a per consumer basis using
<a shape="rect" href="destination-options.html">Destination Options</a>.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><p>It can also be configured on a per consumer basis using
<a shape="rect" href="destination-options.html">Destination Options</a>:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">queue
= new ActiveMQQueue("TEST.QUEUE?consumer.prefetchSize=10");
 consumer = session.createConsumer(queue);
 </pre>
-</div></div><h3 id="WhatisthePrefetchLimitFor?-PooledConsumersandPrefetch">Pooled
Consumers and Prefetch</h3><p>Consuming messages from a pool of consumers an be
problematic due to prefetch. Unconsumed prefetched messages are only released when a consumer
is closed, but with a pooled consumer the close is deferred (for reuse) till the consumer
pool closes. This leaves prefetched messages unconsumed till the consumer is reused. This
feature can be desirable from a performance perspective but it can lead to out-of-sequence
messages when there is more than one consumer in the pool. For this reason, the <a shape="rect"
class="external-link" href="http://activemq.apache.org/maven/5.5.0/activemq-pool/apidocs/index.html">org.apache.activemq.pool.PooledConnectionFactory</a>
does <strong>not</strong> pool consumers. The problem is visible with the Spring
DMLC when the cache level is set to&#160;<strong><code>CACHE_CONSUMER</code></strong>
and there are multiple concurrent consumers. One solu
 tion to this problem is to use a prefetch of 0 for a pooled consumer, in this way, it will
poll for messages on each call to <strong><code>receive(timeout)</code></strong>.
Another option is to enable the <a shape="rect" class="external-link" href="http://activemq.apache.org/maven/5.9.0/apidocs/org/apache/activemq/broker/region/policy/AbortSlowAckConsumerStrategy.html">AbortSlowAckConsumerStrategy</a>
on the broker to disconnect consumers that have not acknowledged a Message after some configurable
time period.</p><h3 id="WhatisthePrefetchLimitFor?-Ramvs.PerformanceTrade-off">Ram
vs. Performance Trade-off</h3><p>Setting a relatively high value of prefetch leads
to higher performance. Therefore the default values are typically greater than 1000 and much
higher for topics and higher still for the non-persistent messages. The prefetch size dictates
how many messages will be held in RAM on the client so if your RAM is limited you may want
to set a low value such as 1 or 10 etc.</p></div
 >
+</div></div><h3 id="WhatisthePrefetchLimitFor?-PooledConsumersandPrefetch">Pooled
Consumers and Prefetch</h3><p>Consuming messages from a pool of consumers an be
problematic due to prefetch. Unconsumed prefetched messages are only released when a consumer
is closed, but with a pooled consumer the close is deferred (for reuse) till the consumer
pool closes. This leaves prefetched messages unconsumed till the consumer is reused. This
feature can be desirable from a performance perspective. However, it can lead to out-of-order
message delivery when there is more than one consumer in the pool. For this reason, the <a
shape="rect" class="external-link" href="http://activemq.apache.org/maven/apidocs/org/apache/activemq/jms/pool/PooledConnectionFactory.html">org.apache.activemq.pool.PooledConnectionFactory</a>
does <strong>not</strong> pool consumers. The problem is visible with the Spring
DMLC when the cache level is set to&#160;<strong><code>CACHE_CONSUMER</code></strong>
and there are m
 ultiple concurrent consumers. One solution to this problem is to use a prefetch of&#160;<strong><code>0</code></strong>
for a pooled consumer, in this way, it will poll for messages on each call to <strong><code>receive(timeout)</code></strong>.
Another option is to enable the <a shape="rect" class="external-link" href="http://activemq.apache.org/maven/apidocs/org/apache/activemq/broker/region/policy/AbortSlowAckConsumerStrategy.html">AbortSlowAckConsumerStrategy</a>
on the broker to disconnect consumers that have not acknowledged a Message after some configurable
time period.</p><h3 id="WhatisthePrefetchLimitFor?-Ramvs.PerformanceTrade-off">Ram
vs. Performance Trade-off</h3><p>Setting a relatively high value of prefetch leads
to higher performance. Therefore the default values are typically greater than 1000 and much
higher for topics and higher still for the non-persistent messages. The prefetch size dictates
how many messages will be held in RAM on the client so if your RAM is li
 mited you may want to set a low value such as 1 or 10 etc.</p><p>&#160;</p></div>
         </td>
         <td valign="top">
           <div class="navigation">



Mime
View raw message