SlideShare a Scribd company logo
ankur.raina@mongodb.com
MongoDB Performance
Tuning
Performance? Fast?
Performance Tuning vs Optimizing
• Optimizing – Opportunity to restructure
your application, data model, and
queries
• Performance Tuning – Experiment and
modify system
Hardware
CPU / RAM / HDD / OS
Topology / Network / Hosting
Application
Input - sources of write traffic
Output - sources of query load
Schema
MongoDB
Replica-set configuration, tags, read & write concern
Shard configuration, tags, shard keys
Where to Focus?
Investigation
Log files, Profiler, Query Optimizer
mongod
log file
profiler (collection)
query engine
Query Planner
Explain Levels in MongoDB 3.x
• queryPlanner (default level): runs the query planner and chooses the winning plan without
actually executing the query
– Use case: "Which plan will MongoDB choose to run my query?"
• executionStats – runs the query optimizer, then runs the winning plan to completion
– Use case: "How is my query performing?"
• allPlansExecution – same as executionStats, but returns all the query plans, not just the winning
plan.
– Use case: "I want as much information as possible to diagnose a slow query."
db.employees.findOne()
{
"_id" : ObjectId("592bebaa7761b028cdec1b6f"),
"last_name" : "Pham",
"quote" : "Aliquam est reiciendis alias neque ad.",
"job" : "Counselling psychologist",
"ssn" : "401-31-6615",
"address" : {
"city" : "Lake Meaganton",
"state" : "Idaho",
"street" : "83248 Woods Extension",
"zip" : "10914-3394"
},
"first_name" : "Yvonne",
"company_id" : ObjectId("58bdbe32500b1d42c7e10be7"),
"employer" : "Terry and Sons",
"birthday" : ISODate("2011-04-17T21:19:28Z"),
"email" : "murillobrian@cox.net"
}
db.employees.count()
1010893
db.employees.getIndexes()
[
{
"v" : 2,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "MUGDB.employees"
}
]
QUERY:
db.employees.find({"first_name":"Yvonne"}).sort({"last_name":1})
2017-05-29T09:54:07.829+0000 I COMMAND [conn286] command
MUGDB.employees appName: "MongoDB Shell" command: find { find: "employees",
filter: { first_name: "Yvonne" }, sort: { last_name: 1.0 } } planSummary: COLLSCAN
cursorid:69354336473 keysExamined:0 docsExamined:1010893 hasSortStage:1
numYields:7900 nreturned:101 reslen:39605 locks:{ Global: { acquireCount: { r:
15802 } }, Database: { acquireCount: { r: 7901 } }, Collection: { acquireCount: { r: 7901
} } } protocol:op_command 480ms
Ohhhh! Ok!
db.employees.find({"first_name":"Yvonne"}).sort({"last_name":1}).explain(true)
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "MUGDB.employees",
"indexFilterSet" : false,
"parsedQuery" : {
"first_name" : {
"$eq" : "Yvonne"
}
},
"winningPlan" : {
"stage" : "SORT",
"sortPattern" : {
"last_name" : 1
},
"inputStage" : {
"stage" :
"SORT_KEY_GENERATOR",
"inputStage" : {
"stage" :
"COLLSCAN",
"filter" : {
"first_name" : {
"$eq" : "Yvonne"
}
},
"direction" : "forward"
}
}
},
"rejectedPlans" : [ ]
},
"executionStats" : {
"executionSuccess" : true,
"nReturned" : 498,
"executionTimeMillis" : 480,
"totalKeysExamined" : 0,
"totalDocsExamined" : 1010893,
"executionStages" : {
"stage" : "SORT",
"nReturned" : 498,
"executionTimeMillisEstimate" : 0,
"works" : 1011395,
"advanced" : 498,
"needTime" : 1010896,
"needYield" : 0,
"saveState" : 7901,
"restoreState" : 7901,
"isEOF" : 1,
"invalidates" : 0,
"sortPattern" : {
"last_name" : 1
},
"memUsage" : 196424,
"memLimit" : 33554432,
"inputStage" : {
"stage" : "SORT_KEY_GENERATOR",
"nReturned" : 498,
"executionTimeMillisEstimate" : 0,
"works" : 1010896,
"advanced" : 498,
"needTime" : 1010397,
"needYield" : 0,
"saveState" : 7901,
"restoreState" : 7901,
"isEOF" : 1,
"invalidates" : 0,
"inputStage" : {
"stage" :
"COLLSCAN",
"filter" : {
"first_name" : {
"$eq" : "Yvonne"
}
},
"nReturned" : 498,
"executionTimeMillisEstimate" : 0,
"works" : 1010895,
"advanced" : 498,
"needTime" :
1010396,
"needYield" : 0,
"saveState" : 7901,
"restoreState" :
7901,
"isEOF" : 1,
"invalidates" : 0,
"allPlansExecution" : [ ]
},
"serverInfo" : {
"host" : "m312",
"port" : 30000,
"version" : "3.4.2",
"gitVersion" : "3f76e40c105fc223b3e5aac3e20dcd026b83b38b"
},
"ok" : 1
}
Create Index
db.employees.createIndex({"first_name":1, "last_name":1}
2017-05-29T10:05:48.432+0000 I COMMAND [conn286] command MUGDB.$cmd
appName: "MongoDB Shell" command: createIndexes { createIndexes: "employees",
indexes: [ { key: { first_name: 1.0, last_name: 1.0 }, name:
"first_name_1_last_name_1" } ] } numYields:0 reslen:98 locks:{ Global: {
acquireCount: { r: 2, w: 2 } }, Database: { acquireCount: { w: 1, W: 1 } }, Collection: {
acquireCount: { w: 1 } }, Metadata: { acquireCount: { w: 1 } }, oplog: { acquireCount: {
w: 1 } } } protocol:op_command 4578ms
MongoDB Enterprise m312RS:PRIMARY> db.employees.find({"first_name":"Yvonne"}).sort({"last_name":1}).explain(true)
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "MUGDB.employees",
"indexFilterSet" : false,
"parsedQuery" : {
"first_name" : {
"$eq" : "Yvonne"
}
},
"winningPlan" : {
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"first_name" : 1,
"last_name" : 1
},
"indexName" : "first_name_1_last_name_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"first_name" : [ ],
"last_name" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"first_name" : [
"["Yvonne", "Yvonne"]"
],
"last_name" : [
"[MinKey, MaxKey]"
]
}
}
},
"rejectedPlans" : [ ]
},
"executionStats" : {
"executionSuccess" : true,
"nReturned" : 498,
"executionTimeMillis" : 7,
"totalKeysExamined" : 498,
"totalDocsExamined" : 498,
"executionStages" : {
"stage" : "FETCH",
"nReturned" : 498,
"executionTimeMillisEstimate" : 0,
"works" : 499,
"advanced" : 498,
"needTime" : 0,
"needYield" : 0,
"saveState" : 3,
"restoreState" : 3,
"isEOF" : 1,
"invalidates" : 0,
"docsExamined" : 498,
"alreadyHasObj" : 0,
"inputStage" : {
"stage" : "IXSCAN",
"nReturned" : 498,
"executionTimeMillisEstimate" : 0,
"works" : 499,
"advanced" : 498,
"needTime" : 0,
"needYield" : 0,
"saveState" : 3,
"restoreState" : 3,
"isEOF" : 1,
"invalidates" : 0,
"keyPattern" : {
"first_name" : 1,
"last_name" : 1
},
"indexName" :
"first_name_1_last_name_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"first_name" : [ ],
"last_name" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"first_name" : [
"["Yvonne", "Yvonne"]"
],
"last_name" : [
"[MinKey, MaxKey]"
]
},
"keysExamined" : 498,
"seeks" : 1,
"dupsTested" : 0,
"dupsDropped" : 0,
"seenInvalidated" : 0
}
},
"allPlansExecution" : [ ]
},
"serverInfo" : {
"host" : "m312",
"port" : 30000,
"version" : "3.4.2",
"gitVersion" : "3f76e40c105fc223b3e5aac3e20dcd026b83b38b"
},
"ok" : 1
}
$indexStats
db.employees.aggregate( [ { $indexStats: { } } ] )
{ "name" : "_id_", "key" : { "_id" : 1 }, "host" : "m312:30000", "accesses" : { "ops" :
NumberLong(1), "since" : ISODate("2017-05-29T09:36:42.253Z") } }
{ "name" : "first_name_1_last_name_1", "key" : { "first_name" : 1, "last_name" : 1 },
"host" : "m312:30000", "accesses" : { "ops" : NumberLong(1), "since" :
ISODate("2017-05-29T10:05:43.856Z") } }
To Be Continued… Questions?
When?
• Next MUG
• Focus Point?
• Which other performance issues would you like to talk about?
What else can I check?
MongoDB University Free Courses ( https://university.mongodb.com/ )
• M201: MongoDB Performance
• M312: Diagnostics and Debugging

More Related Content

What's hot

Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019
Thijs Feryn
 
WebCamp: Developer Day: Web Security: Cookies, Domains and CORS - Юрий Чайков...
WebCamp: Developer Day: Web Security: Cookies, Domains and CORS - Юрий Чайков...WebCamp: Developer Day: Web Security: Cookies, Domains and CORS - Юрий Чайков...
WebCamp: Developer Day: Web Security: Cookies, Domains and CORS - Юрий Чайков...
GeeksLab Odessa
 
Top 10 F5 iRules to migrate to a modern load balancing platform
Top 10 F5 iRules to migrate to a modern load balancing platformTop 10 F5 iRules to migrate to a modern load balancing platform
Top 10 F5 iRules to migrate to a modern load balancing platform
Avi Networks
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
clkao
 
php plus mysql
php plus mysqlphp plus mysql
php plus mysql
Jayson de Leon
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
MongoDB
 
Security: Odoo Code Hardening
Security: Odoo Code HardeningSecurity: Odoo Code Hardening
Security: Odoo Code Hardening
Odoo
 
rsyslog v8: more than just syslog!
rsyslog v8: more than just syslog!rsyslog v8: more than just syslog!
rsyslog v8: more than just syslog!
Yury Bushmelev
 
R57shell
R57shellR57shell
R57shell
ady36
 
Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014
Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014
Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014
Cliff Seal
 
20110514 mongo dbチューニング
20110514 mongo dbチューニング20110514 mongo dbチューニング
20110514 mongo dbチューニング
Yuichi Matsuo
 
JavaScript Proxy (ES6)
JavaScript Proxy (ES6)JavaScript Proxy (ES6)
JavaScript Proxy (ES6)
Aries Cs
 
Php 101: PDO
Php 101: PDOPhp 101: PDO
Php 101: PDO
Jeremy Kendall
 
Gta v savegame
Gta v savegameGta v savegame
Gta v savegame
hozayfa999
 
DevOps Fest 2019. Сергей Марченко. Terraform: a novel about modules, provider...
DevOps Fest 2019. Сергей Марченко. Terraform: a novel about modules, provider...DevOps Fest 2019. Сергей Марченко. Terraform: a novel about modules, provider...
DevOps Fest 2019. Сергей Марченко. Terraform: a novel about modules, provider...
DevOps_Fest
 
Search Evolution - Von Lucene zu Solr und ElasticSearch
Search Evolution - Von Lucene zu Solr und ElasticSearchSearch Evolution - Von Lucene zu Solr und ElasticSearch
Search Evolution - Von Lucene zu Solr und ElasticSearch
Florian Hopf
 
quick json parser
quick json parserquick json parser
quick json parser
Rajesh Putta
 
Agile Testing Days 2018 - API Fundamentals - postman collection
Agile Testing Days 2018 - API Fundamentals - postman collectionAgile Testing Days 2018 - API Fundamentals - postman collection
Agile Testing Days 2018 - API Fundamentals - postman collection
JoEllen Carter
 
Api docs v3.0
Api docs v3.0Api docs v3.0
Api docs v3.0
Anh Tuan
 
Mongodb debugging-performance-problems
Mongodb debugging-performance-problemsMongodb debugging-performance-problems
Mongodb debugging-performance-problems
MongoDB
 

What's hot (20)

Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019
 
WebCamp: Developer Day: Web Security: Cookies, Domains and CORS - Юрий Чайков...
WebCamp: Developer Day: Web Security: Cookies, Domains and CORS - Юрий Чайков...WebCamp: Developer Day: Web Security: Cookies, Domains and CORS - Юрий Чайков...
WebCamp: Developer Day: Web Security: Cookies, Domains and CORS - Юрий Чайков...
 
Top 10 F5 iRules to migrate to a modern load balancing platform
Top 10 F5 iRules to migrate to a modern load balancing platformTop 10 F5 iRules to migrate to a modern load balancing platform
Top 10 F5 iRules to migrate to a modern load balancing platform
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
 
php plus mysql
php plus mysqlphp plus mysql
php plus mysql
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
 
Security: Odoo Code Hardening
Security: Odoo Code HardeningSecurity: Odoo Code Hardening
Security: Odoo Code Hardening
 
rsyslog v8: more than just syslog!
rsyslog v8: more than just syslog!rsyslog v8: more than just syslog!
rsyslog v8: more than just syslog!
 
R57shell
R57shellR57shell
R57shell
 
Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014
Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014
Temporary Cache Assistance (Transients API): WordCamp Phoenix 2014
 
20110514 mongo dbチューニング
20110514 mongo dbチューニング20110514 mongo dbチューニング
20110514 mongo dbチューニング
 
JavaScript Proxy (ES6)
JavaScript Proxy (ES6)JavaScript Proxy (ES6)
JavaScript Proxy (ES6)
 
Php 101: PDO
Php 101: PDOPhp 101: PDO
Php 101: PDO
 
Gta v savegame
Gta v savegameGta v savegame
Gta v savegame
 
DevOps Fest 2019. Сергей Марченко. Terraform: a novel about modules, provider...
DevOps Fest 2019. Сергей Марченко. Terraform: a novel about modules, provider...DevOps Fest 2019. Сергей Марченко. Terraform: a novel about modules, provider...
DevOps Fest 2019. Сергей Марченко. Terraform: a novel about modules, provider...
 
Search Evolution - Von Lucene zu Solr und ElasticSearch
Search Evolution - Von Lucene zu Solr und ElasticSearchSearch Evolution - Von Lucene zu Solr und ElasticSearch
Search Evolution - Von Lucene zu Solr und ElasticSearch
 
quick json parser
quick json parserquick json parser
quick json parser
 
Agile Testing Days 2018 - API Fundamentals - postman collection
Agile Testing Days 2018 - API Fundamentals - postman collectionAgile Testing Days 2018 - API Fundamentals - postman collection
Agile Testing Days 2018 - API Fundamentals - postman collection
 
Api docs v3.0
Api docs v3.0Api docs v3.0
Api docs v3.0
 
Mongodb debugging-performance-problems
Mongodb debugging-performance-problemsMongodb debugging-performance-problems
Mongodb debugging-performance-problems
 

Similar to Mug17 gurgaon

Webinar: Index Tuning and Evaluation
Webinar: Index Tuning and EvaluationWebinar: Index Tuning and Evaluation
Webinar: Index Tuning and Evaluation
MongoDB
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
MongoDB
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
DataStax Academy
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
Edward Capriolo
 
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
Codemotion
 
(SDD411) Amazon CloudSearch Deep Dive and Best Practices | AWS re:Invent 2014
(SDD411) Amazon CloudSearch Deep Dive and Best Practices | AWS re:Invent 2014(SDD411) Amazon CloudSearch Deep Dive and Best Practices | AWS re:Invent 2014
(SDD411) Amazon CloudSearch Deep Dive and Best Practices | AWS re:Invent 2014
Amazon Web Services
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
Francois Zaninotto
 
AST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptAST - the only true tool for building JavaScript
AST - the only true tool for building JavaScript
Ingvar Stepanyan
 
Splitapp coding
Splitapp codingSplitapp coding
Splitapp coding
Kannan Selvam
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
Jie-Wei Wu
 
GraphQL Los Angeles Meetup Slides
GraphQL Los Angeles Meetup SlidesGraphQL Los Angeles Meetup Slides
GraphQL Los Angeles Meetup Slides
Grant Miller
 
Unit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and NodeUnit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and Node
Josh Mock
 
Keeping Spark on Track: Productionizing Spark for ETL
Keeping Spark on Track: Productionizing Spark for ETLKeeping Spark on Track: Productionizing Spark for ETL
Keeping Spark on Track: Productionizing Spark for ETL
Databricks
 
NodeJs
NodeJsNodeJs
NodeJs
dizabl
 
d3sparql.js demo at SWAT4LS 2014 in Berlin
d3sparql.js demo at SWAT4LS 2014 in Berlind3sparql.js demo at SWAT4LS 2014 in Berlin
d3sparql.js demo at SWAT4LS 2014 in Berlin
Toshiaki Katayama
 
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
South Tyrol Free Software Conference
 
Elastic tire demo
Elastic tire demoElastic tire demo
Elastic tire demo
Scott Hamilton
 
Introduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-finalIntroduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-final
M Malai
 
Introduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerIntroduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizer
Mydbops
 
JSLT: JSON querying and transformation
JSLT: JSON querying and transformationJSLT: JSON querying and transformation
JSLT: JSON querying and transformation
Lars Marius Garshol
 

Similar to Mug17 gurgaon (20)

Webinar: Index Tuning and Evaluation
Webinar: Index Tuning and EvaluationWebinar: Index Tuning and Evaluation
Webinar: Index Tuning and Evaluation
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
 
(SDD411) Amazon CloudSearch Deep Dive and Best Practices | AWS re:Invent 2014
(SDD411) Amazon CloudSearch Deep Dive and Best Practices | AWS re:Invent 2014(SDD411) Amazon CloudSearch Deep Dive and Best Practices | AWS re:Invent 2014
(SDD411) Amazon CloudSearch Deep Dive and Best Practices | AWS re:Invent 2014
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
AST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptAST - the only true tool for building JavaScript
AST - the only true tool for building JavaScript
 
Splitapp coding
Splitapp codingSplitapp coding
Splitapp coding
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
GraphQL Los Angeles Meetup Slides
GraphQL Los Angeles Meetup SlidesGraphQL Los Angeles Meetup Slides
GraphQL Los Angeles Meetup Slides
 
Unit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and NodeUnit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and Node
 
Keeping Spark on Track: Productionizing Spark for ETL
Keeping Spark on Track: Productionizing Spark for ETLKeeping Spark on Track: Productionizing Spark for ETL
Keeping Spark on Track: Productionizing Spark for ETL
 
NodeJs
NodeJsNodeJs
NodeJs
 
d3sparql.js demo at SWAT4LS 2014 in Berlin
d3sparql.js demo at SWAT4LS 2014 in Berlind3sparql.js demo at SWAT4LS 2014 in Berlin
d3sparql.js demo at SWAT4LS 2014 in Berlin
 
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
 
Elastic tire demo
Elastic tire demoElastic tire demo
Elastic tire demo
 
Introduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-finalIntroduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-final
 
Introduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerIntroduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizer
 
JSLT: JSON querying and transformation
JSLT: JSON querying and transformationJSLT: JSON querying and transformation
JSLT: JSON querying and transformation
 

More from Ankur Raina

Introduction to MongoDB at IGDTUW
Introduction to MongoDB at IGDTUWIntroduction to MongoDB at IGDTUW
Introduction to MongoDB at IGDTUW
Ankur Raina
 
PyMongo for PyCon First Draft
PyMongo for PyCon First DraftPyMongo for PyCon First Draft
PyMongo for PyCon First Draft
Ankur Raina
 
Ankur py mongo.pptx
Ankur py mongo.pptxAnkur py mongo.pptx
Ankur py mongo.pptx
Ankur Raina
 
E
EE
Oracle SQL Basics by Ankur Raina
Oracle SQL Basics by Ankur RainaOracle SQL Basics by Ankur Raina
Oracle SQL Basics by Ankur Raina
Ankur Raina
 
Cloud computing
Cloud computingCloud computing
Cloud computing
Ankur Raina
 
Sql project presentation
Sql project presentationSql project presentation
Sql project presentation
Ankur Raina
 
Big data
Big dataBig data
Big data
Ankur Raina
 

More from Ankur Raina (8)

Introduction to MongoDB at IGDTUW
Introduction to MongoDB at IGDTUWIntroduction to MongoDB at IGDTUW
Introduction to MongoDB at IGDTUW
 
PyMongo for PyCon First Draft
PyMongo for PyCon First DraftPyMongo for PyCon First Draft
PyMongo for PyCon First Draft
 
Ankur py mongo.pptx
Ankur py mongo.pptxAnkur py mongo.pptx
Ankur py mongo.pptx
 
E
EE
E
 
Oracle SQL Basics by Ankur Raina
Oracle SQL Basics by Ankur RainaOracle SQL Basics by Ankur Raina
Oracle SQL Basics by Ankur Raina
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
Sql project presentation
Sql project presentationSql project presentation
Sql project presentation
 
Big data
Big dataBig data
Big data
 

Recently uploaded

How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
Techgropse Pvt.Ltd.
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
FODUU
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
Claudio Di Ciccio
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 

Recently uploaded (20)

How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 

Mug17 gurgaon

  • 2.
  • 4. Performance Tuning vs Optimizing • Optimizing – Opportunity to restructure your application, data model, and queries • Performance Tuning – Experiment and modify system
  • 5. Hardware CPU / RAM / HDD / OS Topology / Network / Hosting Application Input - sources of write traffic Output - sources of query load Schema MongoDB Replica-set configuration, tags, read & write concern Shard configuration, tags, shard keys Where to Focus?
  • 7. Log files, Profiler, Query Optimizer mongod log file profiler (collection) query engine
  • 9. Explain Levels in MongoDB 3.x • queryPlanner (default level): runs the query planner and chooses the winning plan without actually executing the query – Use case: "Which plan will MongoDB choose to run my query?" • executionStats – runs the query optimizer, then runs the winning plan to completion – Use case: "How is my query performing?" • allPlansExecution – same as executionStats, but returns all the query plans, not just the winning plan. – Use case: "I want as much information as possible to diagnose a slow query."
  • 10. db.employees.findOne() { "_id" : ObjectId("592bebaa7761b028cdec1b6f"), "last_name" : "Pham", "quote" : "Aliquam est reiciendis alias neque ad.", "job" : "Counselling psychologist", "ssn" : "401-31-6615", "address" : { "city" : "Lake Meaganton", "state" : "Idaho", "street" : "83248 Woods Extension", "zip" : "10914-3394" }, "first_name" : "Yvonne", "company_id" : ObjectId("58bdbe32500b1d42c7e10be7"), "employer" : "Terry and Sons", "birthday" : ISODate("2011-04-17T21:19:28Z"), "email" : "murillobrian@cox.net" } db.employees.count() 1010893 db.employees.getIndexes() [ { "v" : 2, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "MUGDB.employees" } ]
  • 11. QUERY: db.employees.find({"first_name":"Yvonne"}).sort({"last_name":1}) 2017-05-29T09:54:07.829+0000 I COMMAND [conn286] command MUGDB.employees appName: "MongoDB Shell" command: find { find: "employees", filter: { first_name: "Yvonne" }, sort: { last_name: 1.0 } } planSummary: COLLSCAN cursorid:69354336473 keysExamined:0 docsExamined:1010893 hasSortStage:1 numYields:7900 nreturned:101 reslen:39605 locks:{ Global: { acquireCount: { r: 15802 } }, Database: { acquireCount: { r: 7901 } }, Collection: { acquireCount: { r: 7901 } } } protocol:op_command 480ms
  • 13. { "queryPlanner" : { "plannerVersion" : 1, "namespace" : "MUGDB.employees", "indexFilterSet" : false, "parsedQuery" : { "first_name" : { "$eq" : "Yvonne" } }, "winningPlan" : { "stage" : "SORT", "sortPattern" : { "last_name" : 1 }, "inputStage" : { "stage" : "SORT_KEY_GENERATOR", "inputStage" : { "stage" : "COLLSCAN", "filter" : { "first_name" : { "$eq" : "Yvonne" } }, "direction" : "forward" } } }, "rejectedPlans" : [ ] },
  • 14. "executionStats" : { "executionSuccess" : true, "nReturned" : 498, "executionTimeMillis" : 480, "totalKeysExamined" : 0, "totalDocsExamined" : 1010893, "executionStages" : { "stage" : "SORT", "nReturned" : 498, "executionTimeMillisEstimate" : 0, "works" : 1011395, "advanced" : 498, "needTime" : 1010896, "needYield" : 0, "saveState" : 7901, "restoreState" : 7901, "isEOF" : 1, "invalidates" : 0, "sortPattern" : { "last_name" : 1 }, "memUsage" : 196424, "memLimit" : 33554432, "inputStage" : { "stage" : "SORT_KEY_GENERATOR", "nReturned" : 498, "executionTimeMillisEstimate" : 0, "works" : 1010896, "advanced" : 498, "needTime" : 1010397, "needYield" : 0, "saveState" : 7901, "restoreState" : 7901, "isEOF" : 1, "invalidates" : 0, "inputStage" : { "stage" : "COLLSCAN", "filter" : { "first_name" : { "$eq" : "Yvonne" } }, "nReturned" : 498, "executionTimeMillisEstimate" : 0, "works" : 1010895, "advanced" : 498, "needTime" : 1010396, "needYield" : 0, "saveState" : 7901, "restoreState" : 7901, "isEOF" : 1, "invalidates" : 0,
  • 15. "allPlansExecution" : [ ] }, "serverInfo" : { "host" : "m312", "port" : 30000, "version" : "3.4.2", "gitVersion" : "3f76e40c105fc223b3e5aac3e20dcd026b83b38b" }, "ok" : 1 }
  • 16. Create Index db.employees.createIndex({"first_name":1, "last_name":1} 2017-05-29T10:05:48.432+0000 I COMMAND [conn286] command MUGDB.$cmd appName: "MongoDB Shell" command: createIndexes { createIndexes: "employees", indexes: [ { key: { first_name: 1.0, last_name: 1.0 }, name: "first_name_1_last_name_1" } ] } numYields:0 reslen:98 locks:{ Global: { acquireCount: { r: 2, w: 2 } }, Database: { acquireCount: { w: 1, W: 1 } }, Collection: { acquireCount: { w: 1 } }, Metadata: { acquireCount: { w: 1 } }, oplog: { acquireCount: { w: 1 } } } protocol:op_command 4578ms
  • 17. MongoDB Enterprise m312RS:PRIMARY> db.employees.find({"first_name":"Yvonne"}).sort({"last_name":1}).explain(true) { "queryPlanner" : { "plannerVersion" : 1, "namespace" : "MUGDB.employees", "indexFilterSet" : false, "parsedQuery" : { "first_name" : { "$eq" : "Yvonne" } }, "winningPlan" : { "stage" : "FETCH", "inputStage" : { "stage" : "IXSCAN", "keyPattern" : { "first_name" : 1, "last_name" : 1 }, "indexName" : "first_name_1_last_name_1", "isMultiKey" : false, "multiKeyPaths" : { "first_name" : [ ], "last_name" : [ ] }, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 2, "direction" : "forward",
  • 18. "indexBounds" : { "first_name" : [ "["Yvonne", "Yvonne"]" ], "last_name" : [ "[MinKey, MaxKey]" ] } } }, "rejectedPlans" : [ ] }, "executionStats" : { "executionSuccess" : true, "nReturned" : 498, "executionTimeMillis" : 7, "totalKeysExamined" : 498, "totalDocsExamined" : 498, "executionStages" : { "stage" : "FETCH", "nReturned" : 498, "executionTimeMillisEstimate" : 0, "works" : 499, "advanced" : 498, "needTime" : 0, "needYield" : 0, "saveState" : 3, "restoreState" : 3, "isEOF" : 1, "invalidates" : 0, "docsExamined" : 498, "alreadyHasObj" : 0, "inputStage" : {
  • 19. "stage" : "IXSCAN", "nReturned" : 498, "executionTimeMillisEstimate" : 0, "works" : 499, "advanced" : 498, "needTime" : 0, "needYield" : 0, "saveState" : 3, "restoreState" : 3, "isEOF" : 1, "invalidates" : 0, "keyPattern" : { "first_name" : 1, "last_name" : 1 }, "indexName" : "first_name_1_last_name_1", "isMultiKey" : false, "multiKeyPaths" : { "first_name" : [ ], "last_name" : [ ] }, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 2, "direction" : "forward", "indexBounds" : { "first_name" : [ "["Yvonne", "Yvonne"]" ], "last_name" : [ "[MinKey, MaxKey]" ] }, "keysExamined" : 498, "seeks" : 1, "dupsTested" : 0, "dupsDropped" : 0, "seenInvalidated" : 0 } }, "allPlansExecution" : [ ] }, "serverInfo" : { "host" : "m312", "port" : 30000, "version" : "3.4.2", "gitVersion" : "3f76e40c105fc223b3e5aac3e20dcd026b83b38b" }, "ok" : 1 }
  • 20. $indexStats db.employees.aggregate( [ { $indexStats: { } } ] ) { "name" : "_id_", "key" : { "_id" : 1 }, "host" : "m312:30000", "accesses" : { "ops" : NumberLong(1), "since" : ISODate("2017-05-29T09:36:42.253Z") } } { "name" : "first_name_1_last_name_1", "key" : { "first_name" : 1, "last_name" : 1 }, "host" : "m312:30000", "accesses" : { "ops" : NumberLong(1), "since" : ISODate("2017-05-29T10:05:43.856Z") } }
  • 21. To Be Continued… Questions? When? • Next MUG • Focus Point? • Which other performance issues would you like to talk about? What else can I check? MongoDB University Free Courses ( https://university.mongodb.com/ ) • M201: MongoDB Performance • M312: Diagnostics and Debugging