firstly, I'd like introduce some key new features at Tomcat JDBC Pool.
- validationInterval - in addition to running validations on connections, avoid running them too frequently, it very useful to downgrade the validation frequently on database.
- maxAge,(long) Time in milliseconds to keep this connection. When a connection is returned to the pool, the pool will check to see if the
now - time-when-connected > maxAge
has been reached, and if so, it closes the connection rather than returning it to the pool. - jdbcInterceptors,flexible and pluggable interceptors to create any customizations around the pool, the query execution and the result set handling.
- fairQueue,Set the fair flag to true to achieve thread fairness or to use asynchronous connection retrieval.
the end, I'd like give you one standard configuration for Tomcat JDBC Pool.
<Resource name="jdbc/my_testing_DB"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1 from dual"
validationInterval="1000"
timeBetweenEvictionRunsMillis="300000"
maxActive="50"
minIdle="10"
maxWait="10000"
initialSize="10"
username="bossrpt"
password="pass"
driverClassName="com.inet.ora.OraDriver"
url="jdbc:inetora:***?service=***;failover=true;host1=***;queryTimeout=600"
/>
Reference:
https://commons.apache.org/proper/commons-dbcp/configuration.html
https://tomcat.apache.org/tomcat-8.0-doc/jndi-datasource-examples-howto.html
No comments:
Post a Comment