Performance
Two choices in choosing storage
* MMAPv1 (default storage)
===========================
Classic storage maps datafiles into virutal memory
eg: mongod --storageEngine mmapv1
or
db.serverStatus()
Locking :
locking 2.2 - 2.6
-> Data (before mongo ver 3.0, db level locking and after 3.0 version it supports collection level locking),
-> Meta data
-> Indexes
Mongo supports - Single Write and multi read operation
Journal - Write ahead log (Redo - archive log in Oracle)
- FSSYNC syncs journal to disk
Data on disk is in consistent state by "write ahead" log
Extend allocation method -> Power of 2 allocation
Start with 32bytes -> 32, 64, 128,256,512.....2MB
Documents will not have to move as soon as they grow in size. - This is because you have some space to grow before you reach your record size.
Record spaces are likely to get re-used. - Without standardized sizes, the likelihood that your new document will want the same size of record space as an old document might be slim, especially if your documents have different sizes (which they will if they're all growing). With standard sizes, all documents are likely to find record spaces that fit them.
Documents that grow at a constant rate will move less often as time goes on. - This makes sense, if you think about it. If your documents start out at an average size of 20 bytes, and grow at a rate of 1 byte per day, your first move will happen in 12 days (since the smallest record size is 32 bytes). Your second move will take 32 days, and your third will take 64. Each successive move will take longer and longer.
*Wired Tiger
============
Opensource storage
First pluggable storage engine
Note : It may not be obvious when you first think about it, but indexes are controlled by the storage engine.
For instance, MongoDB uses Btrees. With MongoDB 3.0, WiredTiger will be using B+ trees, with other formats expected to come in later releases.
Features :
1)Document level locking
2)Compression
3)Better performance
4)Fixes shortfalls in MMAPv1 storage engine
mongod --storageEngine wiretiger
it uses 2 caches
a) WT Cache (Half of RAM - Default)
b) FS Cacge
Every 60Secs - Check point flues WT cache -> FS cache -> Disk
Every check point - take data snapshot and at any point in time 2 previous snapshots will be available for data recovery purpose, hence "Journal or write ahead log" is not used.
Document level locking and writes handled with mutiple threads (based on number of CPU cores)
Compression 2 types
A) SNAPPY (Default) - Fast
B) zlib - More compression but perf will be compromised
Two choices in choosing storage
* MMAPv1 (default storage)
===========================
Classic storage maps datafiles into virutal memory
eg: mongod --storageEngine mmapv1
or
db.serverStatus()
Locking :
locking 2.2 - 2.6
-> Data (before mongo ver 3.0, db level locking and after 3.0 version it supports collection level locking),
-> Meta data
-> Indexes
Mongo supports - Single Write and multi read operation
Journal - Write ahead log (Redo - archive log in Oracle)
- FSSYNC syncs journal to disk
Data on disk is in consistent state by "write ahead" log
Extend allocation method -> Power of 2 allocation
Start with 32bytes -> 32, 64, 128,256,512.....2MB
Documents will not have to move as soon as they grow in size. - This is because you have some space to grow before you reach your record size.
Record spaces are likely to get re-used. - Without standardized sizes, the likelihood that your new document will want the same size of record space as an old document might be slim, especially if your documents have different sizes (which they will if they're all growing). With standard sizes, all documents are likely to find record spaces that fit them.
Documents that grow at a constant rate will move less often as time goes on. - This makes sense, if you think about it. If your documents start out at an average size of 20 bytes, and grow at a rate of 1 byte per day, your first move will happen in 12 days (since the smallest record size is 32 bytes). Your second move will take 32 days, and your third will take 64. Each successive move will take longer and longer.
*Wired Tiger
============
Opensource storage
First pluggable storage engine
Note : It may not be obvious when you first think about it, but indexes are controlled by the storage engine.
For instance, MongoDB uses Btrees. With MongoDB 3.0, WiredTiger will be using B+ trees, with other formats expected to come in later releases.
Features :
1)Document level locking
2)Compression
3)Better performance
4)Fixes shortfalls in MMAPv1 storage engine
mongod --storageEngine wiretiger
it uses 2 caches
a) WT Cache (Half of RAM - Default)
b) FS Cacge
Every 60Secs - Check point flues WT cache -> FS cache -> Disk
Every check point - take data snapshot and at any point in time 2 previous snapshots will be available for data recovery purpose, hence "Journal or write ahead log" is not used.
Document level locking and writes handled with mutiple threads (based on number of CPU cores)
Compression 2 types
A) SNAPPY (Default) - Fast
B) zlib - More compression but perf will be compromised
No comments:
Post a Comment