August 04, 2010

Posted by John

« older newer »

Single Server Durability

A month back, Mikeal Rogers wrote a post about Performance and Durability. In response to Mikeal’s post, a lot of good conversation has come up, including Riyad Kalla’s single server durability guide.

In the post, Riyad covers fsync’ing from the command line, the shell, and a database driver. One point he makes is that he actually likes Mongo’s default to “write and forget”.

MongoDB behaving like this as a default is a great idea in my opinion. Assuming, by default, that MongoDB won’t explode into flames and will service your request makes sense when you consider the performance benefits.

He mentions that, if you really need to know if the the fire was successful, Mongo allows synchronous writes by using the getLastError command and that some of the drivers have this option built-in to the insert/save methods (MongoMapper fully supports safe writes as well).

The last thing I will mention from the post is the preview of the “w” option for getLastError in Mongo 1.5+.

db.runCommand( { getlasterror : 1 , w : 2 } )

Basically, this will make the client block until the write has been replicated to “w” servers (in the above case 2). Very cool option. Personally, on Harmony, I am sticking with the Mongo defaults. I do believe soon though, I will start to intentionally performing synchronous writes in a few important spots.

Labels: Elsewhere

0 Comments

Thoughts? Do Tell...


textile enabled, preview above, please be nice
use <pre><code class="ruby"></code></pre> for code blocks

About

Authored by John Nunemaker (Noo-neh-maker), a web developer and programmer who has fallen deeply in love with Mongo. More about John.

Syndication

Feed IconMongoTips Articles - An assortment of news, howto's and thoughts on MongoDB.