问题描述
对我而言,MongoDB是一个很棒的数据库.但是,在某些情况下,我确实需要原子多文档事务.例如,在帐户之间转移事物(例如金钱或名誉),这需要完全成功或完全失败.
MongoDB is to me a great database. However there are cases where I really need atomic multi-document transactions. For example to transfer things (like money or reputation) between accounts and this needs to either succeed completely or fail completely.
我想知道是否有可能通过实现MultiVersion并发控制模式的库与MongoDB进行交互.
I wonder if it would be possible to interact with MongoDB through a library implementing the MultiVersion Concurrency Control pattern.
关于表演有多糟糕?使用混合方法是否可能且有利可图,仅在必要时使用'mongo-mvcc'库,而仅在单个文档上工作时使用传统的db连接,否则会破坏mvcc的东西吗?
How bad would it be concerning performances? Would it be possible and profitable to use a hybrid approach, using the 'mongo-mvcc' library only when necessary and the traditional db connection when working only on a single document or would this break the mvcc stuff ?
推荐答案
最简单的方法是使用锁(两阶段提交),尽管在某些情况下这不是很有效.为了获得更高的并发性,可以在Mongo的顶部实现某种MVCC.本文提供了很好的描述:
The simplest way is to use locks (two-phase commit), although this is not very efficient in some cases. For higher concurrency some kind of MVCC can be implemented on the top of Mongo. This article provides a good description:
http://highlyscalable.wordpress.com/2012 /01/07/mvcc-transactions-key-value/
这篇关于是否可以在MongoDB之上实现多版本并发控制(MVCC)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!