brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
19.91k stars 2.92k forks source link

HikariCP idleTimeOut/maxLifeTime #2103

Open ndesai15 opened 1 year ago

ndesai15 commented 1 year ago

This is actually some doubts about HikariCP idealTimeOut & maxLifeTime. We are using HikariCP in our application with username, password, jdbcUrl, autoCommit value as false & maxPoolSize. Now we encountered a situation where 2 same records were trying to insert the data to table with same PK where one record as a part of transaction inserted the data but before it could commit that data, 2nd session with the same data same PK was trying to get inserted to same table and that's where table got confused and that led both the sessions to ideal state. Once session 1 got timeOut after around 10/15 mins (don't know that exact duration but for sure it was >= 10 mins), DB allowed session 2 to get inserted. Now here question is how can I reduce this session 1/2's ideal timeOut to some value in seconds (~90 seconds)? By setting idealTimeOut property? Can someone please guide on this?

ndesai15 commented 1 year ago

Also, do I really need to define minimumIdle to use idleTimeOut to expire/timeOut the sessions that falls in above category?