5

I just recently migrated my database to support replication with a 2 node cluster database from mysql to mariadb. The database are hosted over different domain and is accessed over a ELB, when I point my application to one of the node the application works fine but when I use the ELB url to connect with the database, it randomly fluctuates and frequently show the followint error

Communication Link Failure
could not execute query; nested exception is org.hibernate.exception.JDBCConnectionException: could not execute query

Here is my datasource configuration:-

dataSource {
shard = false
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
dbCreate = "update" // one of 'create', 'create-drop','update'

properties {
    initialSize=5
    maxActive=50
    minIdle=5
    maxIdle=25
    maxWait = 10000
    maxAge = 10 * 60000
    timeBetweenEvictionRunsMillis=5000
    minEvictableIdleTimeMillis=60000
    validationQuery="SELECT 1"
    validationInterval=15000
    testWhileIdle=true
    testOnBorrow=true
    testOnReturn=false
    jdbcInterceptors = "ConnectionState"
    defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}

Can anyone please identify whats wrong and provide a possible solution for it

thickGlass
  • 540
  • 1
  • 5
  • 19
  • can you please try with increasing maxWait and maxAge in the DataSourceConfig.groovy as it might be possible it's taking more than usual time sometimes. – Vinay Prajapati Sep 17 '15 at 03:37
  • have already tried all possible combination – thickGlass Sep 17 '15 at 04:42
  • how about adding an autoReconnect property to your DataSourceConfig settings. The default for it is false. You might want to set it to true and see if that solves your issue. – Kartikey Joshi Sep 17 '15 at 07:31
  • already have that, I've added that in my jdbc:mysql:///?zeroDateTimeBehavior=convertToNull&autoReconnect=true – thickGlass Sep 17 '15 at 08:31

1 Answers1

4

I figured out the issue, there was a field in ELB called idleTimeOut which was set to only 60 sec, and query which took more than 1 min was droping unexpectedly, after increasing the timeout to 600 sec the problem is not replicating anymore. :)

thickGlass
  • 540
  • 1
  • 5
  • 19