In addition to the built-in, transparent failover functionality, the Transparent Connectivity functionality in the solidDB JDBC and ODBC drivers provides support for the load balancing of read-only workloads in HotStandby (HSB) systems.
Load balancing is available because there are identical copies of the database on both HSB servers. A read query provides the same result regardless of whether it is executed in the primary or the secondary database.
When load balancing is activated, the JDBC or ODBC driver uses two physical connections, one to each database, and allocates the query load to the workload connection. The workload connection is selected based on query type (such as read or write), and the current load in the database servers.
The load balancing implementation is based on the following principles:
▪ Read queries that need high isolation level (repeatable read, select for update) are executed in the primary database.
▪ Write queries are always executed in the primary database.
▪ Read queries that follow any write operation (within the same transaction) are executed in the primary database. Using the primary database ensures that updated rows are visible for subsequent reads.
▪ The internal read/write level consistency of the databases is ensured so that after a write transaction is committed, the secondary database is not read by the same connection until the secondary database is up-to-date with that write transaction. Using the same connection consistently ensures that, if the 1-safe replication protocol (or the 2-safe replication protocol with the 2-safe received acknowledgment policy) is used, the next read transaction can see committed data from the previous write transaction.
solidDB makes the selection of the workload connection automatically; the load balancing is automatic and transparent to the application. Applications that are primarily read-centric can easily balance the load between the two database servers, and use the full processor capacity of both servers.