blob: e8a6e8a135b27c1c4ef6e779b6e7b864be717066 [file] [log] [blame]
刘洪青6266f992017-05-15 21:21:03 +08001<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 7 Configuration Reference (7.0.77) - The Cluster Receiver object</title><meta name="author" content="Filip Hanik"><style type="text/css" media="print">
2 .noPrint {display: none;}
3 td#mainBody {width: 100%;}
4</style><style type="text/css">
5code {background-color:rgb(224,255,255);padding:0 0.1em;}
6code.attributeName, code.propertyName {background-color:transparent;}
7
8
9table {
10 border-collapse: collapse;
11 text-align: left;
12}
13table *:not(table) {
14 /* Prevent border-collapsing for table child elements like <div> */
15 border-collapse: separate;
16}
17
18th {
19 text-align: left;
20}
21
22
23div.codeBox pre code, code.attributeName, code.propertyName, code.noHighlight, .noHighlight code {
24 background-color: transparent;
25}
26div.codeBox {
27 overflow: auto;
28 margin: 1em 0;
29}
30div.codeBox pre {
31 margin: 0;
32 padding: 4px;
33 border: 1px solid #999;
34 border-radius: 5px;
35 background-color: #eff8ff;
36 display: table; /* To prevent <pre>s from taking the complete available width. */
37 /*
38 When it is officially supported, use the following CSS instead of display: table
39 to prevent big <pre>s from exceeding the browser window:
40 max-width: available;
41 width: min-content;
42 */
43}
44
45div.codeBox pre.wrap {
46 white-space: pre-wrap;
47}
48
49
50table.defaultTable tr, table.detail-table tr {
51 border: 1px solid #CCC;
52}
53
54table.defaultTable tr:nth-child(even), table.detail-table tr:nth-child(even) {
55 background-color: #FAFBFF;
56}
57
58table.defaultTable tr:nth-child(odd), table.detail-table tr:nth-child(odd) {
59 background-color: #EEEFFF;
60}
61
62table.defaultTable th, table.detail-table th {
63 background-color: #88b;
64 color: #fff;
65}
66
67table.defaultTable th, table.defaultTable td, table.detail-table th, table.detail-table td {
68 padding: 5px 8px;
69}
70
71
72p.notice {
73 border: 1px solid rgb(255, 0, 0);
74 background-color: rgb(238, 238, 238);
75 color: rgb(0, 51, 102);
76 padding: 0.5em;
77 margin: 1em 2em 1em 1em;
78}
79</style></head><body bgcolor="#ffffff" text="#000000" link="#525D76" alink="#525D76" vlink="#525D76"><table border="0" width="100%" cellspacing="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img src="../images/tomcat.gif" align="right" alt="
Hongqing Liufd5ee812014-05-10 16:32:51 +080080 The Apache Tomcat Servlet/JSP Container
刘洪青6266f992017-05-15 21:21:03 +080081 " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 7</font></h1><font face="arial,helvetica,sanserif">Version 7.0.77, Mar 28 2017</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="../images/asf-logo.svg" align="right" alt="Apache Logo" border="0" style="width: 266px;height: 83px;"></a></td></tr></table><table border="0" width="100%" cellspacing="4"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><tr><!--LEFT SIDE NAVIGATION--><td width="20%" valign="top" nowrap class="noPrint"><p><strong>Links</strong></p><ul><li><a href="../index.html">Docs Home</a></li><li><a href="index.html">Config Ref. Home</a></li><li><a href="http://wiki.apache.org/tomcat/FAQ">FAQ</a></li><li><a href="#comments_section">User Comments</a></li></ul><p><strong>Top Level Elements</strong></p><ul><li><a href="server.html">Server</a></li><li><a href="service.html">Service</a></li></ul><p><strong>Executors</strong></p><ul><li><a href="executor.html">Executor</a></li></ul><p><strong>Connectors</strong></p><ul><li><a href="http.html">HTTP</a></li><li><a href="ajp.html">AJP</a></li></ul><p><strong>Containers</strong></p><ul><li><a href="context.html">Context</a></li><li><a href="engine.html">Engine</a></li><li><a href="host.html">Host</a></li><li><a href="cluster.html">Cluster</a></li></ul><p><strong>Nested Components</strong></p><ul><li><a href="globalresources.html">Global Resources</a></li><li><a href="jar-scanner.html">JarScanner</a></li><li><a href="listeners.html">Listeners</a></li><li><a href="loader.html">Loader</a></li><li><a href="manager.html">Manager</a></li><li><a href="realm.html">Realm</a></li><li><a href="resources.html">Resources</a></li><li><a href="sessionidgenerator.html">SessionIdGenerator</a></li><li><a href="valve.html">Valve</a></li></ul><p><strong>Cluster Elements</strong></p><ul><li><a href="cluster.html">Cluster</a></li><li><a href="cluster-manager.html">Manager</a></li><li><a href="cluster-channel.html">Channel</a></li><li><a href="cluster-membership.html">Channel/Membership</a></li><li><a href="cluster-sender.html">Channel/Sender</a></li><li><a href="cluster-receiver.html">Channel/Receiver</a></li><li><a href="cluster-interceptor.html">Channel/Interceptor</a></li><li><a href="cluster-valve.html">Valve</a></li><li><a href="cluster-deployer.html">Deployer</a></li><li><a href="cluster-listener.html">ClusterListener</a></li></ul><p><strong>web.xml</strong></p><ul><li><a href="filter.html">Filter</a></li></ul><p><strong>Other</strong></p><ul><li><a href="systemprops.html">System properties</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td width="80%" valign="top" align="left" id="mainBody"><h1>The Cluster Receiver object</h1><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Table of Contents"><!--()--></a><a name="Table_of_Contents"><strong>Table of Contents</strong></a></font></td></tr><tr><td><blockquote>
Hongqing Liufd5ee812014-05-10 16:32:51 +080082<ul><li><a href="#Introduction">Introduction</a></li><li><a href="#Blocking_vs_Non-Blocking_Receiver">Blocking vs Non-Blocking Receiver</a></li><li><a href="#Attributes">Attributes</a><ol><li><a href="#Common_Attributes">Common Attributes</a></li><li><a href="#NioReceiver">NioReceiver</a></li><li><a href="#BioReceiver">BioReceiver</a></li></ol></li></ul>
83</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
84 <p>
85 The receiver component is responsible for receiving cluster messages.
86 As you might notice through the configuration, is that the receiving of messages
刘洪青6266f992017-05-15 21:21:03 +080087 and sending of messages are two different components, this is different from many other
Hongqing Liufd5ee812014-05-10 16:32:51 +080088 frameworks, but there is a good reason for it, to decouple the logic for how messages are sent from
89 how messages are received.<br>
90 The receiver is very much like the Tomcat Connector, its the base of the thread pool
91 for incoming cluster messages. The receiver is straight forward, but all the socket settings
92 for incoming traffic are managed here.
93 </p>
94</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Blocking vs Non-Blocking Receiver"><!--()--></a><a name="Blocking_vs_Non-Blocking_Receiver"><strong>Blocking vs Non-Blocking Receiver</strong></a></font></td></tr><tr><td><blockquote>
95 <p>
刘洪青6266f992017-05-15 21:21:03 +080096 The receiver supports both a non blocking, <code>org.apache.catalina.tribes.transport.nio.NioReceiver</code>, and a
Hongqing Liufd5ee812014-05-10 16:32:51 +080097 blocking, <code>org.apache.catalina.tribes.transport.bio.BioReceiver</code>. It is preferred to use the non blocking receiver
98 to be able to grow your cluster without running into thread starvation.<br>
99 Using the non blocking receiver allows you to with a very limited thread count to serve a large number of messages.
100 Usually the rule is to use 1 thread per node in the cluster for small clusters, and then depending on your message frequency
101 and your hardware, you'll find an optimal number of threads peak out at a certain number.
102 </p>
103</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Attributes"><strong>Attributes</strong></a></font></td></tr><tr><td><blockquote>
104 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Common Attributes"><!--()--></a><a name="Common_Attributes"><strong>Common Attributes</strong></a></font></td></tr><tr><td><blockquote>
刘洪青6266f992017-05-15 21:21:03 +0800105 <table border="1" cellpadding="5"><tr><th width="15%" bgcolor="#023264"><font color="#ffffff">Attribute</font></th><th width="85%" bgcolor="#023264"><font color="#ffffff">Description</font></th></tr><tr><td align="left" valign="center"><strong><code class="attributeName">className</code></strong></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800106 The implementation of the receiver component. Two implementations available,
刘洪青6266f992017-05-15 21:21:03 +0800107 <code>org.apache.catalina.tribes.transport.nio.NioReceiver</code> and
Hongqing Liufd5ee812014-05-10 16:32:51 +0800108 <code>org.apache.catalina.tribes.transport.bio.BioReceiver</code>.<br>
刘洪青6266f992017-05-15 21:21:03 +0800109 The <code>org.apache.catalina.tribes.transport.nio.NioReceiver</code> is the
Hongqing Liufd5ee812014-05-10 16:32:51 +0800110 preferred implementation
刘洪青6266f992017-05-15 21:21:03 +0800111 </td></tr><tr><td align="left" valign="center"><code class="attributeName">address</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800112 The address (network interface) to listen for incoming traffic.
113 Same as the bind address. The default value is <code>auto</code> and translates to
114 <code>java.net.InetAddress.getLocalHost().getHostAddress()</code>.
刘洪青6266f992017-05-15 21:21:03 +0800115 </td></tr><tr><td align="left" valign="center"><code class="attributeName">direct</code></td><td align="left" valign="center">
116 Possible values are <code>true</code> or <code>false</code>.
Hongqing Liufd5ee812014-05-10 16:32:51 +0800117 Set to true if you want the receiver to use direct bytebuffers when reading data
118 from the sockets.
刘洪青6266f992017-05-15 21:21:03 +0800119 </td></tr><tr><td align="left" valign="center"><code class="attributeName">port</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800120 The listen port for incoming data. The default value is <code>4000</code>.
刘洪青6266f992017-05-15 21:21:03 +0800121 To avoid port conflicts the receiver will automatically bind to a free port within the range of
122 <code> port &lt;= bindPort &lt; port+autoBind</code>
123 So for example, if port is 4000, and autoBind is set to 10, then the receiver will open up
124 a server socket on the first available port in the range 4000-4009.
125 </td></tr><tr><td align="left" valign="center"><code class="attributeName">autoBind</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800126 Default value is <code>100</code>.
刘洪青6266f992017-05-15 21:21:03 +0800127 Use this value if you wish to automatically avoid port conflicts the cluster receiver will try to open a
Hongqing Liufd5ee812014-05-10 16:32:51 +0800128 server socket on the <code>port</code> attribute port, and then work up <code>autoBind</code> number of times.
刘洪青6266f992017-05-15 21:21:03 +0800129 </td></tr><tr><td align="left" valign="center"><code class="attributeName">securePort</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800130 The secure listen port. This port is SSL enabled. If this attribute is omitted no SSL port is opened up.
131 There default value is unset, meaning there is no SSL socket available.
刘洪青6266f992017-05-15 21:21:03 +0800132 </td></tr><tr><td align="left" valign="center"><code class="attributeName">udpPort</code></td><td align="left" valign="center">
133 The UDP listen port. If this attribute is omitted no UDP port is opened up.
134 There default value is unset, meaning there is no UDP listener available.
135 </td></tr><tr><td align="left" valign="center"><code class="attributeName">selectorTimeout</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800136 The value in milliseconds for the polling timeout in the <code>NioReceiver</code>. On older versions of the JDK
137 there have been bugs, that should all now be cleared out where the selector never woke up.
138 The default value is a very high <code>5000</code> milliseconds.
刘洪青6266f992017-05-15 21:21:03 +0800139 </td></tr><tr><td align="left" valign="center"><code class="attributeName">maxThreads</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800140 The maximum number of threads in the receiver thread pool. The default value is <code>6</code>
刘洪青6266f992017-05-15 21:21:03 +0800141 Adjust this value relative to the number of nodes in the cluster, the number of messages being exchanged and
142 the hardware you are running on. A higher value doesn't mean more efficiency, tune this value according to your
Hongqing Liufd5ee812014-05-10 16:32:51 +0800143 own test results.
刘洪青6266f992017-05-15 21:21:03 +0800144 </td></tr><tr><td align="left" valign="center"><code class="attributeName">minThreads</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800145 Minimum number of threads to be created when the receiver is started up. Default value is <code>6</code>
刘洪青6266f992017-05-15 21:21:03 +0800146 </td></tr><tr><td align="left" valign="center"><code class="attributeName">ooBInline</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800147 Boolean value for the socket OOBINLINE option. Possible values are <code>true</code> or <code>false</code>.
刘洪青6266f992017-05-15 21:21:03 +0800148 </td></tr><tr><td align="left" valign="center"><code class="attributeName">rxBufSize</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800149 The receiver buffer size on the receiving sockets. Value is in bytes, the default value is <code>43800</code> bytes.
刘洪青6266f992017-05-15 21:21:03 +0800150 </td></tr><tr><td align="left" valign="center"><code class="attributeName">txBufSize</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800151 The sending buffer size on the receiving sockets. Value is in bytes, the default value is <code>25188</code> bytes.
刘洪青6266f992017-05-15 21:21:03 +0800152 </td></tr><tr><td align="left" valign="center"><code class="attributeName">udpRxBufSize</code></td><td align="left" valign="center">
153 The receive buffer size on the datagram socket.
154 Default value is <code>25188</code> bytes.
155 </td></tr><tr><td align="left" valign="center"><code class="attributeName">udpTxBufSize</code></td><td align="left" valign="center">
156 The send buffer size on the datagram socket.
157 Default value is <code>43800</code> bytes.
158 </td></tr><tr><td align="left" valign="center"><code class="attributeName">soKeepAlive</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800159 Boolean value for the socket SO_KEEPALIVE option. Possible values are <code>true</code> or <code>false</code>.
刘洪青6266f992017-05-15 21:21:03 +0800160 </td></tr><tr><td align="left" valign="center"><code class="attributeName">soLingerOn</code></td><td align="left" valign="center">
161 Boolean value to determine whether to use the SO_LINGER socket option.
Hongqing Liufd5ee812014-05-10 16:32:51 +0800162 Possible values are <code>true</code> or <code>false</code>. Default value is <code>true</code>.
刘洪青6266f992017-05-15 21:21:03 +0800163 </td></tr><tr><td align="left" valign="center"><code class="attributeName">soLingerTime</code></td><td align="left" valign="center">
164 Sets the SO_LINGER socket option time value. The value is in seconds.
Hongqing Liufd5ee812014-05-10 16:32:51 +0800165 The default value is <code>3</code> seconds.
刘洪青6266f992017-05-15 21:21:03 +0800166 </td></tr><tr><td align="left" valign="center"><code class="attributeName">soReuseAddress</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800167 Boolean value for the socket SO_REUSEADDR option. Possible values are <code>true</code> or <code>false</code>.
刘洪青6266f992017-05-15 21:21:03 +0800168 </td></tr><tr><td align="left" valign="center"><code class="attributeName">tcpNoDelay</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800169 Boolean value for the socket TCP_NODELAY option. Possible values are <code>true</code> or <code>false</code>.
170 The default value is <code>true</code>
刘洪青6266f992017-05-15 21:21:03 +0800171 </td></tr><tr><td align="left" valign="center"><code class="attributeName">timeout</code></td><td align="left" valign="center">
172 Sets the SO_TIMEOUT option on the socket. The value is in milliseconds and the default value is <code>3000</code>
Hongqing Liufd5ee812014-05-10 16:32:51 +0800173 milliseconds.
刘洪青6266f992017-05-15 21:21:03 +0800174 </td></tr><tr><td align="left" valign="center"><code class="attributeName">useBufferPool</code></td><td align="left" valign="center">
Hongqing Liufd5ee812014-05-10 16:32:51 +0800175 Boolean value whether to use a shared buffer pool of cached <code>org.apache.catalina.tribes.io.XByteBuffer</code>
刘洪青6266f992017-05-15 21:21:03 +0800176 objects. If set to true, the XByteBuffer that is used to pass a message up the channel, will be recycled at the end
Hongqing Liufd5ee812014-05-10 16:32:51 +0800177 of the requests. This means that interceptors in the channel must not maintain a reference to the object
178 after the <code>org.apache.catalina.tribes.ChannelInterceptor#messageReceived</code> method has exited.
179 </td></tr></table>
180 </blockquote></td></tr></table>
181 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="NioReceiver"><strong>NioReceiver</strong></a></font></td></tr><tr><td><blockquote>
182 </blockquote></td></tr></table>
183 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="BioReceiver"><strong>BioReceiver</strong></a></font></td></tr><tr><td><blockquote>
184 </blockquote></td></tr></table>
185
刘洪青6266f992017-05-15 21:21:03 +0800186</blockquote></td></tr></table></td></tr><tr class="noPrint"><td width="20%" valign="top" nowrap class="noPrint"></td><td width="80%" valign="top" align="left"><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="comments_section" id="comments_section"><strong>Comments</strong></a></font></td></tr><tr><td><blockquote><p class="notice"><strong>Notice: </strong>This comments section collects your suggestions
187 on improving documentation for Apache Tomcat.<br><br>
188 If you have trouble and need help, read
189 <a href="http://tomcat.apache.org/findhelp.html">Find Help</a> page
190 and ask your question on the tomcat-users
191 <a href="http://tomcat.apache.org/lists.html">mailing list</a>.
192 Do not ask such questions here. This is not a Q&amp;A section.<br><br>
193 The Apache Comments System is explained <a href="../comments.html">here</a>.
194 Comments may be removed by our moderators if they are either
195 implemented or considered invalid/off-topic.</p><script type="text/javascript"><!--//--><![CDATA[//><!--
196 var comments_shortname = 'tomcat';
197 var comments_identifier = 'http://tomcat.apache.org/tomcat-7.0-doc/config/cluster-receiver.html';
198 (function(w, d) {
199 if (w.location.hostname.toLowerCase() == "tomcat.apache.org") {
200 d.write('<div id="comments_thread"><\/div>');
201 var s = d.createElement('script');
202 s.type = 'text/javascript';
203 s.async = true;
204 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
205 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
206 }
207 else {
208 d.write('<div id="comments_thread"><strong>Comments are disabled for this page at the moment.<\/strong><\/div>');
209 }
210 })(window, document);
211 //--><!]]></script></blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font color="#525D76" size="-1"><em>
212 Copyright &copy; 1999-2017, Apache Software Foundation
Hongqing Liufd5ee812014-05-10 16:32:51 +0800213 </em></font></div></td></tr></table></body></html>