GlassFish High Availability Overview - download.java.net
Transcript of GlassFish High Availability Overview - download.java.net
![Page 1: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/1.jpg)
GlassFish High GlassFish High Availability OverviewAvailability Overview
Shreedhar Ganapathy Shreedhar Ganapathy Engg Manager, GlassFish HA Team Engg Manager, GlassFish HA Team Co-Author Project Shoal ClusteringCo-Author Project Shoal Clustering
Email: Email: [email protected][email protected]://blogs.sun.com/shreedharhttp://blogs.sun.com/shreedhar
![Page 2: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/2.jpg)
2
What we will cover todayWhat we will cover today• What is Project GlassFish ?• Explain GlassFish v2 Clustering
> Cluster Creation & Configuration > Cluster Lifecycle components> Runtime Dynamic Clustering - Project Shoal
• GlassFish High Availability options> HADB based > In-Memory Replication based
• In-memory replication – how it works• Configuration• Q&A
![Page 3: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/3.jpg)
3
What Is Project GlassFish ?What Is Project GlassFish ?● Open Source Project developing JavaTM, Enterprise Edition
(Java EE platform) Application Server● https://glassfish.dev.java.net
● Free for development, deployment, and redistribution● Fully Java EE 5 compliant● Open Source
● Dual OSI Licenses – CDDL, GPL v2 w/CPE● Community at java.net
● Source Code, Bug Database, Discussions/Forums at java.net● Roadmaps, Architectural documents● Code contributions: Sun Microsystems,Oracle & others
![Page 4: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/4.jpg)
4
GlassFish Clustering/HA Introduction GlassFish Clustering/HA Introduction ● What is High Availability?What is High Availability?
● Ensuring a certain absolute degree of operational continuity of business services even when part of the system has failed.
● Continued availability of business services to users during the measurement period
● How do you get High Availability ?How do you get High Availability ?● Cluster server instances for redundant availability of service● Use Session State Persistence for redundant availability of
business data/sessions ● Size your middleware infrastructure for Fault Tolerance,
Scalability, and Reliability ● Supported by a Load Balancing tier to distribute load
![Page 5: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/5.jpg)
5
GlassFish v2 Clustering Lifecycle componentsGlassFish v2 Clustering Lifecycle components
asadmin>
Clustered Clustered GlassFish GlassFish Server InstanceServer Instance
JMX JMX APIAPI
JMX APIJMX API
JMX APIJMX API
Node 1
Node 2
Node Agent
Administration Node
Node Agent
DomainAdministration
Server
Applications
Resources
Configuration
JMX = Java Management Extensions
![Page 6: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/6.jpg)
6
GlassFish v2 Web Admin Console GlassFish v2 Web Admin Console - Creating a Cluster - Creating a Cluster
![Page 7: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/7.jpg)
7
Clu
ster
edIn
stan
ces
Clustering Architecture
Node A
ASAS
Node B
ASAS
Node CAS
ASAS
. . .
Message Routing / Failover / Load Balancing
Man
agem
ent
HA Application State Repository
HTTP(S) JMS RMI/IIOP
RuntimeCluster member
discovery through
Shoal
![Page 8: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/8.jpg)
8
Runtime Dynamic Clustering Runtime Dynamic Clustering – Project Shoal (https://shoal.dev.java.net)– Project Shoal (https://shoal.dev.java.net)● A Java language based clustering framework ● Pluggable into any product for clustering● Provides an event model for Cluster events
● Joining of instances● Failure suspicion ● Failure confirmation● Planned Shutdown ● Recovery Selection
● Provides messaging to group, or individual members ● Basis for building fault tolerance solutions ● GlassFish components such as In-Memory Replication
module use Shoal.
![Page 9: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/9.jpg)
9
GlassFish HA OptionsGlassFish HA Options● Enterprise Profile offers HADB based persistence
solution● HADB
● Enables proven “5—nines” availability● Highly reliable, scalable, but with lower performance ● Right solution for mission critical, high reliability needs● More complex to administer, not (currently) open source
● Cluster Profile offers In-Memory Replication ● In-memory replication
● Ease to configure● A lighter-weight alternative to HADB● Provides high performance and scalability, lower reliability than HADB● Open Source – part of GlassFish project ● Ideal for services for whom some risk of session loss is acceptable
![Page 10: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/10.jpg)
10
GlassFish HA OptionsGlassFish HA Options● HADB and In-memory Replication solutions provide
high availability for● Http session state● Stateful Enterprise JavaBeans™ (EJB™) technology session bean state● Single sign-on state
● GlassFish also provides JMS High Availability ● GlassFish comes with a bundled Message Queue product
● Sun Java System Message Queue● Message Queue provider integration is through resource
adapters ● Message Queue Broker clusters provide redundancy and
availability of service and data● Data is persisted in HADB
![Page 11: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/11.jpg)
11
MQ High Availability
![Page 12: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/12.jpg)
12
GlassFish In-Memory Replication Architecture GlassFish In-Memory Replication Architecture - Internals- Internals
In Memory Replication
Message Transport
Send processingReceive processing
RoutingSync/Async support
Cluster SupportConnection support
Shape Change(JXTA/GMS Events)Repair support
Uses JXTA Uses Shoal GMSPipes Pipe
EventsMembership Notifications
Replication Health
Store(s)
Replica Cache(s)
![Page 13: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/13.jpg)
13
GlassFish Memory Replication ArchitectureGlassFish Memory Replication Architecture- Container interactions- Container interactions
TCP UDP
JXTAShoal GMS
Memory Replication
Web Container EJB Container
![Page 14: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/14.jpg)
14
GlassFish Memory Replication GlassFish Memory Replication ArchitectureArchitecture
Session Store_1
Manager_1
Context_1
Web Container
[Http Sessions]
Context_N
... Manager_N[Http Sessions]
Session Store_N
EJB containers are similar
Per app
Memory Replication
![Page 15: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/15.jpg)
15
Typical cluster topologyMemory ReplicationMemory Replication
Instance 1 Instance 2
Instance 4 Instance 3
![Page 16: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/16.jpg)
16
Typical cluster topologyMemory ReplicationMemory Replication Example: Maximize
Availability on 4 instance cluster on 2 nodes(machines)
Machine 1 Machine 2
Instance 1 Instance 2
Instance 3 Instance 4
![Page 17: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/17.jpg)
17
HTTP Session State FailoverHTTP Session State Failover
Servlet(HTTP Session)
replicas
instance 1
Servlet(HTTP Session)
replicas
instance 2
Servlet(HTTP Session)
replicas
instance 4
Servlet(HTTP Session)
replicas
instance 3Cluster
WS
LoadBalancer
![Page 18: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/18.jpg)
18
HTTP Session State FailoverHTTP Session State Failover
Servlet(HTTP Session)
replicas
instance 1
Servlet(HTTP Session)
replicas
instance 2
Servlet(HTTP Session)
replicas
instance 4
Servlet(HTTP Session)
replicas
instance 3Cluster
WS
LoadBalancer
Case 1:Instance 2 has replica data
![Page 19: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/19.jpg)
19
HTTP Session State FailoverHTTP Session State Failover
Servlet(HTTP Session)
replicas
instance 1
Servlet(HTTP Session)
replicas
instance 2
Servlet(HTTP Session)
replicas
instance 4
Servlet(HTTP Session)
replicas
instance 3Cluster
WS
LoadBalancer
Broadcast…
Case 2:Instance does nothave replica data
![Page 20: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/20.jpg)
20
HTTP Session State FailoverHTTP Session State Failover
Servlet(HTTP Session)
replicas
instance 1
Servlet(HTTP Session)
replicas
instance 2
Servlet(HTTP Session)
replicas
instance 4
Servlet(HTTP Session)
replicas
instance 3Cluster
WS
LoadBalancer
and ownershiptransfer…
Case 2:Instance does nothave replica data
![Page 21: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/21.jpg)
21
Cluster Dynamic Shape ChangeCluster Dynamic Shape Change
Servlet(HTTP Session)
replicas
instance 1
Servlet(HTTP Session)
replicas
instance 2
Servlet(HTTP Session)
replicas
instance 4
Servlet(HTTP Session)
replicas
instance 3Cluster
WS
LoadBalancer
Shape Changeinstance1 fails
![Page 22: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/22.jpg)
22
Cluster Dynamic Shape ChangeCluster Dynamic Shape Change
Servlet(HTTP Session)
replicas
instance 1
Servlet(HTTP Session)
replicas
instance 2
Servlet(HTTP Session)
replicas
instance 4
Servlet(HTTP Session)
replicas
instance 3Cluster
WS
LoadBalancer
Shape Changeinstance1 fails
Instances 2, 3 and 4see the failurethrough Shoal's Failure monitoring
X
X
![Page 23: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/23.jpg)
23
Cluster Dynamic Shape ChangeCluster Dynamic Shape Change
Servlet(HTTP Session)
replicas
instance 1
Servlet(HTTP Session)
replicas
instance 2
Servlet(HTTP Session)
replicas
instance 4
Servlet(HTTP Session)
replicas
instance 3Cluster
WS
LoadBalancer
Shape Changeinstance1 failsInstances 2, 3 and 4see the failurethrough Shoal's Failure monitoringInstance4 selectsInstance2 as newpartner—new connections established the reverse happens when an instance joins or re-joins the cluster
![Page 24: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/24.jpg)
24
Our hope was to say…Memory Replication ConfigurationMemory Replication Configuration
● “This page left intentionally blank” ;-)● Meaning “zero configuration required”
● We came close to that goal…
![Page 25: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/25.jpg)
25
Out of the box…
Memory Replication ConfigurationMemory Replication Configuration
● Create a domain● Use the ‘cluster’ admin profile—defaults for replication are
handled● Enables Shoal GMS — heartbeat enabled● persistence-type = “replicated”
● Create a cluster and instances● Deploy your application with availability-enabled=true● That’s it● Caveat:
● make sure your cluster is all in the same subnet (Cross subnet support coming in next release)
● Synchronize clocks on all machines involved. Important for expiration logic.
![Page 26: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/26.jpg)
26
Beyond “out of the box” admin cluster profileMemory Replication ConfigurationMemory Replication Configuration
● Increase heap size● Default is 512MB for cluster admin profile
● To accommodate cluster demos on laptops, etc.● Too small for serious replication
● Increase to 1GB recommended● <jvm-options>-Xmx1000m</jvm-options>
<jvm-options>-Xms1000m</jvm-options>
![Page 27: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/27.jpg)
27
Making your app distributableMemory Replication ConfigurationMemory Replication Configuration
● <distributable/> element● Required in web.xml
● Indicates you believe your application is ready to run in a cluster
● Serializable objects required● HTTP Session state● EJB technology Stateful Session Bean state
![Page 28: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/28.jpg)
28
3 Main Axes of Configuration – memory replication or HADBMemory Replication ConfigurationMemory Replication Configuration
● Persistence Type
● Persistence Frequency
● Persistence Scope
![Page 29: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/29.jpg)
29
3 Main Axes of ConfigurationMemory Replication ConfigurationMemory Replication Configuration
● persistence-type “where are you storing”● quality of Replication Storage
● Options● memory
● No replication (default, but understand effect of admin profiles)● replicated
● In-memory replication● ha
● HADB replication● file
● Store to a file. (developer can verify serializes correctly) ● Not supported for production environments
![Page 30: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/30.jpg)
30
3 Main Axes of ConfigurationMemory Replication ConfigurationMemory Replication Configuration
● persistence-frequency WHEN to replicate● Options
● web-event● Replicate when returning http-response
● time-based● Replicate every T seconds● Default of 1 minute
● Discuss tradeoffs between these options
![Page 31: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/31.jpg)
31
3 Main Axes of ConfigurationMemory Replication ConfigurationMemory Replication Configuration
● Persistence-scope - WHAT granularity to replicate● Options
● session - i.e.full-session● Always requiring replication. Simplest but least efficient.
● modified-session● Replicate full session when session set/remove attribute called● Otherwise only update timestamp
● modified-attribute● Fine grain. Replicate at attribute granularity.
● Sequence of Add, Delete, Update attribute(s)● Each “bucket” must be separately serializable with no x-references
![Page 32: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/32.jpg)
32
EJB stateful session replication storyMemory Replication ConfigurationMemory Replication Configuration
● Again, feature compatible for HADB or replication● replication called “checkpointing”
● Passivation also causes replication● Done at end of transaction – when there is a
transaction● Container-managed or bean-managed
● Only for non-transactional beans● Particular methods can be marked for checkpointing using
sub-ejb-jar.xml
![Page 33: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/33.jpg)
33
Reference ResourcesReference Resources
GlassFish High Availability Guide http://docs.sun.com/app/docs/doc/819-3679 JMS Availability article of Interest GlassFish users mailing list https://glassfish.dev.java.net/servlets/ProjectMailListList Clustering blogs http://blogs.sun.com/main/tags/clustering GlassFish Cluster/Developer Profile Downloads : https://glassfish.dev.java.net/downloads/v2ur1-b09d.html GlassFish Enterprise Profile Downloads at sun.com
![Page 34: GlassFish High Availability Overview - download.java.net](https://reader030.fdocuments.in/reader030/viewer/2022012414/616e9b697373e914e4199adf/html5/thumbnails/34.jpg)
GlassFish High GlassFish High Availability OverviewAvailability Overview
Shreedhar GanapathyShreedhar Ganapathy