SlideShare a Scribd company logo
1 of 49
Download to read offline
Unearthing 4 Hidden
Gems of MongoDB 2.6
Dan Pasette
VP of Core Engineering
MongoDB 2.6 was big.
> Power of 2 as Default Allocation Strategy
> Server-side Timeouts
> Query Engine Introspection
> Background Indexing on Secondaries
Here’s what you missed:
Allocation. Timeouts. Introspection. Indexing.
Gem 1.
Power of 2 Allocation is
now on by default.
Allocation. Timeouts. Introspection. Indexing.
What happened?
Before 2.6, the default record
allocation used an exact-fit strategy.
Allocation. Timeouts. Introspection. Indexing.
Why does the allocation
strategy matter?
Allocation. Timeouts. Introspection. Indexing.
Allocation. Timeouts. Introspection. Indexing.
Take this section of disk with
some records of various sizes.
Allocation. Timeouts. Introspection. Indexing.
Documents are resized,
and records are removed.
Allocation. Timeouts. Introspection. Indexing.
Space is wasted because
new records cannot fit.
Allocation. Timeouts. Introspection. Indexing.
Fragmentation!
Allocation. Timeouts. Introspection. Indexing.
When document needs to
move, references must be
updated. That costs I/O.
The 2.6 Fix
By default, round up the record size
to the next power of two.
Allocation. Timeouts. Introspection. Indexing.
Allocation. Timeouts. Introspection. Indexing.
5121024
Allocation. Timeouts. Introspection. Indexing.
5121024
804 412
Reduce disk frag!
We’ve made capacity
planning predictable.
Allocation. Timeouts. Introspection. Indexing.
We’ve made capacity
planning predictable.
What about operations?
Allocation. Timeouts. Introspection. Indexing.
Gem 2.
Server-side Timeouts.
Allocation. Timeouts. Introspection. Indexing.
Server
“Our collection was indexed in staging,
but we forgot to index in production.”
Allocation. Timeouts. Introspection. Indexing.
Server
C
Allocation. Timeouts. Introspection. Indexing.
“Our collection was indexed in staging,
but we forgot to index in production.”
Server
C
C retry!
Allocation. Timeouts. Introspection. Indexing.
“Our collection was indexed in staging,
but we forgot to index in production.”
Server
C
C
C
retry!
retry!
Allocation. Timeouts. Introspection. Indexing.
“Our collection was indexed in staging,
but we forgot to index in production.”
The 2.6 Fix
Use maxTimeMS to limit how long
an op can run in the database.
Allocation. Timeouts. Introspection. Indexing.
We’ve stopped the op.
Allocation. Timeouts. Introspection. Indexing.
We’ve stopped the op.
But why was it slow?
Allocation. Timeouts. Introspection. Indexing.
Gem 3.
Get inside the
Query Optimizer.
Allocation. Timeouts. Introspection. Indexing.
What happened?
For 2.6, we rewrote the query
execution framework — and
most of the time, it just works.
Allocation. Timeouts. Introspection. Indexing.
Allocation. Timeouts. Introspection. Indexing.
Query Planner
Query
Parser
Allocation. Timeouts. Introspection. Indexing.
Query Planner Plan
Cache
?
Query
Parser
Allocation. Timeouts. Introspection. Indexing.
Query Planner Plan
Cache
?
Hit
Return
Plan Runner
Miss
Query
Parser
Allocation. Timeouts. Introspection. Indexing.
Query
Parser
Query Planner Plan
Cache
?
Hit
Return
Plan Runner
Miss
Plan Enumerator
Plan
Plan
Plan
Allocation. Timeouts. Introspection. Indexing.
Query
Parser
Query Planner Plan
Cache
?
Hit
Return
Plan Runner
Miss
Plan Enumerator
Plan
Plan
Plan
Multiplan Runner
Allocation. Timeouts. Introspection. Indexing.
Query
Parser
Query Planner Plan
Cache
?
Hit
Return
Plan Runner
Miss
Plan Enumerator
Plan
Plan
Plan
Multiplan Runner
Winner!
Cache
Allocation. Timeouts. Introspection. Indexing.
Query
Parser
Query Planner Plan
Cache
?
Hit
Return
Plan Runner
Miss
Plan Enumerator
Plan
Plan
Plan
Multiplan Runner
Winner!
Cache
Allocation. Timeouts. Introspection. Indexing.
Query Planner Plan
Cache
?
Hit
Return
Plan Runner
Query
Parser
The plan cache cuts out
a lot of processing.
But sometimes,
queries are slow.
Allocation. Timeouts. Introspection. Indexing.
Allocation. Timeouts. Introspection. Indexing.
Query
Parser
Query Planner Plan
Cache
?
Hit
Return
Plan Runner
!!!
The plan cache is caching
a suboptimal plan.
The 2.6 Fix
Add logging and introspection tools
to view and manipulate the cache,
such as getPlanCache.
Allocation. Timeouts. Introspection. Indexing.
Now we know what’s
wrong with the query.
Allocation. Timeouts. Introspection. Indexing.
Now we know what’s
wrong with the query.
Let’s fix it!
Allocation. Timeouts. Introspection. Indexing.
Gem 4.
Background Indexing
on Secondaries.
Allocation. Timeouts. Introspection. Indexing.
P
S S
Allocation. Timeouts. Introspection. Indexing.
P
S S
> db.coll.ensureIndex({ … }, { background: true })
Allocation. Timeouts. Introspection. Indexing.
C
P
S S
> db.coll.ensureIndex({ … }, { background: true })
Allocation. Timeouts. Introspection. Indexing.
What happened?
Before 2.6, background index builds
became foreground index builds
when replicated to secondaries.
Allocation. Timeouts. Introspection. Indexing.
The 2.6 Fix
Now, background index builds
stay in the background.
Allocation. Timeouts. Introspection. Indexing.
C
P
S S
> db.coll.ensureIndex({ … }, { background: true })
Allocation. Timeouts. Introspection. Indexing.
> Power of 2 as Default Allocation Strategy
> Server-side Timeouts
> Query Engine Introspection
> Background Indexing on Secondaries
Here’s what we
covered:
Allocation. Timeouts. Introspection. Indexing.
Small gems, big impact.
Small gems, big impact.
Thank you!

More Related Content

Similar to Hidden Gems in the 2.6 Release

Query-time Nonparametric Regression with Temporally Bounded Models - Patrick ...
Query-time Nonparametric Regression with Temporally Bounded Models - Patrick ...Query-time Nonparametric Regression with Temporally Bounded Models - Patrick ...
Query-time Nonparametric Regression with Temporally Bounded Models - Patrick ...
Lucidworks
 
Shuffling Optimization In Hadoop
Shuffling Optimization In HadoopShuffling Optimization In Hadoop
Shuffling Optimization In Hadoop
Kyujin Shim
 
Lucene BootCamp
Lucene BootCampLucene BootCamp
Lucene BootCamp
GokulD
 

Similar to Hidden Gems in the 2.6 Release (20)

Query-time Nonparametric Regression with Temporally Bounded Models - Patrick ...
Query-time Nonparametric Regression with Temporally Bounded Models - Patrick ...Query-time Nonparametric Regression with Temporally Bounded Models - Patrick ...
Query-time Nonparametric Regression with Temporally Bounded Models - Patrick ...
 
Shuffling Optimization In Hadoop
Shuffling Optimization In HadoopShuffling Optimization In Hadoop
Shuffling Optimization In Hadoop
 
Introduction to SQL Server Internals: How to Think Like the Engine
Introduction to SQL Server Internals: How to Think Like the EngineIntroduction to SQL Server Internals: How to Think Like the Engine
Introduction to SQL Server Internals: How to Think Like the Engine
 
How to think like the engine
How to think like the engineHow to think like the engine
How to think like the engine
 
What’s New in the Upcoming Apache Spark 3.0
What’s New in the Upcoming Apache Spark 3.0What’s New in the Upcoming Apache Spark 3.0
What’s New in the Upcoming Apache Spark 3.0
 
hbaseconasia2019 Pharos as a Pluggable Secondary Index Component
hbaseconasia2019 Pharos as a Pluggable Secondary Index Componenthbaseconasia2019 Pharos as a Pluggable Secondary Index Component
hbaseconasia2019 Pharos as a Pluggable Secondary Index Component
 
Smart Searching Through Trillion of Research Papers with Apache Spark ML with...
Smart Searching Through Trillion of Research Papers with Apache Spark ML with...Smart Searching Through Trillion of Research Papers with Apache Spark ML with...
Smart Searching Through Trillion of Research Papers with Apache Spark ML with...
 
Smart Searching Through Trillion of Research Papers with Apache Spark ML
Smart Searching Through Trillion of Research Papers with Apache Spark MLSmart Searching Through Trillion of Research Papers with Apache Spark ML
Smart Searching Through Trillion of Research Papers with Apache Spark ML
 
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
 
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
 
Leveraging your hadoop cluster better - running performant code at scale
Leveraging your hadoop cluster better - running performant code at scaleLeveraging your hadoop cluster better - running performant code at scale
Leveraging your hadoop cluster better - running performant code at scale
 
Database performance improvement, a six sigma project (improve) by nirav shah
Database performance improvement, a six sigma project (improve) by nirav shah Database performance improvement, a six sigma project (improve) by nirav shah
Database performance improvement, a six sigma project (improve) by nirav shah
 
WDCNZ - Writing Better CSS
WDCNZ - Writing Better CSSWDCNZ - Writing Better CSS
WDCNZ - Writing Better CSS
 
MSR 2009
MSR 2009MSR 2009
MSR 2009
 
Sumo Logic - Optimizing Your Search Experience (2016-08-17)
Sumo Logic - Optimizing Your Search Experience (2016-08-17)Sumo Logic - Optimizing Your Search Experience (2016-08-17)
Sumo Logic - Optimizing Your Search Experience (2016-08-17)
 
Database performance improvement, a six sigma project (mesure) by nirav shah
Database performance improvement, a six sigma project (mesure) by nirav shah Database performance improvement, a six sigma project (mesure) by nirav shah
Database performance improvement, a six sigma project (mesure) by nirav shah
 
JAVA 2013 IEEE DATAMINING PROJECT Ginix generalized inverted index for keywor...
JAVA 2013 IEEE DATAMINING PROJECT Ginix generalized inverted index for keywor...JAVA 2013 IEEE DATAMINING PROJECT Ginix generalized inverted index for keywor...
JAVA 2013 IEEE DATAMINING PROJECT Ginix generalized inverted index for keywor...
 
Ginix generalized inverted index for keyword search
Ginix generalized inverted index for keyword searchGinix generalized inverted index for keyword search
Ginix generalized inverted index for keyword search
 
Partitioning kendralittle
Partitioning kendralittlePartitioning kendralittle
Partitioning kendralittle
 
Lucene BootCamp
Lucene BootCampLucene BootCamp
Lucene BootCamp
 

More from MongoDB

More from MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Hidden Gems in the 2.6 Release