blob: c4b4022a0ae7ac44a21890fb1190d16b933157e2 [file] [log] [blame]
<div class="wiki-content maincontent"><p>Scaling to tens of thousands of Queues in a single broker is relatively straightforward - but requires some configuration changes from the default.</p><h2>Reducing Threads</h2><p>With the default configuration, ActiveMQ is configured to use a dispatch thread per Queue - you can use set the optimizedDispatch property on the destination policy entry - see <link><page ri:content-title="Per Destination Policies"></page><plain-text-link-body>configuring Queues</plain-text-link-body></link>.</p><p>ActiveMQ can optionally use internally a thread pool to control dispatching of messages - but as a lot of deployment operating systems are good at handling a large number of threads, this is off by default. To enable this option, either set the ACTIVEMQ_OPTS to disable dedicated task runners in the start up script, INSTALL_DIR/bin/activemq -e.g.</p><structured-macro ac:macro-id="c277ee98-10b9-4eea-802b-5b68565257c8" ac:name="code" ac:schema-version="1"><plain-text-body>ACTIVEMQ_OPTS="-Xmx512M -Dorg.apache.activemq.UseDedicatedTaskRunner=false"
</plain-text-body></structured-macro><p>or you can set ACTIVEMQ_OPTS in /etc/activemq.conf.</p><p><strong>Note:</strong> From ActiveMQ 5.6 onwards the dedicated task runner is disabled by default (see <structured-macro ac:macro-id="1d4abf51-199a-4b44-89ec-b024075836b8" ac:name="jira" ac:schema-version="1"><parameter ac:name="showSummary">false</parameter><parameter ac:name="server">ASF JIRA</parameter><parameter ac:name="serverId">5aa69414-a9e9-3523-82ec-879b028fb15b</parameter><parameter ac:name="key">AMQ-3667</parameter></structured-macro>).</p><p>To reduce the number of threads used for the transport - take a look at using the NIO transport - see <link><page ri:content-title="Configuring Transports"></page></link></p><p>Here is an <a shape="rect" href="http://svn.apache.org/repos/asf/activemq/trunk/assembly/src/sample-conf/activemq-scalability.xml">example</a> of this in use in one of the provided sample broker configuration files.</p><h2>Reducing Memory Consumption</h2><p>Reduce the memory used per thread - see <link><page ri:content-title="java.lang.OutOfMemory"></page><plain-text-link-body>reducing memory consumption</plain-text-link-body></link></p><h2>Reduce number of file descriptors</h2><p>ActiveMQ uses the amqPersistenceAdapter by default for persistent messages. Unfortunately, this persistence adapter (as well as the kahaPersistenceAdapter) opens a file descriptor for each queue. When creating large numbers of queues, you'll quickly run into the limit for your OS.</p><p>You can either choose another <link><page ri:content-title="Persistence"></page><plain-text-link-body>persistence option</plain-text-link-body></link></p><p>or - try out the new <link><page ri:content-title="KahaDB"></page></link> in version 5.3 and higher</p><h2>Increase the limit on file descriptors per process</h2><p>Try <a shape="rect" href="http://tinyurl.com/o9qs2f">googling for the OS you are using</a></p></div>