Find out how to configure and package clustered Payara Micro with load balancing, automatic scaling and dedicated storage for building cloud-native microservices. Then with the help of cloud scripting and triggering, automate CI/CD for the deployed application and emulate the load to check the scaling and performance results.
2. Why I am here?
I want to discuss with you:
• General autoscaling concept for JavaEE applications
• Real issues and Tricky things
My goals are:
• Save your time if you decide you need to scale your app
• Share our own experience
3. I am sure you’ve heard those words many times …
I just deploy my application to Docker, set a number of replicas and
… have it running … bla bla bla … super easy! Done!
4. Yes, pretty easy …
If you need a super scalable and clustered Hello World application …
5. In real life with JavaEE application
we have architecture similar to this
and its autoscaling becomes not a very trivial task…
In real life with JavaEE application we have architecture
similar to this
21. 1. Analyze metrics (NewRelic /
JavaVisualVM)
2. Find a weak point (!)
3. Move this part to microservice
4. Repeat
Splitting bigger parts into smaller
29. (dedicatee)
Takes much time to sync data
Temporary locks
Temporary performance degradation
RESUME
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)
Typical issues while scaling of database instances
31. onAfterScaleOut[nodeGroup:ejb-app1] {
“call”: “registerNodeInMonitoringSystem”,
“call”: “addMemberToHazelcast”,
“call”: “call3rdPartyApiService”
}
onAfterScaleIn[nodeGroup:jsp-app2] {
“call”: “removeNodeFromMonitoringSystem”,
“call”: “removeMemberFromHazelcast”
}
Example #1
Typical ScaleIn/ScaleOut events and cases
THE FULL WORKING AND MORE COMPLEX CODE EXAMPLE CAN BE FOUND HERE:
https://github.com/jelastic-jps/payara/blob/master/payara-micro-cluster/manifest.jps
32. 1. Decrypt encrypted volume, that was attached on-fly
onAfterVolumeAttached[nodeGroup:instance] {{
“call”: “decryptVolume”
}
2. Get auth keys by instance before joining DAS
onBeforeStartService[nodeGroup:instance] {
“cmd”: “/root/scripts/pullAccessKeys.sh ${token}”
}
3. Deprovision node from DAS if cluster was shrinked
onAfterScaleOut[nodeGroup:das] {
“cmd”: “./asadmin_proxy remove ${instance[@last].ip}”
}
Example #2
THE FULL WORKING AND MORE COMPLEX CODE EXAMPLE CAN BE FOUND HERE:
https://github.com/jelastic-jps/glassfish/blob/master/manifest.jps
41. Network is full of useless traffic
Total bandwidth
Useful traffic
Typical problem #2
Multicast | Heartbeats
42. Avoid multicast for members detection
Instance 1
Orchestrator
Instance 2
Instance 3
What we can do?
Use events and unicast
43. Real use case
On-Demand Scalability and Easy Management of Java EE Project: Hybrid Cloud for Miele
• Migrated from VMs to Containers
• Migrated from GlassFish to WildFly
• Improved scaling and HA
• Implemented Hybrid Cloud