Sun GlassFish Enterprise Server 2.1 Quick Start Guide

High Availability and Failover Using the In-memory Replication Feature

GlassFish v2 does not offer HADB. For high availability and failover, GlassFish offers the in-memory replication feature. The following procedure illustrates this feature:

  1. Restart the web server that has the load balancer plugin installed before deploying an application. This ensures that requests are served by instances in the order set in the loadbalancer.xml file. If you use the loadbalancer.xml file provided in this chapter, instance1 serves the first request.

  2. You have already deployed the clusterjsp web application, which stores session data. You should be able to see that successive requests are served by the same instance that served the first request and the session data is maintained across the requests.

  3. Send few requests and note down the instance that served those requests and shutdown that particular instance. Use this command to stop the instance: asadmin stop-instance --user adminuser --password adminpassword instance1

  4. Send in the next request and verify that the new data is stored and that the previously added data is still there in the session. If one of the server serving requests is not available, another server in the same cluster takes over the request with all earlier session data and completes the request.