NoSQL Smackdown 2012 : Tim Berglund

887 views
717 views

Published on

Alternative databases continue to establish their role in the technology stack of the future—and for many, the technology stack of the present. Making mature engineering decisions about when to adopt new products is not easy, and requires that we learn about them both from an abstract perspective and from a very concrete one as well. If you are going to recommend a NoSQL database for a new project, you're going to have to look at code. In this talk, we'll examine three important contenders in the NoSQL space: Cassandra, MongoDB, and Neo4J. We'll review their data models, scaling paradigms, and query idioms. Most importantly, we'll work through the exercise of modeling a real-world problem with each database, and look at the code and queries we'd use to implement real product features. Come to this session for a thorough and thoroughly practical smackdown between three important NoSQL products.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
887
On SlideShare
0
From Embeds
0
Number of Embeds
16
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

NoSQL Smackdown 2012 : Tim Berglund

  1. 1. NoSQL Smackdown 2012 edition Tim Berglund @tlberglundWednesday, October 17, 12 1
  2. 2. @tlberglund #nosqlWednesday, October 17, 12 2
  3. 3. SQLWednesday, October 17, 12 3
  4. 4. Wednesday, October 17, 12 4
  5. 5. Wednesday, October 17, 12 5
  6. 6. Wednesday, October 17, 12 6
  7. 7. Wednesday, October 17, 12 7
  8. 8. Wednesday, October 17, 12 8
  9. 9. Wednesday, October 17, 12 9
  10. 10. Wednesday, October 17, 12 10
  11. 11. Wednesday, October 17, 12 11
  12. 12. Wednesday, October 17, 12 12
  13. 13. Metadata Data model Scale idiom Queryability LicenseWednesday, October 17, 12 13
  14. 14. Wednesday, October 17, 12 14
  15. 15. name: role: status: tim Tim teacher CoolWednesday, October 17, 12 15
  16. 16. name: role: status: tim Tim teacher Cool name: role: kristen marketing KristenWednesday, October 17, 12 16
  17. 17. name: role: status: tim Tim teacher Cool name: role: kristen marketing Kristen billy role: CEOWednesday, October 17, 12 17
  18. 18. name: role: status: tim Tim teacher Cool name: role: kristen marketing Kristen billy role: CEO name: role: status: matt Matt founder ubercoolWednesday, October 17, 12 18
  19. 19. Outer hash key Inner hash key name: role: status: tim Tim teacher Cool name: role: kristen marketing Kristen billy role: CEO name: role: status: matt Matt founder ubercoolWednesday, October 17, 12 19
  20. 20. Scale Idiom Amazon Dynamo Horizontal scalability No distinguished nodes Fault toleranceWednesday, October 17, 12 20
  21. 21. Queries Nested hash table lookup Single primary key Ranged lookupsWednesday, October 17, 12 21
  22. 22. Queries Ad-Hoc Query Language: CQLWednesday, October 17, 12 22
  23. 23. Queries CREATE COLUMNFAMILY Contacts (KEY uuid PRIMARY KEY); CREATE COLUMNFAMILY Monkey (KEY text PRIMARY KEY, id_tag long, emotion text) WITH comment=Simian Emotional States AND read_repair_chance = 0.5;Wednesday, October 17, 12 23
  24. 24. Queries UPDATE Contacts SET name=Tim Berglund WHERE KEY = B70DE1D0-9908-4AE3-BE34-5573E5B09F14; UPDATE Monkeys USING CONSISTENCY EACH_QUORUM SET emotion = Angry, name = Baby Boss WHERE KEY = OREILLY:8827;Wednesday, October 17, 12 24
  25. 25. Queries SELECT * FROM Contacts WHERE KEY = B70DE1D0-9908-4AE3-BE34-5573E5B09F14; SELECT FIRST 1000 FROM Temperatures WHERE KEY = 7627748986; SELECT emotion, id_tag FROM Monkeys USING CONSISTENCY ONE WHERE KEY = OREILLY:8827;Wednesday, October 17, 12 25
  26. 26. License Apache Public License 2.0 DataStax http://datastax.com/devWednesday, October 17, 12 26
  27. 27. Overview The leader at scale Data model learning curve Great backing from DataStax Innovation (Brisk, Solandra)Wednesday, October 17, 12 27
  28. 28. Wednesday, October 17, 12 28
  29. 29. Data Model Document DatabaseWednesday, October 17, 12 29
  30. 30. Data Model { name: "Hubert Poston", username: "hposton", password: "ab87d24bdc7452e55738deb5f868e1f16dea5ace", active: true, lastLogin: ISODate(2012-01-19 16:37:03), loginCount: 873, rating: 8.6, roles: ["ADMIN", "USER", "BOSS"], address: { street1: "984 Sunny Glen Lane", city: "Warrensville Heights", province: "OH", postalCode: "44128" } }Wednesday, October 17, 12 30
  31. 31. Data Model { name: "Hubert Poston", username: "hposton", password: "ab87d24bdc7452e55738deb5f868e1f16dea5ace", active: true, lastLogin: ISODate(2012-01-19 16:37:03), loginCount: 873, rating: 8.6, roles: ["ADMIN", "USER", "BOSS"], address: { street1: "984 Sunny Glen Lane", city: "Warrensville Heights", province: "OH", postalCode: "44128" } }Wednesday, October 17, 12 31
  32. 32. Data Model { name: "Hubert Poston", username: "hposton", password: "ab87d24bdc7452e55738deb5f868e1f16dea5ace", active: true, lastLogin: ISODate(2012-01-19 16:37:03), loginCount: 873, rating: 8.6, roles: ["ADMIN", "USER", "BOSS"], address: { street1: "984 Sunny Glen Lane", city: "Warrensville Heights", province: "OH", postalCode: "44128" } }Wednesday, October 17, 12 32
  33. 33. Data Model { name: "Hubert Poston", username: "hposton", password: "ab87d24bdc7452e55738deb5f868e1f16dea5ace", active: true, lastLogin: ISODate(2012-01-19 16:37:03), loginCount: 873, rating: 8.6, roles: ["ADMIN", "USER", "BOSS"], address: { street1: "984 Sunny Glen Lane", city: "Warrensville Heights", province: "OH", postalCode: "44128" } }Wednesday, October 17, 12 33
  34. 34. Data Model { name: "Hubert Poston", username: "hposton", password: "ab87d24bdc7452e55738deb5f868e1f16dea5ace", active: true, lastLogin: ISODate(2012-01-19 16:37:03), loginCount: 873, rating: 8.6, roles: ["ADMIN", "USER", "BOSS"], address: { street1: "984 Sunny Glen Lane", city: "Warrensville Heights", province: "OH", postalCode: "44128" } }Wednesday, October 17, 12 34
  35. 35. Scale Idiom Single-master design Master/slave replica sets Auto-sharding Like a nicer MySQLWednesday, October 17, 12 35
  36. 36. Querying Ad-hoc language Secondary indexes Many language bindingsWednesday, October 17, 12 36
  37. 37. Querying Creating a Record db.users.insert({ firstName: "Tim", lastName: "Berglund", username: "tlberglund", password: "ab87d24bdc7452e55738deb5f868e1f16dea5ace" active: true, lastLogin: ISODate(2012-01-19 16:37:03), loginCount: 873, roles: ["ADMIN", "USER", "BOSS"] });Wednesday, October 17, 12 37
  38. 38. Querying Finding a Record db.users.find({ username: "tlberglund", password: "ab87d24bdc7452e55738deb5f868e1f16dea5ace" });Wednesday, October 17, 12 38
  39. 39. Querying Updating a record db.users.update( { username: "tlberglund" }, { $inc: { loginCount: 1 } } );Wednesday, October 17, 12 39
  40. 40. License Database: AGPL 3.0 Drivers: APL 2.0 http://www.10gen.com/commercial-licensesWednesday, October 17, 12 40
  41. 41. Overview NoSQL mindshare leader Easy to adopt Usually used at smaller scale Not your father’s database! (More like your young uncle)Wednesday, October 17, 12 41
  42. 42. Wednesday, October 17, 12 42
  43. 43. Data Model Graph Database Nodes and Relationships Arbitrary key/value bundlesWednesday, October 17, 12 43
  44. 44. Data Model ... How do I use that? Easily!Wednesday, October 17, 12 44
  45. 45. Data Model Graph Database Traversal manages manages navigates identifies expresses Indexes Graph Algorithm map to records data in Paths map to Relationships records data in order map from organize have Nodes have PropertiesWednesday, October 17, 12 45
  46. 46. Data Model Graph Database Traversal manages manages navigates identifies e Indexes Graph A map to records data in PathsWednesday, October 17, 12 46
  47. 47. Indexes Graph Algorithm Data Model map to records data in Paths map to Relationships records data in order map from organize have NodesWednesday, October 17, 12 have 47
  48. 48. map to Data Model Relationships records data in order map from organize have Nodes have PropertiesWednesday, October 17, 12 48
  49. 49. Scale Idiom Single-master design Master/slave replication High-availability clustering Always single-masterWednesday, October 17, 12 49
  50. 50. Wednesday, October 17, 12 50
  51. 51. Querying REST/JSON CypherWednesday, October 17, 12 51
  52. 52. License GPL 3.0 (Community) AGPL 3.0 (Advanced/Enterprise) CommercialWednesday, October 17, 12 52
  53. 53. Overview The 95% niche Usually commercial Scales like MySQL Affinity to ROAWednesday, October 17, 12 53
  54. 54. Do you need this?Wednesday, October 17, 12 54
  55. 55. You will.Wednesday, October 17, 12 55
  56. 56. Tim Berglund http://timberglund.com tlberglund@github.com @tlberglundWednesday, October 17, 12 Thank You 56

×