Sunday, April 27, 2014

Weblogic AGL Transaction Affinity vs. Web Session Affinity

In the world of JEE Application servers the term of "sesssion affinity" denotes that within a cluster of servers, requests from the same client always get routed back to the same server.

Web Session Affinity in Active Grid Link provides analogous functionality, eg. the session affinity policy is used to ensure that all the data base operations for a web session, including transactions, are directed to the same Oracle RAC instance of a RAC cluster. This mechanism is especially usefull because in some circumstances web applications (like shopping applications) have better performance when repeated operations against the same set of records are processed by the same RAC instance.
Applications typically use this type of affinity when:
  • short-lived affinity to an Oracle RAC instance is expected or
  • if the cost (in terms of performance) of being redirected to a new Oracle RAC instance is minimal.
Web Session Affinity should be used for short lived sessions that do not incur a significant penalty when redirecting to a different instance.

Web Session Affinity is a kind of a Connection Affinity which was provided by Oracle RAC Database starting from version 11.1.0.6

Connection Affinity allows a connection pool to select connections that are directed at a specific database instance. The connection pool uses run-time connection load balancing (RCLB) to select an Oracle RAC instance to create the first connection and then subsequent connections are created with an affinity to the same instance.
WebLogic GridLink Data Sources supports:
  • Transaction-based Affinity, 
  • Web Session Affinity and 
  • Data Affinity

The XA Affinity for global transactions ensures all the data base operations for a global transaction performed on an Oracle RAC cluster are directed to the same Oracle RAC instance. The affinity will be established based on the global transaction id, instead of by individual data source, to ensure that connections obtained from different data sources that are configured for the same RAC cluster are all associated with the same RAC instance.
This type of affinity should be used when:
  • the cost (in terms of performance) of being redirected to a new Oracle RAC instance is high (typically during the distributed transaction the cost of a connection redirection to a different Oracle RAC instance is significant) or
  • long-lived affinity to Oracle RAC instance is desired 
Transaction Affinity should be used form long-lived transactions, especially when the performance cost of being redirected to a new Oracle RAC instance is high.

No comments:

Post a Comment