From 1c0d42d9e3a8aed995a4a5220429ab940a539b61 Mon Sep 17 00:00:00 2001 From: fhanik Date: Mon, 16 Oct 2006 19:35:42 +0000 Subject: [PATCH] more cleanup, need to add correct documentation git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@464635 13f79535-47bb-0310-9956-ffa450edef68 --- webapps/docs/cluster-howto.xml | 736 ++++------------------------------------- 1 file changed, 57 insertions(+), 679 deletions(-) diff --git a/webapps/docs/cluster-howto.xml b/webapps/docs/cluster-howto.xml index 048315e9f..ee1a99733 100644 --- a/webapps/docs/cluster-howto.xml +++ b/webapps/docs/cluster-howto.xml @@ -34,6 +34,54 @@ 2. Multicast port is 45564
3. The IP broadcasted is java.net.InetAddress.getLocalHost().getHostAddress()
4. The TCP port listening for replication messages is the first available server socket in range 4000-4100
+ 5. Two listeners are configured ClusterSessionListener and JvmRouteSessionIDBinderListener
+ 6. Two interceptors are configured TcpFailureDetector and MessageDispatch15Interceptor
+ The following is the default cluster configuration:
+ + <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" + channelSendOptions="6"> + + <Manager className="org.apache.catalina.ha.session.BackupManager" + expireSessionsOnShutdown="false" + notifyListenersOnReplication="true" + mapSendOptions="6"/> + <!-- + <Manager className="org.apache.catalina.ha.session.DeltaManager" + expireSessionsOnShutdown="false" + notifyListenersOnReplication="true"/> + --> + <Channel className="org.apache.catalina.tribes.group.GroupChannel"> + <Membership className="org.apache.catalina.tribes.membership.McastService" + address="228.0.0.4" + port="45564" + frequency="500" + dropTime="3000"/> + <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" + address="auto" + port="4000" + selectorTimeout="5000" + maxThreads="6"/> + + <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> + <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/> + </Sender> + <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/> + <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/> + </Channel> + + <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" + filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/> + + <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" + tempDir="/tmp/war-temp/" + deployDir="/tmp/war-deploy/" + watchDir="/tmp/war-listen/" + watchEnabled="false"/> + + <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/> + <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/> + </Cluster> +

@@ -254,12 +302,15 @@ should be completed:

| \ | -- DeltaManager | - ----------------------------- - | | | \ + --------------------------- + | \ + Channel \ + ----------------------------- \ + | | | \ Receiver Sender Membership \ - \ -- Valve - -- SocketReplicationListener | \ - -- ReplicationListener | -- ReplicationValve + -- Valve + | \ + | -- ReplicationValve | -- JvmRouteBinderValve | -- LifecycleListener @@ -275,26 +326,6 @@ should be completed:

- - Sender - \ - -- ReplicationTransmitter - | - --------- - \ - IDataSender - \ - | - --- (sync) - | \ - | -- PooledSocketSender (pooled) - | -- SockerSender (synchronous) - | - --- (async) - \ - -- AsyncSocketSender (asynchronous) - -- FastAsyncSocketSender (fastasyncqueue) -

@@ -316,7 +347,7 @@ are for the actual TCP replication. replication.

- One of the most important performance considerations is the synchronous (pooled or not pooled) versus asynchronous replication + One of the most important performance considerations is the synchronous versus asynchronous replication mode. In a synchronous replication mode the request doesn't return until the replicated session has been sent over the wire and reinstantiated on all the other cluster nodes. There are two settings for synchronous replication. Pooled or not pooled. @@ -333,659 +364,6 @@ are for the actual TCP replication. During async replication, the request is returned before the data has been replicated. async replication yields shorter request times, and synchronous replication guarantees the session to be replicated before the request returns.

-

- The parameter "replicationMode" has four different settings: "pooled", "synchronous", "asynchronous" and "fastasyncqueue" -

- -
-

-Simple one line configuration
- - <Server port="8011" - shutdown="SHUTDOWN" > - <GlobalNamingResources> - <Resource name="UserDatabase" auth="Container" - type="org.apache.catalina.UserDatabase" - description="User database that can be updated and saved" - factory="org.apache.catalina.users.MemoryUserDatabaseFactory" - pathname="conf/tomcat-users.xml" /> - </GlobalNamingResources> - <Service name="Catalina"> - <Connector port="9012" - protocol="AJP/1.3" - <Connector port="9013" - maxThreads="100" - minSpareThreads="4" - maxSpareThreads="4" - /> - <Engine name="Catalina" - defaultHost="localhost" - jvmRoute="node1"> - <Realm className="org.apache.catalina.realm.UserDatabaseRealm" - resourceName="UserDatabase" /> - <Host name="localhost" - appBase="webapps"> - <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"/> - </Host> - </Engine> - </Service> -</Server> - -
-The default mode configuration setup a fastasyncqueue mode cluster configuration with following -parameters: -

-

-

-NOTE: Use this configuration when you need very quick a test cluster with -at your developer machine. You can change the default attributes from cluster sub elements. -Use following cluster attribute prefixes sender., -receiver., service., manager., valve. and listener.. -
Example configure cluster at windows laptop with network connection and -change receiver port range
- -<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster" - service.mcastBindAddress="127.0.0.1" - receiver.tcpListenPort="9070" - receiver.tcpListenMaxPort="9075" /> - -
-WARNING: When you add you sub elements, there overwrite the defaults complete. -
Example configure cluster with cluster failover jsessionid support. In this -case you need also the defaultmode Cluster listener ClusterSessionListener and ReplicationValve.
- -<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster" - service.mcastBindAddress="127.0.0.1" - receiver.tcpListenPort="9070" - receiver.tcpListenMaxPort="9075" > - <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener" /> - <ClusterListener className="org.apache.catalina.cluster.session.JvmRouteSessionIDBinderListener" /> - <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve" - filter=".*\.gif;.*\.js;.*\.css;.*\.png;.*\.jpeg;.*\.jpg;.*\.htm;.*\.html;.*\.txt;" - primaryIndicator="true" /> - <Valve className="org.apache.catalina.cluster.session.JvmRouteBinderValve" - enabled="true" /> -<Cluster/> - -

-
- -
-

-Simple one line engine configuration
- - <Server port="8011" - shutdown="SHUTDOWN" > - <GlobalNamingResources> - <Resource name="UserDatabase" auth="Container" - type="org.apache.catalina.UserDatabase" - description="User database that can be updated and saved" - factory="org.apache.catalina.users.MemoryUserDatabaseFactory" - pathname="conf/tomcat-users.xml" /> - </GlobalNamingResources> - <Service name="Catalina"> - <Connector port="9012" - protocol="AJP/1.3" - <Connector port="9013" - maxThreads="100" - minSpareThreads="4" - maxSpareThreads="4" - /> - <Engine name="Catalina" - defaultHost="localhost" - jvmRoute="node01"> - <Realm className="org.apache.catalina.realm.UserDatabaseRealm" - resourceName="UserDatabase" /> - <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"/> - <Host name="localhost" - appBase="webapps"/> - </Engine> - </Service> -</Server> - -
-See default mode configuration description as simple host cluster example before. -

-
- -
-

-
Example Configure cluster with complete sub elements. Activate this node -as master farm delopyer. Message receiver is NIO based ReplicationListener with six parallel -worker threads. -
- - <Server port="8011" - shutdown="SHUTDOWN" > - <GlobalNamingResources> - <Resource name="UserDatabase" auth="Container" - type="org.apache.catalina.UserDatabase" - description="User database that can be updated and saved" - factory="org.apache.catalina.users.MemoryUserDatabaseFactory" - pathname="conf/tomcat-users.xml" /> - </GlobalNamingResources> - <Service name="Catalina"> - <Connector port="9012" - protocol="AJP/1.3" - <Connector port="9013" - maxThreads="100" - minSpareThreads="4" - maxSpareThreads="4" - /> - <Engine name="Catalina" - defaultHost="localhost" - jvmRoute="node01"> - <Realm className="org.apache.catalina.realm.UserDatabaseRealm" - resourceName="UserDatabase" /> - <Host name="localhost" - appBase="webapps"> - <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster" - doClusterLog="true" - clusterLogName="clusterlog" - manager.className="org.apache.catalina.cluster.session.DeltaManager" - manager.expireSessionsOnShutdown="false" - manager.notifyListenersOnReplication="false" - manager.notifySessionListenersOnReplication="false" - manager.sendAllSessions="false" - manager.sendAllSessionsSize="500" - manager.sendAllSessionsWaitTime="20"> - <Membership - className="org.apache.catalina.cluster.mcast.McastService" - mcastAddr="228.0.0.4" - mcastBindAddress="127.0.0.1" - mcastClusterDomain="d10" - mcastPort="45564" - mcastFrequency="1000" - mcastDropTime="30000"/> - <Receiver - className="org.apache.catalina.cluster.tcp.ReplicationListener" - tcpListenAddress="auto" - tcpListenPort="9015" - tcpSelectorTimeout="100" - tcpThreadCount="6" - <Sender - className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" - replicationMode="fastasyncqueue" - doTransmitterProcessingStats="true" - doProcessingStats="true" - doWaitAckStats="true" - queueTimeWait="true" - queueDoStats="true" - queueCheckLock="true" - ackTimeout="15000" - waitForAck="true" - keepAliveTimeout="80000" - keepAliveMaxRequestCount="-1"/> - <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve" - filter=".*\.gif;.*\.js;.*\.css;.*\.png;.*\.jpeg;.*\.jpg;.*\.htm;.*\.html;.*\.txt;" - primaryIndicator="true" /> - <Valve className="org.apache.catalina.cluster.session.JvmRouteBinderValve" - enabled="true" /> - <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener" /> - <ClusterListener className="org.apache.catalina.cluster.session.JvmRouteSessionIDBinderListener" /> - <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer" - tempDir="${catalina.base}/war-temp" - deployDir="${catalina.base}/war-deploy/" - watchDir="${catalina.base}/war-listen/" - watchEnabled="true"/> - </Cluster> - </Host> - </Engine> - </Service> -</Server> - -

-
- -
-

-List of Attributes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionDefault value
replicationModereplication mode (synchronous, pooled, asynchronous or fastasyncqueue) - pooled
processSenderFrequencyControl the sender keepalive status and drop sender socket connection after timeout is reached. - Check every processSenderFrequency value engine background ticks. - 2
compresscompress bytes before sending (consume memory, but reduce network traffic - GZIP)false
ackTimeoutacknowledge timeout and only usefull it waitForAck is true15000
waitForAckWait for ack after data sendfalse
autoConnectis sender disabled, fork a new socketfalse
doTransmitterProcessingStatscreate processing time statsfalse
-

-

-Example to get statistic information, wait for ack at every message send and transfer at compressed mode
- - <Sender - className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" - replicationMode="fastasyncqueue" - compress="true" - doTransmitterProcessingStats="true" - ackTimeout="15000" - waitForAck="true" - autoConnect="false"/> - -

-
- -
-

-List of Attributes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionDefault value
keepAliveTimeoutactive socket keep alive timeout60000
keepAliveMaxRequestCountmax request over this socket-1
doProcessingStatscreate Processing time statsfalse
doWaitAckStatscreate waitAck time statsfalse
resendresend message after failure, can overwrite at messagefalse
queueDoStatsactivated queue statsfalse
queueCheckLockcheck to lost locksfalse
queueAddWaitTimeoutqueue add wait time (tomcat connector thread waits)10000
queueRemoveWaitTimeoutqueue remove wait time (queue thread waits)30000
maxQueueLengthmax queue length (default without limit)-1
threadPrioritychange queue thread priority (1-10 ; 5 is normal)5
- -

-

-Example to get a lot of statistic information and no wait for ACK
- - <Sender - className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" - replicationMode="fastasyncqueue" - doTransmitterProcessingStats="true" - doProcessingStats="true" - queueTimeWait="true" - queueDoStats="true" - queueCheckLock="true" - waitForAck="false" - autoConnect="false" - keepAliveTimeout="320000" - keepAliveMaxRequestCount="-1"/> - -

-
- -
-

-List of Attributes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionDefault value
keepAliveTimeoutactive socket keep alive timeout60000
keepAliveMaxRequestCountmax request over this socket-1
doProcessingStatscreate Processing time statsfalse
doWaitAckStatscreate waitAck time statsfalse
resendresend message after failure, can overwrite at messagefalse
-

-

-Example to get a processing statistic information, resend after failure and wait for ACK
- - <Sender - className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" - replicationMode="asynchronous" - doProcessingStats="true" - doWaitAckStats="true" - waitForAck="true" - ackTimeout="30000" - resend="true" - keepAliveTimeout="320000" - keepAliveMaxRequestCount="-1"/> - -

-
- -
-

-List of Attributes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionDefault value
keepAliveTimeoutactive socket keep alive timeout60000
keepAliveMaxRequestCountmax request over this socket-1
doProcessingStatscreate Processing time statsfalse
doWaitAckStatscreate waitAck time statstrue
resendresend message after failure, can overwrite at messagefalse
- -

-

-Example to get a no processing statistic information, no wait for ACK, after 10000 request renew socket and autoconnect before first request is send.
- - <Sender - className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" - replicationMode="synchronous" - autoConnect="true" - keepAliveTimeout="-1" - keepAliveMaxRequestCount="100000"/> - -

-
- -
-

-List of Attributes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionDefault value
keepAliveTimeoutactive socket keep alive timeout60000
keepAliveMaxRequestCountmax request over this socket-1
maxPoolSocketLimitmax pooled sockets (Sender Sockets)25
resendresend message after failure, can overwrite at messagefalse
- -

-

-Example to get a no processing statistic information, wait for ACK, after 10000 request renew socket, only 10 SockerSender available and autoconnect before first request is send.
- - <Sender - className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" - replicationMode="pooled" - autoConnect="true" - maxPoolSocketLimit="10" - keepAliveTimeout="-1" - keepAliveMaxRequestCount="10000" - waitForAck="true" /> - -

-
- -
-

-List of Attributes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionDefault value
expireSessionsOnShutdownWhen server stopped, expire all sessions also at backup nodes (only for testing)false
maxActiveSessionsNumber of active sessions. (Default is no limit)-1
notifyListenersOnReplicationNotify application session listener to session creation - and expiring events at backup nodestrue
notifySessionListenersOnReplicationNotify application session listener to attribute changes at backup nodestrue
stateTransferTimeoutTimeout that session state transfer is complete. Is attribute stateTransferTimeout == -1 - then application wait that other node send the complete session state60
sendAllSessionsFlag to send sessions as splited blockstrue
sendAllSessionsSizeNumber of serialize sessions inside a send block session message. Only useful when sendAllSessions==false1000
sendAllSessionsWaitTimewait time between two session send blocks.2000
sendClusterDomainOnlySend all session messages only to member inside same cluster domain - (value od Membership attribute mcastClusterDomain). Also don't handle - session messages from other domains.true
stateTimestampDropDeltaManager queued Sessions messages when send GET_ALL_SESSION to other node. - with stateTimestampDrop all messages before state transfer message creation date (find session) are dropped. - Only other GET_ALL_SESSION events are handle with date before state transfer message.true
- -

-

-Example send all sessions at separate blocks. Serialize and send 100 session inside one block. -Wait maximale two minutes before the complete backup sessions are loaded inside tomcat boot process. -Between send blocks wait 5 secs to transfers the session block to other node. This save memory -when you use the async modes with queues.
- - <Cluster className="org.apache.catalina.tcp.SimpleTcpCluster" - managerClassName="org.apache.catalina.cluster.session.DeltaManager" - manager.stateTransferTimeout="120" - manager.sendAllSessions="false" - manager.sendAllSessionsSize="100" - manager.sendAllSessionsWaitTime="5000" - "/> - -

-

-Note:
-As Cluster.defaultMode=true you can configure the manager attributes with prefix manager.. -
-Note:
-With Cluster.setProperty(<String>,<String>) you can modify -attributes for all register managers. The method exists as MBeans operation. -

-

-- 2.11.0