Sun Java System Application Server Enterprise Edition 8.1 2005Q2 High Availability Administration Guide

- Previous: Chapter 9 Java Message Service Load Balancing and Failover
- Next: Setting up RMI-IIOP Load Balancing and Failover

# Overview

With RMI-IIOP load balancing, IIOP client requests are distributed to different server instances or name servers. The goal is to spread the load evenly across the cluster, thus providing scalability. IIOP load balancing combined with EJB clustering and availability also provides EJB failover.

When a client performs a JNDI lookup for an object, the Naming Service creates a `InitialContext` (IC) object associated with a particular server instance. From then on, all lookup requests made using that IC object are sent to the same server instance. All `EJBHome` objects looked up with that `InitialContext` are hosted on the same target server. Any bean references obtained henceforth are also created on the same target host. This effectively provides load balancing, since all clients randomize the list of live target servers when creating `InitialContext` objects. If the target server instance goes down, the lookup or EJB method invocation will failover to another server instance.

IIOP Load balancing and failover happens transparently. No special steps are needed during application deployment. However, adding or deleting new instances to the cluster will not update an existing client\qs view of the cluster. To do so, you must manually update the endpoints list on the client side.

## Requirements

Sun Java System Application Server Enterprise Editionprovides high availability of remote EJB references and `NameService` objects over RMI-IIOP, provided all the following apply:

- Your deployment has a cluster of at least two application server instances.

- J2EE applications are deployed to all application server instances and clusters that participate in load balancing.

- RMI-IIOP client applications are enabled for load balancing.

Application Server supports load balancing for the following RMI-IIOP clients accessing EJB components deployed on an Application Server.

- Java applications executing in the Application Client Container (ACC). See To set up RMI-IIOP load balancing for the Application Client Container.

- Java applications not running in the ACC. See To set up RMI-IIOP load balancing and failover for Stand-Alone Client

Note –

Application Server does not support RMI-IIOP load balancing and failover over secure sockets layer (SSL).

## Algorithm

Application Server uses a randomization and round-robin algorithm for RMI-IIOP load balancing and failover.

When an RMI-IIOP client first creates a new `InitialContext` object, the list of available Application Server IIOP endpoints is randomized for that client. For that `InitialContext` object, the load balancer directs lookup requests and other `InitialContext` operations to the first endpoint on the randomized list. If the first endpoint is not available then the second endpoint in the list is used, and so on.

Each time the client subsequently creates a new `InitialContext` object, the endpoint list is rotated so that a different IIOP endpoint is used for `InitialContext` operations.

When you obtain or create beans from references obtained by an `InitialContext` object, those beans are created on the Application Server instance serving the IIOP endpoint assigned to the `InitialContext` object. The references to those beans contain the IIOP endpoint addresses of all Application Server instances in the cluster.

The primary endpoint is the bean endpoint corresponding to the `InitialContext` endpoint used to look up or create the bean. The other IIOP endpoints in the cluster are designated as alternate endpoints. If the bean\qs primary endpoint becomes unavailable, further requests on that bean fail over to one of the alternate endpoints.

You can configure RMI-IIOP load balancing and failover to work with applications running in the ACC and with standalone Java clients.

## Sample Application

The following directory contains a sample application that demonstrates using RMI-IIOP failover with and without ACC:

    install_dir/samples/ee-samples/sfsbfailover

See the `index.html` file accompanying this sample for instructions on running the application with and without ACC. The `ee-samples` directory also contains information for setting up your environment to run the samples.

- Previous: Chapter 9 Java Message Service Load Balancing and Failover
- Next: Setting up RMI-IIOP Load Balancing and Failover

- © 2010, Oracle Corporation and/or its affiliates