Your SlideShare is downloading. ×
Battle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDB
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Battle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDB

23,191
views

Published on

Lone Star Ruby Conference 2010... by Jesse Wolgamott …

Lone Star Ruby Conference 2010... by Jesse Wolgamott

Dive into the target audiences and differences in NoSQL storage, how to implement them and what this NoSQL thing is all about.

Discuss how SQL has limits when you get to web-scale and how NoSQL bypasses these limits.

Published in: Technology

3 Comments
19 Likes
Statistics
Notes
No Downloads
Views
Total Views
23,191
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
1
Comments
3
Likes
19
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide







































  • Transcript

    • 1. BATTLE OF THE NO-SQL STARS CouchDB, MongoDB, Amazon SDB, RavenDB
    • 2. WHO IS THIS GUY? Jesse Wolgamott (Nobody, Really) Team Merrica Lead Developer ChaiOne, Houston http://jessewolgamott.com
    • 3. OUR STARS CouchDB: Apache Project, Circa 2007‘ish MongoDB: 10Gen, Circa 2009 SimpleDB: Amazon, Circa 2007 RavenDB: Ayenda, Circa 2010
    • 4. EVIL NUGGET
    • 5. EVIL NUGGET Document Databases share an internal structure similar (inspired?) by: Lotus Notes. (shudder)
    • 6. BATTLE PLAN Languages and API Versioning Internal Queries and Inserts Intangibles
    • 7. THE COOL KID
    • 8. APIS CouchDB: Erlang, REST API MongoDB: C++, Language Driver RavenDB: .NET, REST API SimpleDB: Erlang, Name/ Value Store
    • 9. API: COUCHDB POST /somedatabase/ HTTP/1.0 Content-Length: 245 Content-Type: application/json { "Subject":"I like Plankton", "Author":"Rusty", "PostedDate":"2006-08-15T17:30:12-04:00", "Tags":["plankton", "baseball", "decisions"], "Body":"I decided today that I don't like baseball. I like plankton." } ----------------- GET /somedatabase/some_doc_id HTTP/1.0 ------------------- HTTP/1.1 200 OK Date: Thu, 17 Aug 2006 05:39:28 +0000GMT Content-Type: application/json Connection: close { "_id":"some_doc_id", "_rev":"946B7D1C", "Subject":"I like Plankton", "Author":"Rusty", "PostedDate":"2006-08-15T17:30:12Z-04:00", "Tags":["plankton", "baseball", "decisions"], "Body":"I decided today that I don't like baseball. I like plankton." }
    • 10. API: COUCHPOTATO class User include CouchPotato::Persistence property :age, :type => Fixnum property :receive_newsletter, :type => :boolean end CouchPotato.database.save_document User.new
    • 11. API: MONGODB Mongoid MongoMapper class Person class Person include Mongoid::Document include MongoMapper::Document field :name key :name, String, :required=>true embeds_many :phones many :phones references_many :addresses has_many :addresses end end Person.create {:name=>”Darth Vader”} Person.create {:name=>”Darth Vader”}
    • 12. MM V GOID Mongoid uses ActiveModel Mongoid uses ARel, MM: (Rails3). custom DSL MongoMapper is more like Mongoid has Master/Slave Rails 2 with Validatable MM is more familiar for MongoMapper has better Active Record relational association support
    • 13. API: RAVENDB PUT http://localhost:8080/docs/bobs_address { FirstName: 'Bob', LastName: 'Smith', Address: '5 Elm St' } --------------- GET http://localhost:8080/docs/bobs_address --------------- HTTP/1.1 200 OK { "FirstName": "Bob", "LastName": "Smith", "Address": "5 Elm St." } var companies = session.Query<Company>("CompaniesByRegion") .Where(x => x.Region == "Asia") .Take(5);
    • 14. API: SIMPLEDB Amazon’s Restful... This is rest? Answer: No (IMHO). And returns XML https://sdb.amazonaws.com/?Action=PutAttributes &DomainName=MyDomain &ItemName=Item123 &Attribute.1.Name=Color&Attribute.1.Value=Blue &Attribute.2.Name=Size&Attribute.2.Value=Med &Attribute.3.Name=Price&Attribute.3.Value=0014.99 &AWSAccessKeyId=<valid_access_key> &Version=2007-11-07 &Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQE= &SignatureVersion=2 &SignatureMethod=HmacSHA256 &Timestamp=2007-06-25T15%3A01%3A28-07%3A00
    • 15. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 16. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 17. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 18. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 19. VERSIONING Do we rea!y have it?
    • 20. VERSIONING CouchDB has Multi Versioning Concurrency Control Compaction removes old revs, only the latest rev is represented in view queries, and only the latest revision is replicated. you can only depending on having a single version of the document available. Especially in Multi-Master Mongoid::Versioning (has_many versions) RavenDB - Versioning Built In
    • 21. VERSIONING CouchDB and Mongoid Mongomapper class Person include Mongoid::Document Roll your Own include Mongoid::Versioning Using many versions as embedded # keep at most 5 versions of a record documents max_versions 5 end RavenDB <appSettings> <add key="Raven/Versioning/MaxRevisions" value="50"/> <add key="Raven/Versioning/Exclude" value="Comments;LogEntries;"/> </appSettings>
    • 22. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 23. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 24. QUERIES Gimme Gimme Gimme
    • 25. QUERIES: COUCH Map/Reduce .. Design Documents Cool Part: Fast! The NotHot: Pre-declaring all your views { "_id":"_design/company", "_rev":"12345", "language": "javascript", "views": { "all": { "map": "function(doc) { if (doc.Type == 'customer') emit(null, doc) }" }, "by_lastname": { "map": "function(doc) { if (doc.Type == 'customer') emit(doc.LastName, doc) }" }, "total_purchases": { "map": "function(doc) { if (doc.Type == 'purchase') emit(doc.Customer, doc.Amount) }", "reduce": "function(keys, values) { return sum(values) }" } } }
    • 26. QUERY: MONGODB Dynamic Querying Map-Reduce (BUT: non-concurrent) MongoMapper Example Event.where(:school_id=>school.id).published.future.sort(:start.desc).limit(20).all
    • 27. QUERY: SIMPLEDB No sorting options Obvious comparison operators (=, !=,<=, etc.) RightAWS Interface require 'right_aws' sdb = RightAws::SdbInterface.new(aws_access_key, aws_secret_access_key) sdb.query("picture", "['submitdate' <= '2900'] intersection ['status' = 'approved'] sort 'submitdate'") #parse XML returned
    • 28. QUERY: RAVENDB MapReduce Indexes Raven process them in the background, executing the queries against the stored documents and persisting the results to a Lucene index Raven executes your indexes in the background, and the results are written to disk. Indexes are written in LINQ
    • 29. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 30. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 31. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 32. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 33. INSERTING Here take this
    • 34. INSERTS: COUCH Couch DB PUT API is cool. BUT Recalculates the map-reduce on the insertion Slows down over time
    • 35. INSERTS: MONGO Updates in Place FAST, BUT In Air Collisions Power Turns Off before disk write
    • 36. INSERTS: BENCHMARK Bulk Insertion Benchmark Data: http://www.snailinaturtleneck.com/blog/2009/06/29/couchdb-vs-mongodb-benchmark/ y-axis: seconds MongoDB CouchDB 40 30 20 10 0 1 10 50 100 500 1000 2500 7500 10000 25000 100000
    • 37. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 38. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 39. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 40. EXTRAS MongoDBs - Best Ruby CouchDB: Multi-Multi Integration Master (Success!) SimpleDB: Easy Scalability CouchDB: Offline Replication RavenDB: Windows (Downer) CouchDB and MongoDB: Free Levels on Heroku RavenDB: Commercial (Crazy Success) License for non-Open Source (Downer-er)
    • 41. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 42. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 43. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 44. SCOREBOARD API Versions Queries Inserts Extras Couch Mongo SDB Raven
    • 45. LITTLE BIT OF CODE MLB 2000-2009 Game Data used in Demo The information used here was obtained free of charge from and is copyrighted by Retrosheet. Interested parties may contact Retrosheet at "www.retrosheet.org". Load Time Experience - 24000‘ish Games Load Time in Seconds Mongo 77.6 seconds Couch 355.1 seconds