GlassFish Server Open Source Edition 3.1 - In-memory Session Replication: High Availability
Scope of the ProjectThe In-Memory replication feature allows session availability by replicating session state to other instances in the cluster. By replicating session data, when the instance that was serving the request fails, the session can be restored by retrieving the session data from the replica instance. Also, instead of letting the containers to directly interact with the in-memory replication layer, a BackingStore SPI has been defined. The advantages of using this SPI are: In GlassFish Server Open Source Edition 3.1, we will implement the in-memory replication module as a service provider of BackingStore SPI. High Level Features
High Level Overview of the projectThe general approach is to replicate session state from each instance in a cluster to a back-up / replica. Unlike V2, where HTTP and EJB sessions were replicated to the neighboring instance (buddy), the replication module will rely on an external object called ReplicaSelector to pick a replica. The input to the ReplicaSelector will be the SessionKey and the ReplicaSelector will return an instance name (that is alive) to which the data must be replicated. Each backup instance will store the replicated data in-memory. Upon a failure the instance now servicing the request (after failover) will either already have the necessary data or it will use the ReplicaSelector to locate the replica to obtain and take ownership of the data. Availability configuration will continue to work as it has for previous HA enabled releases. The existing persistence-type ("replicated") will continue to be supported. This will allow QA and performance tests to run as they do with V2.x. The replication layer itself will use the GMS communication APIs for transporting the data. We will use GMS's send() API to replicate data to a replica instance. The current plan is to leverage GMS for cluster group membership services including things like initial bootstrapping/startup and various cluster shape changes like instances being stopped and re-started, instances failing, new instances being added to the cluster, etc. Its is assumed that ReplicaSelector will register itself with GMS to know the current 'alive' members so that it can pick an 'alive' replica. Changes to Various Containers: 1. EJB Container: The EJB Container uses the store to (a) passivate EJBs when the cache overflows and (b) to checkpoint EJBs at the end of business method (or at the end of Tx). The EJB Container currently does not use the SPI to talk to a store. The EJB Container needs to use the BackingStore SPI to talk to in-memory replication layer. Since, the interface used by EJB Container is very similar to the BackingStore SPI, it should not be a major change for the container to switch to the SPI. 2. Web Container: The Web Container will continue to use the same BackingStore SPI to save session state. The Web Container persists session data using one of the two approaches: (a) Full session: The entire session will be saved to the BackingStore and (b) Modified Attributes: Only those HTTP Session attributes that were either deleted / added / updated will be saved. We will continue to support both approaches. 3. Metro: Metro will use the BackingStore SPI. It will save the following data in BackingStore: (a) Message, (b) SAAJMessage and (c) ProtocolSourceMessage. The above three messages will be serialized and the resulting byte[] will be persisted into BackingStore. Feature OverviewHA-1 Session Persistence BackingStore SPI port from v2 to 3.1
Provides a session persistence abstraction to containers allowing GlassFish containers to be agnostic to the actual session persistence implementation.
(a) Create an OSGi module that contains the SPI classes and interfaces. (b) Make the BackingStoreFactory as a hk2 @Contract to allow containers to inject BackingStoreFactory. (c) This Module will also contain a no-op BackingStoreFactory and a no-op BackingStore.
HA-2 Implement Backing Store in Project Shoal providing all of BackingStore operations
The implementation will provide the basic load / save / remove operations and will use GMS APIs to replicate data to replica instance.
(a) Create a DataStore that will provide load / save / remove operations. (b) The DataStore will internally use a ConsistentHash algorithm to select a replica for a given key. The DataStore will also use the Consistent hash algorithm (along with a GMS API to obtain the previous view of the cluster) to locate replica location after a failover. (c) Implement various commands to replicate, remove and locate replica data. (d) Use GMS APIs to react to Cluster Shape changes to implement a simple consistent hash algorithm.
Mahesh & Joe
(a) GMS APIs to provide cluster shape changes (b) GMS APIs to provide send and receive replication data and various command data. (a) GMS API to provide previous cluster state after a node failure / restart.
HA-3 Implement Backing Store in Project Shoal providing generic CRUD semantics
Provides a backing store implementation with simple APIs to do CRUD operations and support querying. The store will be an OSGi module integrated into GlassFish periodically over the release time frame.
Implement save, load, findByCriteria, remove and support for partial updates such as updateTimeStamp of a session.
Mahesh
GMS for JoinedAndReady (instance start and restart), failure detection notifications and all Messaging pertaining to session replication.
HA-4 Monitoring Stat Providers
Provide monitoring stats that will help with diagnosing session replication related issues for testers and end customers.
TBD
Mahesh
One-pager / Functional Specification
Dev Tests
Quality
DocumentationMilestone SchedulePlease refer to the HA one pager document Task List
References / Links
Email Alias
|