Payara Micro is a minimalistic application server based on GlassFish 4.1 and with Java EE 7 support. Having just 70 MB footprint, this server is provisioned with Hazelcast for automatic clustering, Payara JCache as a key-value store, benefits on the embedded Java API and simple management by allowing to run .war packages directly from command line. Payara Micro is optimized for microservices and modern container-based infrastructure. It can be easily run inside the cloud, providing automatic clustering for large-scale JavaEE applications.
To make Payara Micro Cluster integration with Jelastic Platform smooth and quick, a dedicated pre-packaged solution has been developed. It automates all the required installation steps, allowing to deploy and launch a fully-functional and highly scalable Payara Micro Cluster in a matter of clicks.
Jelastic Payara Micro Cluster Specifics
Advanced Payara Micro Cluster package contains the minimal required amount of nodes (containers) by default, but includes all the necessary tools to scale horizontally based on the increased amount of incoming traffic.
This solution is build on top of Docker containers, leveraging the following images:
- jelastic/payara-micro-cluster – Payara Micro application server (1 instance by default, to be automatically scaled out horizontally when the load raises)
- jelastic/haproxy-managed-lb – HAProxy load balancer, which automatically adds/removes application servers within load balancing configs when their number is changed
- jelastic/storage – Dedicated Data Storage container for storing custom data; by default, it contains a simple load simulation application to test the main cluster scaling possibilities
As a basic benefit of hosting at Jelastic Cloud Platform, all containers in this package are preconfigured to be automatically scaled vertically (up to 16 cloudlets by default, which stands for 6400 MHz of CPU and 2048 MiB RAM) based on the load. This allows to utilize resource smartly, using just as much as it’s currently required.
Additionally, all servers within a cluster have special load alerts enabled to automatically send notifications when container capacity is almost at its limit. This indicates that more resources have to be allocated for a server or it should be scaled horizontally.
Obviously, all these predefined settings can be tuned up to your needs via the dashboard.
Quick Deploy of Payara Micro Cluster
Installation of Payara Micro cluster with all additional scaling configurations represents a completely automated process – all you need to do is just to import the corresponding project from the Jelastic JPS Collection at GitHub:
1. Click the Import button at the top pane of dashboard and insert the manifest.jps link within the URL tab:
Click Import at the bottom of the frame to proceed.
2. Within the appeared confirmation window, specify some general environment parameters for your cluster:
- Environment – type the desired environment name to be used as an internal domain
- Display name – alias that will be displayed for the environment within dashboard
- Region – select the preferable hardware region (if available)
Click Install to proceed.
3. Wait a few minutes till Jelastic automatically creates all the required instances and configures cluster for future automation.
That’s it! Payara Micro cluster with out-of-box automated scaling is successfully deployed and ready for work. Now, let’s check how it can cope with traffic of various intensity.
Payara Cluster Load Testing & Scaling
The presented Advanced Payara Micro Cluster package is provisioned with a special inbuilt load testing application, which includes separate options for RAM and CPU loading. This tool is physically located on the Storage node and is automatically mounted to the app server layer upon cluster installation.
With its help, you can discover cluster scaling possibilities and check its behavior in real conditions of changeable load. To open the load test, access the following link using the appropriate domain name (either internal or custom one):
Depending on the resource type you’d like to simulate the load for (i.e. RAM or CPU), fill in the required parameters:
- Load – amount of resources to generate (in ###i#< for RAM and threads for CPU)
- Duration – testing time (in seconds)
Click on Run for the appropriate section.
1. So, let’s launch the tests one by one (we’ll use the settings from the image above) and explore the effect they cause:
- CPU test will be run in just 2 threads to simulate regular conditions of serving a few users and check the automatic vertical scaling. The average load in this case equals 11 cloudlets – this corresponds to approximately 4400 MHz of CPU consumption.
- for RAM test, we’ll apply the moderate load (e.g. 80% of allocated memory) to increase the number of Payara Micro instances due to the automatic horizontal scaling being triggered.
When loading is finished, you’ll see the “Calling GC” string appeared, which stands for the Garbage Сollection initiating as a part of the test. This JVM memory management tool automatically detects the amount of RAM that is no longer needed (in our case it was used to handle load simulation) and frees it to reduce the spends.
2. To see the result, you can refer to the Statistics dashboard section for your Payara cluster and follow load changes visually, in a form of graphs. Herewith, keep in mind that they are built based on average values for the chosen Interval, thus diagram peaks can slightly differ from the text test output.
CPU load graph (the left-hand one) generally corresponds to the consumption values, received during the test – such load can be easily handled by a single Payara Micro container.
As for the green RAM graph, its maximum value reaches about 1500 MiB – this implies execution of the corresponding predefined Memory horizontal scaling trigger, so the amount of Payara Micro containers is automatically increased.
Tip: By referring to the environment Settings > Monitoring > Auto Horizontal Scaling section, you are able to tune any of the existing triggers or add new scaling conditions:
3. Also, to track the results of horizontal scaling while running the tests, you can use the following in-built tools at Jelastic dashboard:
- the Monitoring > Events History section within environment Settings stores details on scaling operations that were automatically executed based on preconfigured scaling triggers:
As you can see, the cluster scaled out up to 2 Payara Micro nodes during the test we’ve handled and returned back to the single app server topology when the load fell.
- the Log section allows to track what actually happens in your Payara Micro Cluster during such scaling in/out. In particular, you can refer to:
- lb_manager.log at the HAProxy node to see the new hosts being automatically added to/removed from the load balancer routing
- run.log within application server layer to track the ongoing cluster activities
Also, you’ll be notified on all scaling changes with the corresponding email messages.
In such a way, you can be sure that a Java application within your Payara cluster will be able to handle diverse amount of incoming traffic without the necessity to keep an eye on its change. Moreover, this will be done with the highest efficiency – automatically adding new resources & servers on load spikes and removing the redundant ones during the time of inactivity, eliminating you from any manual reconfiguration mess. Just try it for yourself with two weeks of free trial on our jelastic cloud.