Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Don't fight MongoDB

Mirko Bonadei
December 13, 2013

Don't fight MongoDB

A brief introduction to MongoDB

Mirko Bonadei

December 13, 2013
Tweet

Other Decks in Technology

Transcript

  1. «a guarantee that every request receives a response about whether

    it was successful or failed» Availability
  2. «the system continues to operate despite arbitrary message loss or

    failure of part of the system» Partitioning
  3. Write Concerns AP CP Unacknowledged (w=0) Acknowledged (w=1) Default Journaled

    (w=1 & journal: true) Replica Acknowledged (w > 1)
  4. db.transfer_in.find({ "created_at": { $gt: ISODate("2013-11-25T11:00:00Z") , $lt: ISODate("2013-11-25T14:00:00Z") }, "business_model"

    : "subscription_activation", "operator" : "ES/Movistar", "seller_id": "4798119" }).explain();
  5. { "cursor" : "BtreeCursor seller_id_1_transaction_id_1", "isMultiKey" : false, "n" :

    44, "nscannedObjects" : 3235639, "nscanned" : 3235639, "nscannedObjectsAllPlans" : 6471278, "nscannedAllPlans" : 6471278, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 16226, "nChunkSkips" : 0, "millis" : 38027, "indexBounds" : { ... }, "server" : " ….:27017" }
  6. db.transfer_in.ensureIndex( { created_at: 1, seller_id: 1, business_model: 1, operator: 1,

    status: 1 }, { background: true, name: “created_seller_bm_operator_status” } )
  7. db.transfer_in.find({ "created_at": { $gt: ISODate("2013-11-25T11:00:00Z") , $lt: ISODate("2013-11-25T14:00:00Z") }, "business_model"

    : "subscription_activation", "operator" : "ES/Movistar", "seller_id": "4798119" }).explain();
  8. { "cursor" : "BtreeCursor created_seller_businessmodel_operator_status", "isMultiKey" : false, "n" :

    44, "nscannedObjects" : 44, "nscanned" : 13542, "nscannedObjectsAllPlans" : 27094, "nscannedAllPlans" : 40592, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 178, "millis" : 219, "indexBounds" : { ... }, "server" : " ….:27017« }
  9. Resources • http://jandiandme.blogspot.de/2013/06/mongodb-and-cap-theorem.html • http://www.infoq.com/articles/cap-twelve-years-later-how-the-rules-have-changed • http://docs.mongodb.org/manual/ • http://edgystuff.tumblr.com/post/54709368492/how-to-speed-up-mongodb-map-reduce-by-20x •

    http://vimeo.com/21515035 (Gabriele Lana @ NoSQL Day 2011 – NoSQL Present, Past and Future) • http://vimeo.com/21586779 (Gabriele Lana @ NoSQL Day 2011 – MongoDB with Style) • http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/ (Sarah Mei wrong way of using MongoDB) • http://www.manning.com/banker/ (MongoDB in Action) • http://aphyr.com/posts/284-call-me-maybe-mongodb (Call me maybe: MongoDB – CP Analysis) • https://blog.serverdensity.com/mongodb-schema-design-pitfalls/ (MongoDB schema design pitfalls) • https://blog.serverdensity.com/does-everyone-hate-mongodb/ (Does everyone hate MongoDB) • http://www.allthingsdistributed.com/2007/12/eventually_consistent.html (AWS CTO) • https://github.com/gabrielelana/mongodb-with-style/tree/master/gol (GOL in Mongo by Gabriele Lana)