本文介绍了Slick 3.0在数据库驱动程序级别上是被动的还是异步的?对于哪些数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Slick历史上一直依赖JDBC驱动程序,该驱动程序在内部阻止等待套接字I/O的响应.每个未完成的数据库调用都需要一个线程来阻塞套接字.因此,它与ReactiveMongo,postgresql-async和mysql-async并不是完全一样,它们一直都是异步的.

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.

在Slick 3.0中这方面有什么改变吗?还是我对此感到困惑?

Has anything changed in this regard in Slick 3.0? Or am I confused about any of this?

推荐答案

它不会异步到驱动程序级别,但这不是问题.在良好的设置中,等待数据库连接的阻塞线程的数量应该很小.因此,它们不会消耗大量资源. Slick管理它们并计划将阻塞的线程安排到它们自己的线程池中,因此它们不会妨碍计算. 本机"异步驱动程序可能会增加次要的速度,但不会增加主要的速度. Slick可能会在将来的某个时候支持这一点. 反应式"的主要好处来自Slick在3.0中已经实现的功能.可以在以下位置找到更广泛的解释: https://www.parleys.com/tutorial/reactive-slick -数据库编程

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

这篇关于Slick 3.0在数据库驱动程序级别上是被动的还是异步的?对于哪些数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 07:51