Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g (

Part Number E13981-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Index
Go to Feedback page
Contact Us

Go to previous page
Go to next page
View PDF

Understanding OC4J EJB Application Clustering Services

Oracle Application Server provides an extensive suite of high availability and failover options, including clustering–the distribution of application server and end-user application components across multiple hosts configured with the appropriate means of host-to-host communication.

OC4J application clustering is a state management service available to HTTP sessions and stateful session beans. In this context, a cluster is defined as two or more OC4J server nodes hosting the same set of applications. In this release, configuration has been simplified and made identical for both HTTP sessions and stateful session beans.

Transactions cannot failover. There is no reinstating an interrupted transaction in another bean. Instead, the transaction rolls back and must start over. For more information, see "Understanding EJB Transaction Services".

The performance for clustering stateful session beans is dependent on the type of replication (see "State Replication") and load balancing (see "Load Balancing") options you choose.

You must choose the appropriate balance between replication frequency and robustness: the more frequently you replicate, the smaller the window of opportunity for losing state but the higher the load on the application server and network.


If you have a servlet (or other Web component) that invokes a stateful session bean, you must configure both HTTP session and stateful session bean clustering.

This section describes OC4J application clustering for stateful session beans, including the following:

For more information, see the following:

State Replication

When you configure a replication policy for a clustered OC4J EJB application, OC4J handles the replication of objects and values contained in stateful session bean instances. Only stateful session beans can be clustered. Because stateless session beans have no state to be replicated, they need not be clustered.

You must configure a replication policy to take advantage of failover: replication of bean state, so that when the original bean terminates unexpectedly, the request can be transparently forwarded to another OC4J process in the cluster.If you only want to take advantage of load balancing, replication is not required (see "Load Balancing").

A replication policy determines the state replication trigger–the conditions under which bean state is broadcast to all other OC4J processes in the cluster. For stateful session beans, when replication is triggered, all the attributes of the stateful session bean are replicated (regardless of whether or not they have changed).

Replication can have an impact on application server and network performance. The fewer times the state is sent out, the better your performance. However, there is a trade-off between performance and the confidence that the bean state is replicated to cover for all areas of the bean instance failing.

For more information, see the following:

Load Balancing

Load balancing refers to how incoming client requests are distributed over all the OC4J instances in your cluster. You can choose from among the following load balancing strategies:

  • Replication-based: hen you configure a replication policy for a clustered OC4J EJB application (see "State Replication"), OC4J will automatically select an OC4J instance at random from the pool of OC4J instances in the cluster when the first client request is serviced.

  • Static retrieval: If you decide not to use EJB replication, but you want to load balance client requests across several statically specified OC4J processes, you can use static retrieval by providing the URLs for all of these processes in the JNDI URL property. For more information, see "Configuring Static Retrieval Load Balancing".

  • DNS: If you decide not to use EJB replication, but you want to load-balance client requests across several DNS-managed OC4J processes, you can use DNS retrieval by configuring your DNS server with a single hostname associated with the desired OC4J host IP addresses and specifying this hostname in the JNDI URL property. For more information, see "Configuring DNS Load Balancing".

For all load balancing strategies, you can configure how a client's requests are load balanced across the OC4J instances in your cluster (see "Configuring Load Balancing Behavior").