fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [fineract] vorburger commented on a change in pull request #722: Fineract-796 - Use Hikari instead of Tomcat Connection Pool
Date Tue, 10 Mar 2020 11:41:32 GMT
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_r390255354
 
 

 ##########
 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");
 
 Review comment:
   Actually, I wonder if it would somehow be possible to read this from the bean for the tenants
DB, instead of having to repeat and hard-cod it here... but we could look into that in a follow-up
PR as well, your call.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message