kofhearts
kofhearts

Reputation: 3784

maxWait MySQL configuration taking no effect in Grails?

I am load testing a Grails 4.0.10 app using Jmeter

enter image description here

After 5 minutes or so the log starts recording error like this

enter image description here

You can see it says

Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.

according to the docs

https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Common_Attributes

the default maxwait is 30 seconds or 30000 ms

enter image description here

This is the configuration I am using

        dataSource {
            pooled = true
            dbCreate = "none"
            url = "jdbc:mysql://localhost:3306/dev2?useUnicode=yes&characterEncoding=UTF-8"
            driverClassName = "com.mysql.cj.jdbc.Driver"
            dialect = org.hibernate.dialect.MySQL8Dialect
            type = "com.zaxxer.hikari.HikariDataSource"
            properties {
                jmxEnabled = true
                initialSize = 5
                maxActive = 50
                minIdle = 5
                maxIdle = 25
                maxWait = 10000
                maxAge = 10 * 60000
                timeBetweenEvictionRunsMillis = 5000
                minEvictableIdleTimeMillis = 60000
                validationQuery = "SELECT 1"
                validationQueryTimeout = 3
                validationInterval = 15000
                testOnBorrow = true
                testWhileIdle = true
                testOnReturn = false
                jdbcInterceptors = "ConnectionState;StatementCache(max=200)"
                defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
            }
}

You can see I am using maxWait 10000.

But the error is saying timeout after 30000 which is the default value.

So this means the configuration change is not taking effect.

I am using root MySQL user so the user should have all privilege.

What could be the reason the db configuration is not taking effect especially the maxWait property? I would like to increase maxWait so that load testing can pass.

I am running the app as standalone using this command

 nohup java -Dgrails.env=prod -Duser.timezone=US/Mountain -jar RCRoadRaceWeb4-0.1.jar &

Upvotes: 0

Views: 206

Answers (1)

Mattias Reichel
Mattias Reichel

Reputation: 99

You are using a Hikari connection pool but are setting properties for a Tomcat connection pool. The property equivalent to maxWait (in Tomcat) is connectionTimeout in Hikari.

You can see all the properties for Hikari here: https://github.com/brettwooldridge/HikariCP#gear-configuration-knobs-baby

Upvotes: 1

Related Questions