Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Upgrade and Migration Guide

Migrating Applications to Support HTTP Failover (Enterprise Edition)

Application Server, Enterprise Edition 8.1 supports load balancing and HTTP session persistence. The primary goal of load-balancing is to distribute the work load between multiple server instances, thereby increasing overall throughput of the system.

For information on configuring HTTP session failover, see HTTP Session Failover in Sun Java System Application Server Enterprise Edition 8.1 2005Q2 High Availability Administration Guide.

To migrate 6.x HTTP applications to Application Server 8.1 EE environment and enable load-balancing capabilities, perform the following steps. Note that, no code changes will be required in the application.

ProcedureTo Migrate and Enable Load-Balancing

  1. Make sure that at least two application server instances are created and configured.

  2. Rename the ias-web-app.xml to sun-web.xml.

    For more information on migrating the deployment descriptors, see the Migrating Deployment Descriptors.

  3. Update the <DOCTYPE definition with the following code:

    <!DOCTYPE web-app PUBLIC 
    ’-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN’ 
    ’http://java.sun.com/j2ee/dtds/web-app_2_3-1.dtd’>
  4. In Sun ONE Application Server 6.5, the failover of HTTP applications was based on Dsync mechanism. The configuration for HTTP failover was done in the ias-web-app.xml file.

    The <server-info> element defined under the <servlet-info> element, specifies whether the server on which the servlet will be served from is enabled.

    The <session-info> element defines the following:

    • dsync-type: This can take the value dsync-distributed or dsync-local.

      dsync-distributed implies that the session is distributed and thus available on all configured servers.

      dsync-local implies that the session is available on available only on the server on which the session was created.

      • impl: This can take the values distributed or lite.

        distributed implies that the session on distributed.

        lite implies that the session is local to the Java engine where the session was created. If this value is set, the dsync-type setting is ignored. I

        In Sun Java System Application Server 8.1, to enable failover of applications on the HTTP route, you define the following properties in the sun-specific web application deployment descriptor file: sun-web.xml.

      • persistence-store - This can take the values memory, file, or ha. In 6.5, however, only memory based persistence store was supported.

      • persistence-scope - define the scope of persistence.

        • session - For every session, the session information will be saved.

        • modified-session - Only the modified session data will be stored.

        • modified-attribute - Only the modified attribute data will be stored. In 6.5, only modified-attribute sope was supported.

        persistenceFrequency - The frequecy can be for every web method or time based. In 6.5, only web-method was supported.

        • web-method - The session state is stored at the end of each web request prior to sending a response back to the client. This mode provides the best guarantee that the session state is fully updated in case of failure.

        • time-based - The session state is stored in the background at the specified frequency. This mode provides less of a guarantee that the session state is fully updated. However, it can provide a significant performance improvement because the state is not stored after each request.

          A sample of the sun-web.xml file is given below:

          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE 
          sun-web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.1 Servlet 2.3//EN' 
          "http://www.sun.com/software/sunone/appserver/dtds/sun-web-app_2_3-1.dtd'>
            <sun-web-app>
              <session-config>
                <seession-manager>
                  <manager-properties>
                    <property name="persistence-type" value "ha'>
                    <property name="persistenceFrequency" value ="web-based">
                  </manager-properties>
                  <store-properties>
                    <property name="persistenceScope" value="session">
                  </store-properties>
                </session-manager>
              </session-config>
          </sun-web-app> 

          For more information on the sun-web.xml configuration file, see The sun-web.xml File in Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Developer’s Guide.

  5. Sun Java System Application Server 8.1 requires the load balancer plug-in to be installed and configured, in order to load-balance the HTTP request and failover the requests to available server instances in a cluster when there is a failure.

    For more information about the load balancer, see Chapter 4, Configuring Load Balancing and Failover, in Sun Java System Application Server Enterprise Edition 8.1 2005Q2 High Availability Administration Guide.

  6. In the load-balancer.xml file, make sure that the web-module enabled element is set to true.

    <loadbalancer>
      <cluster name=cluster1>
      ...
        <web-module context-root="abc" enabled=true>
      </cluster>
      <property name="https-routing" value="true"/>
    </loadbalancer> 

    enabled=true specifies that the web module is active (enabled) for requests to be load balanced to it.

  7. Define the https-routing property and set its value to true.

    For more information on editing the load-balancer.xml file, see Chapter 4, Configuring Load Balancing and Failover, in Sun Java System Application Server Enterprise Edition 8.1 2005Q2 High Availability Administration Guide.

    Deploy the applications on all server instances that is participating in load balancing.