问题
I'm using Slick 3.0 with MySql and I'm getting terrible performance, which I want to tune. I initialize the database with
val db = Database.forConfig("horridDBStuff")
Then in application.conf
I have
horridDBStuff = {
url = "jdbc:mysql://my.db.address:3306/myschema"
driver = "com.mysql.jdbc.Driver"
connectionPool = disabled
keepAliveConnection = true
properties = {
user = "me"
password = "me"
}
}
Slick documentation says that in deployment you should enable the connection pool, so that's what I want to try. However it doesn't give an example of how to do this. I've tried commenting the line out, or replacing with connectionPool = enabled
, or connectionPool = 10
. All of these just crash Slick with a multi-page error stack. Anyone know how to properly configure the connectionPool? (Any other performance suggestions would also be appreciated - I've tried adding numThreads=10
which doesn't seem to improve things much, but at least that doesn't crash it ;)
回答1:
Slick 3.0 uses HikariCP by default. There's a ton of documentation on its project page for tuning information. As long as you don't mind using HikariCP, you should not need a connectionPool param at all.
That being said, you could could set connectionPool = HikariCP in your application.conf and that will not throw an error, though other than self-documentation, this seems redundant.
来源:https://stackoverflow.com/questions/31733586/setting-connectionpool-crashes-slick-3-0