From Standalone to Clusterized: WildFly Auto Scaling in Containers
To get up and running WildFly standalone server in a container is pretty easy, but in case you need to enable clustering in Managed Domain mode (which is one of the key features of Java EE) is not so fast and simple.
A great variety of mission-critical and large-scale applications (banking and billing for example) are still running on Java EE in VMs. Integrated Java EE clustering provides functionality that people are interested in, including high-availability and automated deployment among distributed Java application servers.
WildFly Managed Domain
Within Cloudlets platform it is possible to easily install an embedded Auto-Clustering for WildFly that is enabled by default.
This solution provides a possibility to automatically interconnect the multiple application servers upon the environment topology change, which implements the commonly used clustering configuration in managed domain mode.
And below we’ll show how standalone WildFly can be transformed into the cluster by means of a simple horizontal scaling with no manual configurations. We’ll also describe infrastructure topology specifics and the way to get the appropriate development and production environments up and running inside the cloud.
Create Standalone WildFly
So let's login to the dashboard and open the topology wizard:
1. Create a new environment
- Choose a proper version of WildFly
- Set up vertical scaling limits
- Change the name of your environment (e.g. wildfly)
Click Create.
In a few seconds you will receive an email confirmation of environment creation with the credentials to the Admin Panel.
2. Now, deploy the application to the just provisioned standalone server.
Click Deploy.
Make sure that your application is up and running, pressing Open in browser near the created environment.
If you log in to your container via built-in Web SSH client, you’ll see only one running process of standalone server.
Clustered WildFly with Managed Domain Mode
WildFly clustering with domain mode is configured automatically by means of horizontal scaling. The servers can be scaled manually or automatically.
- Manually
Add new servers via wizard while creating the environment or by changing its topology.
Go to the application server layer, and add (+) nodes within the Horizontal Scaling frame.
- Automatically
The number of servers can be changed automatically by setting up scaling triggers based on the resource consumption within Settings > Auto Horizontal Scaling.
After the scaling is completed, all WildFly instances will join the cluster, working in operation mode of WildFly Managed Domain. Domain Controller and Load Balancer are added automatically as required components of the cluster.
Upon this scaling, the previously deployed application is also automatically redeployed to the rest of WildFly instances of the cluster. Also, database connection pool configurations and other config customizations, previously made via WildFly admin console, are replicated across the whole application server layer.
You can check how WildFly topology is changed from standalone mode to managed domain cluster:
Worker Nodes run 3 processes instead of one as it was in standalone mode:
- Process Controller
- Host Controller
- Worker Server
And Domain Controller node has two processes running:
- Process Controller
- Host Controller
Also, the topology changes are synchronized and shown within WildFly Admin Panel.
So you get a ready-to-use WildFly cluster that can be scaled out and in, making hosting of your applications extremely flexible and cost-effective.
Application Availability among Workers
The application deployed to the standalone server is redeployed to all server instances during transformation to the cluster. To check this you can click Open in browser at each Worker.
Also, you can make sure that the cluster provides high availability. For this, press Restart node button for one or even two nodes and try to access your application via Open in browser for the whole cluster.
The application will be up and running without any interruptions.
Cloning Cluster in Domain Mode
When releasing new application version or just applying some essential adjustments, it’s a good practice to check how the newly implemented changes could affect the service work. You can perform such testing ‘on-fly’ (i.e. without service downtime) with the Clone Environment option.
A cloned environment is a ready-to-work cluster copy with all the required modifications already applied. The newly provisioned Domain Controller node operates with the appropriate cloned Workers, which are already listed within its admin panel. And the application from the original environment is deployed to the cloned one. Thus, the only thing that remains is to recheck your application’s code and custom server configurations for the hardcoded IPs/domains and fix them accordingly (if there are any issues).
This way, you can apply the implied changes to your environment copy without affecting the actual production.
Summary
There is no need to rebuild the whole application architecture in order to gain the required outcome from both managed domain mode and container technology. Try out the easiest way of creation our own WildFly cluster with Cloudlets - just register for free and enjoy the high availability, auto scaling, and unparalleled local hosting service.