问题
Hikari CP Version : 2.7.4
This is actually not an issue but some doubts. a) maxLifetime : retires the connection after 30 mins. Will it also create a new connection automatically at the time of killing it or it waits for a new request and then creates a new connectios? considering pool has more than minIdle.
b) idleTimeout : it will drop after 10 mins of inactivity? but 10mins is too high. is it ok if i mark it as 10s(10 is min as seen from code) as otherwise there will always be connections higher than min-connections?
ALso when does the connetion is mark as idle?
回答1:
The Hikari housekeeper runs every 30s, which closes any connections that are not in use and are older than maxLifetime
. If there are more than minimumIdle
number of connections the housekeeper will close connections that have been idle for longer than idleTimeout
.
If while your app is running there are no free connections it will create another connection for you unless its reached maximumPoolSize
where you'll need to wait for one to be free.
Creating a new connection has an overhead, by pooling the connections we save that connection time from happening everytime, so by reducing this down to 10s you'll be adding a lot more overhead in comparison to every 10min.
For more info: https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby
来源:https://stackoverflow.com/questions/51482978/hikari-cp-maxlifetime-idletimeout