-
Language:
English
-
Language:
English
Red Hat Training
A Red Hat training course is available for Red Hat JBoss Data Virtualization
2.3. Load Balancing
Post connection load balancing can be utilized in one of two ways.
If you are using the
TeiidDataSource
class and the PooledConnection
returned by getPooledConnection
is terminated using the close()
method, then a new server instance will be selected automatically. (When using driver based connections or when using the TeiidDataSource
class in a connection pool, the automatic load balancing will not happen.)
Alternatively, you can explicitly trigger load balancing through the use of the set statement:
SET NEWINSTANCE TRUE
. Typically you will not issue this statement manually, but you can use it as the connection test query on your data source configuration:
<datasources> <datasource jndi-name="java:/teiidDS" pool-name="teiidDS"> <connection-url>jdbc:teiid:{vdb}@mm://{host}:31000</connection-url> <driver>teiid</driver> <pool> <prefill>false</prefill> <use-strict-min>false</use-strict-min> <flush-strategy>FailingConnectionOnly</flush-strategy> <check-valid-connection-sql>SET NEWINSTANCE TRUE</check-valid-connection-sql> </pool> <security> <user-name>{user}</user-name> <password>{password}</password> </security> </datasource> <drivers> <driver name="teiid" module="org.jboss.teiid.client"> <driver-class>org.teiid.jdbc.TeiidDriver</driver-class> <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class> </driver> </drivers> </datasources>
Important
Session level temporary tables, currently running transactions, session level cache entries, and PreparedPlans for a given session will not be available on other cluster members. Therefore, it is recommended that post connection time load balancing is only used when the logical connection could have been closed, but the actual connection is reused. This is the typical connection pool pattern.