activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r996281 - in /websites/production/activemq/content: cache/main.pageCache what-is-the-prefetch-limit-for.html
Date Tue, 30 Aug 2016 15:22:28 GMT
Author: buildbot
Date: Tue Aug 30 15:22:28 2016
New Revision: 996281

Log:
Production update by buildbot for activemq

Modified:
    websites/production/activemq/content/cache/main.pageCache
    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/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 15:22:28
2016
@@ -43,7 +43,7 @@
       </script> 
     
     <title>
-    Apache ActiveMQ &#8482; -- What is the prefetch limit for
+    Apache ActiveMQ &#8482; -- What is the Prefetch Limit For?
     </title>
 </head>
 <body>
@@ -70,7 +70,7 @@
 <p></p>
         <div class="top_red_bar">
           <div id="site-breadcrumbs">
-<a href="community.html">Community</a>&nbsp;&gt;&nbsp;<a href="faq.html">FAQ</a>&nbsp;&gt;&nbsp;<a
href="using-apache-activemq.html">Using Apache ActiveMQ</a>&nbsp;&gt;&nbsp;<a
href="what-is-the-prefetch-limit-for.html">What is the prefetch limit for</a>
+<a href="community.html">Community</a>&nbsp;&gt;&nbsp;<a href="faq.html">FAQ</a>&nbsp;&gt;&nbsp;<a
href="using-apache-activemq.html">Using Apache ActiveMQ</a>&nbsp;&gt;&nbsp;<a
href="what-is-the-prefetch-limit-for.html">What is the Prefetch Limit For?</a>
           </div>
           <div id="site-quicklinks">
 <p><a shape="rect" href="download.html">Download</a> | <a shape="rect"
class="external-link" href="http://activemq.apache.org/maven/apidocs/index.html">JavaDocs</a>
<a shape="rect" href="javadocs.html">More...</a> | <a shape="rect" href="source.html">Source</a>
| <a shape="rect" href="discussion-forums.html">Forums</a> | <a shape="rect"
href="support.html">Support</a></p>
@@ -81,56 +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>
-
-<p>So ActiveMQ uses a <strong>prefetch limit</strong> on 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>Its a good idea to have large values of the prefetch limit if you want high performance
and if you have high message volumes. 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 so that a consumer
is given one message at a time. Specifying a prefetch limit of zero means the consumer will
poll for more 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/activemq-core/apidocs/org/apache/activemq/ActiveMQPrefetchPolicy.html">ActiveMQPrefetchPolicy</a>
on an <a shape="rect" class="external-link" href="http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/ActiveMQConnectionFactory.html">ActiveMQConnectionFactory</a>
or <a shape="rect" class="external-link" href="http://activemq.apache.org/maven/activemq-core/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>persistent queues   (default value: 1000)</li><li>non-persistent
queues  (default value: 1000)</li><li>persistent topics  (default value: 100)</li><li>non-persistent
topics  (default value: Short.MAX_VALUE -1)</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">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">
-tcp://localhost:61616?jms.prefetchPolicy.all=50
+<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">
+<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">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">
-tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1
+</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">
+<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">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">
-queue = new ActiveMQQueue("TEST.QUEUE?consumer.prefetchSize=10");
+</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.<br
clear="none">
-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. <br clear="none">
-The problem is visible with the Spring DMLC when the cache level is set to CACHE_CONSUMER
and there are multiple concurrent consumers.<br clear="none">
-One solution 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 <code>receive(timeout)</code>.  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-RamversusPerformancetradeoff">Ram versus Performance
tradeoff</h3>
-
-<p>Setting a relatively high value of prefetch leads to higher performance; so the
default values are typically &gt; 1000; usually higher for topics and higher for the non-persistent
messaging. 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 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
 >
         </td>
         <td valign="top">
           <div class="navigation">



Mime
View raw message