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

Setting Up HTTP Load Balancing

This section describes how to set up the Load Balancer plug-in and includes the following sections:

Prerequisites for Setting Up Load Balancing

Before configuring your load balancer, you must:

HTTP Load Balancer Deployments

You can configure your load balancer in different ways, depending on your goals and environment, as described in the following sections:

Using Clustered Server Instances

The most common way to deploy the load balancer is with a cluster or clusters of server instances. By default all the instances in a cluster have the same configuration and the same applications deployed to them. The load balancer distributes the workload between the server instances and requests fail over from an unhealthy instance to a healthy one. If you’ve configured HTTP session persistence, session information persists when the request is failed over.

If you have multiple clusters, requests are only load balanced and failed over between the instances in a single cluster. Use multiple clusters in a load balancer to easily enable rolling upgrades of applications. For more information, see Upgrading Applications Without Loss of Availability.

Using a Single, Stand-Alone Instance with Load Balancer Used as a Reverse-Proxy Plug-in

You can also configure your load balancer to use stand-alone server instance instead of a cluster. This configuration results in the load balancer plug-in working as a reverse-proxy plug-in (sometimes called a pass-through plug-in). When the web server receives requests for applications enabled in the load balancer, it forwards the requests directly to the Application Server.

Use the same procedures to configure the load balancer for a pass-through plug-in as you use to configure it for a cluster of server instances.

Using Multiple Stand-Alone Instances

It is also possible to configure your load balancer to use multiple stand-alone instances, and load balance and fail-over requests between them. However, in this configuration, you must manually ensure that the stand-alone instances have homogenous environments and the same applications deployed to them. Because clusters automatically maintain a homogenous environment, for most situations it is better and easier to use clusters.

Procedure to Set Up Load Balancing

Use the asadmin tool to configure load balancing in your environment. For more information on the asadmin commands used in these steps, see Configuring the Load Balancer

ProcedureTo Set Up Load Balancing

  1. Create a load balancer configuration using the asadmin command create-http-lb-config.

  2. Add a reference to a cluster or stand-alone server instance for the load balancer to manage using asadmin create-http-lb-ref.

    If you created the load balancer configuration with a target, and that target is the only cluster or stand-alone server instance the load balancer references, skip this step.

  3. Enable the cluster or stand-alone server instance referenced by the load balancer using asadmin enable-http-lb-server.

  4. Enable applications for load balancing using asadmin enable-http-lb-application.

    These applications must already be deployed and enabled for use on the clusters or stand-alone instances that the load balancer references. Enabling for load balancing is a separate step from enabling them for use.

  5. Create a health checker using asadmin create-health-checker.

    The health checker monitors unhealthy server instances so that when they become healthy again, the load balancer can send new requests to them.

  6. Generate the load balancer configuration file using asadmin export-http-lb-config .

    This command generates a configuration file to use with the load balancer plug-in shipped with the Sun Java System Application Server.

  7. Copy the load balancer configuration file to your web server config directory where the load balancer plug-in configuration files are stored.