Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails MySQL MaxPoolSize

Tags:

mysql

grails

How do I increase the maxPoolSize in Grails when using mysql? It appears to be using a default connection pool only 8 connections.

like image 539
Bob Herrmann Avatar asked Dec 18 '08 00:12

Bob Herrmann


1 Answers

Unfortunately you will need to configure the dataSource spring bean for yourself if you want to gain more control over it. This can be done by defining the 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 DataSource which is configured in "grails-app/conf/DataSource.groovy".


Probably it should also work to override the pool-size properties of the default grails DataSource.groovy configuration like this leveraging the PropertyOverrideConfigurer (in Config.groovy):

beans = {
   dataSource.initialSize = 15
   dataSource.maxActive = 50
   dataSource.maxIdle = 15
}
like image 141
Siegfried Puchbauer Avatar answered Sep 19 '22 23:09

Siegfried Puchbauer