1
我已經通過HikariCP連接池,我可以說這很棒,因爲我已經看到了很好的性能。但是我擔心的是我認爲它需要的連接太多。創建的連接太多
場景: 我有列表對象,其中包含10004條記錄,當我運行插入查詢它需要13秒來完成操作。
DB屬性:
final HikariDataSource dataSource = new HikariDataSource();
dataSource.setMaximumPoolSize(100);
dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
dataSource.setJdbcUrl("jdbc:oracle:thin:@g9u1769.houston.hpecorp.net:1525:ODSDBD");
dataSource.setUsername("Solid_batch1");
dataSource.setPassword("solid_batch123");
dataSource.setMaxLifetime(30000);
日誌:
2016-08-27 11:26:01.779 [] [] [] [Hikari connection adder (pool HikariPool-0)] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-0 - Added connection [email protected]
2016-08-27 11:26:04.204 [] [] [] [Hikari connection adder (pool HikariPool-0)] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-0 - Added connection [email protected]
2016-08-27 11:26:06.620 [] [] [] [Hikari connection adder (pool HikariPool-0)] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-0 - Added connection [email protected]
2016-08-27 11:26:09.038 [] [] [] [Hikari connection adder (pool HikariPool-0)] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-0 - Added connection [email protected]
2016-08-27 11:26:11.455 [] [] [] [Hikari connection adder (pool HikariPool-0)] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-0 - Added connection [email protected]
2016-08-27 11:26:13.869 [] [] [] [Hikari connection adder (pool HikariPool-0)] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-0 - Added connection [email protected]
2016-08-27 11:26:13.975 [] [] [] [main] WARN c.h.i.i.d.manager.dao.DaoService - detail query : 13
誰能幫我減少連接建立。