Your SlideShare is downloading. ×
0
NoSQL
    Death	
  to	
  Relational	
  Databases(?)
    bensco'ield	
  –	
  viget	
  labs
    rubyconf
    20	
  november	...
Motivations



Friday, November 20, 2009
Performance



Friday, November 20, 2009
Friday, November 20, 2009
Scalability



Friday, November 20, 2009
Friday, November 20, 2009
Friday, November 20, 2009
Flexibility



Friday, November 20, 2009
Friday, November 20, 2009
Locus	
  of	
  Work



Friday, November 20, 2009
Charlie	
  Chaplin




                                                               Jet	
  Li



                       ...
Domain	
  Complexity



Friday, November 20, 2009
Friday, November 20, 2009
Taxonomy



Friday, November 20, 2009
Key-­‐Value	
  Stores



Friday, November 20, 2009
distributed	
  hash	
  tables



Friday, November 20, 2009
Dynamo
     GT.M
     PStore
     Redis



Friday, November 20, 2009
Column-­‐Oriented	
  Stores



Friday, November 20, 2009
semi-­‐structured



Friday, November 20, 2009
BigTable
     Cassandra
     HBase



Friday, November 20, 2009
Document-­‐Oriented	
  Stores



Friday, November 20, 2009
also	
  semi-­‐structured



Friday, November 20, 2009
CouchDB
     MongoDB
     RDDB
     Riak



Friday, November 20, 2009
Graph	
  Databases



Friday, November 20, 2009
graph	
  theory



Friday, November 20, 2009
ActiveRDF	
  
     AllegroGraph
     Neo4J



Friday, November 20, 2009
Comparisons



Friday, November 20, 2009
Performance



Friday, November 20, 2009
key-­‐value	
  stores
                            column-­‐oriented	
  stores
                            document-­‐orien...
Scalability



Friday, November 20, 2009
key-­‐value	
  stores
                            column-­‐oriented	
  stores
                            document-­‐orien...
Flexibility



Friday, November 20, 2009
key-­‐value	
  stores
                            document-­‐oriented	
  stores
                            graph	
  datab...
Locus	
  of	
  Work



Friday, November 20, 2009
key-­‐value	
  stores
                            column-­‐oriented	
  stores
                            document-­‐orien...
Domain	
  Complexity



Friday, November 20, 2009
key-­‐value	
  stores
                            column-­‐oriented	
  stores
                            document-­‐orien...
Examples



Friday, November 20, 2009
Redis



Friday, November 20, 2009
Data	
  Types
     strings
     lists
     sets




Friday, November 20, 2009
In-­‐Memory
     periodic	
  snapshots
     master-­‐slave	
  replication
     memory-­‐bound




Friday, November 20, 2009
require 'redis'

    gl = Redis.new

    # A string
    gl['name'] = 'Kyle Rayner'
    gl['name']
    gl.delete('name')

 ...
Tokyo	
  Cabinet



Friday, November 20, 2009
Data	
  Types
     strings
     tables!




Friday, November 20, 2009
Related	
  Projects
     tyrant
     dystopia
     promenade




Friday, November 20, 2009
require 'rufus/tokyo'

    # Key-value
    leagues = Rufus::Tokyo::Cabinet.new('jl.tch')
    leagues['JLI'] = [
      'Bat...
require 'rufus/tokyo'

    # Table
    big7 = Rufus::Tokyo::Table.new('big7.tct')

    big7['s']               =   {'name'...
Cassandra



Friday, November 20, 2009
Genealogy
     Dynamo
     BigTable




Friday, November 20, 2009
Column-­‐Oriented
     columns
     supercolumns
     column	
  families




Friday, November 20, 2009
Distributed
     automatic	
  replication
     eventual	
  consistency
     easy	
  expansion




Friday, November 20, 2009
Availability
     weak	
  reads
     quorum	
  reads




Friday, November 20, 2009
require 'cassandra'

          op = Cassandra.new('OnePiece')

          op.insert(:People, '1', {'name' => 'Luffy'})
    ...
CouchDB



Friday, November 20, 2009
Web-­‐Inspired
     JSON	
  storage
     HTTP	
  /	
  RESTful	
  interface




Friday, November 20, 2009
Views
     predeVined,	
  updated	
  incrementally
     javascript	
  for	
  map/reduce




Friday, November 20, 2009
Updates
     full,	
  including	
  embedded	
  documents




Friday, November 20, 2009
require 'couchrest'

    konoha = CouchRest.database!('http://127.0.0.1:5984/konoha')
    naruto = konoha.save_doc {
     ...
MongoDB



Friday, November 20, 2009
Storage
     binary	
  JSON	
  documents




Friday, November 20, 2009
Access
     native	
  clients




Friday, November 20, 2009
Queries
     dynamic
     index-­‐based




Friday, November 20, 2009
Updates
     allows	
  partial	
  updates




Friday, November 20, 2009
require 'mongo'

          avengers = Mongo::Connection.new.db('avengers')
          members = avengers.collection('member...
Neo4J



Friday, November 20, 2009
Structure
     nodes	
  and	
  edges
     key-­‐value	
  pairs




Friday, November 20, 2009
Queries
     lucene




Friday, November 20, 2009
require 'neo4j'

    class Person
      include Neo4j::NodeMixin

         property :name, :mutant
         index :name, :...
Neo4j::Transaction.run do
      magneto = Person.new('Magneto')
      esme = Person.new('Esme')
      rogue = Person.new('...
magneto = Person.find(:name => 'Magneto')

    # Who likes Magneto?
    magneto.relationships.incoming(:interests).nodes

...
Simulations



Friday, November 20, 2009
Structure



Friday, November 20, 2009
people
    {
      ‘name’:‘Jimmy Olsen’
      ‘title’:‘Superman’s Pal’
      ‘company_id’:12441
    }

    companies
    {...
Lack	
  of	
  Structure



Friday, November 20, 2009
mysql> SELECT * FROM people LIMIT 1 G
    *************************** 1. row ***************************
         id: 1
  ...
mysql> desc people;
    +-------+-------------+------+-----+---------+-------+
    | Field | Type        | Null | Key | De...
Not	
  Only	
  SQL



Friday, November 20, 2009
Caching



Friday, November 20, 2009
Already	
  in	
  Use
     memcached




Friday, November 20, 2009
Logging



Friday, November 20, 2009
Rails	
  Log	
  Replacement
     http://github.com/peburrows/mongo_db_logger




Friday, November 20, 2009
Hybrid	
  Domains



Friday, November 20, 2009
different	
  domains



Friday, November 20, 2009
Publishing
     e-­‐commerce
     documents




Friday, November 20, 2009
Dating
     e-­‐commerce
     social	
  graph




Friday, November 20, 2009
different	
  scales



Friday, November 20, 2009
Photo	
  Sharing
     user	
  accounts
     uploaded	
  photos




Friday, November 20, 2009
Next	
  Steps



Friday, November 20, 2009
Explore



Friday, November 20, 2009
Database	
  List
      http://internetmindmap.com/database_software


      NoSQL	
  Google	
  Group
      http://groups.g...
Ignore	
  the	
  Database



Friday, November 20, 2009
Logical	
  Modeling	
  First
     be	
  mindful




Friday, November 20, 2009
Change	
  the	
  Default



Friday, November 20, 2009
Application	
  Templates
     start	
  with	
  something	
  new




Friday, November 20, 2009
bensco'ield
     @bsco'ield
     ben.sco'ield@viget.com
     http:/    /spkr8.com/bscoVield
     http:/    /viget.com/exte...
Upcoming SlideShare
Loading in...5
×

NoSQL: Death to Relational Databases(?)

8,356

Published on

Overview of the NoSQL ecosystem given at RubyConf 2009

Published in: Technology

Transcript of "NoSQL: Death to Relational Databases(?)"

  1. 1. NoSQL Death  to  Relational  Databases(?) bensco'ield  –  viget  labs rubyconf 20  november  2009 Friday, November 20, 2009
  2. 2. Motivations Friday, November 20, 2009
  3. 3. Performance Friday, November 20, 2009
  4. 4. Friday, November 20, 2009
  5. 5. Scalability Friday, November 20, 2009
  6. 6. Friday, November 20, 2009
  7. 7. Friday, November 20, 2009
  8. 8. Flexibility Friday, November 20, 2009
  9. 9. Friday, November 20, 2009
  10. 10. Locus  of  Work Friday, November 20, 2009
  11. 11. Charlie  Chaplin Jet  Li Hank  Mann Marian  Collier Friday, November 20, 2009
  12. 12. Domain  Complexity Friday, November 20, 2009
  13. 13. Friday, November 20, 2009
  14. 14. Taxonomy Friday, November 20, 2009
  15. 15. Key-­‐Value  Stores Friday, November 20, 2009
  16. 16. distributed  hash  tables Friday, November 20, 2009
  17. 17. Dynamo GT.M PStore Redis Friday, November 20, 2009
  18. 18. Column-­‐Oriented  Stores Friday, November 20, 2009
  19. 19. semi-­‐structured Friday, November 20, 2009
  20. 20. BigTable Cassandra HBase Friday, November 20, 2009
  21. 21. Document-­‐Oriented  Stores Friday, November 20, 2009
  22. 22. also  semi-­‐structured Friday, November 20, 2009
  23. 23. CouchDB MongoDB RDDB Riak Friday, November 20, 2009
  24. 24. Graph  Databases Friday, November 20, 2009
  25. 25. graph  theory Friday, November 20, 2009
  26. 26. ActiveRDF   AllegroGraph Neo4J Friday, November 20, 2009
  27. 27. Comparisons Friday, November 20, 2009
  28. 28. Performance Friday, November 20, 2009
  29. 29. key-­‐value  stores column-­‐oriented  stores document-­‐oriented  stores relational  databases graph  databases Friday, November 20, 2009
  30. 30. Scalability Friday, November 20, 2009
  31. 31. key-­‐value  stores column-­‐oriented  stores document-­‐oriented  stores relational  databases graph  databases Friday, November 20, 2009
  32. 32. Flexibility Friday, November 20, 2009
  33. 33. key-­‐value  stores document-­‐oriented  stores graph  databases   column-­‐oriented  stores relational  databases Friday, November 20, 2009
  34. 34. Locus  of  Work Friday, November 20, 2009
  35. 35. key-­‐value  stores column-­‐oriented  stores document-­‐oriented  stores relational  databases graph  databases   Friday, November 20, 2009
  36. 36. Domain  Complexity Friday, November 20, 2009
  37. 37. key-­‐value  stores column-­‐oriented  stores document-­‐oriented  stores relational  databases graph  databases   Friday, November 20, 2009
  38. 38. Examples Friday, November 20, 2009
  39. 39. Redis Friday, November 20, 2009
  40. 40. Data  Types strings lists sets Friday, November 20, 2009
  41. 41. In-­‐Memory periodic  snapshots master-­‐slave  replication memory-­‐bound Friday, November 20, 2009
  42. 42. require 'redis' gl = Redis.new # A string gl['name'] = 'Kyle Rayner' gl['name'] gl.delete('name') # A list gl.push_tail 'to-dos', 'Lose Ion power' gl.push_tail 'to-dos', 'Mourn dead loved ones' gl.push_tail 'to-dos', 'Blow up zombie lanterns' gl.list_range('to-dos', 0, -1) Friday, November 20, 2009
  43. 43. Tokyo  Cabinet Friday, November 20, 2009
  44. 44. Data  Types strings tables! Friday, November 20, 2009
  45. 45. Related  Projects tyrant dystopia promenade Friday, November 20, 2009
  46. 46. require 'rufus/tokyo' # Key-value leagues = Rufus::Tokyo::Cabinet.new('jl.tch') leagues['JLI'] = [ 'Batman', 'Black Canary', 'Blue Beetle', 'Captain Marvel', 'Doctor Light', 'Doctor Fate', 'Guy Gardner','Martian Manhunter', 'Mister Miracle' ].to_yaml YAML.load(leagues['JLI']) Friday, November 20, 2009
  47. 47. require 'rufus/tokyo' # Table big7 = Rufus::Tokyo::Table.new('big7.tct') big7['s'] = {'name' => 'Superman', 'role' => 'deus ex machina'} big7['b'] = {'name' => 'Batman', 'role' => 'mastermind'} big7['gl'] = {'name' => 'Green Lantern', 'role' => 'space cop'} big7['f'] = {'name' => 'Flash', 'role' => 'speedster'} big7['mm'] = {'name' => 'Martian Manhunter', 'role' => '?'} big7['ww'] = {'name' => 'Wonder Woman', 'role' => 'hitter'} big7['a'] = {'name' => 'Aquaman', 'role' => 'fish-talking'} big7.query {|q| q.add_condition 'role', :streq, 'fish-talking' } Friday, November 20, 2009
  48. 48. Cassandra Friday, November 20, 2009
  49. 49. Genealogy Dynamo BigTable Friday, November 20, 2009
  50. 50. Column-­‐Oriented columns supercolumns column  families Friday, November 20, 2009
  51. 51. Distributed automatic  replication eventual  consistency easy  expansion Friday, November 20, 2009
  52. 52. Availability weak  reads quorum  reads Friday, November 20, 2009
  53. 53. require 'cassandra' op = Cassandra.new('OnePiece') op.insert(:People, '1', {'name' => 'Luffy'}) op.insert(:People, '2', {'name' => 'Crocodile'}) op.insert(:People, '3', {'name' => 'Mr. 3'}) op.insert(:Fights, '1', {'opponents' => {UUID.new => '2'}}) op.insert(:Fights, '1', {'opponents' => {UUID.new => '3'}}) luffy_fights = op.get(:Fights, '1', 'opponents') luffy_fights.map {|t, opp| op.get(:People, opp, 'name')} Friday, November 20, 2009
  54. 54. CouchDB Friday, November 20, 2009
  55. 55. Web-­‐Inspired JSON  storage HTTP  /  RESTful  interface Friday, November 20, 2009
  56. 56. Views predeVined,  updated  incrementally javascript  for  map/reduce Friday, November 20, 2009
  57. 57. Updates full,  including  embedded  documents Friday, November 20, 2009
  58. 58. require 'couchrest' konoha = CouchRest.database!('http://127.0.0.1:5984/konoha') naruto = konoha.save_doc { 'name' => 'Naruto Uzumaki', 'chakra' => 'wind' } shikamaru = konoha.save_doc { 'name' => 'Shikamaru Nara', 'chunin' => true } konoha.save_doc { '_id' => '_design/first', :views => { :chunin => { :map => 'function(doc){if(doc.chunin){emit(null, doc);}}' } } } puts konoha.views('first/chunin')['rows'].inspect Friday, November 20, 2009
  59. 59. MongoDB Friday, November 20, 2009
  60. 60. Storage binary  JSON  documents Friday, November 20, 2009
  61. 61. Access native  clients Friday, November 20, 2009
  62. 62. Queries dynamic index-­‐based Friday, November 20, 2009
  63. 63. Updates allows  partial  updates Friday, November 20, 2009
  64. 64. require 'mongo' avengers = Mongo::Connection.new.db('avengers') members = avengers.collection('members') members.insert {'name' => 'Ant-Man'} members.insert {'name' => 'Hulk'} members.insert {'name' => 'Iron Man'} members.insert {'name' => 'Thor'} members.insert {'name' => 'Wasp'} members.create_index('name') pym = members.find {'name' => 'Ant-Man'} pym['name'] = 'Giant-Man' pym.save members.remove {'name' => 'Hulk'} members.insert {'name' => 'Captain America'} Friday, November 20, 2009
  65. 65. Neo4J Friday, November 20, 2009
  66. 66. Structure nodes  and  edges key-­‐value  pairs Friday, November 20, 2009
  67. 67. Queries lucene Friday, November 20, 2009
  68. 68. require 'neo4j' class Person include Neo4j::NodeMixin property :name, :mutant index :name, :mutant has_n :interests has_n :dates has_n :marriages def initialize(name, mutant = true) name = name mutant = mutant end end Friday, November 20, 2009
  69. 69. Neo4j::Transaction.run do magneto = Person.new('Magneto') esme = Person.new('Esme') rogue = Person.new('Rogue') magda = Person.new('Magda', false) wasp = Person.new('Wasp', false) magneto.interests << wasp magneto.marriages << magda magneto.dates << rogue esme.interests << magneto magda.marriages << magneto rogue.dates << magneto end Friday, November 20, 2009
  70. 70. magneto = Person.find(:name => 'Magneto') # Who likes Magneto? magneto.relationships.incoming(:interests).nodes # Which non-mutants has Magneto dated? magneto.dates{ !mutant? }.to_a Friday, November 20, 2009
  71. 71. Simulations Friday, November 20, 2009
  72. 72. Structure Friday, November 20, 2009
  73. 73. people { ‘name’:‘Jimmy Olsen’ ‘title’:‘Superman’s Pal’ ‘company_id’:12441 } companies { _id:12441 ‘name’:‘Daily Planet’ } Friday, November 20, 2009
  74. 74. Lack  of  Structure Friday, November 20, 2009
  75. 75. mysql> SELECT * FROM people LIMIT 1 G *************************** 1. row *************************** id: 1 content: --- company: Daily Planet name: Jimmy Olsen title: Superman’s Pal Friday, November 20, 2009
  76. 76. mysql> desc people; +-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | id | int(11) | YES | | NULL | | | name | varchar(50) | YES | | NULL | | +-------+-------------+------+-----+---------+-------+ mysql> desc attributes; +-----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+-----+---------+-------+ | id | int(11) | YES | | NULL | | | person_id | int(11) | YES | | NULL | | | attribute | varchar(50) | YES | | NULL | | | value | varchar(100) | YES | | NULL | | +-----------+--------------+------+-----+---------+-------+ Friday, November 20, 2009
  77. 77. Not  Only  SQL Friday, November 20, 2009
  78. 78. Caching Friday, November 20, 2009
  79. 79. Already  in  Use memcached Friday, November 20, 2009
  80. 80. Logging Friday, November 20, 2009
  81. 81. Rails  Log  Replacement http://github.com/peburrows/mongo_db_logger Friday, November 20, 2009
  82. 82. Hybrid  Domains Friday, November 20, 2009
  83. 83. different  domains Friday, November 20, 2009
  84. 84. Publishing e-­‐commerce documents Friday, November 20, 2009
  85. 85. Dating e-­‐commerce social  graph Friday, November 20, 2009
  86. 86. different  scales Friday, November 20, 2009
  87. 87. Photo  Sharing user  accounts uploaded  photos Friday, November 20, 2009
  88. 88. Next  Steps Friday, November 20, 2009
  89. 89. Explore Friday, November 20, 2009
  90. 90. Database  List http://internetmindmap.com/database_software NoSQL  Google  Group http://groups.google.com/group/nosql-­‐discussion NoSQL  Ecosystem http://www.rackspacecloud.com/blog/2009/11/09/nosql-­‐ecosystem/ Wave! Friday, November 20, 2009
  91. 91. Ignore  the  Database Friday, November 20, 2009
  92. 92. Logical  Modeling  First be  mindful Friday, November 20, 2009
  93. 93. Change  the  Default Friday, November 20, 2009
  94. 94. Application  Templates start  with  something  new Friday, November 20, 2009
  95. 95. bensco'ield @bsco'ield ben.sco'ield@viget.com http:/ /spkr8.com/bscoVield http:/ /viget.com/extend http:   /benscoVield.com / Friday, November 20, 2009
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×