Previous Contents Index Next |
Sun Java System Application Server Enterprise Edition 7 2004Q2 Update 2 Getting Started Guide

> ## Chapter 2
> Clustering Scenarios

> This section describes the following topics:

> - HTTP Clustering Scenario
> - RMI/IIOP Clustering Scenario

> ##

> HTTP Clustering Scenario

> The following diagram shows a simple clustering scenario consisting of a web server with a load balancer plug-in, two Sun Java System Application Server instances configured to use the HADB to store HTTP session data, and a remote database management system (RDBMS) to store application data. Note that your actual operational deployment may vary. For example, you could use a third-party load balancer in place of the load balancer plug-in.

> Figure 2-1 Example Clustering Scenario

> The following steps describe how an HTTP request is serviced:

> 1. An incoming client sends an HTTP request to a URL handled by the web server. The web server has been configured to allow the load balancer plug-in to handle the incoming HTTP request.
> 2. The load balancer plug-in then forwards the request to one of the Sun Java System Application Server instances in the cluster. The plug-in uses sticky round-robin load balancing to determine the target instance.
> 3. The target instance receives the request forwarded to it from the load balancer plug-in and begins an HTTP session, storing the HTTP session data to the HADB and the J2EE application data to the RDBMS. As the client progresses through the application, HTTP session data is updated and stored to the HADB and application data is updated in the RDBMS.
> 4. If the instance fails due to a system crash, the load balancer detects that the instance has ceased responding to requests. When subsequent requests come it, the load balancer forwards them to a healthy instance in the cluster.
> 5. The new target instance retrieves the failed over HTTP session information from the HADB and continues responding to the client’s requests, allowing the client to complete the HTTP session with no loss of session data.

> For more information about deployment scenarios for the Sun Java System Application Server, see the Sun Java System Application Server System Deployment Guide.

> ##

> RMI/IIOP Clustering Scenario

> Sun Java System Application Server provides a highly available J2EE application through the use of load-balancing and failover mechanism on the RMI/IIOP path.

> To configure high availability, Application Server instance needs to be configured in an IIOP cluster with the available IIOP listeners that’s used for serving RMI-IIOP requests. The IIOP listeners that will be part of the IIOP cluster, are called as IIOP endpoints.

> The following sections describe the changes required to enable load balancing (client-side configuration) and high availability (server-side changes) for J2EE applications on the RMI/IIOP path.

> - Server-side Configuration
> - Client-side Configuration

> ### Server-side Configuration

> To enable failover of IIOP requests, you should configure IIOP endpoints to constitute the IIOP cluster in Sun Java System Application Server. IIOP endpoints are defined either using the Administration Console or the command line interface.

> Define all the non-SSL endpoints in a cluster to which the RMI/ IIOP requests can be failed over. The iiop-cluster property under the availability-service element defines the IIOP endpoints. Ensure that availability-enabled=”true” to enable failover.

> The following example shows the IIOP cluster configuration property from the server.xml file.

> <availability-service availability-enabled=”true”>

> <iiop-cluster>

> <iiop-server-instance name=server1>

> <iiop-endpoint id=s1_ep1 host=trident port=3700 />

> <iiop-endpoint id=s1_ep2 host=trident port=3800 />

> <iiop-endpoint id=s1_ep3 host=trident port=3900 />

> </iiop-server-instance>

> <iiop-server-instance name=server2>

> <iiop-endpoint id=s2_ep1 host=jupiter port=4700 </>

> <iiop-endpoint id=s2_ep2 host=jupiter port=4800 />

> <iiop-endpoint id=s2_ep3 host=jupiter port=4900 />

> </iiop-server-instance>

> </iiop-cluster>

> </availability-service>

> ### Client-side Configuration

> To enable load balancing of RMI/IIOP requests, you need to configure the client application. Load balancing is supported for the following two types of RMI/IIOP clients:

> - Stand-alone Client
> - ACC Client

> #### Stand-alone Client

> To enable load balancing capabilities in a stand-alone client, the following properties must be defined in the JNDI environment properties or system properties.

> - java.naming.factory.initial

> Set the property to com.sun.appserv.naming.S1ASCtxFactory.

> - com.sun.appserv.iiop.endpoints

> Specifies the list of IIOP endpoints defined in the server.xml.

> - com.sun.appserv.iiop.loadbalancingpolicy

> If the endpoint is specified, then this property is used to specify the load balancing policy. The value used to define this property is based on the JNDI InitialContext.

> When a RMI/IIOP client invokes an InitialContext lookup on a remote object, an Application Server instance (which is part of the IIOP Cluster) is randomly chosen to create the bean. All subsequent operations with this InitialContext will be assigned or stuck to the same Application Server instance.

> To implement load balancing capabilities in your RMI/IIOP client, perform the following steps:

> 1. Set the following JVM properties to configure the ORB.

> com.sun.CORBA.connection.ORBSocketFactoryClass=com.sun.appserv.enterpri se.iiop.EEIIOPSocketFactory
> org.omg.PortableInterceptor.ORBInitializerClass=com.sun.appserv.ee.iiop .EEORBInitializer

> 2. Set the classpath to appserv-rt.jar and appserv-rt-ee.jar. These jar files are located in the install_dir/lib directory.
> 3. Use the following property of S1ASCtxFactory class, prior to the instantiation of the InitialContext:

> Properties env = new Properties();

> env.put(“java.naming.factory.initial”, “com.sun.appserv.naming.S1ASCtxFactory”);

> env.put(“com.sun.appserv.iiop.endpoints”,”trident:3600, exodus:3700”);

> env.put(“com.sun.iiop.loadbalancingpolicy”, “ic-based”);

> //create an initial naming context
> Context initial = new InitialContext(env);

> This client code instantiates the JNDI InitialContext Object by calling the new InitialContext(env), where env is the list of JNDI SPI properties.

> #### ACC Client

> To enable load balancing and failover capabilities in an ACC client, the following properties must be defined in sun-acc.xml.

> - com.sun.appserv.iiop.endpoints
> - com.sun.appserv.iiop.loadbalancingpolicy

> Define the load balancing properties in the sun-acc.xml file to enable a highly available ACC client. These properties are defined as property elements in the sun-acc.xml file.

> For example:

> <client-container>

> <target-server name="saturn" address="saturn" port="3700">

> <property name="com.sun.appserv.iiop.loadbalancingpolicy" value="ic-based" />

> <property name="com.sun.appserv.iiop.endpoints" value="qasol-e1:3700,jupiter:3800"/>

> </client-container>

> Previous Contents Index Next

> Copyright 2005 Sun Microsystems, Inc. All rights reserved.