Your SlideShare is downloading. ×
  • Like
Introduction to MongoDB
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Introduction to MongoDB

  • 5,016 views
Published

 

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Please ignore the 'Partition balancing' mention on page 102. That is the wrong term and taken out of context could be taken wrong. More info on sharding and partition balancing: http://www.mongodb.org/display/DOCS/Sharding+Administration#ShardingAdministration-Balancing
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
5,016
On SlideShare
0
From Embeds
0
Number of Embeds
3

Actions

Shares
Downloads
126
Comments
1
Likes
2

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. MongoDBJustin Smestad@jsmestadjustin@mongomachine.com
  • 2. whoamiSoftware Engineer (Ruby, Javascript, and Clojure)User Experience & Design on the sidePassion for DevOpsChicagoland native
  • 3. whoamiSoftware Engineer (Ruby, Javascript, and Clojure)User Experience & Design on the sidePassion for DevOpsChicagoland native
  • 4. whoamiSoftware Engineer (Ruby, Javascript, and Clojure)User Experience & Design on the sidePassion for DevOpsChicagoland native
  • 5. whoamiSoftware Engineer (Ruby, Javascript, and Clojure)User Experience & Design on the sidePassion for DevOpsChicagoland native
  • 6. BackgroundJava Engineer @ Orbitz Worldwide Brought Ruby and RSpec/Cucumber to replace Fitness TestingApplication Developer @ Factory Design Labs Brand & Campaign sites for Audi, Oakley, and TNFIndependent Contractor Development team for TechStars alumni
  • 7. BackgroundJava Engineer @ Orbitz Worldwide Brought Ruby and RSpec/Cucumber to replace Fitness TestingApplication Developer @ Factory Design Labs Brand & Campaign sites for Audi, Oakley, and TNFIndependent Contractor Development team for TechStars alumni
  • 8. BackgroundJava Engineer @ Orbitz Worldwide Brought Ruby and RSpec/Cucumber to replace Fitness TestingApplication Developer @ Factory Design Labs Brand & Campaign sites for Audi, Oakley, and TNFIndependent Contractor Development team for TechStars alumni
  • 9. mongo machine hosted MongoDB wherever you need it
  • 10. What’s mongo machine ?
  • 11. mongo machine hosted MongoDB + data management http://mongomachine.com
  • 12. mongo machine hosted MongoDB + data managementOur Goals Educate and promote best practices Increase customer efficiency Promote transparency
  • 13. Our Product
  • 14. Hosted MongoDBProvide the best managed MongoDBexperience, on any platform.
  • 15. mongo machine hosted MongoDB + data managementManaged MongoDB Infrastructure Our infrastructure on AWS or Rackspace Automated Deployments to your own infrastructureManagement Console Instantly create new databases Track database trends Scale up & down on-demand
  • 16. Management ConsoleAnalytics data about what your DB is doing.
  • 17. Management ConsoleAnalytics data about what your DB is doing.
  • 18. “NoSQL”hasn’t this been tried before?why should I care now?
  • 19. So what is MongoDB? (10,000ft view)
  • 20. MongoDB (from "humongous") is ascalable, high-performance, open source, schema-free, document-oriented database. -- mongodb.org
  • 21. Who is using MongoDB?
  • 22. Fortune 500 <=> Startups
  • 23. GithubBug Tracking & Analytics
  • 24. FoursquareCheck-in System
  • 25. New York Times Photo Submissions
  • 26. The list is large and growing fasthttp://www.mongodb.org/display/DOCS/Production+Deployments
  • 27. Philosophy
  • 28. Philosophy “One size DOESN’T fit”
  • 29. Philosophy Non-relational (de-normalized) DBs are easier to scale, especially horizontally
  • 30. Philosophy DBs should be an on-demand commodity (cloud-like)
  • 31. Philosophy Focus on performance, flexibility and scalability (CA)
  • 32. Philosophy Not concerned with transactional stuff or relational semantics
  • 33. PhilosophyMongo aims for theperformance of key-value stores whilemaintainingfunctionality oftraditional RDBMS
  • 34. Features
  • 35. FeaturesStandard database stuff Indexing Traditional master-slave Database References (no concept of JOINS)
  • 36. FeaturesStandard database stuff Indexing Traditional master-slave Database References (no concept of JOINS)
  • 37. FeaturesStandard database stuff Indexing Traditional master-slave Database References (no concept of JOINS)
  • 38. FeaturesStandard database stuff Indexing Traditional master-slave Database References (no concept of JOINS)
  • 39. FeaturesSpeedin-memory dataset with fsync to disk
  • 40. FeaturesDurabilitysolve with replication, or use journaling
  • 41. FeaturesDocument-oriented database
  • 42. Features: Document Storage Documents are stored in BSON (binary JSON)
  • 43. Features: Document Storage BSON is a binary serialization of JSON-like objects
  • 44. Features: Document Storage Large BSON documents are served in chunks (GridFS)
  • 45. Features: Document Storage This is extremely powerful, b/c it means mongo understands JSON natively
  • 46. Features: Document Storage Any valid JSON can be easily imported and queried
  • 47. Features: Document Storage Documents can contain embedded documents (nested hashes) without losing any indexing capabilities.
  • 48. FeaturesSchema-less; very flexibleno more blocking ALTER TABLE or NULL debates
  • 49. FeaturesReplica Sets and Sharding make horizontal scaling easy.
  • 50. Features: Replica Set Traditional Master-Slave, but automatic failover Each server holds all data (CA) One is elected master at a given time Arbitration process detects failover New election within seconds
  • 51. Features: Replica Set Traditional Master-Slave, but automatic failover Each server holds all data (CA) One is elected master at a given time Arbitration process detects failover New election within seconds
  • 52. Features: Replica Set Traditional Master-Slave, but automatic failover Each server holds all data (CA) One is elected master at a given time Arbitration process detects failover New election within seconds
  • 53. Features: Replica Set Traditional Master-Slave, but automatic failover Each server holds all data (CA) One is elected master at a given time Arbitration process detects failover New election within seconds
  • 54. Features: Replica Set Traditional Master-Slave, but automatic failover Each server holds all data (CA) One is elected master at a given time Arbitration process detects failover New election within seconds
  • 55. FeaturesMap/ReduceMap Reduce operations are written in Javascript.
  • 56. Features: QueryingRich, javascript-based query syntax Allows us to do deep, nested queries
  • 57. Features: QueryingRich, javascript-based query syntax Allows us to do deep, nested queries
  • 58. Features: QueryingRich, javascript-based query syntax Allows us to do deep, nested queries db.order.find( { shipping: { carrier: "usps" } } );
  • 59. Features: QueryingRich, javascript-based query syntax Allows us to do deep, nested queries db.order.find( { shipping: { carrier: "usps" } } ); shipping is an embedded document (object)
  • 60. Featuresatomic operationsupserts, $set, $inc, $push, $pull, $pop, $addToSet, ...
  • 61. Features Official Drivers .NET, Java, Javascript, Ruby, Node.js, PHP, Haskell, C/C++, Perl
  • 62. Features Community & Market Growth MongoDB works alongside your existing technologies
  • 63. Concepts
  • 64. Concepts: Document-oriented Think of “documents” as objects / database records
  • 65. Concepts: Document-oriented Think of “documents” as objects / database records Documents are basically just JSON in binary
  • 66. Concept: Document-oriented Think of “documents” as objects / database records Documents are basically just JSON in binary Ability to store information all together
  • 67. Concept MappingRDBMS (mysql, postgres) MongoDB Tables Collections
  • 68. Concept MappingRDBMS (mysql, postgres) MongoDB Tables Collections Records/rows Documents/objects
  • 69. Concept MappingRDBMS (mysql, postgres) MongoDB Tables Collections Records/rows Documents/objects Queries return record(s) Queries return a cursor
  • 70. Concept MappingRDBMS (mysql, postgres) MongoDB Tables Collections Records/rows Documents/objectsQueries return record(s) Queries return a cursor ???
  • 71. Concepts: CursorsQueries return “cursors” instead of collections
  • 72. Concepts: CursorsQueries return “cursors” instead of collections A cursor allows you to iterate through the result set
  • 73. Concepts: CursorsQueries return “cursors” instead of collections A cursor allows you to iterate through the result set A big reason for this is performance
  • 74. Concepts: CursorsQueries return “cursors” instead of collections A cursor allows you to iterate through the result set A big reason for this is performance Much more efficient than loading all objects into memory
  • 75. Concepts: CursorsThe find() function returns a cursor object
  • 76. Concepts: CursorsThe find() function returns a cursor object var cursor = db.logged_requests.find({ status_code : 200 }) cursor.hasNext() // "true" cursor.forEach( function(item) { print(tojson(item)) } ); cursor.hasNext() // "false"
  • 77. Cool Features
  • 78. Cool FeaturesCapped collections Fixed-sized, limited operation, auto-LRU age-out collections Fixed insertion order Extremely performant Ideal for logging and caching
  • 79. Cool FeaturesCapped collections Fixed-sized, limited operation, auto-LRU age-out collections Fixed insertion order Extremely performant Ideal for logging and caching
  • 80. Cool FeaturesCapped collections Fixed-sized, limited operation, auto-LRU age-out collections Fixed insertion order Extremely performant Ideal for logging and caching
  • 81. Cool FeaturesCapped collections Fixed-sized, limited operation, auto-LRU age-out collections Fixed insertion order Extremely performant Ideal for logging and caching
  • 82. Cool FeaturesCapped collections Fixed-sized, limited operation, auto-LRU age-out collections Fixed insertion order Extremely performant Ideal for logging and caching
  • 83. Use Cases
  • 84. Use CasesData Warehouse Mongo understands JSON natively Very powerful map-reduce for analytics Nested hashes make roll-up (RRDtool) systems natural
  • 85. Use CasesData Warehouse Mongo understands JSON natively Very powerful map-reduce for analytics Nested hashes make roll-up (RRDtool) systems natural
  • 86. Use CasesData Warehouse Mongo understands JSON natively Very powerful map-reduce for analytics Nested hashes make roll-up (RRDtool) systems natural
  • 87. Use CasesData Warehouse Mongo understands JSON natively Very powerful map-reduce for analytics Nested hashes make roll-up (RRDtool) systems natural
  • 88. Use CasesAudit Trails Nested documents allow you to store audit trails in context.
  • 89. Use CasesAudit Trails Nested documents allow you to store audit trails in context. { ‘name’: ‘Justin Smestad’, ‘address’: ‘1441 Central St’, ‘history’: [ { ‘name’: ‘Justin Smestad’, ‘address’: ‘350 S Jackson St’ },....] }
  • 90. Limitations
  • 91. Limitations Transaction support Relational integrity (normalization) Partition balancing Map / Reduce is single threaded Data compaction
  • 92. Limitations Transaction support Relational integrity (normalization) Partition balancing Map / Reduce is single threaded Data compaction
  • 93. Limitations Transaction support Relational integrity (normalization) Partition balancing Map / Reduce is single threaded Data compaction
  • 94. Limitations Transaction support Relational integrity (normalization) Partition balancing Map / Reduce is single threaded Data compaction
  • 95. Limitations Transaction support Relational integrity (normalization) Partition balancing Map / Reduce is single threaded Data compaction
  • 96. Why not `other db` ?CouchDB, Cassandra, Riak, Membase, Redis, ...
  • 97. Why not `other db`? FLEXIBILITY MongoDB’s design choices empower developers and administrators with features that allow you to implement their own solutions. *
  • 98. Questions?@jsmestad / @mongo_machine