Introduction to MongoDB
Upcoming SlideShare
Loading in...5
×
 

Introduction to MongoDB

on

  • 5,064 views

 

Statistics

Views

Total Views
5,064
Views on SlideShare
4,950
Embed Views
114

Actions

Likes
2
Downloads
104
Comments
1

8 Embeds 114

http://code.pearson.com 98
http://pdn.makedatamakesense.com 5
https://twitter.com 4
http://paper.li 2
http://www.linkedin.com 2
http://partner.pearson.com 1
https://www.linkedin.com 1
https://tasks.crowdflower.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • 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
    Processing…
Post Comment
Edit your comment

Introduction to MongoDB Introduction to MongoDB Presentation Transcript

  • MongoDBJustin Smestad@jsmestadjustin@mongomachine.com
  • whoamiSoftware Engineer (Ruby, Javascript, and Clojure)User Experience & Design on the sidePassion for DevOpsChicagoland native
  • whoamiSoftware Engineer (Ruby, Javascript, and Clojure)User Experience & Design on the sidePassion for DevOpsChicagoland native
  • whoamiSoftware Engineer (Ruby, Javascript, and Clojure)User Experience & Design on the sidePassion for DevOpsChicagoland native
  • whoamiSoftware Engineer (Ruby, Javascript, and Clojure)User Experience & Design on the sidePassion for DevOpsChicagoland native
  • 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
  • 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
  • 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
  • mongo machine hosted MongoDB wherever you need it
  • What’s mongo machine ?
  • mongo machine hosted MongoDB + data management http://mongomachine.com
  • mongo machine hosted MongoDB + data managementOur Goals Educate and promote best practices Increase customer efficiency Promote transparency
  • Our Product
  • Hosted MongoDBProvide the best managed MongoDBexperience, on any platform.
  • 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
  • Management ConsoleAnalytics data about what your DB is doing.
  • Management ConsoleAnalytics data about what your DB is doing.
  • “NoSQL”hasn’t this been tried before?why should I care now?
  • So what is MongoDB? (10,000ft view)
  • MongoDB (from "humongous") is ascalable, high-performance, open source, schema-free, document-oriented database. -- mongodb.org
  • Who is using MongoDB?
  • Fortune 500 <=> Startups
  • GithubBug Tracking & Analytics
  • FoursquareCheck-in System
  • New York Times Photo Submissions
  • The list is large and growing fasthttp://www.mongodb.org/display/DOCS/Production+Deployments
  • Philosophy
  • Philosophy “One size DOESN’T fit”
  • Philosophy Non-relational (de-normalized) DBs are easier to scale, especially horizontally
  • Philosophy DBs should be an on-demand commodity (cloud-like)
  • Philosophy Focus on performance, flexibility and scalability (CA)
  • Philosophy Not concerned with transactional stuff or relational semantics
  • PhilosophyMongo aims for theperformance of key-value stores whilemaintainingfunctionality oftraditional RDBMS
  • Features
  • FeaturesStandard database stuff Indexing Traditional master-slave Database References (no concept of JOINS)
  • FeaturesStandard database stuff Indexing Traditional master-slave Database References (no concept of JOINS)
  • FeaturesStandard database stuff Indexing Traditional master-slave Database References (no concept of JOINS)
  • FeaturesStandard database stuff Indexing Traditional master-slave Database References (no concept of JOINS)
  • FeaturesSpeedin-memory dataset with fsync to disk
  • FeaturesDurabilitysolve with replication, or use journaling
  • FeaturesDocument-oriented database
  • Features: Document Storage Documents are stored in BSON (binary JSON)
  • Features: Document Storage BSON is a binary serialization of JSON-like objects
  • Features: Document Storage Large BSON documents are served in chunks (GridFS)
  • Features: Document Storage This is extremely powerful, b/c it means mongo understands JSON natively
  • Features: Document Storage Any valid JSON can be easily imported and queried
  • Features: Document Storage Documents can contain embedded documents (nested hashes) without losing any indexing capabilities.
  • FeaturesSchema-less; very flexibleno more blocking ALTER TABLE or NULL debates
  • FeaturesReplica Sets and Sharding make horizontal scaling easy.
  • 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
  • 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
  • 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
  • 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
  • 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
  • FeaturesMap/ReduceMap Reduce operations are written in Javascript.
  • Features: QueryingRich, javascript-based query syntax Allows us to do deep, nested queries
  • Features: QueryingRich, javascript-based query syntax Allows us to do deep, nested queries
  • Features: QueryingRich, javascript-based query syntax Allows us to do deep, nested queries db.order.find( { shipping: { carrier: "usps" } } );
  • 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)
  • Featuresatomic operationsupserts, $set, $inc, $push, $pull, $pop, $addToSet, ...
  • Features Official Drivers .NET, Java, Javascript, Ruby, Node.js, PHP, Haskell, C/C++, Perl
  • Features Community & Market Growth MongoDB works alongside your existing technologies
  • Concepts
  • Concepts: Document-oriented Think of “documents” as objects / database records
  • Concepts: Document-oriented Think of “documents” as objects / database records Documents are basically just JSON in binary
  • Concept: Document-oriented Think of “documents” as objects / database records Documents are basically just JSON in binary Ability to store information all together
  • Concept MappingRDBMS (mysql, postgres) MongoDB Tables Collections
  • Concept MappingRDBMS (mysql, postgres) MongoDB Tables Collections Records/rows Documents/objects
  • Concept MappingRDBMS (mysql, postgres) MongoDB Tables Collections Records/rows Documents/objects Queries return record(s) Queries return a cursor
  • Concept MappingRDBMS (mysql, postgres) MongoDB Tables Collections Records/rows Documents/objectsQueries return record(s) Queries return a cursor ???
  • Concepts: CursorsQueries return “cursors” instead of collections
  • Concepts: CursorsQueries return “cursors” instead of collections A cursor allows you to iterate through the result set
  • Concepts: CursorsQueries return “cursors” instead of collections A cursor allows you to iterate through the result set A big reason for this is performance
  • 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
  • Concepts: CursorsThe find() function returns a cursor object
  • 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"
  • Cool Features
  • Cool FeaturesCapped collections Fixed-sized, limited operation, auto-LRU age-out collections Fixed insertion order Extremely performant Ideal for logging and caching
  • Cool FeaturesCapped collections Fixed-sized, limited operation, auto-LRU age-out collections Fixed insertion order Extremely performant Ideal for logging and caching
  • Cool FeaturesCapped collections Fixed-sized, limited operation, auto-LRU age-out collections Fixed insertion order Extremely performant Ideal for logging and caching
  • Cool FeaturesCapped collections Fixed-sized, limited operation, auto-LRU age-out collections Fixed insertion order Extremely performant Ideal for logging and caching
  • Cool FeaturesCapped collections Fixed-sized, limited operation, auto-LRU age-out collections Fixed insertion order Extremely performant Ideal for logging and caching
  • Use Cases
  • Use CasesData Warehouse Mongo understands JSON natively Very powerful map-reduce for analytics Nested hashes make roll-up (RRDtool) systems natural
  • Use CasesData Warehouse Mongo understands JSON natively Very powerful map-reduce for analytics Nested hashes make roll-up (RRDtool) systems natural
  • Use CasesData Warehouse Mongo understands JSON natively Very powerful map-reduce for analytics Nested hashes make roll-up (RRDtool) systems natural
  • Use CasesData Warehouse Mongo understands JSON natively Very powerful map-reduce for analytics Nested hashes make roll-up (RRDtool) systems natural
  • Use CasesAudit Trails Nested documents allow you to store audit trails in context.
  • 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’ },....] }
  • Limitations
  • Limitations Transaction support Relational integrity (normalization) Partition balancing Map / Reduce is single threaded Data compaction
  • Limitations Transaction support Relational integrity (normalization) Partition balancing Map / Reduce is single threaded Data compaction
  • Limitations Transaction support Relational integrity (normalization) Partition balancing Map / Reduce is single threaded Data compaction
  • Limitations Transaction support Relational integrity (normalization) Partition balancing Map / Reduce is single threaded Data compaction
  • Limitations Transaction support Relational integrity (normalization) Partition balancing Map / Reduce is single threaded Data compaction
  • Why not `other db` ?CouchDB, Cassandra, Riak, Membase, Redis, ...
  • Why not `other db`? FLEXIBILITY MongoDB’s design choices empower developers and administrators with features that allow you to implement their own solutions. *
  • Questions?@jsmestad / @mongo_machine