MongoDB Days Silicon Valley: Introducing MongoDB 3.2

52

Transcript of MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Page 1: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 2: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 3: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Document-Level Concurrency

Page 4: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Document-Level

Concurrency

3.0: Document-Level Concurrency

Page 5: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

0

50,000

100,000

150,000

200,000

250,000

300,000

Load 95/5read/write

50/50read/write

YCSB – Replica Set, Journaling Enabled

MongoDB 2.6 MongoDB 3.0

3.0: Document-Level Concurrency

Page 6: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.0: Document-Level Concurrency

Page 7: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Storage Engine

API

Page 8: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.0: Storage Engine API

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

On Disk DB Size

ENRON Email – Compression Performance

Original MMAPv1 WT - no compression WT - Snappy

Page 9: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.0: Storage Engine API

Page 10: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

One more storage

engine

3.0: Storage Engine API

Page 11: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.0: Storage Engine API

/dev/null

Page 12: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 13: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 14: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Automation

Page 15: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.0: Automation

Complete

Management

Toolkit

Page 16: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.0: Cloud Manager

Page 17: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 18: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 19: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Rules

and

Tools

Page 20: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.2: Rules and Tools

Schemas

Page 21: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

db.allthethings.ensureIndex(

{”thing_id": 1},

{filter: {flags: "good”}}

)

3.2: Rules and Tools

Partial Indexes

Page 22: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

db.runCommand({

collMod: "robots",

validator: {

laws_implemented: {$gte: 3}

}

})

3.2: Rules and Tools

Validation

Page 23: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.2: Rules and Tools

> cursor.next()

{

"first_name" : "Rylee",

"last_name" : "Friesen",

"suffix" : "II"

"email" : {

"work" : "[email protected]"

},

"phone_number" : {

"work" : "(346) 182-8049 x3571"

},

"last_contact" : "Thu May 28 2015 18:21:45 GMT-0400 (EDT)",

number_of_licenses : 5

}

Compass

Page 24: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.2: Rules and Tools

> cursor.next()

{

"first_name" : "Jasen",

"middle_name" : "Joseph",

"last_name" : "Jerde",

"phone_number" : {

"work" : "(901) 161-0043",

"cell" : "(534) 815-4550"

},

number_of_licenses : 1

}

> db.customers.find()

Compass

Page 25: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.2: Rules and Tools

{

"first_name" : "Lavada",

"last_name" : "Padberg",

"email" : {

"work" : "[email protected]"

},

"title" : "National Markets Developer",

"last_contact" : "Fri May 29 2015 13:38:33 GMT-0400 (EDT)",

}

Compass

Page 26: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

{

"first_name" : <string>,

"middle_name" : <string>,

"last_name" : <string>,

"suffix" : <string>,

"title" : <string>,

"phone_number" : {

"work" : <string>,

"cell" : <string>

},

"email" : {

"work" : <string>

}

"last_contact" : <date>,

"number_of_licenses" : <number>

}

Compass

3.2: Rules and Tools

Page 27: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

DEMO

3.2: Rules and Tools

Page 28: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Rules

and

Tools

Page 29: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Join me in

querying

your data

Page 30: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.2: Querying

grep -o "[0-9]\+ms" /var/log/mongodb/output.log |

sort -n | tail -n 20 |

xargs -n 1 -J XXX grep XXX/var/log/mongodb/output.log

Pipelines - unix

Page 31: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

db.logs.find().sort( { time : -1 }).limit(20)

3.2: Querying

Pipelines - MongoDB

Page 32: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

db.users.aggregate(

[

{ $unwind : "$likes" },

{ $group : { _id : "$likes" ,

number : { $sum : 1 } } },

{ $sort : { number : -1 } },

{ $limit : 5 }

]

)

3.2: Querying

Pipelines - MongoDB

Page 33: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Reports!

3.2: Querying

Page 34: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

$stdDevPop

$stdDevSamp

$sumArray

$concatArrays

$arrayElemAt

$slice

$isArray

$filterArray

$avg

$min

$max

$sqrt

$log

$log10

$ln

$pow

$exp

$abs

$round

$trunc

$ceil

$floor

3.2: Querying

Reports!

Page 35: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

“Show me the MongoDB Days

attendees who are active Cloud

Manager users, with MongoDB

hosts that have checked in with

Cloud Manager today, grouped by

MongoDB version.”

3.2: Querying

Reports!

Page 36: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

mdbdays_attendees

{ first : "Eliot", last : "horowitz, email : "[email protected]", zip

: "10024", title : "CTO" }

cloud_users

{ first : "Eliot", last : "horowitz, email : "[email protected]",

groups : [ 12321, 51234 ]}

cloud_hosts

{ hostname: "foo.mongodb.com", group_id : 51234, last_ping : new

ISODate("2015-06-02Z05:42:12"), version : "3.0.3”}

3.2: Querying

Reports! – Example Schema

Page 37: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

versions = {}

db.mdbdays_attendees.find().forEach(function(

user) {

var cloudUser = db.cloud_users.findOne({

email : user.email, active : true }); if

(!cloudUser ) {

return;

}

for (var i=0; i < cloudUser.groups.length;

i++) {

3.2: Querying

Reports! – Uh oh

Page 38: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

db.mdbdays_attendeees.aggregate([

{ $lookup : { "from" : ”cloud_users", on: { email : "$email" }, as:

cloud_user_doc } },

{ $match : { cloud_user_doc.active : true } },

{ $unwind : ”$cloud_user_doc.groups"},

{ $lookup : { "from" : ”cloud_hosts", on: { group_id:

”$cloud_user_doc.groups"}, as: host}}

{ $match : { last_ping : {$gte : new ISODate("2015-06-01Z00:00:00") } } },

{ $group : { _id : "$version", count : { $sum : 1}}}

])

3.2: Querying

Reports!

Page 39: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.2: Querying

DEMO

Page 40: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Join me in

querying

your data

Page 41: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

1 picture >

1.0E3

queries

Page 42: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Data Insights

Page 43: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 44: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

3.2

Encryption at Rest

Config Servers as Replica

Set

In Memory

SE

Raft

Read

Committed

Partial Index

WT as DefaultDoc Validation

General Purpose Auth

Networking Layer

clang-format

L D A P driver handshake

V8 -> SpiderMonkey

Per index stats Read after Optime

dump/restore archiving

Oplog Replication

RefactorBitwise query ops

Read Commited dump/restore compression

“Black Box” data file Journaling Perf in WT Oplog perf

open source evergreen

Data Replication

Refactoring

Collection Sampling

Misc Agg

Page 45: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Rules and Tools Aggregation Data Insights

Summary

Page 46: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Thank You

Page 47: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 48: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 49: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 50: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 51: MongoDB Days Silicon Valley: Introducing MongoDB 3.2
Page 52: MongoDB Days Silicon Valley: Introducing MongoDB 3.2

Thank You