Tomcat Clustering, High Availability & Session Replication
In-memory session replication across cluster nodes, DeltaManager vs BackupManager, and cloud static membership.
1. Standard Cluster Configuration (conf/server.xml)
Place the <Cluster> element inside the <Engine> or <Host> block to enable peer-to-peer session state replication:
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="8">
<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.ha.mcast.McastService"
address="228.0.0.4"
port="45564"
frequency="500"
dropTime="3000"/>
<Receiver className="org.apache.catalina.ha.tcp.nio.NioReceiver"
address="auto"
port="4000"
autoBind="100"
selectorTimeout="5000"
maxThreads="6"/>
<Sender className="org.apache.catalina.ha.tcp.ReplicationTransmitter">
<Transport className="org.apache.catalina.ha.tcp.PooledParallelSender"/>
</Sender>
</Channel>
</Cluster>
Webapp Prerequisite: Add
<distributable/> inside your application's WEB-INF/web.xml and ensure all session attribute objects implement java.io.Serializable.