SlideShare a Scribd company logo
Automated Scaling of Microservice Stacks 

for
JavaEE Applications
by Ihor Kolodyuk
Few words about me …
Driving technology direction at Jelastic
Like to solve unsolvable problems
Checking technology concepts on practice
Why I am here?
I want to talk to you about:
General autoscaling concept for JavaEE applications
Real use cases. Real issues. Tricky things
My goals are:
Save your time if you decide you need to scale your app
Share our own experience
I just deploy my application to Docker, set a number of replicas and
… have it running … bla bla bla … super easy! Done!
The myth
Yes, pretty easy …

If you need a super scalable and clustered Hello World application …
In real life with JavaEE application
we have architecture similar to this
and its autoscaling becomes not a very trivial task…
The truth
Legacy Application
Scalable Cluster
Autoscalable Cluster
Theoretical part
At least 3 key things to make your
applications scalable
First:
Adapted runtime
(Container + JVM + JavaEE Server)
micro
Preferably, thin versions of application servers
YES!NO!
micro
glassfish
There are various versions adapted
for lightweight containers
Any specific reason to use
VMs for microservices?
NO!
Well…it might be, but …
What should we use instead?
YES!
One container - one microservice
instance
YES! NO!
Second:
Application
prepared for microservices
APP
MS
MS MS
MS
SORRY,
Application
prepared for SCALABLE microservices
Next few slides can be a bit boring for those
who know…
BUT
Still important!!!!!!
Ideal scaling and decomposition
horizontal
vertical
topology
Decomposition into microservice
At least 2 key approaches
Logical division
Splitting bigger parts into smaller
1.Analyse metrics (NewRelic / JavaVisualVM)
2.Find a weak point (!)
3.Move this part to microservice
4.Repeat
Third:
Orchestration software
What it typically does?
CONTAINERS

PROVISIONING
HEALTHCHECKS
METRICS

GATHERING
APPLICATION 

LIFECYCLE

MANAGEMENT
SCALING
AUTOMATIC 

LOAD

BALANCING
SERVICE

DISCOVERY

&

CONNECTIVITY
CUSTOM
SCRIPTING*
Typical triggers that are used for scaling
CPU RAM
HDD

(disk I/O)
NETWORK
SERVICE

FAILURE
SCHEDULER
Practical part
Tricky things
Typical issues
Examples 

Tricky thing #1
In which direction to scale?
horizontal
vertical
topology
Example #1
Message Queue Service
Triggers configuration
CPU
RAM
HDD (disk I/O)
NETWORK
SCHEDULER YES
NO
PROBABLY NO
GENERAL SET
GENERAL SET
Scaling type HORIZONTAL
Tricky place
Example #2
Databases
CPU
RAM
HDD (disk I/O)
NETWORK
SCHEDULER
YES
VERTICAL
NO
NO
NO
Scaling type
Triggers configuration
YES
Typical issues while scaling of database instances
Takes much time to sync data
Temporary locks
Temporary performance degradation
Hard to use auto horizontal scaling
Automatic vertical scaling can be used just fine
It’s better to keep spare instances underloaded
(dedicated storage per instance)
RESUME
Example #3
Legacy JavaEE application
TOPOLOGY
Java EE Server
Business Tier
Web Tier
JSP App1 JSP App2 JSP App2
EJB App1 EJB App2
Java EE 

Micro Instance
JSP App1
Java EE 

Micro Instance
JSP App1
Java EE 

Micro Instance
JSP App1
Java EE 

Micro Instance
JSP App1
Java EE 

Micro Instance
JSP App1
Java EE 

Micro Instance
JSP App2
Java EE 

Micro Instance
JSP App1
Java EE 

Micro Instance
JSP App1
Java EE 

Micro Instance
EJB App2
Java EE 

Micro Instance
JSP App1
Java EE 

Micro Instance
JSP App1
Java EE 

Micro Instance
EJB App2
Scaling type
Tricky thing #2
Events subscription
Usually, just spinning up an extra instance is NOTenough
Example #1
Typical ScaleIn/ScaleOut events and cases
onAfterScaleOut[nodeGroup:ejb-app1] {
“call”: “registerNodeInMonitoringSystem”,
“call”: “addMemberToHazelcast”,
“call”: “call3rdPartyApiService”
}
onAfterScaleIn[nodeGroup:jsp-app2] {
“call”: “removeNodeFromMonitoringSystem”,
“call”: “removeMemberFromHazelcast”
}
THE FULL WORKING AND MORE COMPLEX CODE EXAMPLE CAN BE FOUND HERE
Example #2
2. Get auth keys by instance before joining DAS
onBeforeStartService[nodeGroup:instance] {
“cmd”: “/root/scripts/pullAccessKeys.sh ${token}”
}
THE FULL WORKING AND MORE COMPLEX CODE EXAMPLE CAN BE FOUND HERE
1. Decrypt encrypted volume, that was attached on-fly
onAfterVolumeAttached[nodeGroup:instance] {
“call”: “decryptVolume”
}
3. Deprovision node from DAS if cluster was shrinked
onAfterScaleOut[nodeGroup:das] {
“cmd”: “./asadmin_proxy remove ${instance[@last].ip}”
}
Tricky thing #3
Proper triggers configuration
This tuning is a long process, so be patient
Typical problem #1
Changing the value in one place can be reflected in other places
How to deal with this?
Load Testing
Gathering

Metrics
Detect deviations in a testing loop
Analyzing

Metrics
Edit
Triggers
Com
pare previous 

results
Typical problem #2
The triggers can become outdated with new code
The fix is easy here
Inject metrics collection as a part of your CI/CD step
COMMIT BUILD TESTING
PERFORMANCE

ANALYSIS
DELIVERY
Tricky thing #4
Getting rid of spare things
Typical problem #1
Network is full of useless traffic
Total bandwidth
Multicast | Heartbeats
Useful traffic
What we can do?
Avoid multicast (for members detection)
Use events and static members lists
Static members list Static members list Static members list
Orchestrator
Typical problem #2
Some of JavaEE Servers are designed for VMs, not for containers
On example of Weblogic
VM VM VM VM
What is the right way to go?
Just remove everything spare
LIVE demo comes here
QUESTIONS
CONTACTS
http://jelastic.com ihor.kolodyuk@jelastic.com

More Related Content

PPTX
Microservices: Another Way
PPTX
JEEConf - Designing a DSL in Kotlin
PDF
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
PPT
Dashboard project.
PPTX
Moving Applications into Azure Kubernetes
PPTX
Deploying Containers on Azure
PPTX
The Microservices world in. NET Core and. NET framework
PPTX
Best Practices with Azure & Kubernetes
Microservices: Another Way
JEEConf - Designing a DSL in Kotlin
From VMs to Containers: Decompose and Migrate Old Legacy JavaEE Application
Dashboard project.
Moving Applications into Azure Kubernetes
Deploying Containers on Azure
The Microservices world in. NET Core and. NET framework
Best Practices with Azure & Kubernetes

What's hot (20)

PPTX
Containers and VMs and Clouds: Oh My. by Mike Coleman
PDF
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
PPTX
Windows azurequickstart
PDF
Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič
PDF
Kubernetes in Azure
PPTX
Hosting Microservices in Microsoft Azure
PDF
CQRS and ES with Lagom
PPTX
Container DevOps in Azure
PDF
Azure Kubernetes Service - benefits and challenges
PPTX
Container on azure
PPTX
Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...
ODP
Hybris install telco accelerators on aws-ec2
PPTX
Azure Service Fabric: The road ahead for microservices
PPTX
Securing an Azure full-PaaS architecture - Data saturday #0001 Pordenone
PPTX
Achieving Cost and Resource Efficiency through Docker, OpenShift and Kubernetes
PPTX
Service Fabric Overview (Yves Goeleven)
PPTX
Windows Azure
PPTX
Container Orchestration with Docker Swarm and Kubernetes
PDF
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
PPTX
Why Kubernetes on Azure
Containers and VMs and Clouds: Oh My. by Mike Coleman
How to Make Money Solving 5 Major Problems of Cloud Hosting Customers
Windows azurequickstart
Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič
Kubernetes in Azure
Hosting Microservices in Microsoft Azure
CQRS and ES with Lagom
Container DevOps in Azure
Azure Kubernetes Service - benefits and challenges
Container on azure
Consolidating Infrastructure with Azure Kubernetes Service - MS Online Tech F...
Hybris install telco accelerators on aws-ec2
Azure Service Fabric: The road ahead for microservices
Securing an Azure full-PaaS architecture - Data saturday #0001 Pordenone
Achieving Cost and Resource Efficiency through Docker, OpenShift and Kubernetes
Service Fabric Overview (Yves Goeleven)
Windows Azure
Container Orchestration with Docker Swarm and Kubernetes
Andrea Tosatto - Kubernetes Beyond - Codemotion Milan 2017
Why Kubernetes on Azure
Ad

Similar to JEEconf 2017 (20)

PDF
Automated Scaling of Microservice Stacks for JavaEE Applications
PDF
Scaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaS
PDF
The Need of Cloud-Native Application
PPTX
Microservices approach for Websphere commerce
PDF
Java EE microservices architecture - evolving the monolith
PPSX
Auto Scaling for Multi-Tier Containers Topology
PDF
Stay productive while slicing up the monolith
PDF
Microservices, Data Services and Containers for Cloud Native Architectures (D...
PDF
Stay productive while slicing up the monolith
PDF
Java Microservices HJUG
PDF
Improving velocity through abstraction
PDF
Suning OpenStack Cloud and Heat
PDF
Microservices and Docker at Scale: The PB&J of Modern Systems
PPT
TransitioningToMicroServonDocker_MS
PPT
The economies of scaling software - Abdel Remani
PDF
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
PDF
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
PPT
The Economies of Scaling Software
PDF
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
PDF
Microservices for java architects it-symposium-2015-09-15
Automated Scaling of Microservice Stacks for JavaEE Applications
Scaling Jakarta EE Applications Vertically and Horizontally with Jelastic PaaS
The Need of Cloud-Native Application
Microservices approach for Websphere commerce
Java EE microservices architecture - evolving the monolith
Auto Scaling for Multi-Tier Containers Topology
Stay productive while slicing up the monolith
Microservices, Data Services and Containers for Cloud Native Architectures (D...
Stay productive while slicing up the monolith
Java Microservices HJUG
Improving velocity through abstraction
Suning OpenStack Cloud and Heat
Microservices and Docker at Scale: The PB&J of Modern Systems
TransitioningToMicroServonDocker_MS
The economies of scaling software - Abdel Remani
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
The Economies of Scaling Software
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Microservices for java architects it-symposium-2015-09-15
Ad

Recently uploaded (20)

PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPT
Teaching material agriculture food technology
PDF
Encapsulation theory and applications.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Monthly Chronicles - July 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Teaching material agriculture food technology
Encapsulation theory and applications.pdf
Chapter 3 Spatial Domain Image Processing.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Understanding_Digital_Forensics_Presentation.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Digital-Transformation-Roadmap-for-Companies.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

JEEconf 2017

  • 1. Automated Scaling of Microservice Stacks 
 for JavaEE Applications by Ihor Kolodyuk
  • 2. Few words about me … Driving technology direction at Jelastic Like to solve unsolvable problems Checking technology concepts on practice
  • 3. Why I am here? I want to talk to you about: General autoscaling concept for JavaEE applications Real use cases. Real issues. Tricky things My goals are: Save your time if you decide you need to scale your app Share our own experience
  • 4. I just deploy my application to Docker, set a number of replicas and … have it running … bla bla bla … super easy! Done! The myth
  • 5. Yes, pretty easy …
 If you need a super scalable and clustered Hello World application …
  • 6. In real life with JavaEE application we have architecture similar to this and its autoscaling becomes not a very trivial task…
  • 7. The truth Legacy Application Scalable Cluster Autoscalable Cluster
  • 9. At least 3 key things to make your applications scalable
  • 10. First: Adapted runtime (Container + JVM + JavaEE Server) micro
  • 11. Preferably, thin versions of application servers YES!NO!
  • 12. micro glassfish There are various versions adapted for lightweight containers
  • 13. Any specific reason to use VMs for microservices? NO!
  • 15. What should we use instead? YES!
  • 16. One container - one microservice instance YES! NO!
  • 19. Next few slides can be a bit boring for those who know… BUT Still important!!!!!!
  • 20. Ideal scaling and decomposition horizontal vertical topology
  • 21. Decomposition into microservice At least 2 key approaches
  • 23. Splitting bigger parts into smaller 1.Analyse metrics (NewRelic / JavaVisualVM) 2.Find a weak point (!) 3.Move this part to microservice 4.Repeat
  • 25. What it typically does? CONTAINERS
 PROVISIONING HEALTHCHECKS METRICS
 GATHERING APPLICATION 
 LIFECYCLE
 MANAGEMENT SCALING AUTOMATIC 
 LOAD
 BALANCING SERVICE
 DISCOVERY
 &
 CONNECTIVITY CUSTOM SCRIPTING*
  • 26. Typical triggers that are used for scaling CPU RAM HDD
 (disk I/O) NETWORK SERVICE
 FAILURE SCHEDULER
  • 28. Tricky thing #1 In which direction to scale? horizontal vertical topology
  • 29. Example #1 Message Queue Service Triggers configuration CPU RAM HDD (disk I/O) NETWORK SCHEDULER YES NO PROBABLY NO GENERAL SET GENERAL SET Scaling type HORIZONTAL Tricky place
  • 30. Example #2 Databases CPU RAM HDD (disk I/O) NETWORK SCHEDULER YES VERTICAL NO NO NO Scaling type Triggers configuration YES
  • 31. Typical issues while scaling of database instances Takes much time to sync data Temporary locks Temporary performance degradation Hard to use auto horizontal scaling Automatic vertical scaling can be used just fine It’s better to keep spare instances underloaded (dedicated storage per instance) RESUME
  • 32. Example #3 Legacy JavaEE application TOPOLOGY Java EE Server Business Tier Web Tier JSP App1 JSP App2 JSP App2 EJB App1 EJB App2 Java EE 
 Micro Instance JSP App1 Java EE 
 Micro Instance JSP App1 Java EE 
 Micro Instance JSP App1 Java EE 
 Micro Instance JSP App1 Java EE 
 Micro Instance JSP App1 Java EE 
 Micro Instance JSP App2 Java EE 
 Micro Instance JSP App1 Java EE 
 Micro Instance JSP App1 Java EE 
 Micro Instance EJB App2 Java EE 
 Micro Instance JSP App1 Java EE 
 Micro Instance JSP App1 Java EE 
 Micro Instance EJB App2 Scaling type
  • 33. Tricky thing #2 Events subscription Usually, just spinning up an extra instance is NOTenough
  • 34. Example #1 Typical ScaleIn/ScaleOut events and cases onAfterScaleOut[nodeGroup:ejb-app1] { “call”: “registerNodeInMonitoringSystem”, “call”: “addMemberToHazelcast”, “call”: “call3rdPartyApiService” } onAfterScaleIn[nodeGroup:jsp-app2] { “call”: “removeNodeFromMonitoringSystem”, “call”: “removeMemberFromHazelcast” } THE FULL WORKING AND MORE COMPLEX CODE EXAMPLE CAN BE FOUND HERE
  • 35. Example #2 2. Get auth keys by instance before joining DAS onBeforeStartService[nodeGroup:instance] { “cmd”: “/root/scripts/pullAccessKeys.sh ${token}” } THE FULL WORKING AND MORE COMPLEX CODE EXAMPLE CAN BE FOUND HERE 1. Decrypt encrypted volume, that was attached on-fly onAfterVolumeAttached[nodeGroup:instance] { “call”: “decryptVolume” } 3. Deprovision node from DAS if cluster was shrinked onAfterScaleOut[nodeGroup:das] { “cmd”: “./asadmin_proxy remove ${instance[@last].ip}” }
  • 36. Tricky thing #3 Proper triggers configuration This tuning is a long process, so be patient
  • 37. Typical problem #1 Changing the value in one place can be reflected in other places
  • 38. How to deal with this? Load Testing Gathering
 Metrics Detect deviations in a testing loop Analyzing
 Metrics Edit
Triggers Com pare previous 
 results
  • 39. Typical problem #2 The triggers can become outdated with new code
  • 40. The fix is easy here Inject metrics collection as a part of your CI/CD step COMMIT BUILD TESTING PERFORMANCE
 ANALYSIS DELIVERY
  • 41. Tricky thing #4 Getting rid of spare things
  • 42. Typical problem #1 Network is full of useless traffic Total bandwidth Multicast | Heartbeats Useful traffic
  • 43. What we can do? Avoid multicast (for members detection) Use events and static members lists Static members list Static members list Static members list Orchestrator
  • 44. Typical problem #2 Some of JavaEE Servers are designed for VMs, not for containers On example of Weblogic VM VM VM VM
  • 45. What is the right way to go? Just remove everything spare