SlideShare a Scribd company logo
The VP R&D Open Seminar
MongoDB Performance
Moshe Kaplan
mokplan@gmail.com
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
Who is Using MongoDB?
2
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
Who is Behind MongoDB?
3
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com4
Strategy A - Sharding
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com5
Strategy B - In Memory Databases
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com6
700 Inserts/Sec
In Memory Engine
3000 Inserts/Sec
InnoDB Engine
700 Inserts/Sec
Amazon
AWS
Standard
Large
Instance
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com7
Strategy C – MapReduce
http://blogs.microsoft.co.il/blogs/vprnd
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
Strategy D - NoSQL
insert
get
multiget
remove
truncate
8
<Key, Value>
http://wiki.apache.org/cassandra/API
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com9
And now…
http://www.webperformancetoday.com/2010/06/15/everything-you-wanted-to-know-about-web-performance/
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
The VP R&D Open Seminar
MONGODB TUNING
10
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
journalCommitInterval = 300:
Write to disk: 2ms <= t <= 300ms
Default 100ms, increase to 300ms to save
resources
Disk
The Journal
11
Memory
Journal Data
1 2
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
mongod.conf Tuning
maxConns: # of connection (<20,000)
objcheck: BSON validation. false to save
overhead.
nohttpinterface = true: disables http interface
noprealloc = false: preallocates space @ startup
noscripting = true: disables scripting engine
profile = 0: disable profiling
rest = false: disable REST service
12
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
The VP R&D Open Seminar
SERVER STATS
13
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
What we are facing of?
> db.serverStatus().mem;
> db.serverStatus().extra_info;
> db.serverStatus().globalLock;
> db.serverStatus().backgroundFlushing;
> db.serverStatus().connections;
> db.serverStatus().network;
14
RAM
Page Faults
Lock Ratio
I/O Speed
Not Too Many
Bandwidth
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
RAM Optimization
dataSize + indexSize < RAM
15
OS
Data Index
Journal
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
The VP R&D Open Seminar
PROFILING AND SLOW LOG
16
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
Profiling Configuration
Enable:
• mongod --profile=1 --slowms=15
• db.setProfilingLevel([level] , [time])
How much:
• 0 (none) 1 (slow queries only) 2 (all)
• 100ms: default
Where:
• system.profile collection
17
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
Profiling Results Analysis
Last 5 >1ms: show profile
w/o commands:
db.system.profile.find( { op: { $ne : 'command' } } ).pretty()
Specific database:
db.system.profile.find( { ns : 'mydb.test' } ).pretty()
Slower than:
db.system.profile.find( { millis : { $gt : 5 } } ).pretty()
Between dates:
db.system.profile.find({ts : {
$gt : new ISODate("2012-12-09T03:00:00Z") ,
$lt : new ISODate("2012-12-09T03:40:00Z")
}}).pretty()
18
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
Explain
> db.courses.find().explain();
{ "cursor" : "BasicCursor",
"isMultiKey" : false,
"n" : 11, “nscannedObjects" : 11,
"nscanned" : 11, "nscannedObjectsAllPlans" : 11,
"nscannedAllPlans" : 11,
"scanAndOrder" : false, "indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 0,
"indexBounds" : {},
"server" : "primary.domain.com:27017"
}
19
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
The VP R&D Open Seminar
INDEXES
20
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
Index Management
Regular Index
db.users.ensureIndex( { user_id: 1 } )
Multiple + DESC Index
db.users.ensureIndex( { user_id: 1, age: -1 } )
Sub Document Index
db.users.ensureIndex( { address.zipcode: 1 } )
List Indexes
db.users.getIndexes()
Drop Indexes
db.users.dropIndex(“indexName”)
21
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
Known Index Issues
Bound filter should be the last
(in the index as well).
22
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
The VP R&D Open Seminar
STATS &
SCHEMA DESIGN
23
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
Sparse Matrix? I don’t Think so
mongostat
> db.stats();
> db.collectionname.stats();
Fragmentation if storageSize/size > 2
db.collectionanme.runCommand(“compact”)
Padding (wrong design) if paddingFactor > 2
24
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
The VP R&D Open Seminar
THE LOCKING DILEMA
25
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
Locking on Write (CRUD)
2.0 Global Lock
2.2 Database Lock
2.X …
What to do till then?
26
http://blogs.microsoft.co.il/blogs/vprnd
http://top-performance.blogspot.com
The Startup Nation Feed
27 Join @ InsideMy.co

More Related Content

What's hot (20)

PPTX
Back to Basics Spanish Webinar 3 - Introducción a los replica sets
MongoDB
 
PDF
Mongo performance tuning: tips and tricks
Vladimir Malyk
 
PDF
Mongodb
Scott Motte
 
ODP
MongoDB : The Definitive Guide
Wildan Maulana
 
PDF
MongoDB World 2016: From the Polls to the Trolls: Seeing What the World Think...
MongoDB
 
PDF
Back to Basics 2017: Mí primera aplicación MongoDB
MongoDB
 
PPTX
Back to Basics: My First MongoDB Application
MongoDB
 
PPTX
MongoDB Roadmap
MongoDB
 
PDF
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB
 
PPTX
MongoDB 101
Abhijeet Vaikar
 
PPTX
MongoDB basics & Introduction
Jerwin Roy
 
PPTX
Back to Basics Webinar 2: Your First MongoDB Application
MongoDB
 
PPTX
Connecting NodeJS & MongoDB
Enoch Joshua
 
KEY
MongoDB
Steven Francia
 
PPTX
Introduction to mongo db
NexThoughts Technologies
 
KEY
Benefits of using MongoDB: Reduce Complexity & Adapt to Changes
Alex Nguyen
 
PPTX
Social Analytics with MongoDB
Patrick Stokes
 
PPTX
MongoDB
Bembeng Arifin
 
PPTX
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
MongoDB
 
PPTX
MongoDB-SESSION03
Jainul Musani
 
Back to Basics Spanish Webinar 3 - Introducción a los replica sets
MongoDB
 
Mongo performance tuning: tips and tricks
Vladimir Malyk
 
Mongodb
Scott Motte
 
MongoDB : The Definitive Guide
Wildan Maulana
 
MongoDB World 2016: From the Polls to the Trolls: Seeing What the World Think...
MongoDB
 
Back to Basics 2017: Mí primera aplicación MongoDB
MongoDB
 
Back to Basics: My First MongoDB Application
MongoDB
 
MongoDB Roadmap
MongoDB
 
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB
 
MongoDB 101
Abhijeet Vaikar
 
MongoDB basics & Introduction
Jerwin Roy
 
Back to Basics Webinar 2: Your First MongoDB Application
MongoDB
 
Connecting NodeJS & MongoDB
Enoch Joshua
 
Introduction to mongo db
NexThoughts Technologies
 
Benefits of using MongoDB: Reduce Complexity & Adapt to Changes
Alex Nguyen
 
Social Analytics with MongoDB
Patrick Stokes
 
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
MongoDB
 
MongoDB-SESSION03
Jainul Musani
 

Viewers also liked (6)

PDF
MongoDB memory management demystified
Alon Horev
 
PDF
Playing in Tune: How We Refactored Cube to Terabyte Scale
MongoDB
 
PPTX
Automated Slow Query Analysis: Dex the Index Robot
MongoDB
 
PPTX
Concurrency Control in MongoDB 3.0
MongoDB
 
PPTX
Tuning Linux for MongoDB
Tim Vaillancourt
 
PPTX
Concurrency Patterns with MongoDB
Yann Cluchey
 
MongoDB memory management demystified
Alon Horev
 
Playing in Tune: How We Refactored Cube to Terabyte Scale
MongoDB
 
Automated Slow Query Analysis: Dex the Index Robot
MongoDB
 
Concurrency Control in MongoDB 3.0
MongoDB
 
Tuning Linux for MongoDB
Tim Vaillancourt
 
Concurrency Patterns with MongoDB
Yann Cluchey
 
Ad

Similar to mongoDB Performance (20)

PPTX
Introduction to MongoDB
Moshe Kaplan
 
PDF
MongoDB performance
Mydbops
 
PDF
MongoDB Tips and Tricks
M Malai
 
PDF
Deploying Machine Learning Models to Production
Anass Bensrhir - Senior Data Scientist
 
PPTX
Effectively Scale and Operate AEM with MongoDB by Norberto Leite
AEM HUB
 
PPTX
Back to Basics, webinar 2: La tua prima applicazione MongoDB
MongoDB
 
PDF
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
Mydbops
 
PDF
Spring Data MongoDB 介紹
Kuo-Chun Su
 
PPTX
Big Data Workshop
Moshe Kaplan
 
PDF
Apache Calcite Tutorial - BOSS 21
Stamatis Zampetakis
 
PPTX
introtomongodb
saikiran
 
PDF
Supercharging your Organic CTR
Phil Pearce
 
PPTX
MongoDB Schema Design: Practical Applications and Implications
MongoDB
 
PPTX
Big Data Seminar: Analytics, Hadoop, Map Reduce, Mongo and other great stuff
Moshe Kaplan
 
PPT
Web Systems Architecture by Moshe Kaplan
Moshe Kaplan
 
PPTX
moma-django overview --> Django + MongoDB: building a custom ORM layer
Gadi Oren
 
PDF
Python and MongoDB
Norberto Leite
 
PDF
The Possibilities and Pitfalls of Writing Your Own State Stores with Daan Gertis
HostedbyConfluent
 
PDF
Effectively Deploying MongoDB on AEM
Norberto Leite
 
PDF
MongoDB and Python
Norberto Leite
 
Introduction to MongoDB
Moshe Kaplan
 
MongoDB performance
Mydbops
 
MongoDB Tips and Tricks
M Malai
 
Deploying Machine Learning Models to Production
Anass Bensrhir - Senior Data Scientist
 
Effectively Scale and Operate AEM with MongoDB by Norberto Leite
AEM HUB
 
Back to Basics, webinar 2: La tua prima applicazione MongoDB
MongoDB
 
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
Mydbops
 
Spring Data MongoDB 介紹
Kuo-Chun Su
 
Big Data Workshop
Moshe Kaplan
 
Apache Calcite Tutorial - BOSS 21
Stamatis Zampetakis
 
introtomongodb
saikiran
 
Supercharging your Organic CTR
Phil Pearce
 
MongoDB Schema Design: Practical Applications and Implications
MongoDB
 
Big Data Seminar: Analytics, Hadoop, Map Reduce, Mongo and other great stuff
Moshe Kaplan
 
Web Systems Architecture by Moshe Kaplan
Moshe Kaplan
 
moma-django overview --> Django + MongoDB: building a custom ORM layer
Gadi Oren
 
Python and MongoDB
Norberto Leite
 
The Possibilities and Pitfalls of Writing Your Own State Stores with Daan Gertis
HostedbyConfluent
 
Effectively Deploying MongoDB on AEM
Norberto Leite
 
MongoDB and Python
Norberto Leite
 
Ad

More from Moshe Kaplan (20)

PDF
Spark and C Integration
Moshe Kaplan
 
PDF
Introduction to Big Data
Moshe Kaplan
 
PDF
Introduciton to Python
Moshe Kaplan
 
PDF
Creating Big Data: Methodology
Moshe Kaplan
 
PDF
Git Tutorial
Moshe Kaplan
 
PDF
Redis training for java software engineers
Moshe Kaplan
 
PDF
MongoDB training for java software engineers
Moshe Kaplan
 
PDF
MongoDB from Basics to Scale
Moshe Kaplan
 
PPTX
MongoDB Best Practices for Developers
Moshe Kaplan
 
PPTX
The api economy
Moshe Kaplan
 
PPT
Scale and Cloud Design Patterns
Moshe Kaplan
 
PPT
Web systems architecture, Performance and More
Moshe Kaplan
 
PPTX
Do Big Data and NoSQL Fit Your Needs?
Moshe Kaplan
 
PPTX
The VP R&D Open Seminar on Project Management, SCRUM, Agile and Continuous De...
Moshe Kaplan
 
PPTX
MySQL Multi Master Replication
Moshe Kaplan
 
PPT
MySQL crash course by moshe kaplan
Moshe Kaplan
 
PPT
VP R&D Open Seminar: Caching
Moshe Kaplan
 
PPT
Expert Days: The VP R&D Open Seminar: Project Management
Moshe Kaplan
 
PPT
Expert Days 2011: The VP R&D Open Seminar: Systems Performance Seminar
Moshe Kaplan
 
PPT
Database2011 MySQL Sharding
Moshe Kaplan
 
Spark and C Integration
Moshe Kaplan
 
Introduction to Big Data
Moshe Kaplan
 
Introduciton to Python
Moshe Kaplan
 
Creating Big Data: Methodology
Moshe Kaplan
 
Git Tutorial
Moshe Kaplan
 
Redis training for java software engineers
Moshe Kaplan
 
MongoDB training for java software engineers
Moshe Kaplan
 
MongoDB from Basics to Scale
Moshe Kaplan
 
MongoDB Best Practices for Developers
Moshe Kaplan
 
The api economy
Moshe Kaplan
 
Scale and Cloud Design Patterns
Moshe Kaplan
 
Web systems architecture, Performance and More
Moshe Kaplan
 
Do Big Data and NoSQL Fit Your Needs?
Moshe Kaplan
 
The VP R&D Open Seminar on Project Management, SCRUM, Agile and Continuous De...
Moshe Kaplan
 
MySQL Multi Master Replication
Moshe Kaplan
 
MySQL crash course by moshe kaplan
Moshe Kaplan
 
VP R&D Open Seminar: Caching
Moshe Kaplan
 
Expert Days: The VP R&D Open Seminar: Project Management
Moshe Kaplan
 
Expert Days 2011: The VP R&D Open Seminar: Systems Performance Seminar
Moshe Kaplan
 
Database2011 MySQL Sharding
Moshe Kaplan
 

Recently uploaded (20)

PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 

mongoDB Performance