MongoDB Engines
Demystified
April, 26, 2017
Sveta Smirnova
• MySQL Support engineer
• Author of
• MySQL Troubleshooting
• JSON UDF functions
• FILTER clause for MySQL
• Speaker
• Percona Live, OOW, Fosdem,
DevConf, HighLoad...
Sveta Smirnova
2
• First version had only one engine: MMAP
History
3
• First version had only one engine: MMAP
• MMAP was not ideal for all workloads
• Collection-level locking
• No ACID
• No MVCC
• Performance limited
History
3
• First version had only one engine: MMAP
• MMAP was not ideal for all workloads
• TokuMX
• Drop-in replacement
• Document-level locking
• ACID
• MVCC
• Scalability
History
3
• First version had only one engine: MMAP
• MMAP was not ideal for all workloads
• TokuMX
• Percona
• Acquired Tokutek in 2015
• Percona Server for MongoDB
History
3
• Not everyone was happy with MMAP
Why Other Engines?
4
• Not everyone was happy with MMAP
• Other solutions on market
• TokuMX
• WiredTiger
• RocksDB
Why Other Engines?
4
• Not everyone was happy with MMAP
• Other solutions on market
• Version 3.0
• MongoDB acquires WiredTiger in 2014
• New Storage Engine API
• WiredTiger is MongoDB storage engine
Why Other Engines?
4
• Not everyone was happy with MMAP
• Other solutions on market
• Version 3.0
• Percona Server for MongoDB
• Released TokuMX as PerconaFT engine
• Later discontinued
Limitations of SE API
• Added MongoRocks
• Added Memory
Why Other Engines?
4
• Only one per mongod instance
Engines in MongoDB
5
• Only one per mongod instance
• Many in multiple-instance setup
• Replica Set
• Sharding
Engines in MongoDB
5
Memory
WiredTiger
Memory
Multiple Engines in Replica Set
6
MongoRocks
WiredTiger
MongoRocks
Multiple Engines in Replica Set
7
Shard 1 Shard 2
MR
MR
MR WT
WT
WT
Multiple Engines In Sharded Cluster
8
• Default since 3.2
WiredTiger
9
• Default since 3.2
• Document-level locking
WiredTiger
9
• Default since 3.2
• Document-level locking
• MVCC/ACID
WiredTiger
9
• Default since 3.2
• Document-level locking
• MVCC/ACID
• Own Journal
WiredTiger
9
• Default since 3.2
• Document-level locking
• MVCC/ACID
• Own Journal
• Compression
WiredTiger
9
• Default since 3.2
• Document-level locking
• MVCC/ACID
• Own Journal
• Compression
• Own memory management
WiredTiger
9
• Default since 3.2
• Document-level locking
• MVCC/ACID
• Own Journal
• Compression
• Own memory management
• Online binary backups in Percona Server
WiredTiger
9
• Default since 3.2
• Document-level locking
• MVCC/ACID
• Own Journal
• Compression
• Own memory management
• Online binary backups in Percona Server
• Suites for any workload
WiredTiger
9
• 3.2+
Encrypted
10
• 3.2+
• MongoDB Enterprise only
Encrypted
10
• 3.2+
• MongoDB Enterprise only
• Encryption at Rest
Encrypted
10
• 3.2+
• MongoDB Enterprise only
• Encryption at Rest
• Based on WiredTiger
Encrypted
10
• 3.2+
• MongoDB Enterprise only
• Encryption at Rest
• Based on WiredTiger
• Percona suggests to use FS encryption
Encrypted
10
• All data stored in memory
In-Memory and Memory
11
• All data stored in memory
• No persistence after restart
In-Memory and Memory
11
• All data stored in memory
• No persistence after restart
• Can be combined with persistent storage
In-Memory and Memory
11
• All data stored in memory
• No persistence after restart
• Can be combined with persistent storage
• Based on WiredTiger
In-Memory and Memory
11
• All data stored in memory
• No persistence after restart
• Can be combined with persistent storage
• Based on WiredTiger
• In-Memory
• 3.2.6+
• MongoDB Enterprise only
In-Memory and Memory
11
• All data stored in memory
• No persistence after restart
• Can be combined with persistent storage
• Based on WiredTiger
• In-Memory
• Memory
• 3.2.8-2.0+
• Percona Server for MongoDB
• Open Source
In-Memory and Memory
11
• 3.0+
MongoRocks
12
• 3.0+
• Percona Server for MongoDB
MongoRocks
12
• 3.0+
• Percona Server for MongoDB
• Compaction
MongoRocks
12
• 3.0+
• Percona Server for MongoDB
• Compaction
• Compression
MongoRocks
12
• 3.0+
• Percona Server for MongoDB
• Compaction
• Compression
• Online binary backups
MongoRocks
12
• 3.0+
• Percona Server for MongoDB
• Compaction
• Compression
• Online binary backups
• MVCC/ACID
MongoRocks
12
• 3.0+
• Percona Server for MongoDB
• Compaction
• Compression
• Online binary backups
• MVCC/ACID
• Best suited for
• Large data
• Write-intensive workloads
MongoRocks
12
• Based on original MMAP
MMAPv1
13
• Based on original MMAP
• Default < 3.2
MMAPv1
13
• Based on original MMAP
• Default < 3.2
• Memory-mapped files
MMAPv1
13
• Based on original MMAP
• Default < 3.2
• Memory-mapped files
• Collection-level locking
MMAPv1
13
• Based on original MMAP
• Default < 3.2
• Memory-mapped files
• Collection-level locking
• Memory management delegated to system
MMAPv1
13
• Based on original MMAP
• Default < 3.2
• Memory-mapped files
• Collection-level locking
• Memory management delegated to system
• No compression
MMAPv1
13
• Based on original MMAP
• Default < 3.2
• Memory-mapped files
• Collection-level locking
• Memory management delegated to system
• No compression
• No MVCC/ACID
MMAPv1
13
• MMAPv1
Monitoring: PMM
14
• WiredTiger
Monitoring: PMM
14
• MongoRocks
Monitoring: PMM
14
• Storage engines provide great flexibility
• They can be used in combinations
• MongoDB architecture allows easily to test
if engine suits your needs
• Percona Server for MongoDB
• 100 % Open Source
• Includes Enterprise-grade features
• Has reach monitoring
Summary
15
• MMAPv1
• WiredTiger
• MongoRocks
• Percona Memory Engine
• PMM Demo
More informaiton
16
???
Time For Questions
17
http://www.slideshare.net/SvetaSmirnova
https://twitter.com/svetsmirnova
Thank you!
18

MongoDB Engines: Demystified

  • 1.
  • 2.
    • MySQL Supportengineer • Author of • MySQL Troubleshooting • JSON UDF functions • FILTER clause for MySQL • Speaker • Percona Live, OOW, Fosdem, DevConf, HighLoad... Sveta Smirnova 2
  • 3.
    • First versionhad only one engine: MMAP History 3
  • 4.
    • First versionhad only one engine: MMAP • MMAP was not ideal for all workloads • Collection-level locking • No ACID • No MVCC • Performance limited History 3
  • 5.
    • First versionhad only one engine: MMAP • MMAP was not ideal for all workloads • TokuMX • Drop-in replacement • Document-level locking • ACID • MVCC • Scalability History 3
  • 6.
    • First versionhad only one engine: MMAP • MMAP was not ideal for all workloads • TokuMX • Percona • Acquired Tokutek in 2015 • Percona Server for MongoDB History 3
  • 7.
    • Not everyonewas happy with MMAP Why Other Engines? 4
  • 8.
    • Not everyonewas happy with MMAP • Other solutions on market • TokuMX • WiredTiger • RocksDB Why Other Engines? 4
  • 9.
    • Not everyonewas happy with MMAP • Other solutions on market • Version 3.0 • MongoDB acquires WiredTiger in 2014 • New Storage Engine API • WiredTiger is MongoDB storage engine Why Other Engines? 4
  • 10.
    • Not everyonewas happy with MMAP • Other solutions on market • Version 3.0 • Percona Server for MongoDB • Released TokuMX as PerconaFT engine • Later discontinued Limitations of SE API • Added MongoRocks • Added Memory Why Other Engines? 4
  • 11.
    • Only oneper mongod instance Engines in MongoDB 5
  • 12.
    • Only oneper mongod instance • Many in multiple-instance setup • Replica Set • Sharding Engines in MongoDB 5
  • 13.
  • 14.
  • 15.
    Shard 1 Shard2 MR MR MR WT WT WT Multiple Engines In Sharded Cluster 8
  • 16.
    • Default since3.2 WiredTiger 9
  • 17.
    • Default since3.2 • Document-level locking WiredTiger 9
  • 18.
    • Default since3.2 • Document-level locking • MVCC/ACID WiredTiger 9
  • 19.
    • Default since3.2 • Document-level locking • MVCC/ACID • Own Journal WiredTiger 9
  • 20.
    • Default since3.2 • Document-level locking • MVCC/ACID • Own Journal • Compression WiredTiger 9
  • 21.
    • Default since3.2 • Document-level locking • MVCC/ACID • Own Journal • Compression • Own memory management WiredTiger 9
  • 22.
    • Default since3.2 • Document-level locking • MVCC/ACID • Own Journal • Compression • Own memory management • Online binary backups in Percona Server WiredTiger 9
  • 23.
    • Default since3.2 • Document-level locking • MVCC/ACID • Own Journal • Compression • Own memory management • Online binary backups in Percona Server • Suites for any workload WiredTiger 9
  • 24.
  • 25.
    • 3.2+ • MongoDBEnterprise only Encrypted 10
  • 26.
    • 3.2+ • MongoDBEnterprise only • Encryption at Rest Encrypted 10
  • 27.
    • 3.2+ • MongoDBEnterprise only • Encryption at Rest • Based on WiredTiger Encrypted 10
  • 28.
    • 3.2+ • MongoDBEnterprise only • Encryption at Rest • Based on WiredTiger • Percona suggests to use FS encryption Encrypted 10
  • 29.
    • All datastored in memory In-Memory and Memory 11
  • 30.
    • All datastored in memory • No persistence after restart In-Memory and Memory 11
  • 31.
    • All datastored in memory • No persistence after restart • Can be combined with persistent storage In-Memory and Memory 11
  • 32.
    • All datastored in memory • No persistence after restart • Can be combined with persistent storage • Based on WiredTiger In-Memory and Memory 11
  • 33.
    • All datastored in memory • No persistence after restart • Can be combined with persistent storage • Based on WiredTiger • In-Memory • 3.2.6+ • MongoDB Enterprise only In-Memory and Memory 11
  • 34.
    • All datastored in memory • No persistence after restart • Can be combined with persistent storage • Based on WiredTiger • In-Memory • Memory • 3.2.8-2.0+ • Percona Server for MongoDB • Open Source In-Memory and Memory 11
  • 35.
  • 36.
    • 3.0+ • PerconaServer for MongoDB MongoRocks 12
  • 37.
    • 3.0+ • PerconaServer for MongoDB • Compaction MongoRocks 12
  • 38.
    • 3.0+ • PerconaServer for MongoDB • Compaction • Compression MongoRocks 12
  • 39.
    • 3.0+ • PerconaServer for MongoDB • Compaction • Compression • Online binary backups MongoRocks 12
  • 40.
    • 3.0+ • PerconaServer for MongoDB • Compaction • Compression • Online binary backups • MVCC/ACID MongoRocks 12
  • 41.
    • 3.0+ • PerconaServer for MongoDB • Compaction • Compression • Online binary backups • MVCC/ACID • Best suited for • Large data • Write-intensive workloads MongoRocks 12
  • 42.
    • Based onoriginal MMAP MMAPv1 13
  • 43.
    • Based onoriginal MMAP • Default < 3.2 MMAPv1 13
  • 44.
    • Based onoriginal MMAP • Default < 3.2 • Memory-mapped files MMAPv1 13
  • 45.
    • Based onoriginal MMAP • Default < 3.2 • Memory-mapped files • Collection-level locking MMAPv1 13
  • 46.
    • Based onoriginal MMAP • Default < 3.2 • Memory-mapped files • Collection-level locking • Memory management delegated to system MMAPv1 13
  • 47.
    • Based onoriginal MMAP • Default < 3.2 • Memory-mapped files • Collection-level locking • Memory management delegated to system • No compression MMAPv1 13
  • 48.
    • Based onoriginal MMAP • Default < 3.2 • Memory-mapped files • Collection-level locking • Memory management delegated to system • No compression • No MVCC/ACID MMAPv1 13
  • 49.
  • 50.
  • 51.
  • 52.
    • Storage enginesprovide great flexibility • They can be used in combinations • MongoDB architecture allows easily to test if engine suits your needs • Percona Server for MongoDB • 100 % Open Source • Includes Enterprise-grade features • Has reach monitoring Summary 15
  • 53.
    • MMAPv1 • WiredTiger •MongoRocks • Percona Memory Engine • PMM Demo More informaiton 16
  • 54.
  • 55.