essential-slick icon indicating copy to clipboard operation
essential-slick copied to clipboard

Talk of connection poolling somewhere?

Open d6y opened this issue 10 years ago • 2 comments

Dave notes:

Slick 3 uses HikariCP by default. You can do nothing and get basic connection pooling for free.

d6y avatar Jul 15 '15 10:07 d6y

Configuring a connection pool is something that developers often get wrong. There are several, possibly counter-intuitive for some, principles that need to be understood when configuring the pool. https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing

d6y avatar Apr 06 '16 11:04 d6y

From the mailing list:

Slick's default is to set HikariCP's maxConnections to 5 times numThreads (see here). So by default, we are running with 20 threads and maxConnections=100.

Is it possible for a Slick thread to use more than one connection at a time? If so, what's the intuition behind having it 5 times - how can we determine the right number for us?

Answered by Stefan:

you can have a connection without an associated thread. This happens whenever you pin a session (e.g. for a transaction or streaming results) and give up the database thread to perform a non-I/O action.

and

It's just an estimate that can and should be changed as needed. The number of threads determines how many things you can run in parallel on the database server and the number of connections determines you many things you can keep in memory at the same time on the database server.

d6y avatar Apr 06 '16 11:04 d6y