MongoDB San Francisco DrupalCon 2010
Upcoming SlideShare
Loading in...5
×
 

MongoDB San Francisco DrupalCon 2010

on

  • 1,819 views

MongoDB San Francisco DrupalCon 2010

MongoDB San Francisco DrupalCon 2010

Statistics

Views

Total Views
1,819
Views on SlideShare
1,807
Embed Views
12

Actions

Likes
2
Downloads
40
Comments
0

1 Embed 12

http://www.slideshare.net 12

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

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…
Post Comment
Edit your comment

MongoDB San Francisco DrupalCon 2010 MongoDB San Francisco DrupalCon 2010 Presentation Transcript

  • Karoly Negyesi Developer team lead NowPublic.com / Examiner.com
  • History
    • Ingres early 1970s
    • Oracle 1979
    • MySQL 1982
    • PostGRES 1986
  • Moore's law
    • Doubling every 18 months
    • Applies to:
      • Processing speed
      • Memory capacity
      • Hard disk capacity
  • We need drastically different design
      http://varnish-cache.org/wiki/ArchitectNotes
  • And now some Bayou slides... www.cs.berkeley.edu/~istoica/classes/cs268/06/notes/20-BFTx2.pdf
  • SQL
    • Rigid schema
    • Normal forms
    • Transactions
    • Rich feature set http://dev.mysql.com/doc/refman/5.0/en/string-functions.html
    • “Databases are operating systems that you don't have to write sound drivers for.” - Brian Aker http://twitter.com/timoreilly/status/12247022198
  • Reality
    • The world is not rigid
    • Denormalization
    • Too much overhead for transactions
    • Most of features are rarely needed
  • Even worse The iPhone
  • NoSQL
    • Very new
    • Key-value stores
    • Document stores
    • Performant
    • Scalable
    • Not too many features
  • MongoDB
    • Databases
    • Collections
    • Documents
    • Strictly but dynamically typed
    • Arrays and objects
    • In place updates
    • Foreign key support
    • Native PHP driver
  • Simple example
    • db.things.save({ x : 3 })
    • db.things.save({ y : 4 })
    • db.things.find()
    • { "_id" : ObjectId("4b10d1997bd1e19a46fc8862"), "x" : 3 }
    • { "_id" : ObjectId("4b10d1aa7bd1e19a46fc8863"), "y" : 4 }
  • ObjectID
    • By default generated
    • Can be anything as long it's unique
  • Update
    • db.things.save({a:1,b:2,c:3})
    • o=db.things.findOne({b:2})
    • o.c=4
    • db.things.update({b:2}, o)
    • db.things.find()
    • { "a" : 1, "b" : 2, "c" : 4 }
  • Modifier operators
    • db.things.update({ b : 2} , { $set : { c : 4 }})
    • db.things.find()
    • {"a" : 1, "b" : 2, "c" : 4 }
    • db.things.update({ b : 2} , { $inc : { c : 100 }})
    • db.things.find() {"a" : 1, "b" : 2, "c" : 104 }
  • Arrays
    • db.things.save({a:[1,2,3]})
    • db.things.save({a:[5,6,7]})
    • db.things.find({a:2}) { "a" : [ 1, 2, 3 ] }
  • Array modification
    • db.things.insert({n:1,a:[1,2,3]})
    • db.things.update({n:1},{$push:{a:4}})
    • db.things.find()
    • { "n" : 1, "a" : [ 1, 2, 3, 4 ] }
  • Objects
    • db.things.save({db:{name:'mongodb', interesting:true }})
    • db.things.save({db:{name:'mysql', interesting:false }})
    • db.things.find({'db.interesting':true})
    • {"db" : { "name" : "mongodb", "interesting" : true } }
  • Indexes
    • Anything can be indexed
    • Objects
    • Arrays
  • New design
    • Not much design is needed...
    • Search for ids and then load the rest
  • What are great fits
    • Statistics
      • Many writes
      • Loss is not that big a deal
    • Fluid data
      • Products in a web store
      • User profiles
  • Not so good fit
    • Very complex queries
    • Transaction needs
  • Drupal and Mongo
    • Cache
    • Field_storage. Oh yes!
    • Session
    • Watchdog
    • Block
    • Queue
  • Crazy...
    • DBTNG driver