Mongodb For Rubyists at NYC.rb

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    10 Favorites

    Mongodb For Rubyists at NYC.rb - Presentation Transcript

    1. Prelude
    2. Q. Why do we love Ruby?
    3. A. “Ruby is designed to be human-oriented. It reduces the burden of programming. It tries to push jobs back to machines. You can accomplish more tasks with less work, in smaller yet readable code.” - Matz
    4. 01001000011101010110 11010110000101101110 0111011001110011 01001101011000010110 00110110100001101001 0110111001100101
    5. Human vs Machine
    6. Q. Why do I love MongoDB?
    7. A. “MongoDB is designed to be human-oriented. It reduces the burden of programming. It tries to push jobs back to machines. You can accomplish more tasks with less work, in smaller yet readable code.” - Banker (indebted to Matz)
    8. MongoDB (is) for Rubyists * * and all human-oriented programmers
    9. 1. SQL (or No)
    10. Key/Value Stores Dynamo, Voldemort, Riak, Memcached (keyword: “stores”)
    11. Column-Oriented Cassandra, BigTable
    12. Document Databases MongoDB, CouchDB
    13. RDBMS Durable Transactional Normalized Rigorous Queryable
    14. Notes: RDBMS is proven necessary * *sometimes
    15. Why build MongoDB?
    16. Mean & Extremes Key-Value MongoDB Relational
    17. MongoDB high-performance built for scale document-oriented schema-free
    18. high performance relaxed acid document model memory-mapped
    19. master-slave M S S S
    20. replica-pairs M (S) S (M) M (S) S (M) M (S) S (M)
    21. (auto) sharding
    22. client
    23. mongos client
    24. Shards mongod mongod mongod ... mongod mongod mongod mongos client
    25. Shards mongod mongod mongod ... mongod mongod mongod mongos mongos ... client
    26. Shards mongod mongod mongod ... Config mongod mongod mongod Servers mongod mongod mongod mongos mongos ... client
    27. document-oriented {:sku => ‘637636’, :name => ‘Linen tailored pant’, :about => [{:title => ‘fabric & care’, :content => [‘Dry clean’, ‘Imported’]}, {:title => ‘overview’, :content => [‘Tailored fit’, ‘Yarn dyed’]} ] }
    28. schema-free {:sku => ‘637636’, :note => ‘Added this with no migration!” :name => ‘Linen tailored pant’, :about => [{:title => ‘fabric & care’, :content => [‘Dry clean’, ‘Imported’]}, {:title => ‘overview’, :content => [‘Tailored fit’, ‘Yarn dyed’]} ]
    29. Q. How to you make an RDBMS dynamic?
    30. A. Hundreds of little tables.
    31. Simulating a flexible schema
    32. Simulating a flexible schema What’s the join like?
    33. Q. What % of these tables need RDBM?
    34. Machine
    35. human
    36. {:sku => ‘637636’, :name => ‘Linen tailored pant’, :about => [{:title => ‘fabric & care’, :content => [‘Dry clean’, ‘Imported’]}, {:title => ‘overview’, :content => [‘Tailored fit’, ‘Yarn dyed’]} ] }* * Admittedly simplified, but not far-fetched.
    37. 2. Ruby to MongoDB
    38. Anatomy of an Insert
    39. Connection mongod (or mongos) Database a database Collection a schema-free table
    40. ObjectID Generation BSON Serialization Fire and Forget
    41. Dynamic Queries * * like sql
    42. b-tree Indexes * * up to 40 per collection
    43. Flexible & Fast Updates * * and upserts, too
    44. Elegant Operators * * document keywords
    45. for queries $ne $in $nin $mod $all $size $exists
    46. for updates $inc $set $push $pushAll $pop $pull $pullAll
    47. for everything else: Javascript * * yes, MongoDB speaks JS
    48. group where map-reduce
    49. 3. Design Patterns
    50. One to y Many Many Many Man any Many Many Many any Many Many Many M Many Many Many Many
    51. comments has_many votes
    52. relation comments votes comment_id user_id
    53. document comments
    54. post has_many comments
    55. relation post comments post_id user_id tree attrs
    56. 1. embedded document {:title => ‘a life unexamined’, :comments => [ {:author => ‘socrates’, :text => ‘is not worthwhile’}, {:author => ‘epicurus’, :text => ‘leads to bliss’} ] }
    57. 2. embedded & nested {:comments => [ {:author => ‘socrates’, :text => ‘is not worthwhile’, :comments => [ {:author => ‘epicurus’, :text => ‘leads to bliss’}]}, ] }
    58. 3. normalized [{:author => ‘socrates’, :text => ‘is not worthwhile’, :post_id => ‘4c4fa6d000002’}, {:author => ‘epicurus’, :text => ‘leads to bliss’, :post_id => ‘4c4fa6d000002’} ]
    59. Embed when possible tradeoffs Break out when complex
    60. any Many Many Many any Many Many Many M Many Many Many Man to y Many Many Many Man any Many Many Many any Many Many Many M Many Many Many Many
    61. relation clients join client_id address_id addresses
    62. document
    63. Den o malization r { :username => ‘socrates’, :text => ‘...be as you wish’, :user_id => ‘4c4fa6d000002’ }
    64. Exercises for the reader
    65. GridFS for images, videos, music, large binary objects
    66. MongoDB JS Shell
    67. MongoDB JS Shell MongoMapper Mongoid
    68. MongoDB JS Shell MongoMapper Mongoid MongoHQ
    69. MongoDB JS Shell MongoMapper Mongoid MongoHQ Pre-­‐compiled  binaries Solid  documenta4on Mul4-­‐language  support
    70. Finale
    71. Q. What is MongoDB good for?
    72. A. the web logging analytics real-time
    73. A. the web logging analytics real-time data models rendered inhumane by RDBMS (or other)
    74. A. the web logging analytics real-time data models rendered inhumane by RDBMS (or other) human-oriented programmers
    75. google groups: mongodb-user freenode: #mongodb docs & download: mongodb.org twitter.com/hwaet kyle@10gen.com inspired by slideshare.net/timanglade/tin
    SlideShare Zeitgeist 2009

    + kbankerkbanker Nominate

    custom

    908 views, 10 favs, 0 embeds more stats

    MongoDB presentation from NYC Ruby, November, 2009. more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 908
      • 908 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 10
    • Downloads 10
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories