I would like to know how maxLifetime
and idleTimeout
settings behave in a fixed-size Hikari pool.
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!
HikariCP is retiring connections when connection 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).
you must set maxLifetime few mins less than (mysql)wait_timeout to avoid broken connection / exceptions.
HikariCP may add new connections in housekeeper or when client attempts to borrow connection. so it may not add connections immediately after retiring them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With