MongoDB Best Practices...

Nice article by the EngineYard team regarding MongoDB best practices.
Its actually a two-part article, first getting into general NoSQL, and then specifically into MongoDB.
The NoSQL part is (as you might expect) somewhat general (I've got my own general contribution here), but I love the understatement in the point about EBS
you should know that the performance of Amazon’s Elastic Block Storage (EBS) can be inconsistent.
Indeed!  I'd actually take it a step further and say Do not use EBS in any environment where reliability and/or performance characteristics of your disk-access are important.  Or, to put it differently, asynchronous backups - OK, disk-based databases - Not So Much.  

Anyhow, the rest of the article is really quite relevant - somewhat obvious, but still extremely relevant.  It may read like a 'best-hits' list of the comments from the Don't Use MongoDB flame-war a wee bit back, but if you weren't part of that, well, read this.  In particular, I'd like to emphasize
  1. Keep current with versions : If you are a CouchDB migrant, this might come as a bit of a shock to you, but MongoDB lives much more on the bleeding edge than you might be used to.  Things seem to be (kinda, sorta) settling down, but still...
  2. Keep your working set in memory : This is extremely relevant if you are on AWS (and you probably are) - remember, EBS is not your friend...
  3. Be very, very, very careful when sharding : The best (worst?) for last.  Sharding is, at the best of times, extremely application and context dependant.  With MongoDB, certain operations - like switching sharding keys - can be righteously painful and lead to ulcers and/or permanent loss of sleep.  My personal recommendation is to avoid sharding if at all possible.  If you have to, well, try and avoid it anyhow :-)
In closing, I'll restate the obvious - it just doesnt matter how well you think you understand your problem space, you will find out that
  • You didn't understand your own problem-space as well as you thought you did. 
  • You didn't understand the package that you are using as well as you think you do.
  • It will not scale the way you thought it would.  Oh, it'll scale all right, just not the way you thought it would. 
  • Your object/document/JSON/whatever model really doesn't map exactly the way you expected it to.



Comments

sneha said…
Your blog is in a convincing manner, thanks for sharing such an information with lots of your effort and time mongodb online training
mongodb online training India
mongodb online training Hyderabad

Popular posts from this blog

Erlang, Binaries, and Garbage Collection (Sigh)

Cannonball Tree!

Visualizing Prime Numbers