Reputation: 10318
What is the correct way to configure the pool size of HikariCP for Play w/ and w/o Slick?
I've tried this with slick:
slick.dbs.default.db.minimumIdle=30
slick.dbs.default.db.maximumPoolSize=30
(other properties like connectionTestQuery seem to work this way)
And w/o Slick I've tried various combinations of:
play.db.default.minimumIdle=30
play.db.default.maximumPoolSize=30
And:
play.db.default.prototype.hikaricp.minimumIdle=30
play.db.default.prototype.hikaricp.maximumPoolSize=30
I've seen the documentation, but nothing seems to stick.
Upvotes: 5
Views: 4747
Reputation: 1672
SBT Dependancy HikariCP Connection Pool
// https://mvnrepository.com/artifact/com.zaxxer/HikariCP
libraryDependencies += "com.zaxxer" % "HikariCP" % "2.3.2"
Use HikariDatasource with imports , and use setMaximumPoolSize() method of hikari config, like below
import com.zaxxer.hikari.HikariDataSource
import com.zaxxer.hikari.HikariConfig
var datasource: HikariDataSource = null
var hc: HikariConfig = new HikariConfig();
hc.setMinimumIdle(--- anything ,depends)
hc.setMaximumPoolSize(300 or anything)
-- set other properties like jdbc url ,user name , password ,database name etc which are needed
set hikari config object to hikari data sourse
var ds: HikariDataSource = new HikariDataSource(hc);
datasource = ds
and use datasource .
Upvotes: 1
Reputation: 4652
Don't take it a wrong way, actually in slick 3.x, the pool size is decided by numThreads value in configuration, the min size is numThreads, and the max size is numThreads * 5, the configuration value of pool size simple not use at its HikariCP wrapper.
Upvotes: 3
Reputation: 12986
I think the correct syntax is
play.db.default.hikaricp.minimumIdle=30
play.db.default.hikaricp.maximumPoolSize=30
but this does not seem to work with Slick
Furthermore, be aware that any configuration under play.db is not considered by Play Slick.
You can try something like
slick.dbs.default.db.numThreads=30
slick.dbs.default.db.queueSize=30
Upvotes: 4