GlassFish Clustering in the Cloud

GlassFish is an open-source enterprise level application server with high reliability and performance, which can run any Java EE project. It provides your application with full clustering capability and has a wide range of additional functions.

With Jelastic PaaS, you can use GlassFish not just as a separate server for hosting your Java applications, but also as a highly-available clustered instance with full replication. Let’s see how to easily setup GlassFish cluster within Jelastic Cloud in two different ways:

GlassFish Cluster Automatic Deployment via JPS Package

Get your GlassFish cluster up and running in just a few minutes using Jelastic one-click installation option.

The process of app installation via widget is simple - just click the Get It Hosted Now button, type your email and get the cluster hosted while skipping the steps of manual installation.

GlassFish clustered solution, installed with this option, is built on top of Docker containers. Such implementation provides additional reliability by operating each node, predefined cluster architecture (i.e. Load Balancer, Worker Nodes, Domain Administration Server), as an isolated instance. Herewith, HAProxy Docker image is used as Load Balancer and GlassFish template serves as a base for Worker nodes and DAS.

JPS GlassFish Cluster on Docker

In order to gain a better insight into this package installation and management, refer to the GlassFish Cluster with Automatic Load Balancing page.


  • if your service is not so much visited yet, you can give a try to a JPS package with a non-clustered GlassFish solution
  • take a look at Jelastic JPS Collection, where other numerous pre-configured solutions are stored for you and can be easily installed to the Platform in one click

GlassFish Cluster Manual Deployment

In case you want to gain the complete control over your GlassFish cluster configuration and deployment, the given below instruction can come in handy. It includes description of the main GF cluster configuration specifics and the way it can be implemented within Jelastic Cloud.

In accordance to the native GlassFish clustering architecture, it uses concept of an administrative domain. Such administrative domains consist of clusters and instances, which are managed using Domain Administration Server (DAS).

glassfish clustering

For central repository management you can use the Admin Console, interactive GUI which supports all available GlassFish features. Group Management Service (GMS) provides information about clusters, and DAS, as it was mentioned above, is responsible for managing Java instances in the administrative domain.

Sessions Replication in GlassFish: How Does It Work?

glassfish replication

Instances in each cluster are paired up. In the case main instance in the cluster fails, all users on this instance are automatically redirected to the second instance in the cluster. Wherein end-users will not see any changes: the replicated instance has all of the sessions of the failed instance. If occasionally both instances in a cluster fail, users are just switched to another cluster. For such switching Jelastic uses NGINX-balancer. It handles and shares all the requests between clusters and instances based on the their load and availability.

Also you are provided with a complete scaling system: with horizontal and vertical scaling size and number of clusters can be easily changed manually or automatically due to the load increasing or decreasing.

To get your own GlassFish high-available clustered environment in the Jelastic Cloud just pick up GlassFish as your application server and increase the number of nodes as it is shown in the picture.

glassfish hosting

Don't forget to enable High Availability feature: it will pair up all the nodes to create the cluster(s).

That's all the configurations you need! Just click Create button and in a minute you'll get highly reliable environment with the instance replication inside each cluster and the cluster replication inside the environment.