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…
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
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
38. How to deal with this?
Load Testing
Gathering
Metrics
Detect deviations in a testing loop
Analyzing
Metrics
Edit Triggers
Com
pare previous
results
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