Connection-reuse and transactions (relationship)

↘锁芯ラ 提交于 2021-01-28 05:00:24

问题


How does R2DBC implement transaction-handling.

As far as I know, JDBC use one connection for one transaction. So in Spring MVC we have the following mapping: 1 request : 1 thread : 1 transaction : 1 connection.

What is the mapping in Webflux with R2DBC? Webflux is reactive, so when we open one transaction, does it use one connection until the end of the transaction? If so, then a transaction is something like a blocking operation because, while the transaction is active no other transaction can reuse the connection in Spring Webflux.

Let's say we define 10 connections in R2DBC and 10 Webflux requests open 10 long transactions. Will all the following Webflux requests wait for ending of one of this 10 transactions or can multiple Webflux requests (with transaction) use one single connection in parallel?


回答1:


R2DBC supports only a single transaction per connection. The primary reason - as far as I'm aware - is that a lot of database systems only support a single transaction per connection, so multiplexing transactions on a single connection is not possible.



来源:https://stackoverflow.com/questions/64729022/connection-reuse-and-transactions-relationship

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