blob: 3beef43ccf6cc4ec2a7dd5119d8d7c6c7d41c73b [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="" >
<head>
<title>Troubleshooting and Performance Tuning ยท ActiveMQ Artemis Documentation</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="">
<meta name="generator" content="GitBook 3.1.1">
<link rel="stylesheet" href="gitbook/style.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="configuration-index.html" />
<link rel="prev" href="unit-testing.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="./">
<a href="./">
Introduction
</a>
</li>
<li class="chapter " data-level="1.2" data-path="notice.html">
<a href="notice.html">
Legal Notice
</a>
</li>
<li class="chapter " data-level="1.3" data-path="preface.html">
<a href="preface.html">
Preface
</a>
</li>
<li class="chapter " data-level="1.4" data-path="project-info.html">
<a href="project-info.html">
Project Info
</a>
</li>
<li class="chapter " data-level="1.5" data-path="versions.html">
<a href="versions.html">
Versions
</a>
</li>
<li class="chapter " data-level="1.6" data-path="messaging-concepts.html">
<a href="messaging-concepts.html">
Messaging Concepts
</a>
</li>
<li class="chapter " data-level="1.7" data-path="architecture.html">
<a href="architecture.html">
Architecture
</a>
</li>
<li class="chapter " data-level="1.8" data-path="using-server.html">
<a href="using-server.html">
Using the Server
</a>
</li>
<li class="chapter " data-level="1.9" data-path="upgrading.html">
<a href="upgrading.html">
Upgrading
</a>
</li>
<li class="chapter " data-level="1.10" data-path="address-model.html">
<a href="address-model.html">
Address Model
</a>
</li>
<li class="chapter " data-level="1.11" data-path="protocols-interoperability.html">
<a href="protocols-interoperability.html">
Protocols and Interoperability
</a>
</li>
<li class="chapter " data-level="1.12" data-path="amqp.html">
<a href="amqp.html">
AMQP
</a>
</li>
<li class="chapter " data-level="1.13" data-path="mqtt.html">
<a href="mqtt.html">
MQTT
</a>
</li>
<li class="chapter " data-level="1.14" data-path="stomp.html">
<a href="stomp.html">
STOMP
</a>
</li>
<li class="chapter " data-level="1.15" data-path="openwire.html">
<a href="openwire.html">
OpenWire
</a>
</li>
<li class="chapter " data-level="1.16" data-path="core.html">
<a href="core.html">
Core
</a>
</li>
<li class="chapter " data-level="1.17" data-path="jms-core-mapping.html">
<a href="jms-core-mapping.html">
Mapping JMS Concepts to the Core API
</a>
</li>
<li class="chapter " data-level="1.18" data-path="using-jms.html">
<a href="using-jms.html">
Using JMS
</a>
</li>
<li class="chapter " data-level="1.19" data-path="client-classpath.html">
<a href="client-classpath.html">
The Client Classpath
</a>
</li>
<li class="chapter " data-level="1.20" data-path="examples.html">
<a href="examples.html">
Examples
</a>
</li>
<li class="chapter " data-level="1.21" data-path="wildcard-routing.html">
<a href="wildcard-routing.html">
Routing Messages With Wild Cards
</a>
</li>
<li class="chapter " data-level="1.22" data-path="wildcard-syntax.html">
<a href="wildcard-syntax.html">
Wildcard Syntax
</a>
</li>
<li class="chapter " data-level="1.23" data-path="filter-expressions.html">
<a href="filter-expressions.html">
Filter Expressions
</a>
</li>
<li class="chapter " data-level="1.24" data-path="persistence.html">
<a href="persistence.html">
Persistence
</a>
</li>
<li class="chapter " data-level="1.25" data-path="configuring-transports.html">
<a href="configuring-transports.html">
Configuring Transports
</a>
</li>
<li class="chapter " data-level="1.26" data-path="config-reload.html">
<a href="config-reload.html">
Configuration Reload
</a>
</li>
<li class="chapter " data-level="1.27" data-path="connection-ttl.html">
<a href="connection-ttl.html">
Detecting Dead Connections
</a>
</li>
<li class="chapter " data-level="1.28" data-path="slow-consumers.html">
<a href="slow-consumers.html">
Detecting Slow Consumers
</a>
</li>
<li class="chapter " data-level="1.29" data-path="network-isolation.html">
<a href="network-isolation.html">
Avoiding Network Isolation
</a>
</li>
<li class="chapter " data-level="1.30" data-path="critical-analysis.html">
<a href="critical-analysis.html">
Detecting Broker Issues (Critical Analysis)
</a>
</li>
<li class="chapter " data-level="1.31" data-path="transaction-config.html">
<a href="transaction-config.html">
Resource Manager Configuration
</a>
</li>
<li class="chapter " data-level="1.32" data-path="flow-control.html">
<a href="flow-control.html">
Flow Control
</a>
</li>
<li class="chapter " data-level="1.33" data-path="send-guarantees.html">
<a href="send-guarantees.html">
Guarantees of sends and commits
</a>
</li>
<li class="chapter " data-level="1.34" data-path="undelivered-messages.html">
<a href="undelivered-messages.html">
Message Redelivery and Undelivered Messages
</a>
</li>
<li class="chapter " data-level="1.35" data-path="message-expiry.html">
<a href="message-expiry.html">
Message Expiry
</a>
</li>
<li class="chapter " data-level="1.36" data-path="large-messages.html">
<a href="large-messages.html">
Large Messages
</a>
</li>
<li class="chapter " data-level="1.37" data-path="paging.html">
<a href="paging.html">
Paging
</a>
</li>
<li class="chapter " data-level="1.38" data-path="scheduled-messages.html">
<a href="scheduled-messages.html">
Scheduled Messages
</a>
</li>
<li class="chapter " data-level="1.39" data-path="last-value-queues.html">
<a href="last-value-queues.html">
Last-Value Queues
</a>
</li>
<li class="chapter " data-level="1.40" data-path="ring-queues.html">
<a href="ring-queues.html">
Ring Queues
</a>
</li>
<li class="chapter " data-level="1.41" data-path="retroactive-addresses.html">
<a href="retroactive-addresses.html">
Retroactive Addresses
</a>
</li>
<li class="chapter " data-level="1.42" data-path="exclusive-queues.html">
<a href="exclusive-queues.html">
Exclusive Queues
</a>
</li>
<li class="chapter " data-level="1.43" data-path="message-grouping.html">
<a href="message-grouping.html">
Message Grouping
</a>
</li>
<li class="chapter " data-level="1.44" data-path="consumer-priority.html">
<a href="consumer-priority.html">
Consumer Priority
</a>
</li>
<li class="chapter " data-level="1.45" data-path="pre-acknowledge.html">
<a href="pre-acknowledge.html">
Extra Acknowledge Modes
</a>
</li>
<li class="chapter " data-level="1.46" data-path="management.html">
<a href="management.html">
Management
</a>
</li>
<li class="chapter " data-level="1.47" data-path="management-console.html">
<a href="management-console.html">
Management Console
</a>
</li>
<li class="chapter " data-level="1.48" data-path="metrics.html">
<a href="metrics.html">
Metrics
</a>
</li>
<li class="chapter " data-level="1.49" data-path="security.html">
<a href="security.html">
Security
</a>
</li>
<li class="chapter " data-level="1.50" data-path="masking-passwords.html">
<a href="masking-passwords.html">
Masking Passwords
</a>
</li>
<li class="chapter " data-level="1.51" data-path="broker-plugins.html">
<a href="broker-plugins.html">
Broker Plugins
</a>
</li>
<li class="chapter " data-level="1.52" data-path="resource-limits.html">
<a href="resource-limits.html">
Resource Limits
</a>
</li>
<li class="chapter " data-level="1.53" data-path="jms-bridge.html">
<a href="jms-bridge.html">
The JMS Bridge
</a>
</li>
<li class="chapter " data-level="1.54" data-path="client-reconnection.html">
<a href="client-reconnection.html">
Client Reconnection and Session Reattachment
</a>
</li>
<li class="chapter " data-level="1.55" data-path="diverts.html">
<a href="diverts.html">
Diverting and Splitting Message Flows
</a>
</li>
<li class="chapter " data-level="1.56" data-path="core-bridges.html">
<a href="core-bridges.html">
Core Bridges
</a>
</li>
<li class="chapter " data-level="1.57" data-path="transformers.html">
<a href="transformers.html">
Transformers
</a>
</li>
<li class="chapter " data-level="1.58" data-path="duplicate-detection.html">
<a href="duplicate-detection.html">
Duplicate Message Detection
</a>
</li>
<li class="chapter " data-level="1.59" data-path="clusters.html">
<a href="clusters.html">
Clusters
</a>
</li>
<li class="chapter " data-level="1.60" data-path="federation.html">
<a href="federation.html">
Federation
</a>
<ul class="articles">
<li class="chapter " data-level="1.60.1" data-path="federation-address.html">
<a href="federation-address.html">
Address Federation
</a>
</li>
<li class="chapter " data-level="1.60.2" data-path="federation-queue.html">
<a href="federation-queue.html">
Queue Federation
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.61" data-path="ha.html">
<a href="ha.html">
High Availability and Failover
</a>
</li>
<li class="chapter " data-level="1.62" data-path="graceful-shutdown.html">
<a href="graceful-shutdown.html">
Graceful Server Shutdown
</a>
</li>
<li class="chapter " data-level="1.63" data-path="libaio.html">
<a href="libaio.html">
Libaio Native Libraries
</a>
</li>
<li class="chapter " data-level="1.64" data-path="thread-pooling.html">
<a href="thread-pooling.html">
Thread management
</a>
</li>
<li class="chapter " data-level="1.65" data-path="web-server.html">
<a href="web-server.html">
Embedded Web Server
</a>
</li>
<li class="chapter " data-level="1.66" data-path="logging.html">
<a href="logging.html">
Logging
</a>
</li>
<li class="chapter " data-level="1.67" data-path="rest.html">
<a href="rest.html">
REST Interface
</a>
</li>
<li class="chapter " data-level="1.68" data-path="embedding-activemq.html">
<a href="embedding-activemq.html">
Embedding the Broker
</a>
</li>
<li class="chapter " data-level="1.69" data-path="karaf.html">
<a href="karaf.html">
Apache Karaf
</a>
</li>
<li class="chapter " data-level="1.70" data-path="tomcat.html">
<a href="tomcat.html">
Apache Tomcat
</a>
</li>
<li class="chapter " data-level="1.71" data-path="spring-integration.html">
<a href="spring-integration.html">
Spring Integration
</a>
</li>
<li class="chapter " data-level="1.72" data-path="cdi-integration.html">
<a href="cdi-integration.html">
CDI Integration
</a>
</li>
<li class="chapter " data-level="1.73" data-path="intercepting-operations.html">
<a href="intercepting-operations.html">
Intercepting Operations
</a>
</li>
<li class="chapter " data-level="1.74" data-path="data-tools.html">
<a href="data-tools.html">
Data Tools
</a>
</li>
<li class="chapter " data-level="1.75" data-path="maven-plugin.html">
<a href="maven-plugin.html">
Maven Plugin
</a>
</li>
<li class="chapter " data-level="1.76" data-path="unit-testing.html">
<a href="unit-testing.html">
Unit Testing
</a>
</li>
<li class="chapter active" data-level="1.77" data-path="perf-tuning.html">
<a href="perf-tuning.html">
Troubleshooting and Performance Tuning
</a>
</li>
<li class="chapter " data-level="1.78" data-path="configuration-index.html">
<a href="configuration-index.html">
Configuration Reference
</a>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="." >Troubleshooting and Performance Tuning</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h1 id="performance-tuning">Performance Tuning</h1>
<p>In this chapter we&apos;ll discuss how to tune Apache ActiveMQ Artemis for optimum
performance.</p>
<h2 id="tuning-persistence">Tuning persistence</h2>
<ul>
<li><p>To get the best performance from Apache ActiveMQ Artemis whilst using
persistent messages it is recommended that the file store is used. Apache
ActiveMQ Artemis also supports JDBC persistence, but there is a performance
cost when persisting to a database vs local disk.</p>
</li>
<li><p>Put the message journal on its own physical volume. If the disk is shared
with other processes e.g. transaction co-ordinator, database or other
journals which are also reading and writing from it, then this may greatly
reduce performance since the disk head may be skipping all over the place
between the different files. One of the advantages of an append only journal is
that disk head movement is minimised - this advantage is destroyed if the disk
is shared. If you&apos;re using paging or large messages make sure they&apos;re ideally
put on separate volumes too.</p>
</li>
<li><p>Minimum number of journal files. Set <code>journal-min-files</code> to a number of files
that would fit your average sustainable rate. This number represents the
lower threshold of the journal file pool.</p>
</li>
<li><p>To set the upper threshold of the journal file pool. (<code>journal-min-files</code> being
the lower threshold). Set <code>journal-pool-files</code> to a number that represents
something near your maximum expected load. The journal will spill over the
pool should it need to, but will shrink back to the upper threshold, when
possible. This allows reuse of files, without taking up more disk space than
required. If you see new files being created on the journal data directory too
often, i.e. lots of data is being persisted, you need to increase the
journal-pool-size, this way the journal would reuse more files instead of
creating new data files, increasing performance</p>
</li>
<li><p>Journal file size. The journal file size should be aligned to the capacity of
a cylinder on the disk. The default value 10MiB should be enough on most
systems.</p>
</li>
<li><p>Use <code>ASYNCIO</code> journal. If using Linux, try to keep your journal type as
<code>ASYNCIO</code>. <code>ASYNCIO</code> will scale better than Java NIO.</p>
</li>
<li><p>Tune <code>journal-buffer-timeout</code>. The timeout can be increased to increase
throughput at the expense of latency.</p>
</li>
<li><p>If you&apos;re running <code>ASYNCIO</code> you might be able to get some better performance by
increasing <code>journal-max-io</code>. DO NOT change this parameter if you are running
NIO.</p>
</li>
<li><p>If you are 100% sure you don&apos;t need power failure durability guarantees,
disable <code>journal-data-sync</code> and use <code>NIO</code> or <code>MAPPED</code> journal: you&apos;ll benefit
a huge performance boost on writes with process failure durability guarantees. </p>
</li>
</ul>
<h2 id="tuning-jms">Tuning JMS</h2>
<p>There are a few areas where some tweaks can be done if you are using the JMS
API</p>
<ul>
<li><p>Disable message id. Use the <code>setDisableMessageID()</code> method on the
<code>MessageProducer</code> class to disable message ids if you don&apos;t need them. This
decreases the size of the message and also avoids the overhead of creating a
unique ID.</p>
</li>
<li><p>Disable message timestamp. Use the <code>setDisableMessageTimeStamp()</code> method on
the <code>MessageProducer</code> class to disable message timestamps if you don&apos;t need
them.</p>
</li>
<li><p>Avoid <code>ObjectMessage</code>. <code>ObjectMessage</code> is convenient but it comes at a cost.
The body of a <code>ObjectMessage</code> uses Java serialization to serialize it to
bytes. The Java serialized form of even small objects is very verbose so takes
up a lot of space on the wire, also Java serialization is slow compared to
custom marshalling techniques. Only use <code>ObjectMessage</code> if you really can&apos;t use
one of the other message types, i.e. if you really don&apos;t know the type of the
payload until run-time.</p>
</li>
<li><p>Avoid <code>AUTO_ACKNOWLEDGE</code>. <code>AUTO_ACKNOWLEDGE</code> mode requires an acknowledgement
to be sent from the server for each message received on the client, this
means more traffic on the network. If you can, use <code>DUPS_OK_ACKNOWLEDGE</code> or use
<code>CLIENT_ACKNOWLEDGE</code> or a transacted session and batch up many acknowledgements
with one acknowledge/commit.</p>
</li>
<li><p>Avoid durable messages. By default JMS messages are durable. If you don&apos;t
really need durable messages then set them to be non-durable. Durable
messages incur a lot more overhead in persisting them to storage.</p>
</li>
<li><p>Batch many sends or acknowledgements in a single transaction. Apache
ActiveMQ Artemis will only require a network round trip on the commit, not on
every send or acknowledgement.</p>
</li>
</ul>
<h2 id="other-tunings">Other Tunings</h2>
<p>There are various other places in Apache ActiveMQ Artemis where we can perform
some tuning:</p>
<ul>
<li><p>Use Asynchronous Send Acknowledgements. If you need to send durable messages
non transactionally and you need a guarantee that they have reached the
server by the time the call to send() returns, don&apos;t set durable messages to be
sent blocking, instead use asynchronous send acknowledgements to get your
acknowledgements of send back in a separate stream, see <a href="send-guarantees.html">Guarantees of sends
and commits</a> for more information on this.</p>
</li>
<li><p>Use pre-acknowledge mode. With pre-acknowledge mode, messages are
acknowledged <code>before</code> they are sent to the client. This reduces the amount of
acknowledgement traffic on the wire. For more information on this, see <a href="pre-acknowledge.html">Extra
Acknowledge Modes</a>.</p>
</li>
<li><p>Disable security. You may get a small performance boost by disabling security
by setting the <code>security-enabled</code> parameter to <code>false</code> in <code>broker.xml</code>.</p>
</li>
<li><p>Disable persistence. If you don&apos;t need message persistence, turn it off
altogether by setting <code>persistence-enabled</code> to false in <code>broker.xml</code>.</p>
</li>
<li><p>Sync transactions lazily. Setting <code>journal-sync-transactional</code> to <code>false</code> in
<code>broker.xml</code> can give you better transactional persistent performance at the
expense of some possibility of loss of transactions on failure. See
<a href="send-guarantees.html">Guarantees of sends and commits</a> for more information.</p>
</li>
<li><p>Sync non transactional lazily. Setting <code>journal-sync-non-transactional</code> to
<code>false</code> in <code>broker.xml</code> can give you better non-transactional persistent
performance at the expense of some possibility of loss of durable messages on
failure. See <a href="send-guarantees.html">Guarantees of sends and commits</a> for more
information.</p>
</li>
<li><p>Send messages non blocking. Setting <code>block-on-durable-send</code> and
<code>block-on-non-durable-send</code> to <code>false</code> in the jms config (if you&apos;re using JMS
and JNDI) or directly on the ServerLocator. This means you don&apos;t have to wait a
whole network round trip for every message sent. See <a href="send-guarantees.html">Guarantees of sends and
commits</a> for more information.</p>
</li>
<li><p>If you have very fast consumers, you can increase consumer-window-size. This
effectively disables consumer flow control.</p>
</li>
<li><p>Use the core API not JMS. Using the JMS API you will have slightly lower
performance than using the core API, since all JMS operations need to be
translated into core operations before the server can handle them. If using the
core API try to use methods that take <code>SimpleString</code> as much as possible.
<code>SimpleString</code>, unlike java.lang.String does not require copying before it is
written to the wire, so if you re-use <code>SimpleString</code> instances between calls
then you can avoid some unnecessary copying.</p>
</li>
<li><p>If using frameworks like Spring, configure destinations permanently broker
side and enable <code>cacheDestinations</code> on the client side. See the <a href="using-jms.html">Setting The
Destination Cache</a> for more information on this.</p>
</li>
</ul>
<h2 id="tuning-transport-settings">Tuning Transport Settings</h2>
<ul>
<li><p>TCP buffer sizes. If you have a fast network and fast machines you may get a
performance boost by increasing the TCP send and receive buffer sizes. See
the <a href="configuring-transports.html">Configuring the Transport</a> for more information
on this.</p>
<blockquote>
<p><strong>Note:</strong></p>
<p>Note that some operating systems like later versions of Linux include TCP
auto-tuning and setting TCP buffer sizes manually can prevent auto-tune
from working and actually give you worse performance!</p>
</blockquote>
</li>
<li><p>Increase limit on file handles on the server. If you expect a lot of
concurrent connections on your servers, or if clients are rapidly opening and
closing connections, you should make sure the user running the server has
permission to create sufficient file handles.</p>
<p>This varies from operating system to operating system. On Linux systems you
can increase the number of allowable open file handles in the file
<code>/etc/security/limits.conf</code> e.g. add the lines</p>
<pre><code>serveruser soft nofile 20000
serveruser hard nofile 20000
</code></pre><p>This would allow up to 20000 file handles to be open by the user
<code>serveruser</code>.</p>
</li>
<li><p>Use <code>batch-delay</code> and set <code>direct-deliver</code> to false for the best throughput
for very small messages. Apache ActiveMQ Artemis comes with a preconfigured
connector/acceptor pair (<code>netty-throughput</code>) in <code>broker.xml</code> and JMS connection
factory (<code>ThroughputConnectionFactory</code>) in <code>activemq-jms.xml</code>which can be used
to give the very best throughput, especially for small messages. See the
<a href="configuring-transports.html">Configuring the Transport</a> for more information on
this.</p>
</li>
</ul>
<h2 id="tuning-the-vm">Tuning the VM</h2>
<p>We highly recommend you use the latest Java JVM for the best performance. We
test internally using the Sun JVM, so some of these tunings won&apos;t apply to JDKs
from other providers (e.g. IBM or JRockit)</p>
<ul>
<li><p>Garbage collection. For smooth server operation we recommend using a parallel
garbage collection algorithm, e.g. using the JVM argument
<code>-XX:+UseParallelOldGC</code> on Sun JDKs.</p>
</li>
<li><p>Memory settings. Give as much memory as you can to the server. Apache
ActiveMQ Artemis can run in low memory by using paging (described in
<a href="paging.html">Paging</a>) but if it can run with all queues in RAM this will improve
performance. The amount of memory you require will depend on the size and
number of your queues and the size and number of your messages. Use the JVM
arguments <code>-Xms</code> and <code>-Xmx</code> to set server available RAM. We recommend setting
them to the same high value.</p>
<p>When under periods of high load, it is likely that Artemis will be generating
and destroying lots of objects. This can result in a build up of stale objects.
To reduce the chance of running out of memory and causing a full GC (which may
introduce pauses and unintentional behaviour), it is recommended that the max
heap size (<code>-Xmx</code>) for the JVM is set at least to 5 x the <code>global-max-size</code> of
the broker. As an example, in a situation where the broker is under high load
and running with a <code>global-max-size</code> of 1GB, it is recommended the the max heap
size is set to 5GB.</p>
</li>
</ul>
<h2 id="avoiding-anti-patterns">Avoiding Anti-Patterns</h2>
<ul>
<li><p>Re-use connections / sessions / consumers / producers. Probably the most
common messaging anti-pattern we see is users who create a new
connection/session/producer for every message they send or every message they
consume. This is a poor use of resources. These objects take time to create and
may involve several network round trips. Always re-use them.</p>
<blockquote>
<p><strong>Note:</strong></p>
<p>Some popular libraries such as the Spring JMS Template are known to use
these anti-patterns. If you&apos;re using Spring JMS Template and you&apos;re getting
poor performance you know why. Don&apos;t blame Apache ActiveMQ Artemis! The
Spring JMS Template can only safely be used in an app server which caches
JMS sessions (e.g. using JCA), and only then for sending messages. It
cannot be safely be used for synchronously consuming messages, even in an
app server.</p>
</blockquote>
</li>
<li><p>Avoid fat messages. Verbose formats such as XML take up a lot of space on the
wire and performance will suffer as result. Avoid XML in message bodies if
you can.</p>
</li>
<li><p>Don&apos;t create temporary queues for each request. This common anti-pattern
involves the temporary queue request-response pattern. With the temporary
queue request-response pattern a message is sent to a target and a reply-to
header is set with the address of a local temporary queue. When the recipient
receives the message they process it then send back a response to the address
specified in the reply-to. A common mistake made with this pattern is to create
a new temporary queue on each message sent. This will drastically reduce
performance. Instead the temporary queue should be re-used for many requests.</p>
</li>
<li><p>Don&apos;t use Message-Driven Beans for the sake of it. As soon as you start using
MDBs you are greatly increasing the codepath for each message received
compared to a straightforward message consumer, since a lot of extra
application server code is executed. Ask yourself do you really need MDBs? Can
you accomplish the same task using just a normal message consumer?</p>
</li>
</ul>
<h2 id="troubleshooting">Troubleshooting</h2>
<h3 id="udp-not-working">UDP not working</h3>
<p>In certain situations UDP used on discovery may not work. Typical situations are:</p>
<ol>
<li>The nodes are behind a firewall. If your nodes are on different machines
then it is possible that the firewall is blocking the multicasts. you can
test this by disabling the firewall for each node or adding the appropriate
rules.</li>
<li>You are using a home network or are behind a gateway. Typically home
networks will redirect any UDP traffic to the Internet Service Provider
which is then either dropped by the ISP or just lost. To fix this you will need
to add a route to the firewall/gateway that will redirect any multicast traffic
back on to the local network instead.</li>
<li><p>All the nodes are in one machine. If this is the case then it is a similar
problem to point 2 and the same solution should fix it. Alternatively you
could add a multicast route to the loopback interface. On linux the command
would be:</p>
<pre><code class="lang-sh"><span class="hljs-comment"># you should run this as root</span>
route add -net 224.0.0.0 netmask 240.0.0.0 dev lo
</code></pre>
<p>This will redirect any traffic directed to the 224.0.0.0 to the loopback
interface. This will also work if you have no network at all. On Mac OS X, the
command is slightly different:</p>
<pre><code class="lang-sh">sudo route add 224.0.0.0 127.0.0.1 -netmask 240.0.0.0
</code></pre>
</li>
</ol>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="unit-testing.html" class="navigation navigation-prev " aria-label="Previous page: Unit Testing">
<i class="fa fa-angle-left"></i>
</a>
<a href="configuration-index.html" class="navigation navigation-next " aria-label="Next page: Configuration Reference">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Troubleshooting and Performance Tuning","level":"1.77","depth":1,"next":{"title":"Configuration Reference","level":"1.78","depth":1,"path":"configuration-index.md","ref":"configuration-index.md","articles":[]},"previous":{"title":"Unit Testing","level":"1.76","depth":1,"path":"unit-testing.md","ref":"unit-testing.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"github":"apache/activemq-artemis","theme":"default","githubHost":"https://github.com/","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"ActiveMQ Artemis Documentation","links":{"home":"http://activemq.apache.org/artemis","issues":"https://issues.apache.org/jira/browse/ARTEMIS","contribute":"http://activemq.apache.org/contributing.html"},"gitbook":"3.x.x","description":"ActiveMQ Artemis User Guide and Reference Documentation"},"file":{"path":"perf-tuning.md","mtime":"2020-03-27T19:42:11.000Z","type":"markdown"},"gitbook":{"version":"3.1.1","time":"2020-04-29T20:47:49.444Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>
<script src="gitbook/gitbook.js"></script>
<script src="gitbook/theme.js"></script>
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="gitbook/gitbook-plugin-search/search.js"></script>
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>