Hikari CP maxLifetime / idleTimeout

妖精的绣舞 提交于 2020-01-02 04:30:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!