Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does RavenDB achieves consistency, availability, and partition tolerance?

Tags:

ravendb

cap

According to CAP theorem it is impossible for a distributed computer system to simultaneously provide consistency, availability, and partition tolerance.

Reading about RavenDB it looks like this database supports ACID transactions and sharding at the same time. How does RavenDB achieves that?

like image 997
Vadim Avatar asked Apr 18 '12 18:04

Vadim


1 Answers

To clarify things upfront:
by default all writes in a RavenDB session between calls to .SaveChanges() are all-or-none. If one operations fails for whatever reason, then all changes in the current session/since the last save will be discarded. This feature, in combination with optimistic concurrency turned on, is very powerful. If you need longer transaction, there is support for System.Transaction as well, and that works as expected.

In regards to sharding:
There is no true support for distributed transactions in a sharded setup. However, due to the locality of reference documents in a good sharding strategy, you can have transactional writes on each of your stores. They simply work the same as if there weren't any shards at all.

like image 96
Daniel Lang Avatar answered Oct 11 '22 16:10

Daniel Lang