When a stateful Web application is deployed to OC4J, multiple HTTP requests from the same client may need to access the application. However, if the application running on the OC4J server experiences a problem where the OC4J process fails, the state associated with a client request may be lost. Using Oracle Application Server, there are three ways to guard against such failures:
■ State safe applications save their state in a database or other persistent storage system, avoiding the loss of state when the server goes down. Obviously, there is a performance cost for continually writing the application state to persistent storage. ■ Stateless applications do not have a state that needs to be carried between
requests, and so, stateless applications do not have state integrity considerations when a server goes down. Another active server can handle the request. High availability for stateless applications is easier to achieve than for state safe or stateful applications.
■ Stateful applications can use OC4J session state replication, with OC4J islands, to automatically replicate the session state across multiple processes in an application server instance, and in a cluster, across multiple application instances which may run on different nodes.
OC4J processes can be grouped into islands to support session state replication for high availability of Web applications. Using OC4J islands together with Oracle HTTP Server mod_oc4j request routing provides stateful failover in the event of a software or hardware problem. For example, if an OC4J process that is part of an island fails,
mod_oc4j is notified of the failure by OPMN and routes requests to another OC4J
process in the same island.
Web Application Session State Protecting Against Software Problems To guard against software problems, such as OC4J process failure or hang, you can configure an OC4J instance to run multiple OC4J processes in the same OC4J island. The processes in the OC4J island communicate their session state between each other. Using this
configuration provides failover and high availability by replicating state across multiple OC4J processes running on an application server instance.
In the event of a failure, Oracle HTTP Server forwards requests to active (alive) OC4J process within the OC4J island. In this case, the Web application state for the client is preserved and the client does not notice any loss of service.
Features and Components for Middle Tier High Availability
Figure 2–4 Web Application Session State Failover Within An OC4J Island in an OC4J
Instance
Web Application Session State Replication Protecting Against Hardware Problems To guard against hardware problems, such as the failure of the node where an application server instance runs, you can configure OC4J islands across application server instances that are in more than one node in an OracleAS Cluster. By configuring an OC4J island that uses the same name across multiple application server instances, the OC4J processes can share session state information across the OracleAS Cluster. When an application server instance fails or is not available, for example, when the node it runs on goes down, Oracle HTTP Server forwards requests to an OC4J process in an application server instance that is available. Thus, Oracle HTTP Server forwards requests only to active (alive) OC4J processes within the cluster.
In this case, the Web application state for the client is preserved and the client does not notice any irregularity.
Figure 2–5 depicts an OC4J island configured within an OracleAS Cluster.
Application Server Instance #1
default_island OC4J_home instance O_1028 OC4J Process OC4J Process
Features and Components for Middle Tier High Availability
Figure 2–5 Web Application Session State Failover Within An OracleAS Cluster
Configuring OC4J Islands With High Availability To protect against software or hardware failure while maintaining state with the least number of OC4J processes, you need to configure at least two OC4J processes in the same island on multiple application server instances running on separate nodes. For example, if you have two application server instances, instance 1 and instance 2, you can configure two OC4J processes in the
default_island on each application server instance. With this configuration,
stateful session applications are protected against hardware and software failures, and the client maintains state if either of the following types of failures occurs:
■ If one of the OC4J processes fails, then the client request is redirected to the other OC4J process in the default_island on the same application server instance. State is preserved and the client does not notice any irregularity.
■ If application server instance 1 terminates abnormally, then the client is redirected to the OC4J process in the default_island on application server instance 2. The state is preserved and the client does not notice any irregularity.