Gripping Adult Web Series You Can't Afford to Miss
MongoDB's usePowerOf2Sizes Feature
1. Implications of MongoDB’s
“usePowerOf2Sizes” Feature
Introduction
Problem Use Case
Activating “usePowerOf2Sizes”
Testing Approach
Analysis of Test Results
Pete Whitney, VP Cloud Development, FireScope, Inc.
2. Problematic Use Case
Insert document
Append to document
Append to document
Append to document
Delete document
Repeat
Pete Whitney, VP Cloud Development, FireScope, Inc.
3. Activating usePowerOf2Sizes
Example shell command to
activate usePowerOf2Sizes:
db.runCommand( { collMod : “collection_name",
usePowerOf2Sizes : true } );
Pete Whitney, VP Cloud Development, FireScope, Inc.
4. Is usePowerOf2Sizes set?
To view the setting of
usePowerOf2Sizes:
db.collection_name.stats();
Inspect the “userFlags” value from the returned results.
A value of 1 indicates that usePowerOf2Sizes is in effect
A value of 0 indicates that usePowerOf2Sizes is not in effect
Pete Whitney, VP Cloud Development, FireScope, Inc.
5. Testing Process
v Create two collections
v One uses usePowerOf2Sizes
v The other does not
v Insert the same documents to each
collection
v Update inserted documents
v Delete documents
v Retrieve and compare data size and
storage size
Pete Whitney, VP Cloud Development, FireScope, Inc.
6. Data Size Results
Final Data Size (KBytes)
600
500
400
300
200
100
0
Final Data
Size (KBytes)
Feature Not Feature Set
Set
Pete Whitney, VP Cloud Development, FireScope, Inc.
7. Storage Size Results
Final Storage Size (M-Bytes)
160
140
120
100
80
60
40
20
0
Final Storage
Size (M-Bytes)
Feature Not Set
Feature Set
Pete Whitney, VP Cloud Development, FireScope, Inc.
8. Compaction Ratio Results
Final Compaction Ratio
700
600
500
400
300
200
100
0
Final
Compaction
Ratio
Feature Not
Set
Feature Set
Pete Whitney, VP Cloud Development, FireScope, Inc.
9. Allocation Results
5000
4500
4000
3500
Allocation Size by
Insertion Count
Feature Not Set
Allocation Size by
Insertion Count
Feature Set
3000
2500
2000
1500
1000
500
0
5
10 15 20 25 30 35 40 45
Pete Whitney, VP Cloud Development, FireScope, Inc.
10. Performance Results
v Test duration using feature: 26.75s
v Test duration not using feature: 34.66s
v Percent improvement: 22.8%
Pete Whitney, VP Cloud Development, FireScope, Inc.
11. Summary
l
l
l
l
Using the usePowerOf2Sizes feature results in
larger data size allocations
Using the usePowerOf2Sizes feature results in
significantly better use of storage size
Using the usePowerOf2Sizes feature results in
improved and sustained compaction ratio
Using the usePowerOf2Sizes feature results in
better performance for append operations due to
reductions in the number of disk allocations and
index updates
Pete Whitney, VP Cloud Development, FireScope, Inc.
12. Parting Thoughts
l
l
l
l
If you are not consistently gathering data from your
IT infrastructure do you know when some
important portion of your business is failing to meet
your customers needs?
When you change something in your IT
infrastructure do you know that the change is
performing up to the expectations of your
customers?
Do you have the tools in place today that allow you
to explore and identify issues, problems,
bottlenecks throughout all of your IT assets?
If not then check out:
www.firescope.com
Pete Whitney, VP Cloud Development, FireScope, Inc.
13. References
l
Reference Article
MongoDB Exorcises File Fragmentation Demons
java.sys-con.com/node/2756958
l
“usePowerOf2Sizes” Documentation
docs.mongodb.org/manual/reference/command/collMod/
l
FireScope Inc.
www.firescope.com
l
MongoDB
www.mongodb.org
l
Pete Whitney
pwhitney@firescope.com
Pete Whitney, VP Cloud Development, FireScope, Inc.