Configuring JDBC Multi Data Sources - 11g Release 1 (10.3.6)

 

Choosing the Multi Data Source Algorithm

Before you set up a multi data source, you need to determine the primary purpose of the multi data source—failover or load balancing. You can choose the algorithm that corresponds with your requirements.

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.

Note:

This algorithm requires that Test Reserved Connections ( TestConnectionsOnReserve) on the data source is enabled. If enabled, a connection in the first data source is tested to verify if the data source is healthy. If the connection fails the test, the multi data source uses a connection from the next data source listed in the multi data source. See  Connection Testing Options for a Data Source for information about configuring  TestConnectionsOnReserve.

JDBC is a highly stateful client-DBMS protocol, in which the DBMS connection and transactional state are tied directly to the socket between the DBMS process and the client (driver). For this reason, failover of a connection while it is in use is not supported.

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.

Multi Data Source Fail-Over Limitations and Requirements

WebLogic Server provides the Failover algorithm for multi data sources so that if a data source fails (for example, if the database management system crashes), your system can continue to operate. However, you must consider the following limitations and requirements when configuring your system.

Test Connections on Reserve to Enable Fail-Over

Data sources rely on the Test Reserved Connections (TestConnectionsOnReserve) feature on the data source to know when database connectivity is lost. Testing reserved connections must be enabled for the data sources within the multi data source. WebLogic Server will test each connection before giving it to an application. With the Failover algorithm, the multi data source uses the results from connection test to determine when to fail over to the next data source in the multi data source. After a test failure, the data source attempts to recreate the connection. If that attempt fails, the multi data source fails over to the next data source.

No Fail-Over for In-Use Connections

It is possible for a connection to fail after being reserved, in which case your application must handle the failure. WebLogic Server cannot provide fail-over for connections that fail while being used by an application. Any failure while using a connection requires that the application code close the failed connection, and the transaction must be restarted from the beginning with a new connection.

Multi Data Source Failover Enhancements

The following enhancements improve failover processing for multi data sources:

  • Connection request routing enhancements to avoid requesting a connection from an automatically disabled (dead) data source within a multi data source. SeeConnection Request Routing Enhancements When a Data Source Fails.

  • Automatic failback on recovery of a failed data source within a multi data source. See Automatic Re-enablement on Recovery of a Failed Data Source within a Multi Data Source.

  • Failover for busy data sources within a multi data sources. See Enabling Failover for Busy Data Sources in a Multi Data Source.

  • Failover callbacks for multi data sources with the Failover algorithm. See Controlling Multi Data Source Failover with a Callback.

  • Failback callbacks for multi data sources with either algorithm. See Controlling Multi Data Source Failback with a Callback.

阅读全文……

你可能感兴趣的:(weblogic,AppServer)