vorburger commented on a change in pull request #722: Fineract-796 - Use Hikari
instead of Tomcat Connection Pool
URL: https://github.com/apache/fineract/pull/722#discussion_r390238713
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java
##########
@@ -85,26 +85,30 @@ private DataSource createNewDataSourceFor(final
FineractPlatformTenantConnection
//
http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency
// see also org.apache.fineract.DataSourceProperties.setDefaults()
- String jdbcUrl =
this.driverConfig.constructProtocol(tenantConnectionObj.getSchemaServer(),
tenantConnectionObj.getSchemaServerPort(), tenantConnectionObj.getSchemaName())
;
- //final String jdbcUrl = tenantConnectionObj.databaseURL();
- final PoolConfiguration poolConfiguration = new PoolProperties();
-
poolConfiguration.setDriverClassName(this.driverConfig.getDriverClassName());
- poolConfiguration.setName(tenantConnectionObj.getSchemaName() +
"_pool");
- poolConfiguration.setUrl(jdbcUrl);
- poolConfiguration.setUsername(tenantConnectionObj.getSchemaUsername());
- poolConfiguration.setPassword(tenantConnectionObj.getSchemaPassword());
-
- poolConfiguration.setInitialSize(tenantConnectionObj.getInitialSize());
-
-
poolConfiguration.setTestOnBorrow(tenantConnectionObj.isTestOnBorrow());
- poolConfiguration.setValidationQuery("SELECT 1");
-
poolConfiguration.setValidationInterval(tenantConnectionObj.getValidationInterval());
-
-
poolConfiguration.setRemoveAbandoned(tenantConnectionObj.isRemoveAbandoned());
-
poolConfiguration.setRemoveAbandonedTimeout(tenantConnectionObj.getRemoveAbandonedTimeout());
-
poolConfiguration.setLogAbandoned(tenantConnectionObj.isLogAbandoned());
-
poolConfiguration.setAbandonWhenPercentageFull(tenantConnectionObj.getAbandonWhenPercentageFull());
- poolConfiguration.setDefaultAutoCommit(true);
+ String jdbcUrl =
this.driverConfig.constructProtocol(tenantConnectionObj.getSchemaServer(),
tenantConnectionObj.getSchemaServerPort(), tenantConnectionObj.getSchemaName());
+
+ HikariConfig config = new HikariConfig();
+ config.setDriverClassName(this.driverConfig.getDriverClassName());
+ config.setPoolName(tenantConnectionObj.getSchemaName() + "_pool");
+ config.setJdbcUrl(jdbcUrl);
+ config.setUsername(tenantConnectionObj.getSchemaUsername());
+ config.setPassword(tenantConnectionObj.getSchemaPassword());
+
+
config.setValidationTimeout(tenantConnectionObj.getValidationInterval());
+
+ config.addDataSourceProperty("cachePrepStmts", "true");
+ config.addDataSourceProperty("prepStmtCacheSize", "250");
+ config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
+ config.addDataSourceProperty("useServerPrepStmts", "true");
+ config.addDataSourceProperty("useLocalSessionState", "true");
+
+ config.addDataSourceProperty("rewriteBatchedStatements", "true");
+ config.addDataSourceProperty("cacheResultSetMetadata", "true");
+ config.addDataSourceProperty("cacheServerConfiguration", "true");
+ config.addDataSourceProperty("elideSetAutoCommits", "true");
+ config.addDataSourceProperty("maintainTimeStats", "true");
Review comment:
https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration
suggests `false` instead of `true` for `maintainTimeStats` .. any reason you
chose the opposite in (only) this case? Just curious.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services