SlideShare uma empresa Scribd logo
1 de 66
Baixar para ler offline
WiredTiger Internals
2
I'm Excited
3
Benefits
4
Performance!
5
Compression in Action
(Flights database, ht Asya)
6
Agenda
Storage Engine API
WiredTiger Architecture
Overall Benefits
http://www.livingincebuforums.com/ipb/uploads/monthly_10_2011/post-198-0-67871200-1318223706.jpg
Pluggable Storage Engine API
8
MongoDB Architecture
Content
Repo
IoT Sensor
Backend
Ad Service
Customer
Analytics
Archive
MongoDB Query Language (MQL) + Native Drivers
MongoDB Document Data Model
MMAP V1 WT In-Memory ? ?
Supported in MongoDB 3.0 Future Possible Storage Engines
Management
Security
Example Future State
Beta
9
Storage Engine API
‱  Allows to "plug-in" different storage engines
–  Different use cases 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 
)
Storage Engines
2 Storage Engines Available

 and more in the making!
MMAPv1 WiredTiger
12
MongoDB Architecture
Content
Repo
IoT Sensor
Backend
Ad Service
Customer
Analytics
Archive
MongoDB Query Language (MQL) + Native Drivers
MongoDB Document Data Model
MMAP V1 WT In-Memory ? ?
Supported in MongoDB 3.0 Future Possible Storage Engines
Management
Security
Example Future State
Beta
MMAPv1
https://angrytechnician.files.wordpress.com/2009/05/memory.jpg
14
MMAPv1
15
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
3.0 Default
http://cdn.theatlantic.com/static/infocus/ngt051713/n10_00203194.jpg
WiredTiger
mongod --storageEngine wiredTiger
18
What is WiredTiger?
‱  Storage engine company founded by BerkeleyDB alums
‱  Recently acquired by MongoDB
‱  Available as a storage engine option in MongoDB 3.0
19
Motivation for WiredTiger
‱  Take advantage of modern hardware:
–  many CPU cores
–  lots of RAM
‱  Minimize contention between threads
–  lock-free algorithms, e.g., hazard pointers
–  eliminate blocking due to concurrency control
‱  Hotter cache and more work per I/O
–  compact file formats
–  compression
WiredTiger Architecture
WiredTiger Architecture
WiredTiger Engine
Schema &
Cursors
Python API C API Java API
Database
Files
Transactions
Page
read/write
Logging
Column
storage
Block
management
Row
storage
Snapshots
Log Files
Cache
WiredTiger Sessions
Document Data Model
WiredTiger Engine
Transactions
Snapshosts
Page
read/write
WAL
Cache
Schema &
Cursors
Row
Storage
Block
Management
DB Files Journal
Your App
Driver
connection (mongod)
Session
Cursor
Session
Session
Cursor
Cursor
WiredTiger Sessions
Document Data Model
WiredTiger Engine
Transactions
Snapshosts
Page
read/write
WAL
Cache
Schema &
Cursors
Row
Storage
Block
Management
DB Files Journal
Your App
Driver
‱  3 main purposes
‱  Schema Operations
‱  Transaction Management
‱  Cursor Creation
WiredTiger Schema & Cursors
Document Data Model
WiredTiger Engine
Transactions
Snapshosts
Page
read/write
WAL
Cache
Schema &
Cursors
Row
Storage
Block
Management
DB Files Journal
db.createCollection("somecollection")
db.somecollection.drop()
db.somecollection.find({...})
db.somecollection.remove({_id:111})
db.somecollection.stats()
db.somecollection.explain().find({_id:111})
WiredTiger Schema & Cursors
Document Data Model
WiredTiger Engine
Transactions
Snapshosts
Page
read/write
Logging
Cache
Schema &
Cursors
Row
Storage
Block
Management
DB Files Log Files
‱  Schema Operations
‱  create, drop, truncate, verify 

‱  Cursors
‱  CRUD
‱  Data iteration
‱  Statistics
Collection
WiredTiger Transactions
Document Data Model
WiredTiger Engine
Transactions
Snapshosts
Page
read/write
WAL
Cache
Schema &
Cursors
Row
Storage
Block
Management
DB Files Journal
COMMAND INSERT
{
"_id": 111,
"name": "Spock",
"message": "Live Long and Prosper!"
}
Index
{_id: 1}
Index
{name: 1}
Index
{message: "text"}
WiredTiger Transactions
Document Data Model
WiredTiger Engine
Transactions
Snapshosts
Page
read/write
WAL
Cache
Schema &
Cursors
Row
Storage
Block
Management
DB Files Journal
‱  Transaction per Session
close, open, commit, rollback
‱  Ensures the atomicity/consistency of
MongoDB operations
‱  Updates / Writes documents
‱  Updates indexes
This is not multi-document
transaction support!
In-memory Performance
Traditional B+tree (ht wikipedia)
Trees in cache
non-resident
child
ordinary pointer
root page
internal
page
internal
page
root page
leaf page
leaf page leaf page leaf page
Cache
Page in Disk
root page
leaf page
Disk
Page not in
memory
File Read
Cache
Page in Memory
root page
Internal Page
Internal Page
Internal Page
Internal Page
Leaf Page Leaf Page Leaf Page Leaf Page
Traditional B-tree
root page
Internal Page
Internal Page
Internal Page
Internal Page
Leaf Page Leaf Page Leaf Page Leaf Page
Deadlock Avoidance
root page
Internal Page
Internal Page
Internal Page
Internal Page
Leaf Page Leaf Page Leaf Page Leaf Page
Cache
Page in Memory
root page
Internal Page
Internal Page
Internal Page
Internal Page
Leaf Page Leaf Page Leaf Page Leaf Page
Doc1Doc0 Doc5Doc2 Doc3 Doc4
Writer
Reader
Standard
pointers
between
tree levels
instead of
traditional
files system
offset
pointers
Page in Cache
Disk
Page images
Page images
Page images
on-disk Page
Image
index
Update
on-disk Page
Image
index
Updates
db.collection.insert( {"_id": 123})
Clean
Page
Dirty
Page
Eviction
Thread
Page in Cache
Disk
Page images
Page images
Page images
on-disk Page
Image
index
Update
on-disk Page
Image
index
Updates
db.collection.insert( {"_id": 123})
Clean
Page
Dirty
Page
Index is build
during read
Page in Cache
Disk
Page images
Page images
Page images
on-disk Page
Image
index
Updates'
db.collection.insert( {"_id": 123})
Dirty
Page
Updates are
held in a skip
list Updates''
db.collection.insert( {"_id": 125})
Updates'''
db.collection.insert( {"_id": 124})
Time
Reconciliation
Disk
Page images
Page images
Page images
on-disk Page
Image
index
Updates'
Dirty
Page
Eviction
Thread
Updates''
Updates'''
Reconciliation
Cache full
After X operations
On a checkpoint
40
In-memory performance
‱  Trees in cache are optimized for in-memory access
‱  Follow pointers to traverse a tree
– no locking to access pages in cache
‱  Keep updates separate from clean data
‱  Do structural changes (eviction, splits) in background threads
41
Takeaways
‱  Page and tree access is optimized
‱  Allows concurrent operations – updates skip lists
‱  Tuning options that you should be aware of:
–  storage.wiredTiger.engineConfig.cacheSizeGB
‱  You can determine the space allocated for your cache
‱  Makes your deployment and sizing more predictable
https://docs.mongodb.org/manual/reference/configuration-options/#storage.wiredTiger.engineConfig.cacheSizeGB
Wiredtiger cache! MongoDB
uses more memory than just
the Storage Engine needs!
Document-level Concurrency
43
What is Concurrency Control?
‱  Computers have
– multiple CPU cores
– multiple I/O paths
‱  To make the most of the hardware, software has to execute
multiple operations in parallel
‱  Concurrency control has to keep data consistent
‱  Common approaches:
– locking
– keeping multiple versions of data (MVCC)
MVCC
on-disk Page
Image
index
WRITE B txn(1)
Updates'''Updates'
WRITE A txn(2)
Updates''
Time
WRITE A txn(3)
Conflict
Detection!
45
Multiversion Concurrency Control (MVCC)
‱  Multiple versions of records kept in cache
‱  Readers see the committed version before the transaction started
– MongoDB “yields” turn large operations into small transactions
‱  Writers can create new versions concurrent with readers
‱  Concurrent updates to a single record cause write conflicts
– MongoDB retries with back-off
MVCC
on-disk Page
Image
index
Updates'
WRITE B txn(1)
Updates''
Updates'''
WRITE A txn(2)
Time
WRITE A
txn(3)
READ A
Compression
48
WiredTiger Page IO
Document Data Model
WiredTiger Engine
Transactions
Snapshosts
Page
read/write
WAL
Cache
Schema &
Cursors
Row
Storage
Block
Management
DB Files Journal
on-disk Page
Image
index
Updates'''
Disk
Page
Reconciliation
Page Allocation
Splitting
49
WiredTiger Page IO
Document Data Model
WiredTiger Engine
Transactions
Snapshosts
Page
read/write
WAL
Cache
Schema &
Cursors
Row
Storage
Block
Management
DB Files Journal
on-disk Page
Image
index
Updates'''
Disk
Page'
Reconciliation
Page Allocation
Splitting
Page''
50
WiredTiger Page IO
Document Data Model
WiredTiger Engine
Transactions
Snapshosts
Page
read/write
WAL
Cache
Schema &
Cursors
Row
Storage
Block
Management
DB Files Journal
on-disk Page
Image
index
Updates'''
Disk
Reconciliation
Page Allocation
Splitting
Page
Compression
-  snappy (default)
-  zlib
-  none
51
Compression
‱  WiredTiger uses snappy compression by default in MongoDB
‱  Supported compression algorithms:
–  snappy [default]: good compression, low overhead
–  zlib: better compression, more CPU
–  none
‱  Indexes also use prefix compression
–  stays compressed in memory
52
Checksums
‱  A checksum is stored with every uncompressed page
‱  Checksums are validated during page read
–  detects filesystem corruption, random bitflips
‱  WiredTiger stores the checksum with the page address (typically
in a parent page)
–  extra safety against reading a stale page image
53
Compression in Action
(Flights database, ht Asya)
54
Takeaway
‱  Main feature that impacts the vast majority of MongoDB projects / use cases
‱  CPU bound
‱  Different algorithms for different workloads
–  Collection level compression tuning
‱  Smaller Data Faster IO
–  Not only improves the disk space footprint
–  also IO
–  and index traversing
Other Gems of WiredTiger
56
Index per Directory
‱  Use different drives for collections and indexes
–  Parallelization of write operations
–  MMAPv1 only allows directoryPerDatabase
mongod
Collection A
Index
"name
"
Collection B
Index
"_id"
57
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 and with j:true
–  Better for insert-heavy workloads
–  By default journaling is enabled!
‱  Replication guarantees the durability
What's Next
59
60
What’s next for WiredTiger?
‱  Tune for (many) more workloads
– avoid stalls during checkpoints with 100GB+ caches
– make capped collections (including oplog) more efficient
‱  Adding encryption
‱  More advanced transactional semantics in the storage engine API
61
Updates and Upgrades
‱  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
–  Wait for resync
–  Rollover
https://tingbudongchine.files.wordpress.com/2012/08/lemonde1.jpeg
Summary
63
MongoDB 3.0
‱  Pluggable Storage Engine API
‱  Storage Engines
‱  Large Replica Sets
‱  Big Polygon
‱  Security Enhancements – SCRAM
‱  Audit Trail
‱  Simplified Operations – Ops Manager
‱  Tools Rewrite
64
3.2 is coming!
65
Performance!
http://www.mongodb.com/lp/white-paper/benchmark-report
http://cl.jroo.me/z3/v/D/C/e/a.baa-Too-many-bicycles-on-the-van.jpg
Norberto Leite
Technical Evangelist
norberto@mongodb.com
@nleite
Obrigado!

Mais conteĂșdo relacionado

Mais procurados

Top 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsTop 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsSpark Summit
 
MongoDB Internals
MongoDB InternalsMongoDB Internals
MongoDB InternalsSiraj Memon
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.Taras Matyashovsky
 
MongoDB at Baidu
MongoDB at BaiduMongoDB at Baidu
MongoDB at BaiduMat Keep
 
MongoDB Fundamentals
MongoDB FundamentalsMongoDB Fundamentals
MongoDB FundamentalsMongoDB
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcachedJurriaan Persyn
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLMorgan Tocker
 
InnoDB MVCC Architecture (by 권걎우)
InnoDB MVCC Architecture (by 권걎우)InnoDB MVCC Architecture (by 권걎우)
InnoDB MVCC Architecture (by 권걎우)I Goo Lee.
 
Materialized Views and Secondary Indexes in Scylla: They Are finally here!
Materialized Views and Secondary Indexes in Scylla: They Are finally here!Materialized Views and Secondary Indexes in Scylla: They Are finally here!
Materialized Views and Secondary Indexes in Scylla: They Are finally here!ScyllaDB
 
Sizing Your MongoDB Cluster
Sizing Your MongoDB ClusterSizing Your MongoDB Cluster
Sizing Your MongoDB ClusterMongoDB
 
Hybrid MongoDB and RDBMS Applications
Hybrid MongoDB and RDBMS ApplicationsHybrid MongoDB and RDBMS Applications
Hybrid MongoDB and RDBMS ApplicationsSteven Francia
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & FeaturesDataStax Academy
 
RocksDB compaction
RocksDB compactionRocksDB compaction
RocksDB compactionMIJIN AN
 
High Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance TuningHigh Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance TuningAlbert Chen
 
RocksDB Performance and Reliability Practices
RocksDB Performance and Reliability PracticesRocksDB Performance and Reliability Practices
RocksDB Performance and Reliability PracticesYoshinori Matsunobu
 
Modeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQLModeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQLScyllaDB
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeperSaurav Haloi
 
Inside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseMike Dirolf
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDBMongoDB
 

Mais procurados (20)

Top 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsTop 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark Applications
 
MongoDB Internals
MongoDB InternalsMongoDB Internals
MongoDB Internals
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.
 
MongoDB at Baidu
MongoDB at BaiduMongoDB at Baidu
MongoDB at Baidu
 
MongoDB Fundamentals
MongoDB FundamentalsMongoDB Fundamentals
MongoDB Fundamentals
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQL
 
InnoDB MVCC Architecture (by 권걎우)
InnoDB MVCC Architecture (by 권걎우)InnoDB MVCC Architecture (by 권걎우)
InnoDB MVCC Architecture (by 권걎우)
 
Materialized Views and Secondary Indexes in Scylla: They Are finally here!
Materialized Views and Secondary Indexes in Scylla: They Are finally here!Materialized Views and Secondary Indexes in Scylla: They Are finally here!
Materialized Views and Secondary Indexes in Scylla: They Are finally here!
 
Sizing Your MongoDB Cluster
Sizing Your MongoDB ClusterSizing Your MongoDB Cluster
Sizing Your MongoDB Cluster
 
Hybrid MongoDB and RDBMS Applications
Hybrid MongoDB and RDBMS ApplicationsHybrid MongoDB and RDBMS Applications
Hybrid MongoDB and RDBMS Applications
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
 
RocksDB compaction
RocksDB compactionRocksDB compaction
RocksDB compaction
 
High Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance TuningHigh Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance Tuning
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 
RocksDB Performance and Reliability Practices
RocksDB Performance and Reliability PracticesRocksDB Performance and Reliability Practices
RocksDB Performance and Reliability Practices
 
Modeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQLModeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQL
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
 
Inside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source Database
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
 

Semelhante a MongoDB WiredTiger Internals

WiredTiger & What's New in 3.0
WiredTiger & What's New in 3.0WiredTiger & What's New in 3.0
WiredTiger & What's New in 3.0MongoDB
 
MongoDB Evenings DC: Get MEAN and Lean with Docker and Kubernetes
MongoDB Evenings DC: Get MEAN and Lean with Docker and KubernetesMongoDB Evenings DC: Get MEAN and Lean with Docker and Kubernetes
MongoDB Evenings DC: Get MEAN and Lean with Docker and KubernetesMongoDB
 
Dynamodb Presentation
Dynamodb PresentationDynamodb Presentation
Dynamodb Presentationadvaitdeo
 
Configuring workload-based storage and topologies
Configuring workload-based storage and topologiesConfiguring workload-based storage and topologies
Configuring workload-based storage and topologiesMariaDB plc
 
Azure: Lessons From The Field
Azure: Lessons From The FieldAzure: Lessons From The Field
Azure: Lessons From The FieldRob Gillen
 
A Technical Deep Dive on Protecting Acropolis Workloads with Rubrik
A Technical Deep Dive on Protecting Acropolis Workloads with RubrikA Technical Deep Dive on Protecting Acropolis Workloads with Rubrik
A Technical Deep Dive on Protecting Acropolis Workloads with RubrikNEXTtour
 
Improving web site performance and scalability while saving
Improving web site performance and scalability while savingImproving web site performance and scalability while saving
Improving web site performance and scalability while savingmdc11
 
MongoDB World 2016: Get MEAN and Lean with MongoDB and Kubernetes
MongoDB World 2016: Get MEAN and Lean with MongoDB and KubernetesMongoDB World 2016: Get MEAN and Lean with MongoDB and Kubernetes
MongoDB World 2016: Get MEAN and Lean with MongoDB and KubernetesMongoDB
 
Sharepoint Performance - part 2
Sharepoint Performance - part 2Sharepoint Performance - part 2
Sharepoint Performance - part 2Regroove
 
Bquery Reporting & Analytics Architecture
Bquery Reporting & Analytics ArchitectureBquery Reporting & Analytics Architecture
Bquery Reporting & Analytics ArchitectureCarst Vaartjes
 
Using MongoDB to Build a Fast and Scalable Content Repository
Using MongoDB to Build a Fast and Scalable Content RepositoryUsing MongoDB to Build a Fast and Scalable Content Repository
Using MongoDB to Build a Fast and Scalable Content RepositoryMongoDB
 
Dynamo DB & RDS Deep Dive - AWS India Summit 2012
Dynamo DB & RDS Deep Dive - AWS India Summit 2012Dynamo DB & RDS Deep Dive - AWS India Summit 2012
Dynamo DB & RDS Deep Dive - AWS India Summit 2012Amazon Web Services
 
thinking in key value stores
thinking in key value storesthinking in key value stores
thinking in key value storesBhasker Kode
 
Top 8 WCM Trends 2010
Top 8 WCM Trends 2010Top 8 WCM Trends 2010
Top 8 WCM Trends 2010David Nuescheler
 
TechEd NZ 2014: Azure and Sharepoint
TechEd NZ 2014: Azure and SharepointTechEd NZ 2014: Azure and Sharepoint
TechEd NZ 2014: Azure and SharepointIntergen
 
01 - Web Programming Intro.pptx
01 - Web Programming Intro.pptx01 - Web Programming Intro.pptx
01 - Web Programming Intro.pptxKarina GonzĂĄlez
 
MongoDB 3.4 webinar
MongoDB 3.4 webinarMongoDB 3.4 webinar
MongoDB 3.4 webinarAndrew Morgan
 
Silverlight Development & The Model-View-ViewModel Pattern
Silverlight Development & The Model-View-ViewModel PatternSilverlight Development & The Model-View-ViewModel Pattern
Silverlight Development & The Model-View-ViewModel PatternDerek Novavi
 

Semelhante a MongoDB WiredTiger Internals (20)

WiredTiger & What's New in 3.0
WiredTiger & What's New in 3.0WiredTiger & What's New in 3.0
WiredTiger & What's New in 3.0
 
MongoDB Evenings DC: Get MEAN and Lean with Docker and Kubernetes
MongoDB Evenings DC: Get MEAN and Lean with Docker and KubernetesMongoDB Evenings DC: Get MEAN and Lean with Docker and Kubernetes
MongoDB Evenings DC: Get MEAN and Lean with Docker and Kubernetes
 
Dynamodb Presentation
Dynamodb PresentationDynamodb Presentation
Dynamodb Presentation
 
Configuring workload-based storage and topologies
Configuring workload-based storage and topologiesConfiguring workload-based storage and topologies
Configuring workload-based storage and topologies
 
Azure: Lessons From The Field
Azure: Lessons From The FieldAzure: Lessons From The Field
Azure: Lessons From The Field
 
A Technical Deep Dive on Protecting Acropolis Workloads with Rubrik
A Technical Deep Dive on Protecting Acropolis Workloads with RubrikA Technical Deep Dive on Protecting Acropolis Workloads with Rubrik
A Technical Deep Dive on Protecting Acropolis Workloads with Rubrik
 
Improving web site performance and scalability while saving
Improving web site performance and scalability while savingImproving web site performance and scalability while saving
Improving web site performance and scalability while saving
 
MongoDB World 2016: Get MEAN and Lean with MongoDB and Kubernetes
MongoDB World 2016: Get MEAN and Lean with MongoDB and KubernetesMongoDB World 2016: Get MEAN and Lean with MongoDB and Kubernetes
MongoDB World 2016: Get MEAN and Lean with MongoDB and Kubernetes
 
Sharepoint Performance - part 2
Sharepoint Performance - part 2Sharepoint Performance - part 2
Sharepoint Performance - part 2
 
Rdbms
Rdbms Rdbms
Rdbms
 
Bquery Reporting & Analytics Architecture
Bquery Reporting & Analytics ArchitectureBquery Reporting & Analytics Architecture
Bquery Reporting & Analytics Architecture
 
AWS Analytics
AWS AnalyticsAWS Analytics
AWS Analytics
 
Using MongoDB to Build a Fast and Scalable Content Repository
Using MongoDB to Build a Fast and Scalable Content RepositoryUsing MongoDB to Build a Fast and Scalable Content Repository
Using MongoDB to Build a Fast and Scalable Content Repository
 
Dynamo DB & RDS Deep Dive - AWS India Summit 2012
Dynamo DB & RDS Deep Dive - AWS India Summit 2012Dynamo DB & RDS Deep Dive - AWS India Summit 2012
Dynamo DB & RDS Deep Dive - AWS India Summit 2012
 
thinking in key value stores
thinking in key value storesthinking in key value stores
thinking in key value stores
 
Top 8 WCM Trends 2010
Top 8 WCM Trends 2010Top 8 WCM Trends 2010
Top 8 WCM Trends 2010
 
TechEd NZ 2014: Azure and Sharepoint
TechEd NZ 2014: Azure and SharepointTechEd NZ 2014: Azure and Sharepoint
TechEd NZ 2014: Azure and Sharepoint
 
01 - Web Programming Intro.pptx
01 - Web Programming Intro.pptx01 - Web Programming Intro.pptx
01 - Web Programming Intro.pptx
 
MongoDB 3.4 webinar
MongoDB 3.4 webinarMongoDB 3.4 webinar
MongoDB 3.4 webinar
 
Silverlight Development & The Model-View-ViewModel Pattern
Silverlight Development & The Model-View-ViewModel PatternSilverlight Development & The Model-View-ViewModel Pattern
Silverlight Development & The Model-View-ViewModel Pattern
 

Mais de Norberto Leite

Data Modelling for MongoDB - MongoDB.local Tel Aviv
Data Modelling for MongoDB - MongoDB.local Tel AvivData Modelling for MongoDB - MongoDB.local Tel Aviv
Data Modelling for MongoDB - MongoDB.local Tel AvivNorberto Leite
 
Avoid Query Pitfalls
Avoid Query PitfallsAvoid Query Pitfalls
Avoid Query PitfallsNorberto Leite
 
MongoDB and Spark
MongoDB and SparkMongoDB and Spark
MongoDB and SparkNorberto Leite
 
Mongo db 3.4 Overview
Mongo db 3.4 OverviewMongo db 3.4 Overview
Mongo db 3.4 OverviewNorberto Leite
 
MongoDB Certification Study Group - May 2016
MongoDB Certification Study Group - May 2016MongoDB Certification Study Group - May 2016
MongoDB Certification Study Group - May 2016Norberto Leite
 
Geospatial and MongoDB
Geospatial and MongoDBGeospatial and MongoDB
Geospatial and MongoDBNorberto Leite
 
MongodB Internals
MongodB InternalsMongodB Internals
MongodB InternalsNorberto Leite
 
MongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewMongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewNorberto Leite
 
MongoDB on Azure
MongoDB on AzureMongoDB on Azure
MongoDB on AzureNorberto Leite
 
MongoDB: Agile Combustion Engine
MongoDB: Agile Combustion EngineMongoDB: Agile Combustion Engine
MongoDB: Agile Combustion EngineNorberto Leite
 
MongoDB Capacity Planning
MongoDB Capacity PlanningMongoDB Capacity Planning
MongoDB Capacity PlanningNorberto Leite
 
Spark and MongoDB
Spark and MongoDBSpark and MongoDB
Spark and MongoDBNorberto Leite
 
Analyse Yourself
Analyse YourselfAnalyse Yourself
Analyse YourselfNorberto Leite
 
Python and MongoDB
Python and MongoDB Python and MongoDB
Python and MongoDB Norberto Leite
 
Strongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible SchemasStrongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible SchemasNorberto Leite
 
Effectively Deploying MongoDB on AEM
Effectively Deploying MongoDB on AEMEffectively Deploying MongoDB on AEM
Effectively Deploying MongoDB on AEMNorberto Leite
 
Advanced applications with MongoDB
Advanced applications with MongoDBAdvanced applications with MongoDB
Advanced applications with MongoDBNorberto Leite
 
MongoDB and Node.js
MongoDB and Node.jsMongoDB and Node.js
MongoDB and Node.jsNorberto Leite
 
MongoDB + Spring
MongoDB + SpringMongoDB + Spring
MongoDB + SpringNorberto Leite
 

Mais de Norberto Leite (20)

Data Modelling for MongoDB - MongoDB.local Tel Aviv
Data Modelling for MongoDB - MongoDB.local Tel AvivData Modelling for MongoDB - MongoDB.local Tel Aviv
Data Modelling for MongoDB - MongoDB.local Tel Aviv
 
Avoid Query Pitfalls
Avoid Query PitfallsAvoid Query Pitfalls
Avoid Query Pitfalls
 
MongoDB and Spark
MongoDB and SparkMongoDB and Spark
MongoDB and Spark
 
Mongo db 3.4 Overview
Mongo db 3.4 OverviewMongo db 3.4 Overview
Mongo db 3.4 Overview
 
MongoDB Certification Study Group - May 2016
MongoDB Certification Study Group - May 2016MongoDB Certification Study Group - May 2016
MongoDB Certification Study Group - May 2016
 
Geospatial and MongoDB
Geospatial and MongoDBGeospatial and MongoDB
Geospatial and MongoDB
 
MongodB Internals
MongodB InternalsMongodB Internals
MongodB Internals
 
MongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewMongoDB 3.2 Feature Preview
MongoDB 3.2 Feature Preview
 
Mongodb Spring
Mongodb SpringMongodb Spring
Mongodb Spring
 
MongoDB on Azure
MongoDB on AzureMongoDB on Azure
MongoDB on Azure
 
MongoDB: Agile Combustion Engine
MongoDB: Agile Combustion EngineMongoDB: Agile Combustion Engine
MongoDB: Agile Combustion Engine
 
MongoDB Capacity Planning
MongoDB Capacity PlanningMongoDB Capacity Planning
MongoDB Capacity Planning
 
Spark and MongoDB
Spark and MongoDBSpark and MongoDB
Spark and MongoDB
 
Analyse Yourself
Analyse YourselfAnalyse Yourself
Analyse Yourself
 
Python and MongoDB
Python and MongoDB Python and MongoDB
Python and MongoDB
 
Strongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible SchemasStrongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible Schemas
 
Effectively Deploying MongoDB on AEM
Effectively Deploying MongoDB on AEMEffectively Deploying MongoDB on AEM
Effectively Deploying MongoDB on AEM
 
Advanced applications with MongoDB
Advanced applications with MongoDBAdvanced applications with MongoDB
Advanced applications with MongoDB
 
MongoDB and Node.js
MongoDB and Node.jsMongoDB and Node.js
MongoDB and Node.js
 
MongoDB + Spring
MongoDB + SpringMongoDB + Spring
MongoDB + Spring
 

Último

Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 

Último (20)

Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 

MongoDB WiredTiger Internals

  • 5. 5 Compression in Action (Flights database, ht Asya)
  • 6. 6 Agenda Storage Engine API WiredTiger Architecture Overall Benefits
  • 8. 8 MongoDB Architecture Content Repo IoT Sensor Backend Ad Service Customer Analytics Archive MongoDB Query Language (MQL) + Native Drivers MongoDB Document Data Model MMAP V1 WT In-Memory ? ? Supported in MongoDB 3.0 Future Possible Storage Engines Management Security Example Future State Beta
  • 9. 9 Storage Engine API ‱  Allows to "plug-in" different storage engines –  Different use cases 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 
)
  • 11. 2 Storage Engines Available 
 and more in the making! MMAPv1 WiredTiger
  • 12. 12 MongoDB Architecture Content Repo IoT Sensor Backend Ad Service Customer Analytics Archive MongoDB Query Language (MQL) + Native Drivers MongoDB Document Data Model MMAP V1 WT In-Memory ? ? Supported in MongoDB 3.0 Future Possible Storage Engines Management Security Example Future State Beta
  • 15. 15 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 3.0 Default
  • 18. 18 What is WiredTiger? ‱  Storage engine company founded by BerkeleyDB alums ‱  Recently acquired by MongoDB ‱  Available as a storage engine option in MongoDB 3.0
  • 19. 19 Motivation for WiredTiger ‱  Take advantage of modern hardware: –  many CPU cores –  lots of RAM ‱  Minimize contention between threads –  lock-free algorithms, e.g., hazard pointers –  eliminate blocking due to concurrency control ‱  Hotter cache and more work per I/O –  compact file formats –  compression
  • 21. WiredTiger Architecture WiredTiger Engine Schema & Cursors Python API C API Java API Database Files Transactions Page read/write Logging Column storage Block management Row storage Snapshots Log Files Cache
  • 22. WiredTiger Sessions Document Data Model WiredTiger Engine Transactions Snapshosts Page read/write WAL Cache Schema & Cursors Row Storage Block Management DB Files Journal Your App Driver connection (mongod) Session Cursor Session Session Cursor Cursor
  • 23. WiredTiger Sessions Document Data Model WiredTiger Engine Transactions Snapshosts Page read/write WAL Cache Schema & Cursors Row Storage Block Management DB Files Journal Your App Driver ‱  3 main purposes ‱  Schema Operations ‱  Transaction Management ‱  Cursor Creation
  • 24. WiredTiger Schema & Cursors Document Data Model WiredTiger Engine Transactions Snapshosts Page read/write WAL Cache Schema & Cursors Row Storage Block Management DB Files Journal db.createCollection("somecollection") db.somecollection.drop() db.somecollection.find({...}) db.somecollection.remove({_id:111}) db.somecollection.stats() db.somecollection.explain().find({_id:111})
  • 25. WiredTiger Schema & Cursors Document Data Model WiredTiger Engine Transactions Snapshosts Page read/write Logging Cache Schema & Cursors Row Storage Block Management DB Files Log Files ‱  Schema Operations ‱  create, drop, truncate, verify 
 ‱  Cursors ‱  CRUD ‱  Data iteration ‱  Statistics
  • 26. Collection WiredTiger Transactions Document Data Model WiredTiger Engine Transactions Snapshosts Page read/write WAL Cache Schema & Cursors Row Storage Block Management DB Files Journal COMMAND INSERT { "_id": 111, "name": "Spock", "message": "Live Long and Prosper!" } Index {_id: 1} Index {name: 1} Index {message: "text"}
  • 27. WiredTiger Transactions Document Data Model WiredTiger Engine Transactions Snapshosts Page read/write WAL Cache Schema & Cursors Row Storage Block Management DB Files Journal ‱  Transaction per Session close, open, commit, rollback ‱  Ensures the atomicity/consistency of MongoDB operations ‱  Updates / Writes documents ‱  Updates indexes This is not multi-document transaction support!
  • 30. Trees in cache non-resident child ordinary pointer root page internal page internal page root page leaf page leaf page leaf page leaf page
  • 31. Cache Page in Disk root page leaf page Disk Page not in memory File Read
  • 32. Cache Page in Memory root page Internal Page Internal Page Internal Page Internal Page Leaf Page Leaf Page Leaf Page Leaf Page
  • 33. Traditional B-tree root page Internal Page Internal Page Internal Page Internal Page Leaf Page Leaf Page Leaf Page Leaf Page
  • 34. Deadlock Avoidance root page Internal Page Internal Page Internal Page Internal Page Leaf Page Leaf Page Leaf Page Leaf Page
  • 35. Cache Page in Memory root page Internal Page Internal Page Internal Page Internal Page Leaf Page Leaf Page Leaf Page Leaf Page Doc1Doc0 Doc5Doc2 Doc3 Doc4 Writer Reader Standard pointers between tree levels instead of traditional files system offset pointers
  • 36. Page in Cache Disk Page images Page images Page images on-disk Page Image index Update on-disk Page Image index Updates db.collection.insert( {"_id": 123}) Clean Page Dirty Page Eviction Thread
  • 37. Page in Cache Disk Page images Page images Page images on-disk Page Image index Update on-disk Page Image index Updates db.collection.insert( {"_id": 123}) Clean Page Dirty Page Index is build during read
  • 38. Page in Cache Disk Page images Page images Page images on-disk Page Image index Updates' db.collection.insert( {"_id": 123}) Dirty Page Updates are held in a skip list Updates'' db.collection.insert( {"_id": 125}) Updates''' db.collection.insert( {"_id": 124}) Time
  • 39. Reconciliation Disk Page images Page images Page images on-disk Page Image index Updates' Dirty Page Eviction Thread Updates'' Updates''' Reconciliation Cache full After X operations On a checkpoint
  • 40. 40 In-memory performance ‱  Trees in cache are optimized for in-memory access ‱  Follow pointers to traverse a tree – no locking to access pages in cache ‱  Keep updates separate from clean data ‱  Do structural changes (eviction, splits) in background threads
  • 41. 41 Takeaways ‱  Page and tree access is optimized ‱  Allows concurrent operations – updates skip lists ‱  Tuning options that you should be aware of: –  storage.wiredTiger.engineConfig.cacheSizeGB ‱  You can determine the space allocated for your cache ‱  Makes your deployment and sizing more predictable https://docs.mongodb.org/manual/reference/configuration-options/#storage.wiredTiger.engineConfig.cacheSizeGB Wiredtiger cache! MongoDB uses more memory than just the Storage Engine needs!
  • 43. 43 What is Concurrency Control? ‱  Computers have – multiple CPU cores – multiple I/O paths ‱  To make the most of the hardware, software has to execute multiple operations in parallel ‱  Concurrency control has to keep data consistent ‱  Common approaches: – locking – keeping multiple versions of data (MVCC)
  • 44. MVCC on-disk Page Image index WRITE B txn(1) Updates'''Updates' WRITE A txn(2) Updates'' Time WRITE A txn(3) Conflict Detection!
  • 45. 45 Multiversion Concurrency Control (MVCC) ‱  Multiple versions of records kept in cache ‱  Readers see the committed version before the transaction started – MongoDB “yields” turn large operations into small transactions ‱  Writers can create new versions concurrent with readers ‱  Concurrent updates to a single record cause write conflicts – MongoDB retries with back-off
  • 46. MVCC on-disk Page Image index Updates' WRITE B txn(1) Updates'' Updates''' WRITE A txn(2) Time WRITE A txn(3) READ A
  • 48. 48 WiredTiger Page IO Document Data Model WiredTiger Engine Transactions Snapshosts Page read/write WAL Cache Schema & Cursors Row Storage Block Management DB Files Journal on-disk Page Image index Updates''' Disk Page Reconciliation Page Allocation Splitting
  • 49. 49 WiredTiger Page IO Document Data Model WiredTiger Engine Transactions Snapshosts Page read/write WAL Cache Schema & Cursors Row Storage Block Management DB Files Journal on-disk Page Image index Updates''' Disk Page' Reconciliation Page Allocation Splitting Page''
  • 50. 50 WiredTiger Page IO Document Data Model WiredTiger Engine Transactions Snapshosts Page read/write WAL Cache Schema & Cursors Row Storage Block Management DB Files Journal on-disk Page Image index Updates''' Disk Reconciliation Page Allocation Splitting Page Compression -  snappy (default) -  zlib -  none
  • 51. 51 Compression ‱  WiredTiger uses snappy compression by default in MongoDB ‱  Supported compression algorithms: –  snappy [default]: good compression, low overhead –  zlib: better compression, more CPU –  none ‱  Indexes also use prefix compression –  stays compressed in memory
  • 52. 52 Checksums ‱  A checksum is stored with every uncompressed page ‱  Checksums are validated during page read –  detects filesystem corruption, random bitflips ‱  WiredTiger stores the checksum with the page address (typically in a parent page) –  extra safety against reading a stale page image
  • 53. 53 Compression in Action (Flights database, ht Asya)
  • 54. 54 Takeaway ‱  Main feature that impacts the vast majority of MongoDB projects / use cases ‱  CPU bound ‱  Different algorithms for different workloads –  Collection level compression tuning ‱  Smaller Data Faster IO –  Not only improves the disk space footprint –  also IO –  and index traversing
  • 55. Other Gems of WiredTiger
  • 56. 56 Index per Directory ‱  Use different drives for collections and indexes –  Parallelization of write operations –  MMAPv1 only allows directoryPerDatabase mongod Collection A Index "name " Collection B Index "_id"
  • 57. 57 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 and with j:true –  Better for insert-heavy workloads –  By default journaling is enabled! ‱  Replication guarantees the durability
  • 59. 59
  • 60. 60 What’s next for WiredTiger? ‱  Tune for (many) more workloads – avoid stalls during checkpoints with 100GB+ caches – make capped collections (including oplog) more efficient ‱  Adding encryption ‱  More advanced transactional semantics in the storage engine API
  • 61. 61 Updates and Upgrades ‱  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 –  Wait for resync –  Rollover
  • 63. 63 MongoDB 3.0 ‱  Pluggable Storage Engine API ‱  Storage Engines ‱  Large Replica Sets ‱  Big Polygon ‱  Security Enhancements – SCRAM ‱  Audit Trail ‱  Simplified Operations – Ops Manager ‱  Tools Rewrite