Scalability
Unlike VMs, resizing of resource limits in Containers:
● can be performed without reboot of the running instances
● easier achieved on the fly
● cheaper and faster than moving to larger VMs
Efficiency
Virtual Machines Containers on Bare Metal
Container technology unlocks a new level of flexibility – resources that are not consumed within the
limit boundaries are automatically shared with other containers running on the same hardware node.
https://www.infoq.com/articles/java-cloud-cost-reduction
Decomposition
Splitting large monolithic application topology into small logical pieces to work with
them independently
Scaling GlassFish Server in VM
● Provision a new VM with preconfigured GlassFish template
● Configure SSH connect and add this VM as an SSH Node to the DAS
● Create a new remote Worker Instance on a Node via DAS UI or asadmin CLI
Application Container + System Container
Pros
● IP, hostname and local stored
data survive downtimes
● No need in a port mapping
● Better isolation and virtualization
of resources
● Compatible with SSH based
config tools
● Provide live migration of memory
state
Cons
● Start-up time is slower
GlassFish in Container
https://github.com/oracle/docker-images/tree/master/GlassFish/5.0
Scaling GlassFish in Containers
Worker nodes can be added / removed automatically as well as can be attached to
DAS node using container orchestration platform and a set of automation scripts
Database Connection
● Connect to the current database in VM
● OR decompose database to containers to gain the benefits of easy scaling
and better resource utilization
Scenario
● Create standalone GlassFish
● Create MySQL master-slave database cluster
● Connect GlassFish to Databases
● Deploy application
● Scale GlassFish and add NGINX load balancer
● Clone the environment
● Install Traffic Distributor and connect it to the two envs (original and clone)
Import JPS manifesthttps://github.com/jelastic-jps/mysql-cluster/tree/master/mysql-cluster-orchestrator
Download test SQL dump
NetBeans Sample App for Connection to MySQLhttps://netbeans.org/kb/docs/web/mysql-webapp.html
DatabaseName=MyNewDatabase
ServerName=[db hostname]
URL=jdbc:mysql://[db hostname]:3306/MyNewDatabase
Url=[same as URL]
User=[db user]
Password=[db password]
Download the sample application
Download source and build “war” archive
https://netbeans.org/kb/docs/web/mysql-webapp.html