Overview of Session Persistence and Failover
Application Server provides high availability session persistence through
failover of HTTP session data and stateful session bean
(SFSB) session data. Failover means that in the event of an server instance
or hardware failure, another server instance takes over a distributed session.
Requirements
A distributed session can run in multiple Sun Java System Application Server instances,
if:
-
Each server instance has access to the same session state
data. Application Server provides the following types of high availability storage
for HTTP session and stateful session bean data:
-
In-memory replication on other servers in the cluster. In-memory
replication is enabled by default with the cluster profile.
The use of in-memory replication requires the Group Management Service (GMS) to be enabled. For more information about GMS, see Group Management Service.
If server instances in a cluster are located on different machines, ensure that the following prerequisites are met:
-
To ensure that GMS and in-memory replication function correctly, the machines must be on the same subnet.
-
To ensure that in-memory replication functions correctly, the system clocks on all machines in the cluster must be synchronized as closely as possible.
-
High-availability database (HADB). For information about how
to enable this database, see configure-ha-cluster(1).
Note –
The HADB software is supplied with the Application Server standalone distribution of Sun Java System Application Server.
For information about available distributions of Sun Java System Application Server,
see Distribution Types and Their Components in Sun Java System Application Server 9.1 Installation Guide. HADB features are available only in the enterprise profile.
For information about profiles, see Usage Profiles in Sun Java System Application Server 9.1 Administration Guide.
-
Each server instance has the same distributable web application
deployed to it. The web-app element of the web.xml deployment
descriptor file must contain the distributable element.
-
The web application uses high-availability session persistence.
If a non-distributable web application is configured to use high-availability
session persistence, the server writes an error to the log file.
-
The web application must be deployed using the deploy or
deploydir command with the --availabilityenabled option
set to true. For more information on these commands, see deploy(1) and deploydir(1).
Restrictions
When a session fails over, any references to open files or network connections
are lost. Applications must be coded with this restriction in mind.
You can only bind certain objects to distributed sessions that support
failover. Contrary to the Servlet 2.4 specification, Sun Java System Application Server does
not throw an IllegalArgumentException if an object type
not supported for failover is bound into a distributed session.
You can bind the following objects into a distributed session that supports
failover:
-
Local home and object references for all EJB components.
-
Colocated stateless session, stateful session, or entity bean
reference .
-
Distributed stateless session, stateful session, or entity
bean reference.
-
JNDI Context for InitialContext and java:comp/env.
-
UserTransaction objects. However, if the
instance that fails is never restarted, any prepared global transactions are
lost and might not be correctly rolled back or committed.
-
Serializable Java types.
You cannot bind the following object types into sessions that support
failover:
In general, for these objects, failover will not work. However, failover
might work in some cases, if for example the object is serializable.