SlideShare a Scribd company logo
Scaling Jakarta EE Applications
Vertically and Horizontally
with Jelastic PaaS
About Speaker
● Ruslan Synytsky
● CEO and co-founder of Jelastic PaaS
● Java Champion
● Two-times Duke’s Choice Award Winner
● Former lead of engineering team at
National Data Center (NDC) at National
Space Agency of Ukraine
● @siruslan
Agenda
● Vertical vs Horizontal Scaling
● Scaling Jakarta EE Applications
in VMs and Containers
● Overcoming Problems of Java
Vertical Scaling
● Testing Java Vertical and
Horizontal Scaling with Jakarta EE
Application Server
Vertical and Horizontal
Scaling
Vertical vs Horizontal Scaling
Vertical Scaling Horizontal Scaling
VS
Vertical Scaling Pros & Cons
● Easy to deploy and configure
● No code change required during scaling up
● No need in data synchronization
● No network connection and latency issues
● No complexity of multiple instances management
● Cost efficiency, minimal overhead comparing to
running several nodes
● Instances with large memory limits available across
different infrastructure providers
● The fastest way to boost performance
● No high availability - significant risk of
downtime if the server fails or a load exceeds
the available resource
● Rolling deployments without downtime is
difficult and available only if supported at the
runtime stack level
● Hard to migrate to a bigger physical box, live
migration support is required in virtualized
environments for keeping uptime
The ability to grow or shrink the resources available to a particular instance
in order to react on load changes in fast and flexible way
Pros Cons
Horizontal Scaling Pros & Cons
● Easier to achieve fault-tolerance and high
availability
● Better resilience of data and services
● Rolling deployments without going offline
● Better performance at highly loaded projects
● Available tools to configure scaling without
extensive tech knowledge required
● Must have for business and mission critical
applications
● Designing scalable applications can be a
challenge
● Complexity of data distribution and parallel
processing, less consistency, large number of
cross-server communications
● Higher overallocation of resources
● Often purchase of additional licenses required
● Increased load and management complexity
on the network level
Pros Cons
The process of changing the number of nodes in order to enable
high availability and improve performance
Scaling Jakarta EE in
VMs & Containers
Resource Limit vs Real Usage in VM and Container
VMs vs Container Vertical Scaling
Resizing of the same container on the fly is
easier, cheaper and faster than moving to a larger VM
Automatic Vertical Scaling
Every container hosted with
Jelastic PaaS is divided into
granular units – cloudlets
(128MiB of RAM and 400MHz of
CPU)
Automatic Vertical Scaling
You can set up a maximum
Scaling Limit for each container,
so the resources will be always
available in case of load spikes
or other consumption changes
Jelastic PaaS adjusts configs of certified Java software stacks based on the
vertical scaling limits
Automatic Stacks Adjusting based on Scaling Limits
Environment variable
XMX_DEF_PERCENT=80
UNDERALLOCATION
JVM Vertical Scaling
OK OVERALLOCATION
Using automatic vertical scaling, cloud provides can offer economically
advantageous pricing based on the actual resource consumption
Forbes - Deceptive Cloud Efficiency: Do You Really Pay As You Use?
Pay-As-You-Go Pay-per-Use
Pay-As-You-Go vs Pay-per-Use
Real Statistics of Resource Consumption with Containers
Containers Horizontal Scaling
Stateless (Create New) vs Stateful (Clone)
MasterMaster Worker Worker
Stateless Stateful
Stateless mode creates an empty node from
a base container image template.
Works faster than stateful and easy to
parallelize the scaling process.
Stateful mode creates a new node as a full
copy (clone) from the master.
Usually takes longer than stateless, but data is
replicated automatically.
Empty Clone
Horizontal Scaling of Jakarta EE Containers
Automatic Horizontal Scaling of Jakarta EE Containers
Anti-Affinity Rules
All newly added containers of
the single layer are created
at the different hosts,
providing advanced
high-availability and failover
protection.
Automation of Scaling with Cloud Scripting
Possibility to perform custom automation actions at the scaling events using Cloud Scripting
● onBeforeScaleOut
● onAfterScaleOut
● onBeforeScaleIn
● onAfterScaleIn
● onBeforeServiceScaleOut
● onAfterServiceScaleOut
● onBeforeAddNode
● onAfterAddNode
● onBeforeRemoveNode
● onAfterRemoveNode
● onBeforeSetCloudletCount
● onAfterSetCloudletCount
Automatic Clusterization of Jakarta EE Application Servers
Clustering mode can be automatically enabled from the topology wizard.
Interconnected servers with pre-configured session replication and load balancing
provides high availability across nodes and guarantees continuous performance of
deployed Java applications.
Automatic Clusterization of Jakarta EE Containers
Jakarta EE 9 Support
● Tomcat
● TomEE
● GlassFish
● WildFly
● Jetty
● Payara is coming
● OpenLiberty is coming
Overcoming Java
Memory Waste
Most Challenging Aspect of Working with Jakarta EE
Jakarta EE Developer Survey 2018
“The most widely acknowledged issue
when employing with Java EE is
large memory requirements (40%)”
Unreleased Heap Memory
Over-Allocation and Underutilization
The Problem Symptoms
Timely Reduce Unused Committed Memory (JEP 346)
Make the G1 garbage collector automatically give back Java heap memory
to the operating system when idle
● -XX:G1PeriodicGCInterval=[milliseconds]
● -XX:G1PeriodicGCSystemLoadThreshold=[float]
● -XX:+G1PeriodicGCInvokesConcurrent
JEP 346: Promptly Return Unused Committed Memory from G1
java -Xmx2g -XX:+UseG1GC -XX:G1PeriodicGCInterval=900k
-XX:G1PeriodicGCSystemLoadThreshold=0.6 -jar app.jar
Available from Java 12
Immediately Improved Heap Elasticity
Automatically Released Heap
Community Recognition
Workaround for Java < 12: Calling Full GC Periodically
https://github.com/jelastic-
jps/java-memory-agent
As compacting GC cycles are not triggered automatically, we execute them explicitly by
injecting an agent which monitors the memory usage and calls System.gc() periodically:
-javaagent:jelastic-gc-agent.jar=period=300,debug=true
G1 and Full GC
java -XX:+UseG1GC -Xmx2g -jar app.jar
https://github.com/jelastic/java-vertical-scaling-test
Running GC Tests
with Jakarta EE
● simple .war artifact deployed with GlassFish 5
● JSP that sets 1MB attribute in session
● 1 min session timeout
● https://github.com/jelastic/java-vertical-scaling-test/tree/jakartaee/webapp
Load Testing of Vertical Scaling with GlassFish 5
Load test GETs webapp endpoint n times
for i in {1..n}; do curl -s localhost:8080 > /dev/null; done
Parallel
-Xmx3g -XX:+UseCompressedOops -XX:+UseParallelGC
for i in {1..1000}; do curl -s localhost:8080 > /dev/null; done
G1
-Xmx3g -XX:+UseCompressedOops -XX:+UseG1GC
for i in {1..1000}; do curl -s localhost:8080 > /dev/null; done
Shenandoah
-Xmx3g -XX:+UseCompressedOops -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
for i in {1..1000}; do curl -s localhost:8080 > /dev/null; done
Main Points of Elastic Vertical Scaling
A - initial usage
B - maximum usage
C - growth speed
D - duration before release
E - release speed
F - minimum usage after release
Different GCs provide different results and fine tuning options
Vertical and Horizontal Scaling in Jelastic PaaS
Vertical Scaling
● Solving right-sizing problem - no need
to guess in advance how much
resources to allocate
● RAM and CPU are available
accordingly to the runtime needs and
specified container scaling limits
● The actual consumption is
automatically monitored and billed
according to the real use
● Ability to adjust maximum scaling
limits without migration required
Horizontal Scaling
● Solving high-availability problem -
easy to start with production ready
environment
● Automated clusterization (aka
auto-clustering) reduces complexity
of scaling management
● Automatic scaling based on triggers
● Stateful and stateless scaling mode
● Anti-affinity distribution rules
● Flexible node group management
options via UI, API and JPS
Request Jakarta EE Scaling Optimization
If you have scaling or memory usage
issues with Jakarta EE applications
running in containers or VMs request
an assistance:
savememory@jelastic.com

More Related Content

What's hot (20)

PDF
JVM and Garbage Collection Tuning
Kai Koenig
 
PDF
Java & containers: What I wish I knew before I used it | DevNation Tech Talk
Red Hat Developers
 
PDF
A guide of PostgreSQL on Kubernetes
t8kobayashi
 
PDF
DevoxxUK: Optimizating Application Performance on Kubernetes
Dinakar Guniguntala
 
PDF
Performance Tuning - Understanding Garbage Collection
Haribabu Nandyal Padmanaban
 
PDF
Spark / Mesos Cluster Optimization
ebiznext
 
PDF
The Case For Docker In Multi-Cloud Enabled Bioinformatics Applications
Ahmed Abdullah
 
PDF
Antoine Coetsier - billing the cloud
ShapeBlue
 
PDF
Garbage First and you
Kai Koenig
 
PDF
Supporting bioinformatics applications with hybrid multi-cloud services
Ahmed Abdullah
 
PPTX
Tuning Java GC to resolve performance issues
Sergey Podolsky
 
PDF
Boyan Krosnov - Building a software-defined cloud - our experience
ShapeBlue
 
PDF
Suning OpenStack Cloud and Heat
Qiming Teng
 
PDF
Kubernetes on Bare Metal at the Kitchener-Waterloo Kubernetes and Cloud Nativ...
CloudOps2005
 
PDF
GC Tuning in the HotSpot Java VM - a FISL 10 Presentation
Ludovic Poitou
 
PDF
XCP-ng - past, present and future
ShapeBlue
 
PPT
Jvm Performance Tunning
guest1f2740
 
PDF
淺談 Java GC 原理、調教和 新發展
Leon Chen
 
PDF
JVM Memory Management Details
Azul Systems Inc.
 
PPTX
Deploy an Elastic, Resilient, Load-Balanced Cluster in 5 Minutes with Senlin
Qiming Teng
 
JVM and Garbage Collection Tuning
Kai Koenig
 
Java & containers: What I wish I knew before I used it | DevNation Tech Talk
Red Hat Developers
 
A guide of PostgreSQL on Kubernetes
t8kobayashi
 
DevoxxUK: Optimizating Application Performance on Kubernetes
Dinakar Guniguntala
 
Performance Tuning - Understanding Garbage Collection
Haribabu Nandyal Padmanaban
 
Spark / Mesos Cluster Optimization
ebiznext
 
The Case For Docker In Multi-Cloud Enabled Bioinformatics Applications
Ahmed Abdullah
 
Antoine Coetsier - billing the cloud
ShapeBlue
 
Garbage First and you
Kai Koenig
 
Supporting bioinformatics applications with hybrid multi-cloud services
Ahmed Abdullah
 
Tuning Java GC to resolve performance issues
Sergey Podolsky
 
Boyan Krosnov - Building a software-defined cloud - our experience
ShapeBlue
 
Suning OpenStack Cloud and Heat
Qiming Teng
 
Kubernetes on Bare Metal at the Kitchener-Waterloo Kubernetes and Cloud Nativ...
CloudOps2005
 
GC Tuning in the HotSpot Java VM - a FISL 10 Presentation
Ludovic Poitou
 
XCP-ng - past, present and future
ShapeBlue
 
Jvm Performance Tunning
guest1f2740
 
淺談 Java GC 原理、調教和 新發展
Leon Chen
 
JVM Memory Management Details
Azul Systems Inc.
 
Deploy an Elastic, Resilient, Load-Balanced Cluster in 5 Minutes with Senlin
Qiming Teng
 

Similar to Scaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaS (20)

PDF
Automated Scaling of Microservice Stacks for JavaEE Applications
Jelastic Multi-Cloud PaaS
 
PDF
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Jelastic Multi-Cloud PaaS
 
PDF
JEEconf 2017
Ihor Kolodyuk
 
PDF
Multi-Containers Orchestration with Live Migration and High-Availability for ...
Jelastic Multi-Cloud PaaS
 
PDF
Jelastic Features 2.x
Ruslan Synytsky
 
PDF
Jelastic DevOps Platform Product Overview for ISVs
Jelastic Multi-Cloud PaaS
 
PDF
Jelastic DevOps Platform Product Overview for Service Providers
Jelastic Multi-Cloud PaaS
 
PDF
Multi-Cloud Lightweight Platform as a Service
Jelastic Multi-Cloud PaaS
 
PDF
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
Jelastic Multi-Cloud PaaS
 
PDF
JavaOne Latin America - DevOps with Containers for Java
Jelastic Multi-Cloud PaaS
 
PDF
Jelastic Enterprise
Julio Pari
 
PDF
Running Projects in Application Containers, System Containers & VMs - Jelasti...
Jelastic Multi-Cloud PaaS
 
PDF
Java scalability considerations yogesh deshpande
IndicThreads
 
PDF
Jelastic DevOps VPC and Hybrid Cloud
Jelastic Multi-Cloud PaaS
 
PPTX
Jelastic Overview: Technical and Business Benefits
Tetiana Fydorenchyk
 
PDF
Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...
DevOpsDays Tel Aviv
 
PDF
Jelastic Overview
Jelastic Multi-Cloud PaaS
 
PDF
JELASTIC IS THE PIONEER AND VISIONARY IN THE CLOUD INDUSTRY
Ruslan Synytsky
 
PDF
Grow your business with Jelastic - WHD.global 2015
Jelastic Multi-Cloud PaaS
 
PPT
The Economies of Scaling Software
Abdelmonaim Remani
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Jelastic Multi-Cloud PaaS
 
Automated scaling of microservice stacks for JavaEE applications - JEEConf 2017
Jelastic Multi-Cloud PaaS
 
JEEconf 2017
Ihor Kolodyuk
 
Multi-Containers Orchestration with Live Migration and High-Availability for ...
Jelastic Multi-Cloud PaaS
 
Jelastic Features 2.x
Ruslan Synytsky
 
Jelastic DevOps Platform Product Overview for ISVs
Jelastic Multi-Cloud PaaS
 
Jelastic DevOps Platform Product Overview for Service Providers
Jelastic Multi-Cloud PaaS
 
Multi-Cloud Lightweight Platform as a Service
Jelastic Multi-Cloud PaaS
 
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
Jelastic Multi-Cloud PaaS
 
JavaOne Latin America - DevOps with Containers for Java
Jelastic Multi-Cloud PaaS
 
Jelastic Enterprise
Julio Pari
 
Running Projects in Application Containers, System Containers & VMs - Jelasti...
Jelastic Multi-Cloud PaaS
 
Java scalability considerations yogesh deshpande
IndicThreads
 
Jelastic DevOps VPC and Hybrid Cloud
Jelastic Multi-Cloud PaaS
 
Jelastic Overview: Technical and Business Benefits
Tetiana Fydorenchyk
 
Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...
DevOpsDays Tel Aviv
 
Jelastic Overview
Jelastic Multi-Cloud PaaS
 
JELASTIC IS THE PIONEER AND VISIONARY IN THE CLOUD INDUSTRY
Ruslan Synytsky
 
Grow your business with Jelastic - WHD.global 2015
Jelastic Multi-Cloud PaaS
 
The Economies of Scaling Software
Abdelmonaim Remani
 
Ad

More from Jelastic Multi-Cloud PaaS (17)

PDF
Kubernetes and Nested Containers: Enhanced 3 Ps (Performance, Price and Provi...
Jelastic Multi-Cloud PaaS
 
PDF
SaaSification in Action. Attracting Software Vendors with Easy Transformation
Jelastic Multi-Cloud PaaS
 
PDF
State of the Art UI - Overview of Jelastic PaaS Functionality
Jelastic Multi-Cloud PaaS
 
PDF
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
Jelastic Multi-Cloud PaaS
 
PDF
Automating CICD Pipeline with GitLab and Docker Containers for Java Applications
Jelastic Multi-Cloud PaaS
 
PDF
Cloud Hosting Business in Africa: Market Specifics and Ways to Grow
Jelastic Multi-Cloud PaaS
 
PPSX
Auto Scaling for Multi-Tier Containers Topology
Jelastic Multi-Cloud PaaS
 
PDF
DevOps Epoch 2016
Jelastic Multi-Cloud PaaS
 
PDF
Онлайн миграция контейнеров. Взгляд изнутри
Jelastic Multi-Cloud PaaS
 
PDF
Jelastic - DevOps PaaS Business with Docker Support for Service Providers
Jelastic Multi-Cloud PaaS
 
PDF
Jelastic Turnkey Cloud PaaS for Developers
Jelastic Multi-Cloud PaaS
 
PDF
Jelastic - Containers Live Migration Behind the Scene
Jelastic Multi-Cloud PaaS
 
PDF
Jelastic Reselling Option for Hosting Providers and MSPs
Jelastic Multi-Cloud PaaS
 
PDF
Docker and DevOps Trends in Hosting Industry
Jelastic Multi-Cloud PaaS
 
PDF
Jelastic Turnkey Cloud PaaS for Hosting Business
Jelastic Multi-Cloud PaaS
 
PDF
Jelastic - Turn Containers into Money Making Machine - WHD.global 2016
Jelastic Multi-Cloud PaaS
 
PDF
Jelastic Cluster Admin Panel Overview
Jelastic Multi-Cloud PaaS
 
Kubernetes and Nested Containers: Enhanced 3 Ps (Performance, Price and Provi...
Jelastic Multi-Cloud PaaS
 
SaaSification in Action. Attracting Software Vendors with Easy Transformation
Jelastic Multi-Cloud PaaS
 
State of the Art UI - Overview of Jelastic PaaS Functionality
Jelastic Multi-Cloud PaaS
 
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
Jelastic Multi-Cloud PaaS
 
Automating CICD Pipeline with GitLab and Docker Containers for Java Applications
Jelastic Multi-Cloud PaaS
 
Cloud Hosting Business in Africa: Market Specifics and Ways to Grow
Jelastic Multi-Cloud PaaS
 
Auto Scaling for Multi-Tier Containers Topology
Jelastic Multi-Cloud PaaS
 
DevOps Epoch 2016
Jelastic Multi-Cloud PaaS
 
Онлайн миграция контейнеров. Взгляд изнутри
Jelastic Multi-Cloud PaaS
 
Jelastic - DevOps PaaS Business with Docker Support for Service Providers
Jelastic Multi-Cloud PaaS
 
Jelastic Turnkey Cloud PaaS for Developers
Jelastic Multi-Cloud PaaS
 
Jelastic - Containers Live Migration Behind the Scene
Jelastic Multi-Cloud PaaS
 
Jelastic Reselling Option for Hosting Providers and MSPs
Jelastic Multi-Cloud PaaS
 
Docker and DevOps Trends in Hosting Industry
Jelastic Multi-Cloud PaaS
 
Jelastic Turnkey Cloud PaaS for Hosting Business
Jelastic Multi-Cloud PaaS
 
Jelastic - Turn Containers into Money Making Machine - WHD.global 2016
Jelastic Multi-Cloud PaaS
 
Jelastic Cluster Admin Panel Overview
Jelastic Multi-Cloud PaaS
 
Ad

Recently uploaded (20)

PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
July Patch Tuesday
Ivanti
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 

Scaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaS

  • 1. Scaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaS
  • 2. About Speaker ● Ruslan Synytsky ● CEO and co-founder of Jelastic PaaS ● Java Champion ● Two-times Duke’s Choice Award Winner ● Former lead of engineering team at National Data Center (NDC) at National Space Agency of Ukraine ● @siruslan
  • 3. Agenda ● Vertical vs Horizontal Scaling ● Scaling Jakarta EE Applications in VMs and Containers ● Overcoming Problems of Java Vertical Scaling ● Testing Java Vertical and Horizontal Scaling with Jakarta EE Application Server
  • 5. Vertical vs Horizontal Scaling Vertical Scaling Horizontal Scaling VS
  • 6. Vertical Scaling Pros & Cons ● Easy to deploy and configure ● No code change required during scaling up ● No need in data synchronization ● No network connection and latency issues ● No complexity of multiple instances management ● Cost efficiency, minimal overhead comparing to running several nodes ● Instances with large memory limits available across different infrastructure providers ● The fastest way to boost performance ● No high availability - significant risk of downtime if the server fails or a load exceeds the available resource ● Rolling deployments without downtime is difficult and available only if supported at the runtime stack level ● Hard to migrate to a bigger physical box, live migration support is required in virtualized environments for keeping uptime The ability to grow or shrink the resources available to a particular instance in order to react on load changes in fast and flexible way Pros Cons
  • 7. Horizontal Scaling Pros & Cons ● Easier to achieve fault-tolerance and high availability ● Better resilience of data and services ● Rolling deployments without going offline ● Better performance at highly loaded projects ● Available tools to configure scaling without extensive tech knowledge required ● Must have for business and mission critical applications ● Designing scalable applications can be a challenge ● Complexity of data distribution and parallel processing, less consistency, large number of cross-server communications ● Higher overallocation of resources ● Often purchase of additional licenses required ● Increased load and management complexity on the network level Pros Cons The process of changing the number of nodes in order to enable high availability and improve performance
  • 8. Scaling Jakarta EE in VMs & Containers
  • 9. Resource Limit vs Real Usage in VM and Container
  • 10. VMs vs Container Vertical Scaling Resizing of the same container on the fly is easier, cheaper and faster than moving to a larger VM
  • 11. Automatic Vertical Scaling Every container hosted with Jelastic PaaS is divided into granular units – cloudlets (128MiB of RAM and 400MHz of CPU)
  • 12. Automatic Vertical Scaling You can set up a maximum Scaling Limit for each container, so the resources will be always available in case of load spikes or other consumption changes
  • 13. Jelastic PaaS adjusts configs of certified Java software stacks based on the vertical scaling limits Automatic Stacks Adjusting based on Scaling Limits Environment variable XMX_DEF_PERCENT=80
  • 15. Using automatic vertical scaling, cloud provides can offer economically advantageous pricing based on the actual resource consumption Forbes - Deceptive Cloud Efficiency: Do You Really Pay As You Use? Pay-As-You-Go Pay-per-Use Pay-As-You-Go vs Pay-per-Use
  • 16. Real Statistics of Resource Consumption with Containers
  • 18. Stateless (Create New) vs Stateful (Clone) MasterMaster Worker Worker Stateless Stateful Stateless mode creates an empty node from a base container image template. Works faster than stateful and easy to parallelize the scaling process. Stateful mode creates a new node as a full copy (clone) from the master. Usually takes longer than stateless, but data is replicated automatically. Empty Clone
  • 19. Horizontal Scaling of Jakarta EE Containers
  • 20. Automatic Horizontal Scaling of Jakarta EE Containers
  • 21. Anti-Affinity Rules All newly added containers of the single layer are created at the different hosts, providing advanced high-availability and failover protection.
  • 22. Automation of Scaling with Cloud Scripting Possibility to perform custom automation actions at the scaling events using Cloud Scripting ● onBeforeScaleOut ● onAfterScaleOut ● onBeforeScaleIn ● onAfterScaleIn ● onBeforeServiceScaleOut ● onAfterServiceScaleOut ● onBeforeAddNode ● onAfterAddNode ● onBeforeRemoveNode ● onAfterRemoveNode ● onBeforeSetCloudletCount ● onAfterSetCloudletCount
  • 23. Automatic Clusterization of Jakarta EE Application Servers Clustering mode can be automatically enabled from the topology wizard. Interconnected servers with pre-configured session replication and load balancing provides high availability across nodes and guarantees continuous performance of deployed Java applications.
  • 24. Automatic Clusterization of Jakarta EE Containers
  • 25. Jakarta EE 9 Support ● Tomcat ● TomEE ● GlassFish ● WildFly ● Jetty ● Payara is coming ● OpenLiberty is coming
  • 27. Most Challenging Aspect of Working with Jakarta EE Jakarta EE Developer Survey 2018 “The most widely acknowledged issue when employing with Java EE is large memory requirements (40%)”
  • 28. Unreleased Heap Memory Over-Allocation and Underutilization The Problem Symptoms
  • 29. Timely Reduce Unused Committed Memory (JEP 346) Make the G1 garbage collector automatically give back Java heap memory to the operating system when idle ● -XX:G1PeriodicGCInterval=[milliseconds] ● -XX:G1PeriodicGCSystemLoadThreshold=[float] ● -XX:+G1PeriodicGCInvokesConcurrent JEP 346: Promptly Return Unused Committed Memory from G1 java -Xmx2g -XX:+UseG1GC -XX:G1PeriodicGCInterval=900k -XX:G1PeriodicGCSystemLoadThreshold=0.6 -jar app.jar Available from Java 12
  • 30. Immediately Improved Heap Elasticity Automatically Released Heap
  • 32. Workaround for Java < 12: Calling Full GC Periodically https://github.com/jelastic- jps/java-memory-agent As compacting GC cycles are not triggered automatically, we execute them explicitly by injecting an agent which monitors the memory usage and calls System.gc() periodically: -javaagent:jelastic-gc-agent.jar=period=300,debug=true
  • 33. G1 and Full GC java -XX:+UseG1GC -Xmx2g -jar app.jar https://github.com/jelastic/java-vertical-scaling-test
  • 34. Running GC Tests with Jakarta EE
  • 35. ● simple .war artifact deployed with GlassFish 5 ● JSP that sets 1MB attribute in session ● 1 min session timeout ● https://github.com/jelastic/java-vertical-scaling-test/tree/jakartaee/webapp Load Testing of Vertical Scaling with GlassFish 5 Load test GETs webapp endpoint n times for i in {1..n}; do curl -s localhost:8080 > /dev/null; done
  • 36. Parallel -Xmx3g -XX:+UseCompressedOops -XX:+UseParallelGC for i in {1..1000}; do curl -s localhost:8080 > /dev/null; done
  • 37. G1 -Xmx3g -XX:+UseCompressedOops -XX:+UseG1GC for i in {1..1000}; do curl -s localhost:8080 > /dev/null; done
  • 38. Shenandoah -Xmx3g -XX:+UseCompressedOops -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact for i in {1..1000}; do curl -s localhost:8080 > /dev/null; done
  • 39. Main Points of Elastic Vertical Scaling A - initial usage B - maximum usage C - growth speed D - duration before release E - release speed F - minimum usage after release Different GCs provide different results and fine tuning options
  • 40. Vertical and Horizontal Scaling in Jelastic PaaS Vertical Scaling ● Solving right-sizing problem - no need to guess in advance how much resources to allocate ● RAM and CPU are available accordingly to the runtime needs and specified container scaling limits ● The actual consumption is automatically monitored and billed according to the real use ● Ability to adjust maximum scaling limits without migration required Horizontal Scaling ● Solving high-availability problem - easy to start with production ready environment ● Automated clusterization (aka auto-clustering) reduces complexity of scaling management ● Automatic scaling based on triggers ● Stateful and stateless scaling mode ● Anti-affinity distribution rules ● Flexible node group management options via UI, API and JPS
  • 41. Request Jakarta EE Scaling Optimization If you have scaling or memory usage issues with Jakarta EE applications running in containers or VMs request an assistance: [email protected]