Added: websites/production/activemq/content/artemis/docs/latest/configuring-transports.html ============================================================================== --- websites/production/activemq/content/artemis/docs/latest/configuring-transports.html (added) +++ websites/production/activemq/content/artemis/docs/latest/configuring-transports.html Thu Sep 14 19:48:11 2017 @@ -0,0 +1,1437 @@ + +<!DOCTYPE HTML> +<html lang="" > + <head> + <title>Configuring Transports · 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="config-reload.html" /> + + + <link rel="prev" href="persistence.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="messaging-concepts.html"> + + <a href="messaging-concepts.html"> + + + Messaging Concepts + + </a> + + + + </li> + + <li class="chapter " data-level="1.6" data-path="architecture.html"> + + <a href="architecture.html"> + + + Architecture + + </a> + + + + </li> + + <li class="chapter " data-level="1.7" data-path="using-server.html"> + + <a href="using-server.html"> + + + Using the Server + + </a> + + + + </li> + + <li class="chapter " data-level="1.8" data-path="address-model.html"> + + <a href="address-model.html"> + + + Address Model + + </a> + + + + </li> + + <li class="chapter " data-level="1.9" data-path="using-jms.html"> + + <a href="using-jms.html"> + + + Using JMS + + </a> + + + + </li> + + <li class="chapter " data-level="1.10" data-path="using-core.html"> + + <a href="using-core.html"> + + + Using Core + + </a> + + + + </li> + + <li class="chapter " data-level="1.11" data-path="using-AMQP.html"> + + <a href="using-AMQP.html"> + + + Using AMQP + + </a> + + + + </li> + + <li class="chapter " data-level="1.12" 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.13" data-path="client-classpath.html"> + + <a href="client-classpath.html"> + + + The Client Classpath + + </a> + + + + </li> + + <li class="chapter " data-level="1.14" data-path="examples.html"> + + <a href="examples.html"> + + + Examples + + </a> + + + + </li> + + <li class="chapter " data-level="1.15" data-path="wildcard-routing.html"> + + <a href="wildcard-routing.html"> + + + Routing Messages With Wild Cards + + </a> + + + + </li> + + <li class="chapter " data-level="1.16" data-path="wildcard-syntax.html"> + + <a href="wildcard-syntax.html"> + + + Understanding the Apache ActiveMQ Artemis Wildcard Syntax + + </a> + + + + </li> + + <li class="chapter " data-level="1.17" data-path="filter-expressions.html"> + + <a href="filter-expressions.html"> + + + Filter Expressions + + </a> + + + + </li> + + <li class="chapter " data-level="1.18" data-path="persistence.html"> + + <a href="persistence.html"> + + + Persistence + + </a> + + + + </li> + + <li class="chapter active" data-level="1.19" data-path="configuring-transports.html"> + + <a href="configuring-transports.html"> + + + Configuring Transports + + </a> + + + + </li> + + <li class="chapter " data-level="1.20" data-path="config-reload.html"> + + <a href="config-reload.html"> + + + Configuration Reload + + </a> + + + + </li> + + <li class="chapter " data-level="1.21" data-path="connection-ttl.html"> + + <a href="connection-ttl.html"> + + + Detecting Dead Connections + + </a> + + + + </li> + + <li class="chapter " data-level="1.22" data-path="slow-consumers.html"> + + <a href="slow-consumers.html"> + + + Detecting Slow Consumers + + </a> + + + + </li> + + <li class="chapter " data-level="1.23" data-path="network-isolation.html"> + + <a href="network-isolation.html"> + + + Avoiding Network Isolation + + </a> + + + + </li> + + <li class="chapter " data-level="1.24" data-path="critical-analysis.html"> + + <a href="critical-analysis.html"> + + + Detecting Broker Issues (Critical Analysis) + + </a> + + + + </li> + + <li class="chapter " data-level="1.25" data-path="transaction-config.html"> + + <a href="transaction-config.html"> + + + Resource Manager Configuration + + </a> + + + + </li> + + <li class="chapter " data-level="1.26" data-path="flow-control.html"> + + <a href="flow-control.html"> + + + Flow Control + + </a> + + + + </li> + + <li class="chapter " data-level="1.27" data-path="send-guarantees.html"> + + <a href="send-guarantees.html"> + + + Guarantees of sends and commits + + </a> + + + + </li> + + <li class="chapter " data-level="1.28" data-path="undelivered-messages.html"> + + <a href="undelivered-messages.html"> + + + Message Redelivery and Undelivered Messages + + </a> + + + + </li> + + <li class="chapter " data-level="1.29" data-path="message-expiry.html"> + + <a href="message-expiry.html"> + + + Message Expiry + + </a> + + + + </li> + + <li class="chapter " data-level="1.30" data-path="large-messages.html"> + + <a href="large-messages.html"> + + + Large Messages + + </a> + + + + </li> + + <li class="chapter " data-level="1.31" data-path="paging.html"> + + <a href="paging.html"> + + + Paging + + </a> + + + + </li> + + <li class="chapter " data-level="1.32" data-path="queue-attributes.html"> + + <a href="queue-attributes.html"> + + + Queue Attributes + + </a> + + + + </li> + + <li class="chapter " data-level="1.33" data-path="scheduled-messages.html"> + + <a href="scheduled-messages.html"> + + + Scheduled Messages + + </a> + + + + </li> + + <li class="chapter " data-level="1.34" data-path="last-value-queues.html"> + + <a href="last-value-queues.html"> + + + Last-Value Queues + + </a> + + + + </li> + + <li class="chapter " data-level="1.35" data-path="message-grouping.html"> + + <a href="message-grouping.html"> + + + Message Grouping + + </a> + + + + </li> + + <li class="chapter " data-level="1.36" data-path="pre-acknowledge.html"> + + <a href="pre-acknowledge.html"> + + + Extra Acknowledge Modes + + </a> + + + + </li> + + <li class="chapter " data-level="1.37" data-path="management.html"> + + <a href="management.html"> + + + Management + + </a> + + + + </li> + + <li class="chapter " data-level="1.38" data-path="management-console.html"> + + <a href="management-console.html"> + + + Management Console + + </a> + + + + </li> + + <li class="chapter " data-level="1.39" data-path="security.html"> + + <a href="security.html"> + + + Security + + </a> + + + + </li> + + <li class="chapter " data-level="1.40" data-path="broker-plugins.html"> + + <a href="broker-plugins.html"> + + + Broker Plugins + + </a> + + + + </li> + + <li class="chapter " data-level="1.41" data-path="resource-limits.html"> + + <a href="resource-limits.html"> + + + Resource Limits + + </a> + + + + </li> + + <li class="chapter " data-level="1.42" data-path="jms-bridge.html"> + + <a href="jms-bridge.html"> + + + The JMS Bridge + + </a> + + + + </li> + + <li class="chapter " data-level="1.43" data-path="client-reconnection.html"> + + <a href="client-reconnection.html"> + + + Client Reconnection and Session Reattachment + + </a> + + + + </li> + + <li class="chapter " data-level="1.44" data-path="diverts.html"> + + <a href="diverts.html"> + + + Diverting and Splitting Message Flows + + </a> + + + + </li> + + <li class="chapter " data-level="1.45" data-path="core-bridges.html"> + + <a href="core-bridges.html"> + + + Core Bridges + + </a> + + + + </li> + + <li class="chapter " data-level="1.46" data-path="duplicate-detection.html"> + + <a href="duplicate-detection.html"> + + + Duplicate Message Detection + + </a> + + + + </li> + + <li class="chapter " data-level="1.47" data-path="clusters.html"> + + <a href="clusters.html"> + + + Clusters + + </a> + + + + </li> + + <li class="chapter " data-level="1.48" data-path="ha.html"> + + <a href="ha.html"> + + + High Availability and Failover + + </a> + + + + </li> + + <li class="chapter " data-level="1.49" data-path="graceful-shutdown.html"> + + <a href="graceful-shutdown.html"> + + + Graceful Server Shutdown + + </a> + + + + </li> + + <li class="chapter " data-level="1.50" data-path="libaio.html"> + + <a href="libaio.html"> + + + Libaio Native Libraries + + </a> + + + + </li> + + <li class="chapter " data-level="1.51" data-path="thread-pooling.html"> + + <a href="thread-pooling.html"> + + + Thread management + + </a> + + + + </li> + + <li class="chapter " data-level="1.52" data-path="logging.html"> + + <a href="logging.html"> + + + Logging + + </a> + + + + </li> + + <li class="chapter " data-level="1.53" data-path="rest.html"> + + <a href="rest.html"> + + + REST Interface + + </a> + + + + </li> + + <li class="chapter " data-level="1.54" data-path="embedding-activemq.html"> + + <a href="embedding-activemq.html"> + + + Embedding Apache ActiveMQ Artemis + + </a> + + + + </li> + + <li class="chapter " data-level="1.55" data-path="karaf.html"> + + <a href="karaf.html"> + + + Apache Karaf + + </a> + + + + </li> + + <li class="chapter " data-level="1.56" data-path="spring-integration.html"> + + <a href="spring-integration.html"> + + + Spring Integration + + </a> + + + + </li> + + <li class="chapter " data-level="1.57" data-path="cdi-integration.html"> + + <a href="cdi-integration.html"> + + + CDI Integration + + </a> + + + + </li> + + <li class="chapter " data-level="1.58" data-path="intercepting-operations.html"> + + <a href="intercepting-operations.html"> + + + Intercepting Operations + + </a> + + + + </li> + + <li class="chapter " data-level="1.59" data-path="protocols-interoperability.html"> + + <a href="protocols-interoperability.html"> + + + Protocols and Interoperability + + </a> + + + + </li> + + <li class="chapter " data-level="1.60" data-path="tools.html"> + + <a href="tools.html"> + + + Tools + + </a> + + + + </li> + + <li class="chapter " data-level="1.61" data-path="maven-plugin.html"> + + <a href="maven-plugin.html"> + + + Maven Plugin + + </a> + + + + </li> + + <li class="chapter " data-level="1.62" data-path="unit-testing.html"> + + <a href="unit-testing.html"> + + + Unit Testing + + </a> + + + + </li> + + <li class="chapter " data-level="1.63" data-path="perf-tuning.html"> + + <a href="perf-tuning.html"> + + + Troubleshooting and Performance Tuning + + </a> + + + + </li> + + <li class="chapter " data-level="1.64" data-path="configuration-index.html"> + + <a href="configuration-index.html"> + + + Configuration Reference + + </a> + + + + </li> + + <li class="chapter " data-level="1.65" data-path="updating-artemis.html"> + + <a href="updating-artemis.html"> + + + Updating Artemis + + </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="." >Configuring Transports</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="configuring-the-transport">Configuring the Transport</h1> +<p>In this chapter we'll describe the concepts required for understanding +Apache ActiveMQ Artemis transports and where and how they're configured.</p> +<h2 id="understanding-acceptors">Understanding Acceptors</h2> +<p>One of the most important concepts in Apache ActiveMQ Artemis transports is the +<em>acceptor</em>. Let's dive straight in and take a look at an acceptor +defined in xml in the configuration file <code>broker.xml</code>.</p> +<pre><code><acceptors> + <acceptor name="netty">tcp://localhost:61617</acceptor> +</acceptors> +</code></pre><p>Acceptors are always defined inside an <code>acceptors</code> element. There can be +one or more acceptors defined in the <code>acceptors</code> element. There's no +upper limit to the number of acceptors per server.</p> +<p>Each acceptor defines a way in which connections can be made to the +Apache ActiveMQ Artemis server.</p> +<p>In the above example we're defining an acceptor that uses +<a href="http://netty.io/" target="_blank">Netty</a> to listen for connections at port +<code>61617</code>.</p> +<p>The <code>acceptor</code> element contains a <code>URL</code> that defines the kind of Acceptor +to create along with its configuration. The <code>schema</code> part of the <code>URL</code> +defines the Acceptor type which can either be <code>tcp</code> or <code>vm</code> which is +<code>Netty</code> or an In VM Acceptor respectively. For <code>Netty</code> the host and the +port of the <code>URL</code> define what host and port the <code>acceptor</code> will bind to. For +In VM the <code>Authority</code> part of the <code>URL</code> defines a unique server id.</p> +<p>The <code>acceptor</code> can also be configured with a set of key=value pairs +used to configure the specific transport, the set of +valid key=value pairs depends on the specific transport be used and are +passed straight through to the underlying transport. These are set on the +<code>URL</code> as part of the query, like so:</p> +<pre><code><acceptor name="netty">tcp://localhost:61617?sslEnabled=true&keyStorePath=/path</acceptor> +</code></pre><h2 id="understanding-connectors">Understanding Connectors</h2> +<p>Whereas acceptors are used on the server to define how we accept +connections, connectors are used to define how to connect to a server.</p> +<p>Let's look at a connector defined in our <code>broker.xml</code> file:</p> +<pre><code><connectors> + <connector name="netty">tcp://localhost:61617</connector> +</connectors> +</code></pre><p>Connectors can be defined inside a <code>connectors</code> element. There can be +one or more connectors defined in the <code>connectors</code> element. There's no +upper limit to the number of connectors per server.</p> +<p>A <code>connector</code> is used when the server acts as a client itself, e.g.:</p> +<ul> +<li>When one server is bridged to another</li> +<li>When a server takes part in a cluster</li> +</ul> +<p>In these cases the server needs to know how to connect to other servers. +That's defined by <code>connectors</code>.</p> +<h2 id="configuring-the-transport-directly-from-the-client-side">Configuring the transport directly from the client side.</h2> +<p>How do we configure a core <code>ClientSessionFactory</code> with the information +that it needs to connect with a server?</p> +<p>Connectors are also used indirectly when configuring a core +<code>ClientSessionFactory</code> to directly talk to a server. Although in this +case there's no need to define such a connector in the server side +configuration, instead we just specify the appropriate URI.</p> +<p>Here's an example of creating a <code>ClientSessionFactory</code> which will +connect directly to the acceptor we defined earlier in this chapter, it +uses the standard Netty TCP transport and will try and connect on port +61617 to localhost (default):</p> +<pre><code class="lang-java">ServerLocator locator = ActiveMQClient.createServerLocator(<span class="hljs-string">"tcp://localhost:61617"</span>); + +ClientSessionFactory sessionFactory = locator.createClientSessionFactory(); + +ClientSession session = sessionFactory.createSession(...); +</code></pre> +<p>Similarly, if you're using JMS, you can configure the JMS connection +factory directly on the client side:</p> +<pre><code class="lang-java">ConnectionFactory connectionFactory = <span class="hljs-keyword">new</span> ActiveMQConnectionFactory(<span class="hljs-string">"tcp://localhost:61617"</span>); + +Connection jmsConnection = connectionFactory.createConnection(); +</code></pre> +<h2 id="configuring-the-netty-transport">Configuring the Netty transport</h2> +<p>Out of the box, Apache ActiveMQ Artemis currently uses +<a href="http://netty.io/" target="_blank">Netty</a>, a high performance low level +network library.</p> +<p>Our Netty transport can be configured in several different ways; to use +straightforward TCP sockets, SSL, or to tunnel over HTTP or HTTPS..</p> +<p>We believe this caters for the vast majority of transport requirements.</p> +<h2 id="single-port-support">Single Port Support</h2> +<p>Apache ActiveMQ Artemis supports using a single port for all +protocols, Apache ActiveMQ Artemis will automatically detect which protocol is being +used CORE, AMQP, STOMP or OPENWIRE and use the appropriate Apache ActiveMQ Artemis +handler. It will also detect whether protocols such as HTTP or Web +Sockets are being used and also use the appropriate decoders</p> +<p>It is possible to limit which protocols are supported by using the +<code>protocols</code> parameter on the Acceptor like so:</p> +<pre><code> <connector name="netty">tcp://localhost:61617?protocols=CORE,AMQP</connector> +</code></pre><h2 id="configuring-netty-tcp">Configuring Netty TCP</h2> +<p>Netty TCP is a simple unencrypted TCP sockets based transport. If you're +running connections across an untrusted network please bear in +mind this transport is unencrypted. You may want to look at the SSL or +HTTPS configurations.</p> +<p>With the Netty TCP transport all connections are initiated from the +client side (i.e. the server does not initiate any connections to the +client). This works well with firewall policies that typically only allow +connections to be initiated in one direction.</p> +<p>All the valid keys for the <code>tcp</code> URL scheme used for Netty are defined in the +class <code>org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants</code>. +Most parameters can be used either with acceptors or connectors, some only +work with acceptors. The following parameters can be used to configure +Netty for simple TCP:</p> +<blockquote> +<p><strong>Note</strong></p> +<p>The <code>host</code> and <code>port</code> parameters are only used in the core API, in +XML configuration these are set in the URI host and port.</p> +</blockquote> +<ul> +<li><p><code>host</code>. This specifies the host name or IP address to connect to +(when configuring a connector) or to listen on (when configuring an +acceptor). The default value for this property is <code>localhost</code>. When +configuring acceptors, multiple hosts or IP addresses can be +specified by separating them with commas. It is also possible to +specify <code>0.0.0.0</code> to accept connection from all the host's network +interfaces. It's not valid to specify multiple addresses when +specifying the host for a connector; a connector makes a connection +to one specific address.</p> +<blockquote> +<p><strong>Note</strong></p> +<p>Don't forget to specify a host name or IP address! If you want +your server able to accept connections from other nodes you must +specify a hostname or IP address at which the acceptor will bind +and listen for incoming connections. The default is localhost +which of course is not accessible from remote nodes!</p> +</blockquote> +</li> +<li><p><code>port</code>. This specified the port to connect to (when configuring a +connector) or to listen on (when configuring an acceptor). The +default value for this property is <code>61616</code>.</p> +</li> +<li><p><code>tcpNoDelay</code>. If this is <code>true</code> then <a href="http://en.wikipedia.org/wiki/Nagle%27s_algorithm" target="_blank">Nagle's +algorithm</a> will be +disabled. This is a <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/net/socketOpt.html" target="_blank">Java (client) socket +option</a>. +The default value for this property is <code>true</code>.</p> +</li> +<li><p><code>tcpSendBufferSize</code>. This parameter determines the size of the +TCP send buffer in bytes. The default value for this property is +<code>32768</code> bytes (32KiB).</p> +<p>TCP buffer sizes should be tuned according to the bandwidth and +latency of your network. Here's a good link that explains the theory +behind <a href="http://www-didc.lbl.gov/TCP-tuning/" target="_blank">this</a>.</p> +<p>In summary TCP send/receive buffer sizes should be calculated as:</p> +<pre><code>buffer_size = bandwidth * RTT. +</code></pre><p>Where bandwidth is in <em>bytes per second</em> and network round trip time +(RTT) is in seconds. RTT can be easily measured using the <code>ping</code> +utility.</p> +<p>For fast networks you may want to increase the buffer sizes from the +defaults.</p> +</li> +<li><p><code>tcpReceiveBufferSize</code>. This parameter determines the size of the +TCP receive buffer in bytes. The default value for this property is +<code>32768</code> bytes (32KiB).</p> +</li> +<li><p><code>writeBufferLowWaterMark</code>. This parameter determines the low water mark of +the Netty write buffer. Once the number of bytes queued in the write buffer exceeded +the high water mark and then dropped down below this value, Netty's channel +will start to be writable again. The default value for this property is +<code>32768</code> bytes (32KiB).</p> +</li> +<li><p><code>writeBufferHighWaterMark</code>. This parameter determines the high water mark of +the Netty write buffer. If the number of bytes queued in the write buffer exceeds +this value, Netty's channel will start to be not writable. The default value for +this property is <code>131072</code> bytes (128KiB).</p> +</li> +<li><p><code>batchDelay</code>. Before writing packets to the transport, Apache ActiveMQ Artemis can +be configured to batch up writes for a maximum of <code>batchDelay</code> +milliseconds. This can increase overall throughput for very small +messages. It does so at the expense of an increase in average +latency for message transfer. The default value for this property is +<code>0</code> ms.</p> +</li> +<li><p><code>directDeliver</code>. When a message arrives on the server and is +delivered to waiting consumers, by default, the delivery is done on +the same thread as that on which the message arrived. This gives +good latency in environments with relatively small messages and a +small number of consumers, but at the cost of overall throughput and +scalability - especially on multi-core machines. If you want the +lowest latency and a possible reduction in throughput then you can +use the default value for <code>directDeliver</code> (i.e. <code>true</code>). If you are +willing to take some small extra hit on latency but want the highest +throughput set <code>directDeliver</code> to <code>false</code>.</p> +</li> +<li><p><code>nioRemotingThreads</code> This is deprecated. It is replaced by <code>remotingThreads</code>, +if you are using this please update your configuration</p> +</li> +<li><p><code>remotingThreads</code>. Apache ActiveMQ Artemis will, +by default, use a number of threads equal to three times the number +of cores (or hyper-threads) as reported by +<code>Runtime.getRuntime().availableProcessors()</code> for processing incoming +packets. If you want to override this value, you can set the number +of threads by specifying this parameter. The default value for this +parameter is <code>-1</code> which means use the value from +<code>Runtime.getRuntime().availableProcessors()</code> * 3.</p> +</li> +<li><p><code>localAddress</code>. When configured a Netty Connector it is possible to +specify which local address the client will use when connecting to +the remote address. This is typically used in the Application Server +or when running Embedded to control which address is used for +outbound connections. If the local-address is not set then the +connector will use any local address available</p> +</li> +<li><p><code>localPort</code>. When configured a Netty Connector it is possible to +specify which local port the client will use when connecting to the +remote address. This is typically used in the Application Server or +when running Embedded to control which port is used for outbound +connections. If the local-port default is used, which is 0, then the +connector will let the system pick up an ephemeral port. valid ports +are 0 to 65535</p> +</li> +<li><p><code>connectionsAllowed</code>. This is only valid for acceptors. It limits the +number of connections which the acceptor will allow. When this limit +is reached a DEBUG level message is issued to the log, and the connection +is refused. The type of client in use will determine what happens when +the connection is refused. In the case of a <code>core</code> client, it will +result in a <code>org.apache.activemq.artemis.api.core.ActiveMQConnectionTimedOutException</code>.</p> +</li> +</ul> +<h2 id="configuring-netty-native-transport">Configuring Netty Native Transport</h2> +<p>Netty Native Transport support exists for selected OS platforms. +This allows Apache ActiveMQ Artemis to use native sockets/io instead of Java NIO.</p> +<p>These Native transports add features specific to a particular platform, +generate less garbage, and generally improve performance when compared to Java NIO based transport.</p> +<p>Both Clients and Server can benefit from this.</p> +<p>Current Supported Platforms.</p> +<ul> +<li>Linux running 64bit JVM</li> +<li>MacOS running 64bit JVM</li> +</ul> +<p>Apache ActiveMQ Artemis will by default enable the corresponding native transport if a supported platform is detected.</p> +<p>If running on an unsupported platform or any issues loading native libs, Apache ActiveMQ Artemis will fallback onto Java NIO.</p> +<h4 id="linux-native-transport">Linux Native Transport</h4> +<p>On supported Linux platforms Epoll is used, @see <a href="https://en.wikipedia.org/wiki/Epoll" target="_blank">https://en.wikipedia.org/wiki/Epoll</a>. </p> +<p>The following properties are specific to this native transport:</p> +<ul> +<li><code>useEpoll</code> enables the use of epoll if a supported linux platform is running a 64bit JVM is detected. + Setting this to <code>false</code> will force the use of Java NIO instead of epoll. Default is <code>true</code></li> +</ul> +<h4 id="macos-native-transport">MacOS Native Transport</h4> +<p>On supported MacOS platforms KQueue is used, @see <a href="https://en.wikipedia.org/wiki/Kqueue" target="_blank">https://en.wikipedia.org/wiki/Kqueue</a>. </p> +<p>The following properties are specific to this native transport:</p> +<ul> +<li><code>useKQueue</code> enables the use of kqueue if a supported MacOS platform running a 64bit JVM is detected. + Setting this to <code>false</code> will force the use of Java NIO instead of kqueue. Default is <code>true</code></li> +</ul> +<h2 id="configuring-netty-ssl">Configuring Netty SSL</h2> +<p>Netty SSL is similar to the Netty TCP transport but it provides +additional security by encrypting TCP connections using the Secure +Sockets Layer SSL</p> +<p>Please see the examples for a full working example of using Netty SSL.</p> +<p>Netty SSL uses all the same properties as Netty TCP but adds the +following additional properties:</p> +<ul> +<li><p><code>sslEnabled</code></p> +<p>Must be <code>true</code> to enable SSL. Default is <code>false</code>.</p> +</li> +<li><p><code>keyStorePath</code></p> +<p>When used on an <code>acceptor</code> this is the path to the SSL key store on +the server which holds the server's certificates (whether +self-signed or signed by an authority).</p> +<p>When used on a <code>connector</code> this is the path to the client-side SSL +key store which holds the client certificates. This is only relevant +for a <code>connector</code> if you are using 2-way SSL (i.e. mutual +authentication). Although this value is configured on the server, it +is downloaded and used by the client. If the client needs to use a +different path from that set on the server then it can override the +server-side setting by either using the customary +"javax.net.ssl.keyStore" system property or the ActiveMQ-specific +"org.apache.activemq.ssl.keyStore" system property. The +ActiveMQ-specific system property is useful if another component on +client is already making use of the standard, Java system property.</p> +</li> +<li><p><code>keyStorePassword</code></p> +<p>When used on an <code>acceptor</code> this is the password for the server-side +keystore.</p> +<p>When used on a <code>connector</code> this is the password for the client-side +keystore. This is only relevant for a <code>connector</code> if you are using +2-way SSL (i.e. mutual authentication). Although this value can be +configured on the server, it is downloaded and used by the client. +If the client needs to use a different password from that set on the +server then it can override the server-side setting by either using +the customary "javax.net.ssl.keyStorePassword" system property or +the ActiveMQ-specific "org.apache.activemq.ssl.keyStorePassword" +system property. The ActiveMQ-specific system property is useful if +another component on client is already making use of the standard, +Java system property.</p> +</li> +<li><p><code>trustStorePath</code></p> +<p>When used on an <code>acceptor</code> this is the path to the server-side SSL +key store that holds the keys of all the clients that the server +trusts. This is only relevant for an <code>acceptor</code> if you are using +2-way SSL (i.e. mutual authentication).</p> +<p>When used on a <code>connector</code> this is the path to the client-side SSL +key store which holds the public keys of all the servers that the +client trusts. Although this value can be configured on the server, +it is downloaded and used by the client. If the client needs to use +a different path from that set on the server then it can override +the server-side setting by either using the customary +"javax.net.ssl.trustStore" system property or the ActiveMQ-specific +"org.apache.activemq.ssl.trustStore" system property. The +ActiveMQ-specific system property is useful if another component on +client is already making use of the standard, Java system property.</p> +</li> +<li><p><code>trustStorePassword</code></p> +<p>When used on an <code>acceptor</code> this is the password for the server-side +trust store. This is only relevant for an <code>acceptor</code> if you are +using 2-way SSL (i.e. mutual authentication).</p> +<p>When used on a <code>connector</code> this is the password for the client-side +truststore. Although this value can be configured on the server, it +is downloaded and used by the client. If the client needs to use a +different password from that set on the server then it can override +the server-side setting by either using the customary +"javax.net.ssl.trustStorePassword" system property or the +ActiveMQ-specific "org.apache.activemq.ssl.trustStorePassword" +system property. The ActiveMQ-specific system property is useful if +another component on client is already making use of the standard, +Java system property.</p> +</li> +<li><p><code>enabledCipherSuites</code></p> +<p>Whether used on an <code>acceptor</code> or <code>connector</code> this is a comma +separated list of cipher suites used for SSL communication. The +default value is <code>null</code> which means the JVM's default will be used.</p> +</li> +<li><p><code>enabledProtocols</code></p> +<p>Whether used on an <code>acceptor</code> or <code>connector</code> this is a comma +separated list of protocols used for SSL communication. The default +value is <code>null</code> which means the JVM's default will be used.</p> +</li> +<li><p><code>needClientAuth</code></p> +<p>This property is only for an <code>acceptor</code>. It tells a client +connecting to this acceptor that 2-way SSL is required. Valid values +are <code>true</code> or <code>false</code>. Default is <code>false</code>.</p> +</li> +<li><p><code>verifyHost</code></p> +<p>When used on an <code>acceptor</code> the <code>CN</code> of the connecting client's SSL certificate +will be compared to its hostname to verify they match. This is useful +only for 2-way SSL.</p> +<p>When used on a <code>connector</code> the <code>CN</code> of the server's SSL certificate will be +compared to its hostname to verify they match. This is useful for both 1-way +and 2-way SSL.</p> +<p>Valid values are <code>true</code> or <code>false</code>. Default is <code>false</code>.</p> +</li> +<li><p><code>useDefaultSslContext</code></p> +<p>Only valid on a <code>connector</code>. Allows the <code>connector</code> to use the "default" SSL +context (via <code>SSLContext.getDefault()</code>) which can be set programmatically by +the client (via <code>SSLContext.setDefault(SSLContext)</code>). If set to <code>true</code> all +other SSL related parameters except for <code>sslEnabled</code> are ignored.</p> +<p>Valid values are <code>true</code> or <code>false</code>. Default is <code>false</code>.</p> +</li> +</ul> +<h2 id="configuring-netty-http">Configuring Netty HTTP</h2> +<p>Netty HTTP tunnels packets over the HTTP protocol. It can be useful in +scenarios where firewalls only allow HTTP traffic to pass.</p> +<p>Please see the examples for a full working example of using Netty HTTP.</p> +<p>Netty HTTP uses the same properties as Netty TCP but adds the following +additional properties:</p> +<ul> +<li><p><code>httpEnabled</code>. This is now no longer needed. With single port support +Apache ActiveMQ Artemis will now automatically detect if http is being +used and configure itself.</p> +</li> +<li><p><code>httpClientIdleTime</code>. How long a client can be idle before +sending an empty http request to keep the connection alive</p> +</li> +<li><p><code>httpClientIdleScanPeriod</code>. How often, in milliseconds, to scan +for idle clients</p> +</li> +<li><p><code>httpResponseTime</code>. How long the server can wait before sending an +empty http response to keep the connection alive</p> +</li> +<li><p><code>httpServerScanPeriod</code>. How often, in milliseconds, to scan for +clients needing responses</p> +</li> +<li><p><code>httpRequiresSessionId</code>. If <code>true</code> the client will wait after the +first call to receive a session id. Used the http connector is +connecting to servlet acceptor (not recommended)</p> +</li> +</ul> + + + </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="persistence.html" class="navigation navigation-prev " aria-label="Previous page: Persistence"> + <i class="fa fa-angle-left"></i> + </a> + + + <a href="config-reload.html" class="navigation navigation-next " aria-label="Next page: Configuration Reload"> + <i class="fa fa-angle-right"></i> + </a> + + + + </div> + + <script> + var gitbook = gitbook || []; + gitbook.push(function() { + gitbook.page.hasChanged({"page":{"title":"Configuring Transports","level":"1.19","depth":1,"next":{"title":"Configuration Reload","level":"1.20","depth":1,"path":"config-reload.md","ref":"config-reload.md","articles":[]},"previous":{"title":"Persistence","level":"1.18","depth":1,"path":"persistence.md","ref":"persistence.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":"sty les/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":"configuring-transports.md","mtime":"2017-09-08T01:26:53.000Z","type":"markdown"},"gitbook":{"version":"3.1.1","time":"2017-09-14T19:42:32.953Z"},"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> +
Added: websites/production/activemq/content/artemis/docs/latest/connection-ttl.html ============================================================================== --- websites/production/activemq/content/artemis/docs/latest/connection-ttl.html (added) +++ websites/production/activemq/content/artemis/docs/latest/connection-ttl.html Thu Sep 14 19:48:11 2017 @@ -0,0 +1,1229 @@ + +<!DOCTYPE HTML> +<html lang="" > + <head> + <title>Detecting Dead Connections · 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="slow-consumers.html" /> + + + <link rel="prev" href="config-reload.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="messaging-concepts.html"> + + <a href="messaging-concepts.html"> + + + Messaging Concepts + + </a> + + + + </li> + + <li class="chapter " data-level="1.6" data-path="architecture.html"> + + <a href="architecture.html"> + + + Architecture + + </a> + + + + </li> + + <li class="chapter " data-level="1.7" data-path="using-server.html"> + + <a href="using-server.html"> + + + Using the Server + + </a> + + + + </li> + + <li class="chapter " data-level="1.8" data-path="address-model.html"> + + <a href="address-model.html"> + + + Address Model + + </a> + + + + </li> + + <li class="chapter " data-level="1.9" data-path="using-jms.html"> + + <a href="using-jms.html"> + + + Using JMS + + </a> + + + + </li> + + <li class="chapter " data-level="1.10" data-path="using-core.html"> + + <a href="using-core.html"> + + + Using Core + + </a> + + + + </li> + + <li class="chapter " data-level="1.11" data-path="using-AMQP.html"> + + <a href="using-AMQP.html"> + + + Using AMQP + + </a> + + + + </li> + + <li class="chapter " data-level="1.12" 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.13" data-path="client-classpath.html"> + + <a href="client-classpath.html"> + + + The Client Classpath + + </a> + + + + </li> + + <li class="chapter " data-level="1.14" data-path="examples.html"> + + <a href="examples.html"> + + + Examples + + </a> + + + + </li> + + <li class="chapter " data-level="1.15" data-path="wildcard-routing.html"> + + <a href="wildcard-routing.html"> + + + Routing Messages With Wild Cards + + </a> + + + + </li> + + <li class="chapter " data-level="1.16" data-path="wildcard-syntax.html"> + + <a href="wildcard-syntax.html"> + + + Understanding the Apache ActiveMQ Artemis Wildcard Syntax + + </a> + + + + </li> + + <li class="chapter " data-level="1.17" data-path="filter-expressions.html"> + + <a href="filter-expressions.html"> + + + Filter Expressions + + </a> + + + + </li> + + <li class="chapter " data-level="1.18" data-path="persistence.html"> + + <a href="persistence.html"> + + + Persistence + + </a> + + + + </li> + + <li class="chapter " data-level="1.19" data-path="configuring-transports.html"> + + <a href="configuring-transports.html"> + + + Configuring Transports + + </a> + + + + </li> + + <li class="chapter " data-level="1.20" data-path="config-reload.html"> + + <a href="config-reload.html"> + + + Configuration Reload + + </a> + + + + </li> + + <li class="chapter active" data-level="1.21" data-path="connection-ttl.html"> + + <a href="connection-ttl.html"> + + + Detecting Dead Connections + + </a> + + + + </li> + + <li class="chapter " data-level="1.22" data-path="slow-consumers.html"> + + <a href="slow-consumers.html"> + + + Detecting Slow Consumers + + </a> + + + + </li> + + <li class="chapter " data-level="1.23" data-path="network-isolation.html"> + + <a href="network-isolation.html"> + + + Avoiding Network Isolation + + </a> + + + + </li> + + <li class="chapter " data-level="1.24" data-path="critical-analysis.html"> + + <a href="critical-analysis.html"> + + + Detecting Broker Issues (Critical Analysis) + + </a> + + + + </li> + + <li class="chapter " data-level="1.25" data-path="transaction-config.html"> + + <a href="transaction-config.html"> + + + Resource Manager Configuration + + </a> + + + + </li> + + <li class="chapter " data-level="1.26" data-path="flow-control.html"> + + <a href="flow-control.html"> + + + Flow Control + + </a> + + + + </li> + + <li class="chapter " data-level="1.27" data-path="send-guarantees.html"> + + <a href="send-guarantees.html"> + + + Guarantees of sends and commits + + </a> + + + + </li> + + <li class="chapter " data-level="1.28" data-path="undelivered-messages.html"> + + <a href="undelivered-messages.html"> + + + Message Redelivery and Undelivered Messages + + </a> + + + + </li> + + <li class="chapter " data-level="1.29" data-path="message-expiry.html"> + + <a href="message-expiry.html"> + + + Message Expiry + + </a> + + + + </li> + + <li class="chapter " data-level="1.30" data-path="large-messages.html"> + + <a href="large-messages.html"> + + + Large Messages + + </a> + + + + </li> + + <li class="chapter " data-level="1.31" data-path="paging.html"> + + <a href="paging.html"> + + + Paging + + </a> + + + + </li> + + <li class="chapter " data-level="1.32" data-path="queue-attributes.html"> + + <a href="queue-attributes.html"> + + + Queue Attributes + + </a> + + + + </li> + + <li class="chapter " data-level="1.33" data-path="scheduled-messages.html"> + + <a href="scheduled-messages.html"> + + + Scheduled Messages + + </a> + + + + </li> + + <li class="chapter " data-level="1.34" data-path="last-value-queues.html"> + + <a href="last-value-queues.html"> + + + Last-Value Queues + + </a> + + + + </li> + + <li class="chapter " data-level="1.35" data-path="message-grouping.html"> + + <a href="message-grouping.html"> + + + Message Grouping + + </a> + + + + </li> + + <li class="chapter " data-level="1.36" data-path="pre-acknowledge.html"> + + <a href="pre-acknowledge.html"> + + + Extra Acknowledge Modes + + </a> + + + + </li> + + <li class="chapter " data-level="1.37" data-path="management.html"> + + <a href="management.html"> + + + Management + + </a> + + + + </li> + + <li class="chapter " data-level="1.38" data-path="management-console.html"> + + <a href="management-console.html"> + + + Management Console + + </a> + + + + </li> + + <li class="chapter " data-level="1.39" data-path="security.html"> + + <a href="security.html"> + + + Security + + </a> + + + + </li> + + <li class="chapter " data-level="1.40" data-path="broker-plugins.html"> + + <a href="broker-plugins.html"> + + + Broker Plugins + + </a> + + + + </li> + + <li class="chapter " data-level="1.41" data-path="resource-limits.html"> + + <a href="resource-limits.html"> + + + Resource Limits + + </a> + + + + </li> + + <li class="chapter " data-level="1.42" data-path="jms-bridge.html"> + + <a href="jms-bridge.html"> + + + The JMS Bridge + + </a> + + + + </li> + + <li class="chapter " data-level="1.43" data-path="client-reconnection.html"> + + <a href="client-reconnection.html"> + + + Client Reconnection and Session Reattachment + + </a> + + + + </li> + + <li class="chapter " data-level="1.44" data-path="diverts.html"> + + <a href="diverts.html"> + + + Diverting and Splitting Message Flows + + </a> + + + + </li> + + <li class="chapter " data-level="1.45" data-path="core-bridges.html"> + + <a href="core-bridges.html"> + + + Core Bridges + + </a> + + + + </li> + + <li class="chapter " data-level="1.46" data-path="duplicate-detection.html"> + + <a href="duplicate-detection.html"> + + + Duplicate Message Detection + + </a> + + + + </li> + + <li class="chapter " data-level="1.47" data-path="clusters.html"> + + <a href="clusters.html"> + + + Clusters + + </a> + + + + </li> + + <li class="chapter " data-level="1.48" data-path="ha.html"> + + <a href="ha.html"> + + + High Availability and Failover + + </a> + + + + </li> + + <li class="chapter " data-level="1.49" data-path="graceful-shutdown.html"> + + <a href="graceful-shutdown.html"> + + + Graceful Server Shutdown + + </a> + + + + </li> + + <li class="chapter " data-level="1.50" data-path="libaio.html"> + + <a href="libaio.html"> + + + Libaio Native Libraries + + </a> + + + + </li> + + <li class="chapter " data-level="1.51" data-path="thread-pooling.html"> + + <a href="thread-pooling.html"> + + + Thread management + + </a> + + + + </li> + + <li class="chapter " data-level="1.52" data-path="logging.html"> + + <a href="logging.html"> + + + Logging + + </a> + + + + </li> + + <li class="chapter " data-level="1.53" data-path="rest.html"> + + <a href="rest.html"> + + + REST Interface + + </a> + + + + </li> + + <li class="chapter " data-level="1.54" data-path="embedding-activemq.html"> + + <a href="embedding-activemq.html"> + + + Embedding Apache ActiveMQ Artemis + + </a> + + + + </li> + + <li class="chapter " data-level="1.55" data-path="karaf.html"> + + <a href="karaf.html"> + + + Apache Karaf + + </a> + + + + </li> + + <li class="chapter " data-level="1.56" data-path="spring-integration.html"> + + <a href="spring-integration.html"> + + + Spring Integration + + </a> + + + + </li> + + <li class="chapter " data-level="1.57" data-path="cdi-integration.html"> + + <a href="cdi-integration.html"> + + + CDI Integration + + </a> + + + + </li> + + <li class="chapter " data-level="1.58" data-path="intercepting-operations.html"> + + <a href="intercepting-operations.html"> + + + Intercepting Operations + + </a> + + + + </li> + + <li class="chapter " data-level="1.59" data-path="protocols-interoperability.html"> + + <a href="protocols-interoperability.html"> + + + Protocols and Interoperability + + </a> + + + + </li> + + <li class="chapter " data-level="1.60" data-path="tools.html"> + + <a href="tools.html"> + + + Tools + + </a> + + + + </li> + + <li class="chapter " data-level="1.61" data-path="maven-plugin.html"> + + <a href="maven-plugin.html"> + + + Maven Plugin + + </a> + + + + </li> + + <li class="chapter " data-level="1.62" data-path="unit-testing.html"> + + <a href="unit-testing.html"> + + + Unit Testing + + </a> + + + + </li> + + <li class="chapter " data-level="1.63" data-path="perf-tuning.html"> + + <a href="perf-tuning.html"> + + + Troubleshooting and Performance Tuning + + </a> + + + + </li> + + <li class="chapter " data-level="1.64" data-path="configuration-index.html"> + + <a href="configuration-index.html"> + + + Configuration Reference + + </a> + + + + </li> + + <li class="chapter " data-level="1.65" data-path="updating-artemis.html"> + + <a href="updating-artemis.html"> + + + Updating Artemis + + </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="." >Detecting Dead Connections</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="detecting-dead-connections">Detecting Dead Connections</h1> +<p>In this section we will discuss connection time-to-live (TTL) and +explain how Apache ActiveMQ Artemis deals with crashed clients and clients which have +exited without cleanly closing their resources.</p> +<h2 id="cleaning-up-dead-connection-resources-on-the-server">Cleaning up Dead Connection Resources on the Server</h2> +<p>Before an Apache ActiveMQ Artemis client application exits it is considered good +practice that it should close its resources in a controlled manner, +using a <code>finally</code> block.</p> +<p>Here's an example of a well behaved core client application closing its +session and session factory in a finally block:</p> +<pre><code class="lang-java">ServerLocator locator = <span class="hljs-keyword">null</span>; +ClientSessionFactory sf = <span class="hljs-keyword">null</span>; +ClientSession session = <span class="hljs-keyword">null</span>; + +<span class="hljs-keyword">try</span> +{ + locator = ActiveMQClient.createServerLocatorWithoutHA(..); + + sf = locator.createClientSessionFactory();; + + session = sf.createSession(...); + + ... do some stuff with the session... +} +<span class="hljs-keyword">finally</span> +{ + <span class="hljs-keyword">if</span> (session != <span class="hljs-keyword">null</span>) + { + session.close(); + } + + <span class="hljs-keyword">if</span> (sf != <span class="hljs-keyword">null</span>) + { + sf.close(); + } + + <span class="hljs-keyword">if</span>(locator != <span class="hljs-keyword">null</span>) + { + locator.close(); + } +} +</code></pre> +<p>And here's an example of a well behaved JMS client application:</p> +<pre><code class="lang-java">Connection jmsConnection = <span class="hljs-keyword">null</span>; + +<span class="hljs-keyword">try</span> +{ + ConnectionFactory jmsConnectionFactory = <span class="hljs-keyword">new</span> ActiveMQConnectionFactory(<span class="hljs-string">"tcp://localhost:61616"</span>); + + jmsConnection = jmsConnectionFactory.createConnection(); + + ... do some stuff with the connection... +} +<span class="hljs-keyword">finally</span> +{ + <span class="hljs-keyword">if</span> (connection != <span class="hljs-keyword">null</span>) + { + connection.close(); + } +} +</code></pre> +<p>Or with using auto-closeable feature from Java, which can save a few lines of code:</p> +<pre><code class="lang-java"> + +<span class="hljs-keyword">try</span> ( + ActiveMQConnectionFactory jmsConnectionFactory = <span class="hljs-keyword">new</span> ActiveMQConnectionFactory(<span class="hljs-string">"tcp://localhost:61616"</span>); + Connection jmsConnection = jmsConnectionFactory.createConnection()) +{ + ... do some stuff with the connection... +} +</code></pre> +<p>Unfortunately users don't always write well behaved applications, and +sometimes clients just crash so they don't have a chance to clean up +their resources!</p> +<p>If this occurs then it can leave server side resources, like sessions, +hanging on the server. If these were not removed they would cause a +resource leak on the server and over time this result in the server +running out of memory or other resources.</p> +<p>We have to balance the requirement for cleaning up dead client resources +with the fact that sometimes the network between the client and the +server can fail and then come back, allowing the client to reconnect. +Apache ActiveMQ Artemis supports client reconnection, so we don't want to clean up +"dead" server side resources too soon or this will prevent any client +from reconnecting, as it won't be able to find its old sessions on the +server.</p> +<p>Apache ActiveMQ Artemis makes all of this configurable via a <em>connection TTL</em>. +Basically, the TTL determines how long the server will keep a connection +alive in the absence of any data arriving from the client. The client will +automatically send "ping" packets periodically to prevent the server from +closing it down. If the server doesn't receive any packets on a connection +for the connection TTL time, then it will automatically close all the +sessions on the server that relate to that connection.</p> +<p>The connection TTL is configured on the URI using the <code>connectionTtl</code> +parameter.</p> +<p>The default value for connection ttl on an "unreliable" connection (e.g. +a Netty connection using the <code>tcp</code> URL scheme) is <code>60000</code>ms, i.e. 1 minute. +The default value for connection ttl on a "reliable" connection (e.g. an +in-vm connection using the <code>vm</code> URL scheme) is <code>-1</code>. A value of <code>-1</code> for +<code>connectionTTL</code> means the server will never time out the connection on +the server side.</p> +<p>If you do not wish clients to be able to specify their own connection +TTL, you can override all values used by a global value set on the +server side. This can be done by specifying the +<code>connection-ttl-override</code> attribute in the server side configuration. +The default value for <code>connection-ttl-override</code> is <code>-1</code> which means "do +not override" (i.e. let clients use their own values).</p> +<p>The logic to check connections for TTL violations runs periodically on +the broker. By default, the checks are done every 2,000 milliseconds. +However, this can be changed if necessary by using the +<code>connection-ttl-check-interval</code> attribute.</p> +<h2 id="closing-core-sessions-or-jms-connections-that-you-have-failed-to-close">Closing core sessions or JMS connections that you have failed to close</h2> +<p>As previously discussed, it's important that all core client sessions +and JMS connections are always closed explicitly in a <code>finally</code> block +when you are finished using them.</p> +<p>If you fail to do so, Apache ActiveMQ Artemis will detect this at garbage collection +time, and log a warning (If you are using JMS the warning will involve a JMS connection).</p> +<p>Apache ActiveMQ Artemis will then close the connection / client session for you.</p> +<p>Note that the log will also tell you the exact line of your user code +where you created the JMS connection / client session that you later did +not close. This will enable you to pinpoint the error in your code and +correct it appropriately.</p> +<h2 id="detecting-failure-from-the-client-side">Detecting failure from the client side.</h2> +<p>In the previous section we discussed how the client sends pings to the +server and how "dead" connection resources are cleaned up by the server. +There's also another reason for pinging, and that's for the <em>client</em> to +be able to detect that the server or network has failed.</p> +<p>As long as the client is receiving data from the server it will consider +the connection to be still alive.</p> +<p>If the client does not receive any packets for a configurable number +of milliseconds then it will consider the connection failed and will +either initiate failover, or call any <code>FailureListener</code> instances (or +<code>ExceptionListener</code> instances if you are using JMS) depending on how +it has been configured.</p> +<p>This is controlled by setting the <code>clientFailureCheckPeriod</code> parameter +on the URI your client is using to connect, e.g. +<code>tcp://localhost:61616?clientFailureCheckPeriod=30000</code>.</p> +<p>The default value for client failure check period on an "unreliable" +connection (e.g. a Netty connection) is <code>30000</code> ms, i.e. 30 seconds. The +default value for client failure check period on a "reliable" connection +(e.g. an in-vm connection) is <code>-1</code>. A value of <code>-1</code> means the client +will never fail the connection on the client side if no data is received +from the server. Typically this is much lower than connection TTL to +allow clients to reconnect in case of transitory failure.</p> +<h2 id="configuring-asynchronous-connection-execution">Configuring Asynchronous Connection Execution</h2> +<p>Most packets received on the server side are executed on the remoting +thread. These packets represent short-running operations and are always +executed on the remoting thread for performance reasons.</p> +<p>However, by default some kinds of packets are executed using a thread +from a thread pool so that the remoting thread is not tied up for too +long. Please note that processing operations asynchronously on another +thread adds a little more latency. These packets are:</p> +<ul> +<li><p><code>org.apache.activemq.artemis.core.protocol.core.impl.wireformat.RollbackMessage</code></p> +</li> +<li><p><code>org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionCloseMessage</code></p> +</li> +<li><p><code>org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionCommitMessage</code></p> +</li> +<li><p><code>org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionXACommitMessage</code></p> +</li> +<li><p><code>org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionXAPrepareMessage</code></p> +</li> +<li><p><code>org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionXARollbackMessage</code></p> +</li> +</ul> +<p>To disable asynchronous connection execution, set the parameter +<code>async-connection-execution-enabled</code> in <code>broker.xml</code> to +<code>false</code> (default value is <code>true</code>).</p> + + + </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="config-reload.html" class="navigation navigation-prev " aria-label="Previous page: Configuration Reload"> + <i class="fa fa-angle-left"></i> + </a> + + + <a href="slow-consumers.html" class="navigation navigation-next " aria-label="Next page: Detecting Slow Consumers"> + <i class="fa fa-angle-right"></i> + </a> + + + + </div> + + <script> + var gitbook = gitbook || []; + gitbook.push(function() { + gitbook.page.hasChanged({"page":{"title":"Detecting Dead Connections","level":"1.21","depth":1,"next":{"title":"Detecting Slow Consumers","level":"1.22","depth":1,"path":"slow-consumers.md","ref":"slow-consumers.md","articles":[]},"previous":{"title":"Configuration Reload","level":"1.20","depth":1,"path":"config-reload.md","ref":"config-reload.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":"connection-ttl.md","mtime":"2017-09-08T01:26:53.000Z","type":"markdown"},"gitbook":{"version":"3.1.1","time":"2017-09-14T19:42:32.953Z"},"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> +
