• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Mongo db presentation
 

Mongo db presentation

on

  • 1,648 views

 

Statistics

Views

Total Views
1,648
Views on SlideShare
1,648
Embed Views
0

Actions

Likes
0
Downloads
10
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Mongo db presentation Mongo db presentation Presentation Transcript

  • Julie Sommervillejsommerville@businessinsider.com
  • DB1 primary DB3 primary businessinsider bi_analytics 64GB 16GBWeb1 DB2 - Secondary arbiter businessinsider businessinsider port xxxxx arbiter bi_analytics bi_analytics port yyyyyy 32GB 16GB
  • It’s very easy to add a new nodes to a replica setStart the process on the new server: mkdir /data/db mongod --port xxx --dbpath /data/db --replSet setnameAdd the node on the Primary DB rs.add(“[hostname]:port”);
  • Most of the operations we perform on the analytics db are atomic in-place updates : analytics.heatmap.update( { homepage_id:"4ecfb4eefcda248b89000003", uri : "/ron-paul-slams-trump-joins-huntsman-in-sitting-out-circus-like-debate-2011-12" }, { $inc : {views : 1}, $set : {updated_at : {"sec":1329587057,"usec":175000}} }}, true // upsert)
  • Check this
  • Process
  • Example: adding a new field to an objectIn the console> var myObj = {name: julie, role: "developer"}//creates the foo collection and inserts an object> db.foo.save(myObj)> db.foo.find(){ "_id" : ObjectId("4f418251f4dd8d3d88a776ea"), "name" : "julie", "role" : "developer" }// Add a new fieldvar julie = db.foo.findOne(){ "_id" : ObjectId("4f418251f4dd8d3d88a776ea"), "name" : "julie", "role" : "developer"}> julie.last_name = "sommerville> db.foo.save(julie)> db.foo.find().pretty(){ "_id" : ObjectId("4f418251f4dd8d3d88a776ea"), "name" : "julie", "role" : "developer", "last_name" : "sommerville"}(pretty just makes it pretty)
  • Some Examples from our DBPost Object: contains comments, many posts will have way more than a couple of commentsdb.blog.posts.findOne({comments : {$exists:true}, comment_count : {$gte: 1}, ts : {$gte: start}}){ "_id" : ObjectId("4d4798c949e2aef0100d0000"), "attached_images" : [ ], "author" : "Ed Dolan", "author_id" : ObjectId("4d121ca0ccd1d5d337000000"), "autotweet" : false, "badges" : [ ], "browser_title" : null, "categories" : [ ], "cls" : "entry", "comment_count" : 1, "comment_thread_count" : 1, "comments" : [ { "cid" : ObjectId("4d482923cadcbb310a080000"), "ts" : ISODate("2011-02-01T15:39:15.541Z"), "ip" : "113.53.150.3", "author" : "kenhow", "email" : "info@howincorporated.com", "url" : "http://howincorporated.com", "user_id" : ObjectId("4d32fceaccd1d53d7b010000"), "text" : "In other words: nothing to worry about" } ],
  • We also store the Replies to comments : { "author" : "LS", "cid" : ObjectId("4eda72376bb3f72279000009"), "email" : "lawrenceshapiro@gmail.com", "flags" : [ ], "ip" : "74.68.112.217", "rate_down" : 0, "rate_up" : 6, "raters" : { "$ref" : "blog.comments.raters", "$id" : ObjectId("4eda72376bb3f72279000008") }, "replies" : [ { "cid" : ObjectId("4eda800b69beddf55900004f"), "author" : "Skepticus Maximus", "email" : "henry1807@yahoo.com", "flags" : [ ], "ip" : "66.159.194.20", "rate_down" : 0, "rate_up" : 1, "raters" : { "$ref" : "blog.comments.raters", "$id" : ObjectId("4eda800b69beddf55900004e") }, "reply" : ObjectId("4eda72376bb3f72279000009"), "reply_author" : "LS", "text" : "No, its perfectly natural - natures way to make sure the species continues", "ts" : ISODate("2011-12-03T20:01:15.930Z"), "url" : "", "session_id" : ObjectId("4eda76e3eab8ea9f4d00003d") },* Fast retrieval - no joins
  • MMS (MongoDB Monitoring Service)* Really nice stats with the ability to “zoom” in (minute, 5min, hour etc.).* If the data base is acting up you can go in and see where the problem may lie-- Num Collections-- Data Size in the DB and in storage-- Avg. doc size-- Index Sizes-- Replica Set Stats-- page faults-- the lock queue (reads and writes)
  • total number of contiguously allocated chunks of datafile space for the database
  • num commands index access and hits
  • secondary shouldn’t be more than this number hours behind
  • shows slow ops
  • Sharding- Probably on our main database- Help deal with load/num of connections