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

左心房为你撑大大i 提交于 2019-12-03 07:33:02

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/29597601/is-slick-3-0-reactive-asynchronous-at-the-database-driver-level-for-which-datab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!