High availability demo for 3.1 MS3

Skip to end of metadata
Go to start of metadata

Web container and EJB High availability demo

This demo is aimed show casing the high availability features in GlassFish 3.1 open source edition. The demo will show full http session replication as well as transaction check pointing in EJBs. For purpose of this demo the following script will create a 3 instance cluster on the same node.

Team

  • Mahesh Kannan
  • Rajiv Mordani
  • Joe Fialli

Cluster creation

The following shell script can be used to create the cluster or the cluster can be created via the Admin Console as is demoed in this milestone (MS3). You must set GF_HOME environment variable before invoking the script below.

Once you have the cluster setup - deploy the attached application to the cluster with the availabilityenabled parameter set to true as shown below.

The application SFSBDriver is what shows the HA features in MS3. To start the demo - point your browser to

http://localhost:18080/SFSBDriver/SFSBDriverServlet (we are pointing to instance 1 but you could use any instance. Also replace localhost appropriately)

The application puts the following attributes in the HTTP session -

an Integer value
a String
and two stateful session bean references.

When the application is loaded on the browser hit refresh a few times and you will see that the counter is incremented.
Now shutdown the instance on which you were loading the page, in our case instance 1 as follows -

Get the session id for the cookie from the browser (on firefox right click on the page and select Page Info and you will get the session id).

Now redirect the browser to go to instance 3 - passing it the JSESSIONID=<session id> in the url.

So the url will be

You will observe that the counter increment continues from where you left off on instance1. The session data is replicated to inst3 and the state is preserved.

The [^SFSBDriver.war] is attached (sources will also be put up shortly). Click on Tools on the top right corner of this page to get to the attachments.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jul 22, 2010

    if you're using the same browser instance, do you need to explicitly pass the JSESSIONID?

  2. Jul 29, 2010

    Hi Alexis,
    If you use the same browser instance then you don't need to explicitly pass the JSESSIONID.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Oracle community and they might not be employed or in any way formally affiliated with Oracle. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Oracle nor any other party necessarily agrees with them.