GlassFish/SJS AS in production - which bundle, which profile, ...?
By alexismp on nov. 06, 2007
You may have heard it before, GlassFish v2 is a single bundle (no more "Editions"). So why bother writing a post about this? Well, the reality is a little more complex.
First you need to choose between the GlassFish v2 bits (simple ANT-based installer) from java.net and the SJS Application Server 9.1 (more polished installer). Both end up installing the same JARs (see this FAQ entry for more on the differences between the two approaches). As explained in this previous post, you should be using SJS Application Server 9.1 bits for patches to be applicable.
Profiles in GlassFish v2 are "developer", "cluster", and "enterprise". The difference between the first two is pretty much self explanatory. The "enterprise" profile is mainly related to the use of HADB (highly available and distributed database) and a different keystore. Note that HADB is not open source (more on its relevance later). Here are the other main differences:
You can have any profile in production, including "developer". In that case, you should probably tune GlassFish (default tuning is done for developers) and certainly remove the fast startup:
The GlassFish bits provide support for the "developer" and "cluster" profiles. Chose between the two at install-time (
setup-cluster.xml) or upgrade using the "Add clustering" web admin action to a "developer" instance. There is no "entreprise" support in GlassFish bits.
The SJS Application Server 9.1 bundles provide the choice between Application Server 9.1 and Application Server 9.1 with HADB. The first one is roughly the equivalent of the glassfish bits from java.net (with no
asadmin create-domain instead). The second one contains HADB.
The difference between "cluster" and "enterprise" really boils down to the technology used for replicating data to provide high availability. The first one uses in-memory replication based on the Shoal framework while the second one uses HADB. This is a trade-off between degradation and availability:
• "cluster" is providing availability (not sure how many 9's, but that's clearly less than 5) with a very reasonable performance degradation (depending on your session size and application obviously).
• "enterprise" is 99.999% available, but performance can be less than half what it is without any data replication.
The other important thing to note here is that the "cluster" profile is very easy to setup while "enterprise" does require installing and administering HADB nodes.
Once you have either "cluster" or "enterprise" profiles in place, you simply need to :
• Deploy your application with
• Make sure the application is deployed with the <distributable/> element in
One question I often get is "What if I want clustering and load-balancing, but no data replication"? This can be achieved by using the "cluster" profile and deploying without the above two steps. In that case, load-balancing can still happen (using GlassFish's software load-balancer) or any external one with a sticky behavior - sessions live on only one instance and users are always redirected to this instance. If the instance fails, all associated sessions are lost. A great deal of applications can live with that.