是否可以在 MongoDB 之上实现多版本并发控制(MVCC)? [英] Is it possible to implement Multi-Version Concurrency Control (MVCC) on top of MongoDB?

查看:9
本文介绍了是否可以在 MongoDB 之上实现多版本并发控制(MVCC)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

我想知道是否可以通过实现多版本并发控制模式的库与 MongoDB 进行交互.

I wonder if it would be possible to interact with MongoDB through a library implementing the MultiVersion Concurrency Control pattern.

在表演方面会有多糟糕?使用混合方法是否可能且有利可图,仅在必要时使用mongo-mvcc"库,而在仅处理单个文档时使用传统的数据库连接,或者这会破坏 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)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆