Search code examples
hikaricp

What is difference between maxLifetime and idleTimeout in HikariCP


When i set minimum idleTimeout then idle connections closed after 10 seconds.

    hikari:
      maximum-pool-size: 150
      minimum-idle: 50
      idle-timeout: 10000

But even i set maxLifeTime 30 seconds then they closed either.

    hikari:
      maximum-pool-size: 150
      minimum-idle: 50
      max-lifetime: 30000

Here's question.

What is difference between maxLifeTime and idleTimeout?


Solution

  • If a connection is older than maxLifeTime when it is returned to the connection pool, it will be closed immediately. If it sits idle for longer than idleTime, OR maxLifeTime, then it will close.