HikariCP
HikariCP copied to clipboard
What is minimum possible size of Hikari connection pool?
I am working on developing a spring-boot based microservice of which dozens of application instances will run concurrently. I am planning to use HikariCP as our database connection pooling tool to connect with MySQL databases. However, when I try to create connection pools varying in size from 0-10, I am able to create connection pools that vary in size from 1-10 but never reach the sweet spot of 0 during idle time.
My configuration,
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setMinimumIdle(0);
hikariConfig.setMaximumPoolSize(10);
hikariConfig.setIdleTimeout(60000);
hikariConfig.setPoolName(poolName);
hikariConfig.setJdbcUrl(jdbcUrl);
hikariConfig.setUsername(userName);
hikariConfig.setPassword(password);
hikariConfig.setDriverClassName(databaseDriverClass);
return new HikariDataSource(hikariConfig);
I'd like to understand if HikariCP has a hard limit where it can never reach a size of less than 1 idle connection?
Raised it on stackoverflow aswell but did not find any suitable answer: StackOverflow
I would also like an official statement on this. It isn't brought up in the documentation and I can find previous issues with 0 being thought of as Unlimited.
谢谢你的来信,目前有点忙,稍后会尽快回复您!
which version did you used? i have test the 4.0.3 is ok,the idle is 0 for a while,housekeeper do that every 30.5s,if you set IdleTimeout 60s, may be need 61s to keep idle to 0.