Web Application session replication is enabled in a clustered environment from WSO2 Application Server 5.0.0 onwards . Therefore, when a Web application is defined as "distributable" and once a session is created for it from a node, that session gets replicated to other nodes. The subsequent changes in the session from any node will also get replicated to other nodes. The same session replication mechanism from Tomcat is used here, except for Axis2 Hazelcast used to send the session replication messages across the cluster.
There are some custom changes required to enable this session replication from Tomcat to WSO2 Carbon. For example, WSO2 has developed its own
TomcatValve to start the session replication process and own implementation of
ClusterableSessionManager, which is responsible for handling session for a distributable Web application and sending session replication messages.
Follow the instructions below to enable session replication in a WSO2 Application Server cluster:
First enable clustering in Axis2. We also have to enable clustering for the Catalina engine by adding the following in between the
Add the following
TomcatValvefor <Host> which is responsible for starting the replication of session. This should be the first of the Tomcat valves.
- Make the Web application distributable by defining the property
web.xmlfile. Then, deploy it in the Application Server.
The above steps should also be implemented for other Application Server nodes in the cluster, for which session replication should be enabled. These steps are the standard steps for session replication in a standalone Tomcat cluster environment.