Monday, February 17, 2014

ADF High Availability

In a cluster of application instances, if a node becomes unavailable any subsequent requests to that instance would be routed to another instance. This new instance is the replication partner of the previous instance which maintains the user's session state.

Following is the excerpt from Oracle documentation which explains the failover in detail
A user makes a request and is routed by a hardware load balancer to instance A of the application.
Instance A of the application becomes unavailable because of node failure, process failure, or network failure.
The hardware load balancer marks instance A as unavailable.
The user makes a subsequent request. The request is routed to instance B.
Instance B is configured as a replication partner of Instance A and has the user's session state.
The application resumes using the session state on Instance B and the user continues working without interruption.
This replication happens by serializing the Users session state from one instance to another. Also all the PageFlowScope Beans are implemented as a collection object inside Session Scope. Now during the session replication, these PageFlow Scopes would be serialized. If these Page Flowscope beans have any bindings to the UI Components, there would be an issue in serializing(UI Components are not serializable). Hence for HighAvailability all the UI Components must be binded to Backing Bean/View Scope Beans which are not part of session.


ADF optimizes the serialization and it wont serialize the beans until they are dirty. As the session bean maintains these beans in a collection and if one of the attribute is modified in the bean, session scope cannot identify that bean as dirty (as the reference to the bean is still intact and it is unaware of the change in the value of the managed bean attributes). Thus whenever we use a Page Flow scope bean, we need to explicitly set the bean as dirty (for high availability) whenever its attributes are modified. It can be achieved by:
ControllerContext.getInstance().markScopeDirty(viewScope/pageFlowScope);

No comments: