DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
What's in store for DevOps in 2023? Hear from the experts in our "DZone 2023 Preview: DevOps Edition" on Fri, Jan 27!
Save your seat
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Auto-Scalable Payara Micro Cluster for Java EE Microservices

Auto-Scalable Payara Micro Cluster for Java EE Microservices

An advanced package has been developed to help make Payara Micro Cluster integration with Jelastic Platform smooth and quick.

Tetiana Markova user avatar by
Tetiana Markova
·
Feb. 23, 17 · Tutorial
Like (10)
Save
Tweet
Share
5.53K Views

Join the DZone community and get the full member experience.

Join For Free

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 from the embedded java api and simple management by allowing running 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

the 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. payara micro cluster package

this solution is built 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 and 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 6,400 mhz of cpu and 2,048 mib ram) based on the load. this allows you 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 the payara micro cluster with all additional scaling configurations represents a completely automated process. all you need to do is import the corresponding project from the jelastic jps collection at github.

1. import the url

click the import button on the top pane of the dashboard and insert the jps link in the url tab.

click import at the bottom of the frame to proceed.

installation of payara micro cluster

2. specify parameters

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 the dashboard.
  • region. select the preferable hardware region (if available).

click install to proceed.

install payara micro cluster

3. wait...

wait a few minutes for jelastic to automatically create all of the required instances and configure the cluster for future automation.

payara cluster easy installation

that’s it! payara micro cluster with out-of-the-box automated scaling is successfully deployed and ready for work. now, let’s check how it can cope with traffics of varying intensities.

payara cluster load testing and 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.

payara cluster load testing

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 an internal or a custom one).

http://{env.domain}/loader : open the load test to simulate the load

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 % for ram and threads for cpu).
  • duration: testing time (in seconds).

click on run for the appropriate section.

1. launch the tests

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 tests will be run in just two 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 4,400 mhz of cpu consumption.

cpu test payara micro

for the 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.

ram test

when loading is finished, you’ll see the calling gc string appear, means that garbage сollection is 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 spend.

2. see results

to see the result, you can refer to the statistics dashboard section for your payara cluster and follow load changes visually, in the form of graphs. 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.

payara cluster statistics

the cpu load graph (on the left) 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.

auto horizontal scaling payara

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. payara cluster auto scaling

3. track the results

to track the results of horizontal scaling while running the tests, you can use the following built-in 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. payara cluster settings

as you can see, the cluster scaled out up to two 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 you 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 and removed from the load balancer routing. lb manager log
  • run.log within the application server layer to track the ongoing cluster activities. run log inbuilt tool for tracking activities

also, you’ll be notified of 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 a 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 and servers on load spikes and removing the redundant ones during the time of inactivity, eliminating you from any manual reconfiguration mess.

have any questions or comments for the further improvements? need some additional assistance with the package installation or hosting? let us know with a comment below or refer for the help from our technical experts at stack overflow .

Docker (software) clustering Java EE Java (programming language) Scaling (geometry) application Testing microservice Application server Load testing

Published at DZone with permission of Tetiana Markova, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • The Role of Data Governance in Data Strategy: Part II
  • Educating the Next Generation of Cloud Engineers With Google Cloud
  • Pros and Cons of Using Styled Components in React
  • (Deep) Cloning Objects in JavaScript

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: