7 ms·
MongoDB is partition tolerant and consistent. You can never have multi-master with MongoDB, which is required for "always writable." However, it can be readab
by kchodorow 15y ago
MongoDB is partition tolerant and consistent.
You can never have multi-master with MongoDB, which is required for "always writable." However, it can be readable. Our CEO did a series of posts on distributed consistency, see http://blog.mongodb.org/post/475279604/on-distributed-consistency-part-1 http://blog.mongodb.org/post/475279604/on-distributed-consis....
- benblack 15y agoIf a slave can continue serving reads whilst partitioned from a master that continues to accept writes then you cannot guarantee consistency. If a slave cannot serve reads when partitioned then you aren't available. If a master cannot accept writes when partitioned then you aren't available. See this excellent post from Coda Hale on why it is meaningless to claim a system is partition tolerant http://codahale.com/you-cant-sacrifice-partition-tolerance/ http://codahale.com/you-cant-sacrifice-partition-tolerance/. One love. - Lil' B
- jorgeortiz85 15y agoIn a replica set configuration, all reads and writes are routed to the master by default. In this scenario, consistency is guaranteed. (You can optionally mark reads as "slaveOk", but then you admit inconsistency.) This does sacrifice availability (in the CAP sense), but I haven't heard anyone claim otherwise.
- benblack 15y ago"In a replica set configuration, all reads and writes are routed to the master by default. In this scenario, consistency is guaranteed." One would hope that reading and writing a single node database was consistent. This is table stakes for something calling itself a persistent store. Claiming partition tolerance in the above is the same as claiming availability. The former claim has been made. Rest left as exercise for the reader. Namasté. - Lil' B
- jorgeortiz85 15y agoIf a slave is partitioned from its master, it won't be able to serve requests. (Unless the request is a read query marked as "slaveOk", in which case you admit inconsistency.) I highly doubt anyone would claim otherwise.
- aguynamedben 15y agoLil' B, stop trying to outsmart us all, MongoDB works, supports JSON, and autoshards.
- jdefarge 15y agoThanks God. At least it's not Cassandra. :)
- tuna 15y agoWhich C is lying ? CEO or CAP ? I let to the heart of pure and to the late night sysadmin to decide.
- kchodorow 15y agoI interpreted "what is sacrificed?" as asking which letter of CAP MongoDB was giving up. Coda's article actually explains exactly the tradeoffs MongoDB makes for CP: ------------------- Choosing Consistency Over Availability If a system chooses to provide Consistency over Availability in the presence of partitions (again, read: failures), it will preserve the guarantees of its atomic reads and writes by refusing to respond to some requests. It may decide to shut down entirely (like the clients of a single-node data store), refuse writes (like Two-Phase Commit), or only respond to reads and writes for pieces of data whose "master" node is inside the partition component (like Membase). This is perfectly reasonable. There are plenty of things (atomic counters, for one) which are made much easier (or even possible) by strongly consistent systems. They are a perfectly valid type of tool for satisfying a particular set of business requirements. -------------------