maxLifetime and idleTimeout with fixed-size pool

2,423 views
Skip to first unread message

Michail Anastasopoulos

unread,
Jan 5, 2016, 5:31:19 AM1/5/16
to HikariCP

Hello,


I would like to know how maxLifetime and idleTimeout settings behave in a fixed-size Hikari pool.

In other words, under which circumstances are connections being retired from a fixed-size pool?

And since the pool is fixed-size is a new connection immediately created after a retirement?


Furthermore, what happens if the database itself (MySQL in my case) closes a connection after the database wait timeout is reached (in case the maxLifetime is not less than the DB timeout)?

Will the connection be retired from the fixed-size pool and another one will be immediately created?


Thanks,

Michail

Nitin Chauhan

unread,
Jan 6, 2016, 5:04:56 AM1/6/16
to HikariCP

I would like to know how maxLifetime and idleTimeout settings behave in a fixed-size Hikari pool.

In other words, under which circumstances are connections being retired from a fixed-size pool?

And since the pool is fixed-size is a new connection immediately created after a retirement?


HikariCP is retiring connections when reaches its maxLifetime or connection remains idle in pool for idleTimeout
HikariCP housekeeper runs every 30s by default. to maintain 'minimumIdle' connections it may add new connections or retire idle connections (not borrowed by client for idleTimeout millis).
 

Furthermore, what happens if the database itself (MySQL in my case) closes a connection after the database wait timeout is reached (in case the maxLifetime is not less than the DB timeout)?


you may get broken connection / exceptions. you must set maxLifetime few mins less than wait timeout
 

Will the connection be retired from the fixed-size pool and another one will be immediately created?


if not immediately, in next run of housekeeper.

Hope this helps


Thanks,

Michail

Reply all
Reply to author
Forward
0 new messages