Grails MySQL MaxPoolSize

How to increase maxPoolSize in Grails when using mysql? It appears that the default connection pool uses only 8 connections.

+5
source share
2 answers

Unfortunately, you need to configure the dataSource spring bean for yourself if you want more control over it. This can be done by specifying a bean in "grails-app / conf / spring / resources.groovy"

beans = {

   dataSource(org.apache.commons.dbcp.BasicDataSource) {
      driverClassName = "com.mysql.jdbc.Driver"
      username = "someuser"
      password = "s3cret"
      initialSize = 15
      maxActive = 50
      maxIdle = 15
   }

}

It will override the default Grails data file, which is configured in "grails-app / conf / DataSource.groovy".


, , grails. DataSource.groovy, , PropertyOverrideConfigurer ( Config.groovy):

beans = {
   dataSource.initialSize = 15
   dataSource.maxActive = 50
   dataSource.maxIdle = 15
}
+6

grails 1.2 :

dataSource {
    pooled = true
    dbCreate = "update"
    url = "jdbc:mysql://localhost/yourDB"
    driverClassName = "com.mysql.jdbc.Driver"
    username = "yourUser"
    password = "yourPassword"
    properties {
        maxActive = 50
        maxIdle = 25
        minIdle = 5
        initialSize = 5
        minEvictableIdleTimeMillis = 60000
        timeBetweenEvictionRunsMillis = 60000
        maxWait = 10000     
    }   
}
+3

All Articles