Friday, February 3, 2012

JDBC Multi Data Sources in weblogic server


JDBC Multi Data Sources in weblogic server:

A multi data source is an abstraction around a group of data sources that provides load balancing or failover processing between the data sources associated with the multi data source. Multi data sources are bound to the JNDI tree or local application context just like data sources are bound to the JNDI tree. The Multi Data Source can be used in the same way as we use a Data Source.


When an application requests a connection, the Multi Data Source determines which data source will provide a connection based on the selected algorithm.
Create two or more data sources, and then create a Multi Data Source and assign data sources to the Multi Data Source.



Configurations for the Multi Data Source.

Algorithm Type

Load-Balancing

Connection requests to a load-balancing multi data source are served from any data source in the list. The multi data source selects data sources to use to satisfy connection requests using a round-robin scheme. When the multi data source provides a connection, it selects a connection from the data source listed just after the last data source that was used to provide a connection. Multi data sources that use the Load Balancing algorithm also fail over to the next data source in the list if a database connection test fails and the connection cannot be replaced, or if the data source is suspended.

Failover

The Failover algorithm provides an ordered list of data sources to use to satisfy connection requests. Normally, every connection request to this kind of multi data source is served by the first data source in the list. If a database connection test fails and the connection cannot be replaced, or if the data source is suspended, a connection is sought sequentially from the next data source on the list.

FailoverRequestIfBusy

With the Failover algorithm, this attribute enables failover when all connections in a data source are in use.

TestFrequencySeconds

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.


2 comments:

  1. Hi Albin,

    If synchronization is not handled by Weblogic, i don't see any use of this except for read only data bases. If synchronization has to be handled outside, that is going to be more pain. Share your thoughts on this.

    Thanks in advance.

    Thanks,
    Sai

    ReplyDelete
  2. The point of Multi-datasources it to stop a set of linked operations from being distributed across different DB instances which would otherwise cause severe performance loss, especially if the operations were part of the same XA transaction.

    ReplyDelete