This section shows you how to configure Apache, Tomcat, and JOnAS to run the following architecture:
The term session replication is used when the current service state is being replicated across multiple application instances. Session replication occurs when the information stored in an HttpSession is replicated from, in this example, one Servlet engine instance to another. This could be data such as items contained in a shopping cart or information being entered on an insurance application. Anything being stored in the session must be replicated for the service to failover without a disruption.
The solution chosen for achieving Session replication is called in-memory session-replication. It uses a group communication protocol written entirely in Java, called JavaGroups. JavaGroups is a communication protocol based on the concept of virtual synchrony and probabilistic broadcasting.
The following describes the steps for achieving Session replication with JOnAS.
mod_jk is used to illustrate the Session Replication. Therefore, first perform the configuration steps presented in the section Section 32.2 Load Balancing at the Web Level with mod_jk.
On the JOnAS servers, open the JONAS_BASE/conf/server.xml file and configure the <context> as described:
<Context path="/replication-example" docBase="replication-example" debug="99" reloadable="true" crossContext="true" className="org.objectweb.jonas.web.catalina41.JOnASStandardContext"> <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_replication_log." suffix=".txt" timestamp="true"/> <Valve className="org.apache.catalina.session.ReplicationValve" filter=".*\.gif;.*\.jpg;.*\.jpeg;.*\.js" debug="0"/> <Manager className="org.apache.catalina.session.InMemoryReplicationManager" debug="10" printToScreen="true" saveOnRestart="false" maxActiveSessions="-1" minIdleSwap="-1" maxIdleSwap="-1" maxIdleBackup="-1" pathname="null" printSessionInfo="true" checkInterval="10" expireSessionsOnShutdown="false" serviceclass="org.apache.catalina.cluster.mcast.McastService" mcastAddr="237.0.0.1" mcastPort="45566" mcastFrequency="500" mcastDropTime="5000" tcpListenAddress="auto" tcpListenPort="4001" tcpSelectorTimeout="100" tcpThreadCount="2" useDirtyFlag="true"> </Manager> </Context> |
Note: | |
---|---|
The multicast address and port must be identically configured for all JOnAS/Tomcat instances. |