• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
NoSQL Shootout: RavenDB vs MongoDB
 

NoSQL Shootout: RavenDB vs MongoDB

on

  • 25,663 views

A SoCal CodeCamp talk about two NoSQL databases, the crowd favorite MongoDB and the up-and-comer RavenDB. Which one is better at what?...

A SoCal CodeCamp talk about two NoSQL databases, the crowd favorite MongoDB and the up-and-comer RavenDB. Which one is better at what?

This talk really just offers a pair and contrast view of both database systems and tries to speak to the strengths and weaknesses of each. It's a 300-level talk and is not meant for people who are totally unfamiliar with NoSQL and document database systems.

Statistics

Views

Total Views
25,663
Views on SlideShare
22,055
Embed Views
3,608

Actions

Likes
9
Downloads
112
Comments
0

14 Embeds 3,608

http://www.aaronstannard.com 2569
http://www.nosqlforum.com 962
http://jabbr.net 33
http://www.slashdocs.com 15
https://twitter.com 6
http://localhost 6
http://liuhanxue.tumblr.com 3
http://translate.googleusercontent.com 3
http://www.redditmedia.com 3
https://jabbr.net 3
http://www.linkedin.com 2
http://10.242.25.199 1
http://www.google.fr 1
http://webcache.googleusercontent.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Both MongoDB and RavenDB support the modern toolsets we expect from production database technologies, like support for sharding, replication, and for producing stand-alone static backup images at any time.
  • AndersHejdlsberg and Bjorn Soustroup (invetors of C# and C++ respectively)Jayson Werth (baseball players for the Phillies) and Wyoming Bison scratching itself against a rockLucene vs. B-tree for indexingEsentvs Memory mapped files for storage engine
  • RavenDB supports transaction scope for batch insert operations, whereas transactions (i.e. operations which are atomic and can be rolled back) are only applicable at the single item level for MongoDB. However, it is worth noting that Mongo does support batch writes even though they cannot be wrapped inside transaction scope.In terms of concurrency management, MongoDB has none whereas RavenDB implements a form of optimistic concurrency – so before a record is written to the system will check to see if that document has been modified by another transaction beforehand, and if that’s the case the transaction simply rolls back. There are no locks when this happens so the underyling database doesn’t do any lock escalation or row / table locking.In terms of write safety, RavenDB is fully ACID compliant – every write is committed to disk before the operation returns true to the client. In MongoDB, write safety is more granular – by default writes are not safe; they’re written to an in-memory buffer first and MongoDB tells the client that everything is fine even though the data is not committed to disk. Eventually Mongo will write the data to disk in the background asynchronously. You have the ability to configure this in Mongo though, so you can make writes in MongoDB commit to disk before returning “true” to the client.
  • Buffet, representing cross-collection query support – and a fat guy eating a gargantuan cheeseburger representing single-collection-only queriesIn RavenDB cross-collection queries are done in a couple of different ways – MultiMap indexes are one, transform indexes are another where collections can be cross-referenced on the server.MakerBotvsIkeaIn Raven, you can have the server render whatever type of data object or view that you want as long as it’s derived from one or more of the indexes or collections inside of RavenDB, so this means that you can have it use transforms to take cross-collection references and resolve them server side.In Mongo, you’re stuck with the Ikea model of “some assembly required” – any relationships between documents in different collections have to be resolved through the calling client application. The 10gen folks have called this an “application join.”Some random book and album coversRavenDB does not support ad-hoc queries on subsets of fields, meaning when you ask “give me back just these parts of documents that match this criteria in collection A” you still get the entire document back on the client and not just the fields you requested. Mongo does have the ability to run these types of queries and return back only a subset of fields you requested.Lastly, full-text indexing. Due to the fact that RavenDB is built on top of Lucene.NET (a powerful indexing agent) it has the ability to run full-text search right out of the box. MongoDB does not support full-text indexing or queries currently.
  • Both MongoDB and RavenDB support static indexes, which include indexes on deep properties and covered indexes.Interestingly, RavenDB supports the notion of a dynamic index created on-the-fly during production operations – these indexes are temporary and are not as powerful for flexible as static indexes, but they do make it so if your client application misses creating an index for an important set of operations that Raven will still find a way to provide it with the speed and timeliness of queries covered by static indexes.Raven also supports the notion of a multi-map index, where documents from multiple different collections are reduced down into a common subset – this is really useful for building search indexes that need to cover multiple types of documents (like blog posts, comments, and tags.) MongoDB does not support multi-map indexes.Lastly, in terms of how indexing is performed – this is always a background operation in RavenDB so technically you can end up with “stale indexes” in the course of consuming indexed data from a client. There are ways to wait for a non-stale index, but these are typically not used in production applications. In MongoDB indexing behavior is configurable – it can either be a blocking foreground operation (and is done at the same time as a document insert) or it can run in the background like RavenDB.
  • InRavenDB, MapReduce is defined as an index and is precalculated in the background, whereas in MongoDBMapReduce is run as a query against the existing dataset in real time. One of the advantages of Mongo’s model is that it can support a MapReduce pipeline, where multiple MapReduce operations may need to be performed before the final result we’re interested in can be delivered. As far as I know, this isn’t typically feasible in RavenDB without a lot of Linq magic or making inline calls to load data from other MapReduceindicies.
  • Boring chart showing master-slave replicationMaster-Slave replication is handy in environments where you need some read-only and both MongoDB and RavenDB support it.Phil Mickelson winning the masters (again) vs. Sad Tiger Woods - Should be noted that Tiger actually has 4 master wins over Phil Mickelson’s 3, but hasn’t won the masters since 2005.Master-Master replication is not supported in mostNoSQL databases but it is supported in RavenDB – the scenario where it’s handy is when you have all of your databases running under a load-balancer and don’t want to expose the network topography to the client. In Master-Master you essentially have mirrored databases that are both writeable at any given time.The most popular form of replication in the NoSQL universe is sharding, where the contents of the database are partitioned into phyiscally separate databases spread across different servers, the idea being to help balance the load for large collections across multiple machines. Both Raven and Mongo support user-defined sharding strategies or automatic sharding where the Database Management System decides what the most balanced approach for the shards are in the cluster.Lastly, in terms of how you replicate shards RavenDB allows you to mix and match replication with sharding, but this is done somewhat manually. Mongo has a more elegant solution known as the replica set, where shards are replicated across the set of servers that are running, so if at any given time one server goes down the replica set can re-balance and not lose any data.
  • RavenDB loses to Mongo big time on ecosystem.It has a very limited set of drivers compared to Mongo, it has fewer documentation and examples, and it only runs on Windows. Couple that with the fact that it costs $500 per server to run in a commercial application and it has a much less appeal ecosystem than Mongo, where its adoption is much more widespread and it has a more favorable cost model for small companies.That being said, the RavenDB team often make exceptions for early stage startups, students, and non-profits in terms of licensing costs – and it’s free to start developing with RavenDB. You only need to pay for a license once you deploy your commercial application to market.
  • Anonymous authenticationis granular

NoSQL Shootout: RavenDB vs MongoDB NoSQL Shootout: RavenDB vs MongoDB Presentation Transcript

  • vs.Aaron Stannard Nuri Halperin
  • What are we talking about today?OVERVIEW
  • What do RavenDB and MongoDB do that are similar?WHAT’S IN COMMON?
  • Fundamentals No Schema No Impedance Mismatch{ "Address" : "123 AnywhereSt.", "City" : "Springfield", Expose Data as JSON"PostalCode" : 99999 }
  • Queries Documents Stored as Collections Indexing for Deep PropertiesMap(k1,v1) → list(k2,v2)Reduce(k2, list (v2)) → list(v3) MapReduce Support
  • Scaling & Replication Sharding Support Replication Support Full Backup Support
  • What do RavenDB and MongoDB do differently?THE SHOWDOWN
  • FundamentalsRavenDB MongoDB Built with C# Built with C++ Data saved as Data saved as JSON BSON Uses Lucene.NET Uses B-Trees for for indexing indexing Uses Memory- Uses Esent for mapped files for Storage storage
  • Writing to a DatabaseRavenDB MongoDB Batch transaction Single row support transactions* Optimistic No concurrency concurrency management Granular write & ACID safety control
  • Reading from a DatabaseRavenDB MongoDB Cross-collection No cross-collection query support queries Server-side DbRef Client-side DbRef Resolution* Resolution No ad-hoc queries Supports ad-hoc on subsets queries on subsets Supports full-text No support for full-text queries queries
  • IndexesRavenDB MongoDB Supports static Supports indexes static indexes Supports ad-hoc No ad-hoc index indexes support Multi-map No multi-map indexes indexes Indexing performed Indexing is configurable in background to background or foreground
  • MapReduceRavenDB MongoDB M/R done as M/R done as indexes queries Supports No M/R pipeline incremental M/R M/R is calculated M/R is calculated in background in real time
  • Replication and ScalingRavenDB MongoDB Master-Slave Master-Slave Replication Replication Master-Master No Master-Master Replication Replication Manual & Auto Manual & Auto Sharding Sharding Mix and Match Replication / Shards Replica sets
  • EcosystemRavenDB MongoDB Limited driver Rich driver ecosystem ecosystem Little Lots of documentation documentation and examples and examples Depends on Can run Windows anywhere OSS and Commercial Free / OSS License Licenses ($$)
  • ExtrasRavenDB MongoDB• Supports Triggers • No Trigger Support• Multi-tenant • Multi-tenant• Supports OAuth / Basic • Supports Basic Auth Auth / Anonymous*• REST API • BSON over TCP
  • Further Reading• http://ravendb.net• http://mongodb.org• https://www.10gen.com/events/mongdb-san- diego (July 25th)