Database tuning performance from play framework in play scala project

595 Views Asked by At

https://www.playframework.com/documentation/2.0/SettingsJDBC talks about some additional tuning performance params, but did not say anything about suggestions/advices on best or moderate settings.

Wonder if anyone has any suggestions/advice on these Additional Tuning Performance parameters?

Also, I have the following SQL error alot. Wonder if it is something to do with the tuning settings as I have all stable builds such as bonecp 0.8.0.RELEASE, play 2.2.2, play Slick 0.6.0.1 etc.

Caught SQLException!
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after  connection closed.

Would really appreciate any response on this?

2

There are 2 best solutions below

9
On BEST ANSWER

According to the exception's message you want to apply a db operation (whatever create, select, update or delete this may be) on an already closed connection. Could you past some code?

btw: I'm running bonecp 0.8.0 as well and I'm not experiencing these exceptions with using this (development) config:

db {
  default.driver=org.postgresql.Driver
  default.url="jdbc:postgresql://.../database"
  default.user=some-user
  default.password="some-pass"
  default.logStatements=true
  default.maxConnectionAge=0
  default.logStatements=true
  default.maxConnectionAge=0
  default.partitionCount=1
  default.maxConnectionsPerPartition=10
  default.minConnectionsPerPartition=5
}

Maybe you can try to tweak your config settings when inspecting the "BoneCpPlugin": "https://github.com/playframework/playframework/blob/879588fd9d1b1cdeb800f904a454014e51a8568e/framework/src/play-jdbc/src/main/scala/play/api/db/BoneCPModule.scala"

1
On

I think you can add "db.default.maxConnectionAge=0" code in applications.conf file. This one line code is enough.