MongoDB in Denver: What's New In MongoDB 3.0

35
Let the Tiger Roar! MongoDB 3.0 Bryan Reinero US Developer Advocate [email protected] @blimpyacht

Transcript of MongoDB in Denver: What's New In MongoDB 3.0

Page 1: MongoDB in Denver: What's New In MongoDB 3.0

Let the Tiger Roar!

MongoDB 3.0

Bryan ReineroUS Developer Advocate [email protected]@blimpyacht

Page 2: MongoDB in Denver: What's New In MongoDB 3.0

Agenda

• MongoDB 3.0• Pluggable Storage Engine API• Storage Engines

– MMAPv1– WiredTiger– WT vs MMAPv1

• Improvements

Page 3: MongoDB in Denver: What's New In MongoDB 3.0

MongoDB 3.0

http://www.pixelresort.com/wp-content/uploads/2013/06/3point0.jpg

Page 4: MongoDB in Denver: What's New In MongoDB 3.0

MongoDB 3.0 is a bag full of goodies!

Page 5: MongoDB in Denver: What's New In MongoDB 3.0

Storage Engine

http://files.ecomagination.com/wp-content/uploads/2012/08/PowerHaul-Engine-Green_844x680.jpg

Page 6: MongoDB in Denver: What's New In MongoDB 3.0

How does MongoDB persist data?

• <= MongoDB 2.6– One unique mechanism using Memory Mapped Files– "mmapv1" Storage Engine

• MongoDB 3.0 has a few more options– mmapv1 – default– wiredTiger– (in_memory – experimental only)

Page 7: MongoDB in Denver: What's New In MongoDB 3.0

Pluggable Storage Engine API

http://www.livingincebuforums.com/ipb/uploads/monthly_10_2011/post-198-0-67871200-1318223706.jpg

Page 8: MongoDB in Denver: What's New In MongoDB 3.0

Storage Engine API

• Allows to "plug-in" different storage engines– Different work sets require different performance

characteristics – mmapv1 is not ideal for all workloads– More flexibility

• Can mix storage engines on same replica set/sharded cluster

• Opportunity to integrate further ( HDFS, native encrypted, hardware optimized …)

Page 9: MongoDB in Denver: What's New In MongoDB 3.0

MMAPv1

https://angrytechnician.files.wordpress.com/2009/05/memory.jpg

Page 10: MongoDB in Denver: What's New In MongoDB 3.0

MMAPv1

Page 11: MongoDB in Denver: What's New In MongoDB 3.0

MMAPv1

• Improved concurrency control• Great performance on read-heavy workloads• Data & Indexes memory mapped into virtual

address space

• Data access is paged into RAM

• OS evicts using LRU

• More frequently used pages stay in RAM

Page 12: MongoDB in Denver: What's New In MongoDB 3.0

WiredTiger

Page 13: MongoDB in Denver: What's New In MongoDB 3.0

What is WiredTiger?

• Storage engine company founded by BerkeleyDB alums• Recently acquired by MongoDB• Available as a storage engine option in MongoDB 3.0

Page 14: MongoDB in Denver: What's New In MongoDB 3.0

Why is WiredTiger Awesome

• Document-level concurrency• Disk Compression• Consistency without journaling• Better performance on certain workloads

– write heavy

Page 15: MongoDB in Denver: What's New In MongoDB 3.0

Improving Concurrency

• 2.2 – Global Lock • 2.4 – Database-level Locking• 3.0 MMAPv1 – Collection-level Locking• 3.0 WT – Document-level

– Writes no longer block all other writes– Higher level of concurrency leads to more

CPU usage

Page 16: MongoDB in Denver: What's New In MongoDB 3.0

Compression

• WT uses snappy compression by default• Data is compressed on disk• 2 supported compression algorithms

– snappy: default. Good compression, relatively low overhead

– zlib: Better• Indexes are compressed using prefix

compression– Allows compression in memory

Page 17: MongoDB in Denver: What's New In MongoDB 3.0

Consistency without Journaling

• MMAPv1 uses write-ahead log (journal) to guarantee consistency

• WT doesn't have this need: no in-place updates– Write-ahead log committed at checkpoints

• 2GB or 60sec by default – configurable!– No journal commit interval: writes are written to

journal as they come in– Better for insert-heavy workloads

• Replication guarantees the durability

Page 18: MongoDB in Denver: What's New In MongoDB 3.0

MMAPv1 vs. WT

Page 19: MongoDB in Denver: What's New In MongoDB 3.0

How to run MMAPv1

• MMAPv1 is the default

Page 20: MongoDB in Denver: What's New In MongoDB 3.0

How to run WT

• mongod now has --storageEngine option

Page 21: MongoDB in Denver: What's New In MongoDB 3.0

MMAPv1 Database Files

• MMAPv1 persists data to files per databases – Indexes – Data

Page 22: MongoDB in Denver: What's New In MongoDB 3.0

WT Database Files

• Each collection & indexes stored in own file

Page 23: MongoDB in Denver: What's New In MongoDB 3.0

Playing nice together

• Can not– Can't copy database files– Can't just restart w/ same dbpath

• Yes we can!– Initial sync from replica set works perfectly!– mongodump/restore

• Rolling upgrade of replica set to WT:– Shutdown secondary – Delete dbpath – Relaunch w/ --storageEngine=wiredTiger– Rollover

Page 24: MongoDB in Denver: What's New In MongoDB 3.0

Other WT configuration options

• Compression: --wiredTigerCollectionBlockCompressor

• YAML format for configuration

Page 25: MongoDB in Denver: What's New In MongoDB 3.0

Gotcha's!!!

• No 32-bit Support– WT is 64bit only

• system.indexes & system.namespaces deprecated– Explicit commands: db.getIndexes() db.getCollectionNames()

Page 26: MongoDB in Denver: What's New In MongoDB 3.0

https://tingbudongchine.files.wordpress.com/2012/08/lemonde1.jpeg

Small Demo

Page 27: MongoDB in Denver: What's New In MongoDB 3.0

Improvements

Page 28: MongoDB in Denver: What's New In MongoDB 3.0

Benefits

Page 29: MongoDB in Denver: What's New In MongoDB 3.0

Wider Range of Use Cases

How: Flexible Storage Architecture• Fundamental rearchitecture, with new pluggable storage engine API• Same data model, same query language, same ops• But under the hood, many storage engines optimized for many use

cases

Single View Content Management

Real-Time Analytics Catalog

Internet of Things (IoT)Messaging

Log Data Tick Data

Page 30: MongoDB in Denver: What's New In MongoDB 3.0

Up to 95% Lower Operational Overhead

How: MongoDB Ops Manager• The best way to run MongoDB• Automates core management

tasks• Single-click provisioning, scaling,

upgrades, administration• Monitoring, with charts,

dashboards & alerts on 100+ metrics

• Backup and restore, with point-in-time recovery

Page 31: MongoDB in Denver: What's New In MongoDB 3.0

7x-10x Performance, 50%-80% Less StorageHow: WiredTiger Storage Engine• Same data model, same query

language, same ops• Write performance gains driven

by document-level concurrency control

• Storage savings driven by native compression

• 100% backwards compatible• Non-disruptive upgrade

MongoDB 3.0MongoDB 2.6

Performance

Page 32: MongoDB in Denver: What's New In MongoDB 3.0

http://www.humanandnatural.com/data/media/178/badan_jaran_desert_oasis_china.jpg

Please go and test it!

3.0.1 https://www.mongodb.org/downloadshttps://jira.mongodb.org/secure/Dashboard.jspa

http://www.tinypm.com/blog/wp-content/uploads/2015/01/hammer.jpg

Page 33: MongoDB in Denver: What's New In MongoDB 3.0

http://www.humanandnatural.com/data/media/178/badan_jaran_desert_oasis_china.jpg

Questions?

@[email protected]

Page 34: MongoDB in Denver: What's New In MongoDB 3.0

http://www.mandywalker.com.au/wp-content/uploads/2013/07/Wall-with-Tools.jpg

We are hiring!

http://www.mongodb.com/careers/positions/consulting-engineer-emea

Page 35: MongoDB in Denver: What's New In MongoDB 3.0

Register now: mongodbworld.com

Super Early Bird Ends April 3!Use Code BryanReinero for additional 25% Off

*Come as a group of 3 or more – Save another 25%