Slick has historically relied on JDBC drivers, which internally block waiting for socket I/O in response to queries. Every outstanding database call requires a thread to block on a socket; hence, it's not really reactive in the same sense as ReactiveMongo, postgresql-async and mysql-async, which are asynchronous all the way down.
Has anything changed in this regard in Slick 3.0? Or am I confused about any of this?
Slick is easy to use in asynchronous, non-blocking application designs, and supports building applications according to the Reactive Manifesto.
Slick is a Functional Relational Mapping library for Scala that allows us to query and access a database like other Scala collections. We can write database queries in Scala instead of SQL, thus providing typesafe queries.
It is not async down to the driver level, but that is not a problem. The number of blocking threads waiting for database connections is supposed to be small in a good setup. Thus they don't consume a lot of resources. Slick manages them and schedules blocking threads into their own thread pool, so they aren't in the way of computations. A "native" async driver would probably add a minor speedup, but not a major one. Slick may support that at some point in the future. The major benefit of "reactive" comes from what Slick already implements in 3.0. A more extensive explanation can be found here: https://www.parleys.com/tutorial/reactive-slick-database-programming
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With