NoSQL Smackdown!

2,753 views
2,652 views

Published on

A whirlwind tour of a few NoSQL solutions, learning the very different ways they represent data and seeing their unique strengths and weaknesses in various kinds of applications. Along the way, we'll learn why new technologies must be introduced to address today's scaling challenges, and what compromises we'll have to make if we want to abandon the databases of our youth.

Published in: Technology
1 Comment
6 Likes
Statistics
Notes
  • Great coverage! I'd be interested to see how OrientDB (http://orientdb.org/) compares to these options.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
2,753
On SlideShare
0
From Embeds
0
Number of Embeds
34
Actions
Shares
0
Downloads
52
Comments
1
Likes
6
Embeds 0
No embeds

No notes for slide

NoSQL Smackdown!

  1. 1. oSQLN ACKDOWNSM Tim Berglund 1
  2. 2. @tlberglund #nosql 2
  3. 3. Voldemort 3
  4. 4. vianegativa 4
  5. 5. SQL 5
  6. 6. relation (n.) An unordered set of tuple (n.)the same type. tuples of 6
  7. 7. tuple (n.) A function that maps attributes to values. 7
  8. 8. tuple (n.) (A bundle of key-value pairs—but don’t tell anyone!) 8
  9. 9. id username pwd_hash born_at monkey1 mluther d8c82af9 Nov 1483 FALSE2 aaugustine 329b8dae Nov 354 FALSE3 gnyssa e50ec9e0 Jun 335 FALSE4 bonzo 330e01f2 Apr 2007 TRUE 9
  10. 10. Relations 10
  11. 11. Comparing “NoSQL” to“relational” is a bit of ashell game. —Eben Hewitt author of Cassandra: The Definitive Guide 11
  12. 12. Transactions 12
  13. 13. CAP Theorem C A P 13
  14. 14. Tradeoff Between Consistency Availability Partition Tolerance 14
  15. 15. Between what? 15
  16. 16. consistency (n.) All clients always have the same view of the data. 16
  17. 17. availability (n.) All clients can always read or write within some maximum latency. 17
  18. 18. partition tolerance (n.) No set of failures less than total network failure is allowed to cause the system to respond incorrectly. 18
  19. 19. Cluster Node Cluster NodeCluster Node Cluster Node 19
  20. 20. Cluster Node Cluster Node SwitchCluster Node Cluster Node 20
  21. 21. Cluster Node Cluster Node SwitchCluster Node Cluster Node 21
  22. 22. CAP Theorem C A P 22
  23. 23. Strongly Consistent MongoDB C Cassandra A P 23
  24. 24. Always Available CouchDB Riak C Voldemort Cassandra A P 24
  25. 25. Partition Intolerant MySQL C OracleSQL Server Neo4J Redis A P 25
  26. 26. CA P 26
  27. 27. vianegativaa way forward 27
  28. 28. NoSQL is a set of differentapproaches to storing and retrieving data. 28
  29. 29. What’s Different? Data models Querying Approaches to scale 29
  30. 30. TradeoffsComplex transactions vs. scalabilityConsistency vs. availability (often)Performance vs. durabilityHorizontal vs. vertical scaleCheap writes vs. cheap reads 30
  31. 31. Origin LicenseI mplementati on language Data model How d oes it scale? API/Qu ery language Deployments Support and community 31
  32. 32. 32
  33. 33. Voldemort 33
  34. 34. 34
  35. 35. Origin- Facebook Inbox search b ack in 2007License- Apache Public License 2.0 35
  36. 36. Implementa tion Language- Java 6Data Model- It’s a Big-Table-based “c olumn store.” 36
  37. 37. Name Value Timestamp Column 37
  38. 38. email tlberglund@gmail.com 20101011T120502Z Column 38
  39. 39. Key Column Column Column Column Column Row 39
  40. 40. Key Column ColumnKey Column Column ColumnKey Column Column Family 40
  41. 41. bbf77f01d full_name email050fe74e2 full_name email mobile8b20d8f6 full_name “Contacts” Column Family 41
  42. 42. Name key Column key Column key Column SuperColumn 42
  43. 43. 4145bfaf15f10c2e6033f8b9c3143297a36f5fe3 full_name full_name Tim Berglund 20101011T120502Z email email tlberglund@gmail.com 20101011T120503Z mobile mobile [redacted] 19940217T145637Z postal_code postal_code 80123 20101011T120452Z Contact Info SuperColumn 43
  44. 44. Key SuperColumn SuperColumnKey SuperColumn SuperColumnKey SuperColumn SuperColumn Family 44
  45. 45. SuperColumn FamilySuperColumn FamilySuperColumn Family Column Family Column Family Keyspace 45
  46. 46. A what? 46
  47. 47. Nested Hash TableCluster.Keyspace.ColumnFamily[key1][key2] = <column> Cluster.Keyspace.ColumnFamily[key] = <row> ...SuperColumnFamily[key1][key2][key3] = <column> ...SuperColumnFamily[key1][key2] = <row> ...SuperColumnFamily[key] = <map of rows> 47
  48. 48. Scalability- Rock star! (see Amazo n Dynamo) 0000 2000 E000 4000 C000 6000 A000 8000 48
  49. 49. 0000 E000 2000C000 4000 A000 6000 8000 49
  50. 50. Scalability - Consist ent hashing - No disting uished nodes - Add and re move nodes on a live cluster 50
  51. 51. API - Thrift RPC - Easy to fet ch columns by key - Nat ive clients - Hadoop integration 51
  52. 52. Deployments- 52
  53. 53. Sup port/Community- - www .datastax.com - Eben H ewitt’s book - Plus , it is an Apache project... 53
  54. 54. Voldemort 54
  55. 55. 55
  56. 56. Origin- Founders of DoubleClick were tota lly going to take o ver the CloudLicense- Database: G NU Affero 3.0 D rivers: APL 2 56
  57. 57. Implementatio n Language- C++D ata Model- JSON documen t database (this is so simple!) 57
  58. 58. { "_id" : ObjectId("4cbd00455280f73d395922a4"), "contact" : { "tags" : ["man", "", "", ""] "firstName" : "Myron", "lastName" : "Dalton", "address1" : "4322 Maple Street", "city" : "Santa Ana", "state" : "CA", "postalCode" : "92705", "email" : "Myron.C.Dalton@spambob.com" }, "occupation" : "Long haul truck driver"} 58
  59. 59. Does it scale? Well...it shards! 59
  60. 60. API - Native JavaScript console - Bin ary drivers - Ad-hoc q uery language ( but it’s NOT S QL, okay?) 60
  61. 61. db.address.find().limit(5)db.contact.find({ “lastName”: “Berglund” })db.address.find({ $query: { “stateProvince”: “CO” }, $orderBy:{ “city”: 1 } })db.address.find({ “contact.city”: “Chicago” })db.address.remove({_id: ObjectId("4cbcfd7df72291161b1d1bf2")}) 61
  62. 62. API - Can writ e MapReduce jobs in JavaScript - Morph ia for Java - Mongoos e for node.js 62
  63. 63. D eployments- 63
  64. 64. Communi ty/Support - www.10gen.com - Proba bly the NoSQL minds hare leader 64
  65. 65. Concerns - Write durability? Journa ling coming in 1.8! - Sharding p erformance - But everyone still wants to date her 65
  66. 66. Voldemort 66
  67. 67. 67
  68. 68. Origin -N eo Technolog ies in 2003 -Malmö and San Francisco 68
  69. 69. License - GPL3, f ull-featured -C ommercial $49/ mo antiviral $499/mo advanced $1,999/mo enterprise 69
  70. 70. Maturity - Productio n since 2003 - 1.0 i n Feb 2010Implementat ion Language - Java 6 - Easil y embeddable! 70
  71. 71. Da ta Metaphor - Graph - Nodes, re lationships 71
  72. 72. All nodes and relationships have arbitrary properties 4CG 7L CN? M QCN B 7I >CMJ %HA NCIH -;NNB?Q LEM ON; ;A? QCNB QCNB M CH EM(IFFSQII> ?; 4SJ?M 3J CNB Q +HIQM "LC;H 72
  73. 73. Query Model - REST/JSON - Java traversal API - Bindings in C lojure, Ruby, Python, PHP, S cala, Grails - JTA/JTS XA 73
  74. 74. Scale Idiom - Traditional ly focused on si ngle-node pe rformance- Recent HA support -M aster/slave - ZK mast er election - Writeable slaves 74
  75. 75. Support- Neo TechnologiesDeployments - Box.net -T houghtWorks 75
  76. 76. Voldemort 76
  77. 77. 77
  78. 78. Origin- Internal datastore for Basho’s S alesforce.com apps (Hey, it seemed like a good idea at the time!) 78
  79. 79. License- APL 2 fo r OSS version Clo sed-source “Enterprise DS” version 79
  80. 80. Implementatio n Language- Erlang, C, S piderMonkey Ja vaScript VMData Model- Key/va lue store, but w ith buckets! 80
  81. 81. Key Value That’s it. 81
  82. 82. Key Value Key ValueKey Value Key Value Bucket AKey Value Key ValueKey Value Key Value Bucket B 82
  83. 83. name Tim birthday 061972occupation Developer city Littleton Bucket A name Aurelius birthday 110354occupation Bishop city Hippo Bucket B 83
  84. 84. Does it scale? - Like a boss! - No distin guished node - Tunable consistency, replication - Add n odes without taking the cluster down 84
  85. 85. API - HTTP interface (slow, but featureful) - Proto col Buffers (a performa nce beast) 85
  86. 86. API - Key CRUD- Ma pReduce in JavaScript- Grap h traversals translate t o MapReduce 86
  87. 87. D eployments- 87
  88. 88. Communi ty/Support - www.basho.com 88
  89. 89. Voldemort 89
  90. 90. 90
  91. 91. Origin- Salvatore Sanfilippo w rote it for his analytics s ite, llogg.comLicense- Open Sou rce-Brand open source 91
  92. 92. Implementat ion Language - ANSI C, baby - Wan ts a POSIX OS - 340kB download! 92
  93. 93. Data Model -Key/ value store++ -Strings -Hashes, Sets -Lists -Sorted Sets 93
  94. 94. Does it scale? - Ve rtically, sure - Plus it’s really fast - Master/sl ave options - Technically a CA system 94
  95. 95. API - Binary socke t interface - Dr ivers for 22+ languages - Comm ands look like assem bly language 95
  96. 96. 96
  97. 97. 97
  98. 98. 98
  99. 99. 99
  100. 100. D eployments- craigslist 100
  101. 101. Commun ity/Support - Offici ally sponsored by VMware 101
  102. 102. Voldemort 102
  103. 103. Do you need this? Maybe. 103
  104. 104. 104
  105. 105. Thank You Tim Berglund www.augusttechgroup.comtim.berglund@augusttechgroup.com @tlberglund 105
  106. 106. Further ReadingBrewer’s Conjecturehttp://www.podc.org/podc2000/Proof of Brewer’s Conjecture (the “CAP Theorem”)http://bit.ly/cap-theorem-proofAmazon Dynamohttp://bit.ly/amazon-dynamohttp://www.allthingsdistributed.com/2007/10/amazons_dynamo.htmlGoogle BigTablehttp://bit.ly/big-tableThe CAP Theorem Explainedhttp://www.julianbrowne.com/article/viewer/brewers-cap-theoremVisualzing NoSQL Databases on the CAP Venn Diagramhttp://blog.nahurst.com/visual-guide-to-nosql-systemsRedishttp://redis.io/Cassandrahttp://cassandra.apache.orgMongoDBhttp://mongodb.org 106
  107. 107. Further ReadingCouchDBhttp://couchdb.apache.orgRiakhttp://basho.comVoldemorthttp://project-voldemort.comNeo4Jhttp://neo4j.orgPretty Much Everything About NoSQLhttp://nosql.mypopescu.com 107
  108. 108. Photo CreditsWrestlershttp://www.flickr.com/photos/stigster/4573851095Desert Roadhttp://www.flickr.com/photos/kenlund/2439199670Kindergarten Graduationhttp://www.flickr.com/photos/moyermk/3102262394Clipboardhttp://www.flickr.com/photos/wheatfields/264890076Winning Wrestlerhttp://www.flickr.com/photos/jrandallc/2259174414 108

×