Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Hikari cp losing connections.
PostPosted: Wed Sep 06, 2017 3:51 am 
Newbie

Joined: Wed Oct 19, 2016 2:57 am
Posts: 13
Hi all,
I'm using Hikari 2.4.12 (java 7) version with the following configuration in Hibernate (5.1.2) and Spring (4.3.3):
Code:
<bean id="hikariConfig" class="com.zaxxer.hikari.HikariConfig">
      <property name="poolName" value="springHikariCP" />
      <property name="connectionTestQuery" value="${database.connectionTestStatement}" />
      <property name="jdbcUrl" value="${database.jdbc.url}" />
      <property name="connectionTimeout" value="15000"/>
      <property name="maximumPoolSize" value="${database.poolConnections:40}" />
      <property name="maxLifetime" value="27000000"/>
      <property name="dataSourceProperties">
         <props>
            <prop key="url">${database.jdbc.url}</prop>
            <prop key="user">${database.user}</prop>
            <prop key="password">${database.password}</prop>
            <prop key="cachePrepStmts">true</prop>
            <prop key="prepStmtCacheSize">250</prop>
            <prop key="prepStmtCacheSqlLimit">2048</prop>
         </props>
      </property>


We have seen that the number of connections is being reduced in time and after a week more or less we get connection exceptions:
QueryTimeoutException: Unable to acquire JDBC Connection.....

That's to say, there are no available connections in the pool.
I attach a plot of the behaviour of the connections (the recover corresponds to backend deployments so the connections are recovered) :
[img]
https://ibb.co/jm7goa
[/img]
https://ibb.co/jm7goa

It seems that after the maxLifeTime the connections can not be reestablished in the pool. The database (mysql) wait_timeout is 28800 seconds, so the pool maxLifeTime is less as recommended.
We do not use miminumIdle in favour of better performance and responsiveness as says the Hikari Cp documentation.

Is there a better/correct configuration to avoid the loose of connections?.

Best regards.


Top
 Profile  
 
 Post subject: Re: Hikari cp losing connections.
PostPosted: Wed Sep 06, 2017 4:53 am 
Newbie

Joined: Wed Oct 19, 2016 2:57 am
Posts: 13
I'm not shure but maybe the maxLifeTime in my production environment is not working (it works locally) and it's applied the wait_timeout of the database.
Maybe this would explain the loose of connections.


Top
 Profile  
 
 Post subject: Re: Hikari cp losing connections.
PostPosted: Wed Sep 06, 2017 6:25 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1439
I think you should post this question on the Hikari CP forum. They surely know it better.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.