Thursday, November 18, 2010

Oracle RAC and Multi DataSource

Oracle RAC Load Balancing with WebLogic Server

If your application requires load balancing across RAC nodes, WebLogic Server supports this capability through use of JDBC multi data sources with Oracle RAC nodes. The data sources that form a multi data source are accessed using a round-robin scheme. When switching connections, WebLogic Server selects a connection from the next data source in the order listed. 

Using Multi Data Sources with Oracle RAC
To connect WebLogic Server to multiple Oracle RAC nodes using multi data sources, first configure a JDBC data source for each RAC instance in your RAC cluster with the Oracle Thin driver. Then configure a multi data source, using either the algorithm for load balancing or the algorithm for failover, and add the data sources to it.

To use a database connection in this configuration, your applications look up one multi data source on the JNDI tree and then request a connection. The multi data source determines which data source to use to satisfy the connection request based on the algorithm type specified in the configuration (that is, failover or load balancing).

Attributes of a Multi Data Source
The multi data source may have the following attributes, depending on the role of RAC in your system—load balancing or failover:
  • AlgorithmType="Load-Balancing" or AlgorithmType="Failover"
    • With the Load-Balancing option, connection requests are distributed among available data sources; with the High-Availability option, connection requests are served by the first available pool in the list. When a data source becomes defunct, connection requests are served by the next data source in the list.
  • FailoverRequestIfBusy="true"
    • With the Failover algorithm, this attribute enables failover when all connections in a data source are in use.
  • TestFrequencySeconds="120"
    • This attribute controls the frequency at which WebLogic Server checks the health of data sources previously marked as unhealthy to see if connections can be recreated and if the data source can be re-enabled.

1 comment:

  1. is there a wlst script where we can change the order of data sources in a mult data source.

    For example, in production when there is a database failover, how do we switch the order of datasources in a multi datasource from one to another.