HikariCP icon indicating copy to clipboard operation
HikariCP copied to clipboard

What is minimum possible size of Hikari connection pool?

Open murtaza13 opened this issue 2 years ago • 4 comments

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?

murtaza13 avatar Nov 21 '21 09:11 murtaza13

Raised it on stackoverflow aswell but did not find any suitable answer: StackOverflow

murtaza13 avatar Nov 21 '21 09:11 murtaza13

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.

Zanndorin avatar Dec 07 '21 12:12 Zanndorin

谢谢你的来信,目前有点忙,稍后会尽快回复您!

gdspw avatar Dec 07 '21 12:12 gdspw

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.

wangdengwu avatar Dec 10 '21 07:12 wangdengwu