Live data from Hacker News

MongoDB Performance & Durability

mikealrogers.com

11–20 of 52 posts

Re: MongoDB Performance & Durability

#11
There's a blog post where the MongoDB people explain why they haven't prioritised single server durability:

http://blog.mongodb.org/post/381927266/what-about-durability

Basically: (a) for real single server durability you need to turn off hardware buffering or have a battery-backed RAID controller to ensure your write really hit disk; (b) this won't help you if your disks fail, and this failure mode is as likely as any other; and (c) for some applications, the delay required to replay a transaction log in unacceptable--you need 100% uptime.

I am thinking though, that the fact that MongoDB writes to files at all is somewhat misleading, and that they may as well say that all your data is loaded into virtual memory. (Since they make no guarantees that the database files will be consistent except in the case of a controlled shutdown. Neither does MySQL, they point out, but I think in practice MySQL database files will be easier to recover from, since their structure is presumably more regular.)

Re: MongoDB Performance & Durability

#13
post #9
post #6

Earlier quoted context omitted.

It's not really about losing a minute of data though--the whole thing could become corrupted, and repairing it will be extremely difficult.

...which is why you have a slave. Master corrupt? Promote the slave to master, get it its own slave. Repairing a corrupted database, even a relational database, often takes too long for a production app.

So you run naked during the time of the master rebuild? — The only sensible solution is to run two slaves at least, IMHO. — I haven't looked, but do you promote that?

Re: MongoDB Performance & Durability

#14
I've tried to post this as a comment on the blog, but it's not showing up (moderated?):

-----------

Full disclosure: I work for 10gen.

You strategically posted this when my air conditioning was broken, so here are a few thoughts before I go find somewhere cooler. Since CouchDB is "not a competitor" to MongoDB, it's nice of you to put all this time into a public service.

> MongoDB, by default, doesn’t actually have a response for writes.

Whoopsy, got your emphasis wrong there. We did this to make MongoDB look good in stupid benchmarks (http://www.snailinaturtleneck.com/blog/2009/06/29/couchdb-vs...).

Seriously, though, this "unchecked" type of write is just supposed to be for stuff like analytics or sensor data, when you're getting a zillion a second and don't really care some get lost if the server crashes. You can do an insert that not only waits for a database response, but waits for N slaves (user configurable) to have replicated that insert. Note that this is very similar to Cassandra's "write to multiple nodes" promise. You can also fsync after every write.

> MongoDB writes to a mem-mapped file and lets the kernel fsync it whenever > the kernel feels like it.

fsyncs are configurable. You can fsync once a second, never, or after every single insert, remove, and update if you wish.

> When you look at MongoDB more critically I don’t see how you could actually > justify using it for anything resembling the traditional role of a database.

This is because you assume you'll run it on single server. MongoDB's documentation clearly, repeatedly, and earnestly tells people to run MongoDB on multiple servers.

Also, as another commenter mentioned, full single-server durability is scheduled for the fall.

> Stories like this (http://www.korokithakis.net/node/119) are dubious not > because they expose a few bugs in MongoDB but because they show inherent > architectural problems you cannot overcome long term without something > append-only.

Stories "like this" show that MongoDB doesn't work for everyone, particularly people who give no specifics about their architecture, setup, what happened, or anything else. Isn't it irritating how people will write, "MongoDB lost my data" or "CouchDB is really slow" and provide no specifics?

That's not to say that things never go wrong, MongoDB is definitely not perfect and has lots of room for improvement. I hope that users with questions and problems will contact us on the list, our wiki, the bug tracker, or IRC (or, heck, write a snarky blog post). Anything to contact the community and let us try to help. I wish every person who tried MongoDB had a great experience with it.

Lots of users, hopefully most, love MongoDB and are using it happily and successfully in production.

Re: MongoDB Performance & Durability

#15
post #13
post #9

Earlier quoted context omitted.

...which is why you have a slave. Master corrupt? Promote the slave to master, get it its own slave. Repairing a corrupted database, even a relational database, often takes too long for a production app.

So you run naked during the time of the master rebuild? — The only sensible solution is to run two slaves at least, IMHO. — I haven't looked, but do you promote that?

Actually, that will be a recommended config for replica sets. Most of our slides already show 3 replicas per set.

Also, most people have backups so its not really "running naked". See http://www.mongodb.org/display/DOCS/Backups for a few ways to backup mongodb. With LVM/EBS/ZFS or any other snapshotable filesystem, backups can be done almost instantly. With EBS you can even get an insta-slave from the snapshot.

Re: MongoDB Performance & Durability

#16
Ok, so the standard response seems to be "single server durability" isn't supported, but replication makes up for that.

How can this be? If no single server guarantees durability of the writes, how can a cluster of those types of machines suddenly cause those writes to be durable? Maybe it's a pedantic argument, but it seems to me that semantically speaking you are simply relying upon luck that your replicated nodes don't become corrupt or die for some systemtic reason.

The fact that there is not a replayable, append-only transaction log says to me that no matter what you build on top of it, it will never by definition be durable because the whole cannot be greater than the sum of its parts in this case.

Re: MongoDB Performance & Durability

#17
post #11

There's a blog post where the MongoDB people explain why they haven't prioritised single server durability: http://blog.mongodb.org/post/381927266/what-about-durability Basically: (a) for real single server durability you need to turn off hardware buffering or have a battery-backed RAID controller to ensure your write really hit disk; (b) this won't help you if your disks fail, and this failure mode is as likely as a…

It's more interesting to see how they recover in case of failure, rather than how write is completely on disk. Machine failure will happen. Writes will not be fully flushed to disk. It's how one recovers from failure that defines how robust the system is.

Re: MongoDB Performance & Durability

#18
post #2

Scary.

Eh. Yes and no. The Mongo guys are very, very upfront about this. Check their web site. There are good workarounds, they just require spending a bit more on hardware.

Replication does not always work if you deploy MongoDB as VM since master and slave instances may be running in a single physical machine.

Re: MongoDB Performance & Durability

#19

I've tried to post this as a comment on the blog, but it's not showing up (moderated?): ----------- Full disclosure: I work for 10gen. You strategically posted this when my air conditioning was broken, so here are a few thoughts before I go find somewhere cooler. Since CouchDB is "not a competitor" to MongoDB, it's nice of you to put all this time into a public service. > MongoDB, by default , doesn’t actually have a…

Full disclosure: I love MongoDB and use it in a few projects.

Having said that, I must ask. Do the "unchecked" writes, configurable fsyncs and multi-node writes exist in the currently stable version of MongoDB or are these features still in alpha or beta?

While I do disagree with the article, he clearly pointed at the current version of Mongo.

Re: MongoDB Performance & Durability

#20

I've tried to post this as a comment on the blog, but it's not showing up (moderated?): ----------- Full disclosure: I work for 10gen. You strategically posted this when my air conditioning was broken, so here are a few thoughts before I go find somewhere cooler. Since CouchDB is "not a competitor" to MongoDB, it's nice of you to put all this time into a public service. > MongoDB, by default , doesn’t actually have a…

> Isn't it irritating how people will write, "MongoDB lost my data" or "CouchDB is really slow" and provide no specifics?

He did go into several specifics as to why MongoDB might lose your data. Nice jab at CouchDB though!

Post reply on HN