Is there any NoSQL data store that is ACID compliant?
Asked Answered
E

32

196

Is there any NoSQL data store that is ACID compliant?

Escudo answered 9/4, 2010 at 14:5 Comment(3)
There was actually FoundationDB which was acid compliant. Now Apple grabbed itMachine
wiredtiger.com and sophia.systemsNernst
Why has nobody mentioned MongoDB?Plains
W
125

I'll post this as an answer purely to support the conversation - Tim Mahy , nawroth , and CraigTP have suggested viable databases. CouchDB would be my preferred due to the use of Erlang, but there are others out there.

I'd say ACID does not contradict or negate the concept of NoSQL... While there seems to be a trend following the opinion expressed by dove , I would argue the concepts are distinct.

NoSQL is fundamentally about simple key-value (e.g. Redis) or document-style schema (collected key-value pairs in a "document" model, e.g. MongoDB) as a direct alternative to the explicit schema in classical RDBMSs. It allows the developer to treat things asymmetrically, whereas traditional engines have enforced rigid same-ness across the data model. The reason this is so interesting is because it provides a different way to deal with change, and for larger data sets it provides interesting opportunities to deal with volumes and performance.

ACID provides principles governing how changes are applied to a database. In a very simplified way, it states (my own version):

  • (A) when you do something to change a database the change should work or fail as a whole
  • (C) the database should remain consistent (this is a pretty broad topic)
  • (I) if other things are going on at the same time they shouldn't be able to see things mid-update
  • (D) if the system blows up (hardware or software) the database needs to be able to pick itself back up; and if it says it finished applying an update, it needs to be certain

The conversation gets a little more excitable when it comes to the idea of propagation and constraints. Some RDBMS engines provide the ability to enforce constraints (e.g. foreign keys) which may have propagation elements (a la cascade). In simpler terms, one "thing" may have a relationship with another "thing" in the database, and if you change an attribute of one it may require the other be changed (updated, deleted, ... lots of options). NoSQL databases, being predominantly (at the moment) focused on high data volumes and high traffic, seem to be tackling the idea of distributed updates which take place within (from a consumer perspective) arbitrary time frames. This is basically a specialized form of replication managed via transaction - so I would say that if a traditional distributed database can support ACID, so can a NoSQL database.

Some resources for further reading:

Whimsicality answered 10/6, 2010 at 13:9 Comment(3)
Good answer. You can have both NoSQL+ACID and non-ACID-RDBMS (think MySQL + MyISAM). I'd usually consider NoSQL as "eventually consistent". I'll throw in the CAP theorem too... :-)Dealings
+1 @Dealings for the mention of CAP theorem. Being more familiar with "nosql" db's now than I was then has only reinforced the separation of the concepts. Also, key-value vs doc databases, since there are architectural differences.Whimsicality
-1 for the mention of CAP theorem, we should burn it. Please read https://martin.kleppmann.com/2015/05/11/please-stop-calling-databases-cp-or-ap.htmlBirthmark
I
41

UPDATE (27 July 2012): Link to Wikipedia article has been updated to reflect the version of the article that was current when this answer was posted. Please note that the current Wikipedia article has been extensively revised!

Well, according to an older version of a Wikipedia article on NoSQL:

NoSQL is a movement promoting a loosely defined class of non-relational data stores that break with a long history of relational databases and ACID guarantees.

and also:

The name was an attempt to describe the emergence of a growing number of non-relational, distributed data stores that often did not attempt to provide ACID guarantees.

and

NoSQL systems often provide weak consistency guarantees such as eventual consistency and transactions restricted to single data items, even though one can impose full ACID guarantees by adding a supplementary middleware layer.

So, in a nutshell, I'd say that one of the main benefits of a "NoSQL" data store is its distinct lack of ACID properties. Furthermore, IMHO, the more one tries to implement and enforce ACID properties, the further away from the "spirit" of a "NoSQL" data store you get, and the closer to a "true" RDBMS you get (relatively speaking, of course).

However, all that said, "NoSQL" is a very vague term and is open to individual interpretations, and depends heavily upon just how much of a purist viewpoint you have. For example, most modern-day RDBMS systems don't actually adhere to all of Edgar F. Codd's 12 rules of his relation model!

Taking a pragmatic approach, it would appear that Apache's CouchDB comes closest to embodying both ACID-compliance whilst retaining loosely-coupled, non-relational "NoSQL" mentality.

Immateriality answered 9/4, 2010 at 14:22 Comment(5)
+1 I'm not sure I agree with the lack of ACID being a key characteristic of "NoSQL", but I really appreciate your writeup. Ultimately, it should be about a solution which fits.Whimsicality
I edited (pending review) to try to make even more clear. There's nothing about NoSQL datamodels that imply ACID transactions aren't possible. Some NoSQL distributed systems don't have them. Some actually do without any "middleware layer".Hedva
This was never correct and has even lost it's source. It should really be deleted.Sulphurous
Well, most blatantly, this: "in a nutshell, I'd say that one of the main benefits of a "NoSQL" data store is its distinct lack of ACID properties." You also imply that NoSQL and ACID somehow are mutually exclusive which is definitely incorrect. This is a good example of when a large number of ignorant people upvote an incorrect answer because it sounds reasonable. That most NoSQL databases aren't ACID compliant is mostly because the people implemented it didn't know what it was/why it was important/didn't care.Sulphurous
@LennartRegebro - I didn't imply any such thing. ACID-compliance has indeed been eschewed by most of the current, existing NoSQL databases in favour of speed/performance and eventual consistency. I never said that you couldn't have NoSQL with ACID-compliance, though.Immateriality
C
38

Please ensure you read the Martin Fowler introduction about NoSQL databases. And the corresponding video.

First of all, we can distinguish two types of NoSQL databases:

  1. Aggregate-oriented databases;
  2. Graph-oriented databases (e.g. Neo4J).

By design, most Graph-oriented databases are ACID!

Then, what about the other types?

In Aggregate-oriented databases, we can put three sub-types:

  • Document-based NoSQL databases (e.g. MongoDB, CouchDB);
  • Key/Value NoSQL databases (e.g. Redis);
  • Column family NoSQL databases (e.g. Hibase, Cassandra).

What we call an Aggregate here, is what Eric Evans defined in its Domain-Driven Design as a self-sufficient of Entities and Value-Objects in a given Bounded Context.

As a consequence, an aggregate is a collection of data that we interact with as a unit. Aggregates form the boundaries for ACID operations with the database. (Martin Fowler)

So, at Aggregate level, we can say that most NoSQL databases can be as safe as ACID RDBMS, with the proper settings. Of source, if you tune your server for the best speed, you may come into something non ACID. But replication will help.

My main point is that you have to use NoSQL databases as they are, not as a (cheap) alternative to RDBMS. I have seen too much projects abusing of relations between documents. This can't be ACID. If you stay at document level, i.e. at Aggregate boundaries, you do not need any transaction. And your data will be as safe as with an ACID database, even if it not truly ACID, since you do not need those transactions! If you need transactions and update several "documents" at once, you are not in the NoSQL world any more - so use a RDBMS engine instead!

some 2019 update: Starting in version 4.0, for situations that require atomicity for updates to multiple documents or consistency between reads to multiple documents, MongoDB provides multi-document transactions for replica sets.

Cammiecammy answered 28/2, 2014 at 20:36 Comment(9)
I wrote a blog article about this question.Cammiecammy
There are cases when there is a big process/saga that handles many aggregates . There are cases when a command sent to an aggregate might trigger some events that change other aggregates . In these cases you need ACID compliant data stores .Beheld
@TudorTudor but in this case you are breaking one of the nosql principle, since you are using it as a rdbms. You just need bigger aggregates or versioning of the documents (like in couchdb). Nosql document-oriented db are acid at document/aggregate boundaries.Cammiecammy
None of those you list are acid compliant. Mongo just owns not being ACID compliant. CouchDB pretends it's acid compliant so long as you're not updating two documents. Redis only has "partial support for transactions". HBase is straight up not acid compliant (from the devs), neither is Cassandra. This answer is in fact just wrong. None of these databases support ACID, and most of them openly own it with a simple google search.Commination
@EvanCarroll I never wrote that MongoDB is ACID compliant, in the same meaning as with an ACID RDBMS transaction. There is no transaction available. What I wrote is that most NoSQL databases can be as safe as ACID RDBMS, with the proper settings. For instance, check the $isolated MongoDB operator for a DB without any shared cluster. I would never use MongoDB for financial process, but I could trust its write process to some extend, for ACID-like operations, if the A for Atomicity is enough. Sorry if my answer is confusing.Cammiecammy
Respectfully, I do think it's confusing to say "most NoSQL databases can be as safe as ACID RDBMS, with the proper settings" and then to go on listing a bunch of databases that themselves say they're not ACID compliant. Or, to say that Mongo is ACID compliant because writing to one document is atomic. That's not what ACID refers to: the idea is that a complex transaction can be atomic. Not that file operations are atomic. Is EXT4 ACID compliant with data=journal?Commination
@ArnaudBouchez blog article link you shared is brokenSyntactics
I guess blog.synopse.info?post/2014/02/28/Are-NoSQL-databases-ACID is the correct link now. @SyntacticsCammiecammy
AS per redis.io/topics/transactions , Redis has started providing Atomicity and Isolation.Trometer
P
21

In this question someone must mention OrientDB: OrientDB is a NoSQL database, one of the few, that support fully ACID transactions. ACID is not only for RDBMS because it's not part of the Relational algebra. So it IS possible to have a NoSQL database that support ACID.

This feature is the one I miss the most in MongoDB

Phenolic answered 22/2, 2012 at 0:11 Comment(1)
Open source mostly github.com/orientechnologies/orientdb but has closed source enterprise featuresFume
I
19

FoundationDB is ACID compliant:

http://www.foundationdb.com/

It has proper transactions, so you can update multiple disparate data items in an ACID fashion. This is used as the foundation for maintaining indexes at a higher layer.

Inductance answered 25/1, 2013 at 18:23 Comment(4)
unfortunatly it isn't open source. But it does look like a very nice database.Pancreatotomy
To add up to @Ken-Tindell answer, djondb is also NoSQL and implements transactions and it's ACID compliant. djondb.com I agree that NoSQL is just a term to coin all the databases that does not follow the traditional rules of the RDBMS, it does not mean "get rid of the TX systems", or forget about the relationships.Arceliaarceneaux
My answer has been rendered moot by Apple's acquisition of Foundation DB.Inductance
foundationdb is now open sources by AppleBaillargeon
P
17

ACID and NoSQL are completely orthogonal. One does not imply the other.

I have a notebook on my desk, I use it to keep notes on things that I still have to do. This notebook is a NoSQL database. I query it using a linear search with a "page cache" so I don't always have to search every page. It is also ACID compliant as I ensure that I only write one thing at a time and never while I am reading it.

NoSQL simply means that it isn't SQL. Many people get confused and think it means highly-scaleable-wild-west-super-fast-storage. It doesn't. It doesn't mean key-value store, or eventual consistency. All it means is "not SQL", there are a lot of databases in this planet and most of them are not SQL[citation needed].

You can find many examples in the other answers so I need not list them here, but there are non-SQL databases with ACID compliance for various operations, some are only ACID for single object writes while some guarantee far more. Each database is different.

Pancreatotomy answered 29/7, 2014 at 21:36 Comment(2)
Just to be pedantic but it usually means 'Not only SQL' :-)Keeler
@Keeler not really. It meant "No SQL" when the term was first coined. The "o" is small, not capital after all. There were attempts later to recoin the term as "Not Only SQL" when some of these (NoSQL products) started adding SQL-like query language interfaces.Raychel
U
11

"NoSQL" is not a well-defined term. It's a very vague concept. As such, it's not even possible to say what is and what is not a "NoSQL" product. Not nearly all of the products typcially branded with the label are key-value stores.

Uneven answered 9/4, 2010 at 14:12 Comment(1)
Best answer. When ever this flame war comes up I like to ask the other party what defining features they explicitly require from a NoSQL database and often it overlaps with features they can find in a RDBMS - not because one or RDBMSs fit the NoSQL theme but simply because their feature 'requirements' are so vague that they do not negate completely, features found in (not all necessarily) RDMBSs. +1 for your comment mate!Rugose
S
9

As one of the originators of NoSQL (I was an early contributor to Apache CouchDB, and a speaker at the first NoSQL event held at CBS Interactive / CNET in 2009) I'm excited to see new algorithms create possibilities that didn't exist before. The Calvin protocol offers a new way to think of physical constraints like CAP and PACELC.

Instead of active/passive async replication, or active/active synchronous replication, Calvin preserves correctness and availability during replica outages by using a RAFT-like protocol to maintain a transaction log. Additionally, transactions are processed deterministically at each replica, removing the potential for deadlocks, so agreement is achieved with only a single round of consensus. This makes it fast even on multi-cloud worldwide deployments.

FaunaDB is the only database implementation using the Calvin protocol, making it uniquely suited for workloads that require mainframe-like data integrity with NoSQL scale and flexibility.

Sexism answered 5/2, 2019 at 22:49 Comment(0)
O
8

Yes, MarkLogic Server is a NoSQL solution (document database I like to call it) that works with ACID transactions

Offal answered 20/5, 2011 at 0:26 Comment(1)
MarkLogic has ACID transactions, multi-document transactions, multi-statement transactions, and support for XA - all cluster-wide/distributed.Hedva
S
8

The grandfather of NoSQL: ZODB is ACID compliant. http://www.zodb.org/

However, it's Python only.

Sulphurous answered 24/9, 2012 at 22:17 Comment(1)
For those looking to transition from python's "shelve" library, I found ZODB to be nearly seemless. I did not need to re-write all my functions - just access ZODB as a dictionary just like shelve, but it is an order of magnitude faster.Rehabilitation
B
7

If you are looking for an ACID compliant key/value store, there's Berkeley DB. Among graph databases at least Neo4j and HyperGraphDB offer ACID transactions (HyperGraphDB actually uses Berkeley DB for low-level storage at the moment).

Bubble answered 10/4, 2010 at 9:26 Comment(0)
C
6

FoundationDB was mentioned and at the time it wasn't open source. It's been open sourced by Apple two days ago: https://www.foundationdb.org/blog/foundationdb-is-open-source/

I believe it is ACID compliant.

Cruet answered 21/4, 2018 at 13:24 Comment(0)
P
5

MongoDB announced that its 4.0 version will be ACID compliant for multi-document transactions.

Version 4.2. is supposed to support it under sharded setups.

https://www.mongodb.com/blog/post/multi-document-transactions-in-mongodb

Pagepageant answered 19/2, 2018 at 2:6 Comment(1)
Yes, multi-document ACID transactions are now supported in MongoDB. See mongodb.com/transactions for more info and deep dive videos into how they were implemented.Yenta
P
4

NewSQL

This concept Wikipedia contributors define as:

[…] a class of modern relational database management systems that seek to provide the same scalable performance of NoSQL systems for online transaction processing (OLTP) read-write workloads while still maintaining the ACID guarantees of a traditional database system.[1][2][3]

References

[1] Nancy Lynch and Seth Gilbert, “Brewer's conjecture and the feasibility of consistent, available, partition-tolerant web services”, ACM SIGACT News, Volume 33 Issue 2 (2002), pg. 51-59.

[2] "Brewer's CAP Theorem", julianbrowne.com, Retrieved 02-Mar-2010

[3] "Brewers CAP theorem on distributed systems", royans.net

Planetstruck answered 6/12, 2014 at 3:43 Comment(0)
A
3

take a look at the CAP theorem

EDIT: RavenDB seems to be ACID compliant

Alta answered 9/4, 2010 at 14:39 Comment(0)
W
3

To add to the list of alternatives, another fully ACID compliant NoSQL database is GT.M.

Wateriness answered 7/6, 2012 at 23:55 Comment(0)
E
3

Hyperdex Warp http://hyperdex.org/warp/ Warp (ACID feature) is proprietary, but Hyperdex is free.

Exhort answered 30/7, 2013 at 5:56 Comment(0)
C
2

db4o

Unlike roll-your-own persistence or serialization, db4o is ACID transaction safe and allows for querying, replication and schema changes during runtime

http://www.db4o.com/about/productinformation/db4o/

Chee answered 10/6, 2010 at 12:9 Comment(0)
H
2

BergDB is a light-weight, open-source, NoSQL database designed from the start to run ACID transactions. Actually, BergDB is "more" ACID than most SQL databases in the sense that the only way to change the state of the database is to run ACID transactions with the highest isolation level (SQL term: "serializable"). There will never be any issues with dirty reads, non-repeatable reads, or phantom reads.

In my opinion, the database is still highly performant; but don't trust me, I created the software. Try it yourself instead.

Heliostat answered 25/9, 2013 at 11:25 Comment(0)
S
2

Tarantool is a fully ACID NoSQL database. You can issue CRUD operations or stored procedures, everything will be run with strict accordance with an ACID property. You can also read about that here: http://stable.tarantool.org/doc/mpage/data-and-persistence.html

Snaggy answered 8/7, 2015 at 23:57 Comment(0)
G
2

MarkLogic is also ACID complient. I think is one of the biggest players now.

Greenbelt answered 18/8, 2017 at 10:20 Comment(0)
S
1

Wait is over.

ACID compliant NoSQL DB is out ----------- have a look at citrusleaf

Scotsman answered 8/7, 2011 at 6:16 Comment(1)
Does Aerospike support multi-key ACID transaction? AKAIK it's limited to single-key transaction.Canopus
T
1

A lot of modern NoSQL solution don't support ACID transactions (atomic isolated multi-key updates), but most of them support primitives which allow you to implement transactions on the application level.

If a data store supports per key linearizability and compare-and-set (document level atomicity) then it's enough to implement client-side transactions, more over you have several options to choose from:

  1. If you need Serializable isolation level then you can follow the same algorithm which Google use for the Percolator system or Cockroach Labs for CockroachDB. I've blogged about it and create a step-by-step visualization, I hope it will help you to understand the main idea behind the algorithm.

  2. If you expect high contention but it's fine for you to have Read Committed isolation level then please take a look on the RAMP transactions by Peter Bailis.

  3. The third approach is to use compensating transactions also known as the saga pattern. It was described in the late 80s in the Sagas paper but became more actual with the raise of distributed systems. Please see the Applying the Saga Pattern talk for inspiration.

The list of data stores suitable for client side transactions includes Cassandra with lightweight transactions, Riak with consistent buckets, RethinkDB, ZooKeeper, Etdc, HBase, DynamoDB, MongoDB and others.

Turney answered 5/3, 2016 at 7:0 Comment(0)
P
1

YugaByte DB supports an ACID Compliant distributed txns as well as Redis and CQL API compatibility on the query layer.

Pantagruel answered 4/3, 2018 at 20:0 Comment(0)
R
1

DynamoDB is a NoSQL database and has ACID transactions.

Rachele answered 2/1, 2019 at 20:57 Comment(0)
W
1

If you add enough pure water and successfully flip a coin, anything can become acidic. Or basic for that matter.

To say a database is ACID compliant means four specific things. And in defining the system (restricting the range) we can arbitrarily water down the meanings so that the result is ACID compliance.

  • A—if your NoSQL database only allows one record operation at a time and records either go or they don't then that's atomic.
  • C—if the only constraints you allow are simple, like checking JSON schemas against a known schema then that's consistent.
  • I—if just append-only transactions are supported (and schema changes are disallowed) then it is impossible for anything to depend on anything else, that's independent.
  • D—if you turn off all machines at night and synchronize disks then the transactions will be it in or they won't, that's durable.
Walkup answered 9/3, 2022 at 15:55 Comment(0)
L
1

MongoDB added support for multi-document ACID transactions in version 4.0 in 2018 and extended that support for distributed multi-document ACID transactions in version 4.2 in 2019.

https://www.mongodb.com/basics/acid-transactions

DynamoDB transactions provide developers atomicity, consistency, isolation, and durability (ACID) across one or more tables within a single AWS account and region.

https://aws.amazon.com/blogs/aws/new-amazon-dynamodb-transactions/

Lamina answered 8/10, 2022 at 17:47 Comment(0)
U
0

VoltDB is an entrant which claims ACID compliance, and while it still uses SQL, its goals are the same in terms of scalability

Uranus answered 2/6, 2010 at 1:8 Comment(1)
The creator of VoltDB mentioned that they do not label themselves as NoSql but more like NewSql (still using Sql but with better implementation than those RDBMs built in the eighties)Goodygoody
J
0

Whilst it's only an embedded engine and not a server, leveldb has WriteBatch and the ability to turn on Synchronous writes to provide ACID behaviour.

Jigger answered 8/6, 2012 at 0:37 Comment(0)
F
0

Node levelUP is transactional and built on leveldb https://github.com/rvagg/node-levelup#batch

Fume answered 24/8, 2013 at 0:15 Comment(0)
T
-1

Not only NoSQL is not ACID compliant by design. NoSQL movement embrace the BASE (Basically Available, Soft state, Eventual consistency) claimed to be the opposite of ACID. NoSQL database are often called Eventually-Consisted database. To understand the differences you should drill down into the CAP theorem (aka Brewer's theorem)

Visit http://www.julianbrowne.com/article/viewer/brewers-cap-theorem

Themselves answered 13/5, 2012 at 14:33 Comment(4)
I think pointer to the CAP theorem is very relevant for this question!Affectionate
Some NoSQL databases have ACID transactions.Hedva
Some noSQL claim to be ACID compliant but when u drill down inside you discover that only in some particular cases they're ACID so IMHO as there is no 'eventually ACID' they are definitely not ACIDThemselves
You're fundamentally misapplying CAP. CAP and ACID are loosely related at best, but CAP does not prevent a distributed system from being ACID compliant. CAP describes requisite tradeoffs of a distributed system - a NoSQL system that is strongly consistent may be unavailable during a partition, but that doesn't preclude it from being ACID compliant.Parishioner

© 2022 - 2024 — McMap. All rights reserved.