Is Slick 3.0 reactive/asynchronous at the database driver level? For which databases?

后端 未结 1 1446
甜味超标
甜味超标 2021-02-02 09:00

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

1条回答
  •  轮回少年
    2021-02-02 09:41

    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

    0 讨论(0)
提交回复
热议问题