| 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat Configuration Reference - The Cluster Receiver object</title><meta value="Filip Hanik" name="author"><meta value="fhanik@apache.org" name="email"></head><body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff"><table cellspacing="0" width="100%" border="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img border="0" alt=" | 
|---|
| 2 |     The Apache Tomcat Servlet/JSP Container | 
|---|
| 3 |   " align="right" src="../../images/tomcat.gif"></a></td><td><font face="arial,helvetica,sanserif"><h1>Apache Tomcat 6.0</h1></font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img border="0" alt="Apache Logo" align="right" src="../../images/asf-logo.gif"></a></td></tr></table><table cellspacing="4" width="100%" border="0"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><tr><!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%"><table cellspacing="4" width="100%" border="0"><tr><td valign="top" align="left"><h1>Apache Tomcat Configuration Reference</h1><h2>The Cluster Receiver object</h2></td><td nowrap="true" valign="top" align="right"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../../images/void.gif"></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 4 |   <p> | 
|---|
| 5 |   The receiver component is responsible for receiving cluster messages. | 
|---|
| 6 |   As you might notice through the configuration, is that the receiving of messages | 
|---|
| 7 |   and sending of messages are two different components, this is different from many other  | 
|---|
| 8 |   frameworks, but there is a good reason for it, to decouple the logic for how messages are sent from | 
|---|
| 9 |   how messages are received.<br> | 
|---|
| 10 |   The receiver is very much like the Tomcat Connector, its the base of the thread pool | 
|---|
| 11 |   for incoming cluster messages. The receiver is straight forward, but all the socket settings | 
|---|
| 12 |   for incoming traffic are managed here. | 
|---|
| 13 |   </p> | 
|---|
| 14 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Blocking vs Non-Blocking Receiver"><strong>Blocking vs Non-Blocking Receiver</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 15 |   <p> | 
|---|
| 16 |   The receiver supports both a non blocking, <code>org.apache.catalina.tribes.transport.nio.NioReceiver</code>, and a  | 
|---|
| 17 |   blocking, <code>org.apache.catalina.tribes.transport.bio.BioReceiver</code>. It is preferred to use the non blocking receiver | 
|---|
| 18 |   to be able to grow your cluster without running into thread starvation.<br> | 
|---|
| 19 |   Using the non blocking receiver allows you to with a very limited thread count to serve a large number of messages. | 
|---|
| 20 |   Usually the rule is to use 1 thread per node in the cluster for small clusters, and then depending on your message frequency | 
|---|
| 21 |   and your hardware, you'll find an optimal number of threads peak out at a certain number. | 
|---|
| 22 |   </p> | 
|---|
| 23 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Attributes"><strong>Attributes</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 24 |   <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Common Attributes"><strong>Common Attributes</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 25 |   <table cellpadding="5" border="1"><tr><th bgcolor="#023264" width="15%"><font color="#ffffff">Attribute</font></th><th bgcolor="#023264" width="85%"><font color="#ffffff">Description</font></th></tr><tr><td valign="center" align="left"><strong><code>className</code></strong></td><td valign="center" align="left"> | 
|---|
| 26 |       The implementation of the receiver component. Two implementations available, | 
|---|
| 27 |       <code>org.apache.catalina.tribes.transport.nio.NioReceiver</code> and  | 
|---|
| 28 |       <code>org.apache.catalina.tribes.transport.bio.BioReceiver</code>.<br> | 
|---|
| 29 |       The <code>org.apache.catalina.tribes.transport.nio.NioReceiver</code> is the  | 
|---|
| 30 |       preferred implementation | 
|---|
| 31 |     </td></tr><tr><td valign="center" align="left"><code>address</code></td><td valign="center" align="left"> | 
|---|
| 32 |       The address (network interface) to listen for incoming traffic. | 
|---|
| 33 |       Same as the bind address. The default value is <code>auto</code> and translates to | 
|---|
| 34 |       <code>java.net.InetAddress.getLocalHost().getHostAddress()</code>. | 
|---|
| 35 |     </td></tr><tr><td valign="center" align="left"><code>direct</code></td><td valign="center" align="left"> | 
|---|
| 36 |       Possible values are <code>true</code> or <code>false</code>.  | 
|---|
| 37 |       Set to true if you want the receiver to use direct bytebuffers when reading data | 
|---|
| 38 |       from the sockets. | 
|---|
| 39 |     </td></tr><tr><td valign="center" align="left"><code>port</code></td><td valign="center" align="left"> | 
|---|
| 40 |       The listen port for incoming data. The default value is <code>4000</code>. | 
|---|
| 41 |       To avoid port conflicts the receiver will automatically bind to a free port within the range of  | 
|---|
| 42 |       <code> port <= bindPort <= port+autoBind</code> | 
|---|
| 43 |       So for example, if port is 4000, and autoBind is set to 10, then the receiver will open up  | 
|---|
| 44 |       a server socket on the first available port in the range 4000-4100. | 
|---|
| 45 |     </td></tr><tr><td valign="center" align="left"><code>autoBind</code></td><td valign="center" align="left"> | 
|---|
| 46 |       Default value is <code>100</code>. | 
|---|
| 47 |       Use this value if you wish to automatically avoid port conflicts the cluster receiver will try to open a  | 
|---|
| 48 |       server socket on the <code>port</code> attribute port, and then work up <code>autoBind</code> number of times. | 
|---|
| 49 |     </td></tr><tr><td valign="center" align="left"><code>securePort</code></td><td valign="center" align="left"> | 
|---|
| 50 |       The secure listen port. This port is SSL enabled. If this attribute is omitted no SSL port is opened up. | 
|---|
| 51 |       There default value is unset, meaning there is no SSL socket available. | 
|---|
| 52 |     </td></tr><tr><td valign="center" align="left"><code>selectorTimeout</code></td><td valign="center" align="left"> | 
|---|
| 53 |       The value in milliseconds for the polling timeout in the <code>NioReceiver</code>. On older versions of the JDK | 
|---|
| 54 |       there have been bugs, that should all now be cleared out where the selector never woke up. | 
|---|
| 55 |       The default value is a very high <code>5000</code> milliseconds. | 
|---|
| 56 |     </td></tr><tr><td valign="center" align="left"><code>maxThreads</code></td><td valign="center" align="left"> | 
|---|
| 57 |       The maximum number of threads in the receiver thread pool. The default value is <code>6</code> | 
|---|
| 58 |       Adjust this value relative to the number of nodes in the cluster, the number of messages being exchanged and  | 
|---|
| 59 |       the hardware you are running on. A higher value doesn't mean more effiecency, tune this value according to your  | 
|---|
| 60 |       own test results. | 
|---|
| 61 |     </td></tr><tr><td valign="center" align="left"><code>minThreads</code></td><td valign="center" align="left"> | 
|---|
| 62 |       Minimum number of threads to be created when the receiver is started up. Default value is <code>6</code> | 
|---|
| 63 |     </td></tr><tr><td valign="center" align="left"><code>ooBInline</code></td><td valign="center" align="left"> | 
|---|
| 64 |       Boolean value for the socket OOBINLINE option. Possible values are <code>true</code> or <code>false</code>. | 
|---|
| 65 |     </td></tr><tr><td valign="center" align="left"><code>rxBufSize</code></td><td valign="center" align="left"> | 
|---|
| 66 |       The receiver buffer size on the receiving sockets. Value is in bytes, the default value is <code>43800</code> bytes. | 
|---|
| 67 |     </td></tr><tr><td valign="center" align="left"><code>txBufSize</code></td><td valign="center" align="left"> | 
|---|
| 68 |       The sending buffer size on the receiving sockets. Value is in bytes, the default value is <code>25188</code> bytes. | 
|---|
| 69 |     </td></tr><tr><td valign="center" align="left"><code>soKeepAlive</code></td><td valign="center" align="left"> | 
|---|
| 70 |       Boolean value for the socket SO_KEEPALIVE option. Possible values are <code>true</code> or <code>false</code>. | 
|---|
| 71 |     </td></tr><tr><td valign="center" align="left"><code>soLingerOn</code></td><td valign="center" align="left"> | 
|---|
| 72 |       Boolean value to determine whether to use the SO_LINGER socket option.  | 
|---|
| 73 |       Possible values are <code>true</code> or <code>false</code>. Default value is <code>true</code>. | 
|---|
| 74 |     </td></tr><tr><td valign="center" align="left"><code>soLingerTime</code></td><td valign="center" align="left"> | 
|---|
| 75 |       Sets the SO_LINGER socket option time value. The value is in seconds.  | 
|---|
| 76 |       The default value is <code>3</code> seconds. | 
|---|
| 77 |     </td></tr><tr><td valign="center" align="left"><code>soReuseAddress</code></td><td valign="center" align="left"> | 
|---|
| 78 |      Boolean value for the socket SO_REUSEADDR option. Possible values are <code>true</code> or <code>false</code>. | 
|---|
| 79 |     </td></tr><tr><td valign="center" align="left"><code>soTrafficClass</code></td><td valign="center" align="left"> | 
|---|
| 80 |      Sets the traffic class level for the socket, the value is between 0 and 255. | 
|---|
| 81 |      Different values are defined in <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setTrafficClass(int)"> | 
|---|
| 82 |      java.net.Socket#setTrafficClass(int)</a>. | 
|---|
| 83 |     </td></tr><tr><td valign="center" align="left"><code>tcpNoDelay</code></td><td valign="center" align="left"> | 
|---|
| 84 |      Boolean value for the socket TCP_NODELAY option. Possible values are <code>true</code> or <code>false</code>. | 
|---|
| 85 |      The default value is <code>true</code> | 
|---|
| 86 |     </td></tr><tr><td valign="center" align="left"><code>timeout</code></td><td valign="center" align="left"> | 
|---|
| 87 |      Sets the SO_TIMEOUT option on the socket. The value is in milliseconds and the default value is <code>3000</code>  | 
|---|
| 88 |      milliseconds. | 
|---|
| 89 |     </td></tr><tr><td valign="center" align="left"><code>useBufferPool</code></td><td valign="center" align="left"> | 
|---|
| 90 |      Boolean value whether to use a shared buffer pool of cached <code>org.apache.catalina.tribes.io.XByteBuffer</code> | 
|---|
| 91 |      objects. If set to true, the XByteBuffer that is used to pass a message up the channel, will be recycled at the end  | 
|---|
| 92 |      of the requests. This means that interceptors in the channel must not maintain a reference to the object | 
|---|
| 93 |      after the <code>org.apache.catalina.tribes.ChannelInterceptor#messageReceived</code> method has exited. | 
|---|
| 94 |     </td></tr></table> | 
|---|
| 95 |   </blockquote></td></tr></table> | 
|---|
| 96 |   <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="NioReceiver"><strong>NioReceiver</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 97 |   </blockquote></td></tr></table> | 
|---|
| 98 |   <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="BioReceiver"><strong>BioReceiver</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 99 |   </blockquote></td></tr></table> | 
|---|
| 100 |  | 
|---|
| 101 | </blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font size="-1" color="#525D76"><em> | 
|---|
| 102 |         Copyright © 1999-2008, Apache Software Foundation | 
|---|
| 103 |         </em></font></div></td></tr></table></body></html> | 
|---|