SlideShare a Scribd company logo
Application Development Series
Back to Basics
Monitoring & Performance Tuning
Daniel Roberts
@dmroberts
#MongoDBBasics
2
• Recap from last session
• Monitoring Tools
– MongoDB command line and shell
• Key Metrics in MongoDB
• Logs
– Log levels
– mtools
• Disk saturation
Agenda
3
• Virtual Genius Bar
– Use the chat to post
questions
– EMEA Solution
Architecture / Support
team are on hand
– Make use of them
during the sessions!!!
Q & A
Recap from last time….
5
• mongodump & mongorestore
• File system copy
• Files system snapshot
• Don’t use mongoimport & mongoexport!
Backup Tools & Approaches
//mongodump Example
server> mongodump -h myhost -d cms -c articles
6
• Creates a .bson file
– (and a json metadata
file)
– Over network or direct
from file system.
Mongodump
>mongodump –h myhost -d cms -c articles
connected to: myhost
2014-04-16T12:54:56.758+0100 DATABASE: cms to dump/cms
2014-04-16T12:54:56.759+0100 cms.articles to
dump/cms/articles.bson
2014-04-16T12:54:56.816+0100 7 documents
2014-04-16T12:54:56.817+0100 Metadata for cms.articles to
dump/cms/articles.metadata.json
7
• Use secondary for backup
– Or hidden secondary
• Fsync+Lock
• Balance off
– In sharded cluster
Backup Architecture
mongodump
Monitoring Tools
9
• Key MongoDB tools
– Mongostat
– Mongo shell
– Mongo Management Service mms
• Mtools
– Logs
• OS
– iostat
Tools
10
MMS Architecture
11
MMS Alerts
12
Metrics Collection and Reporting
13
Logs and Profile data
14
• Access to key statistics
– Connect to mongod or mongos for sharded cluster stats
– Shows, operations per second, memory usage, page faults, queues and more
Mongostat
>mongostat -h localhost --port 27017
connected to: localhost:27017
insert query update delete getmore command flushes mapped vsize res faults locked db idx miss % qr|qw ar|aw
netIn netOut conn time
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:24
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:25
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:26
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:27
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:28
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:29
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:30
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:31
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.1% 0 0|0 0|0 62b 5k 2 09:08:32
*0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:33
15
• Commands for access metrics
– db.serverStatus()
– workingSet analyzer
Mongo shell
//to access a subset of serverStatus output specify the sub document
>db.serverStatus().mem
{
"bits" : 64,
"resident" : 266,
"virtual" : 5920,
"supported" : true,
"mapped" : 1712,
"mappedWithJournal" : 3424
}
16
• Estimates the ‘working set’ of the database
– Number of ‘pagesInMemory’ accessed in RAM over
‘overSeconds’ number of seconds.
– Default Page is 4k
– overSecond – delta between oldest and newest
WorkingSet analyzer
>db.serverStatus({ workingSet : 1 })
{
"note" : "thisIsAnEstimate",
"pagesInMemory" : 723,
"computationTimeMicros" : 4601,
"overSeconds" : 2311
}
overSeconds
decreasing or small,
workingSet could be
larger than RAM
MongoDB Metrics
18
• Queued readers | writers
• Page faults
• OpCounters
• Background flush process
• Memory usage
• Lock %
• Btree misses
• connections
Key Metrics
Available from :
• MMS
• db.serverStatus()
• mongostat
19
Queued Reader | Writers
• Number of
operations waiting
for:
• Read Lock
• Write Lock
20
Page Faults
• How often we are
going to disk to
retrieve data?
• Can be a problem if disk IO
is saturated
• Combine with iostat
21
Background Flush Process
• Length of time to
flush data back to
disk
• Again can point to
disk saturation.
22
Memory
• Virtual
• Mapped
• Resident
23
Lock %
• Percentage of time
in the global lock
24
btree
• Accesses
• Hits
• Misses
• Bad!
• Points to Indexes
not in RAM
25
connections
• Connections to the
database
• Growing over time?
• Check pool logic
in your
application code.
Logs
27
• Increase the log level
– See further insight to operation performance
– Index efficiency
– Document moves
– Operation time
Set log level
//Increase log level verbosity from the shell
> db.adminCommand( { setParameter:1, logLevel:1 } )
{ "was" : 0, "ok" : 1 }
>
-v [ --verbose ] be more verbose (include multiple times for more
verbosity e.g. -vvvvv)
28
• Pinpoint problems
– In this example we can see that there has been a document move.
Log output example
2014-05-02T13:55:02.047+0100 [conn7] update cms.articles query: {
_id: ObjectId('532198379fb5ba99a6bd4063') } update: { $inc: {
comment_count: 1 }, $push: { comments: { $each: [ { date: new
Date(1399035302013), text: "Data locality provides an amazing
performance boost over relational" } ], $slice: -10, $sort: { date: 1 } } } }
nscanned:1 nscannedObjects:1 nmoved:1 nMatched:1 nModified:1
keyUpdates:0 numYields:0 locks(micros) w:33529 33ms
29
• Log analysis (example syntax)
– Show me queries that took more than 1000 ms from 6
am to 6 pm:
• Now, graph those queries:
mtools
prompt> mlogfilter mongodb.log --from 06:00 --to 18:00 --
slow 1000 > mongodb-filtered.log
prompt> mplotqueries --logscale mongodb-filtered.log
30
mtools output
Disk saturation
32
• iostat
– Disk IO usage
– Use to review % utilisation of disk
– High %
• If it’s sustained, you may need to increase disk IO.
– Sharding
– RAID 1+0
– Partitioning on different disk
– Provisioned IOPS
OS Tools and Paramenters
prompt> iostat –xmt 1
Summary
34
• Monitor regularly
– Set alerts for changes
• Quick check with command line and shell
• View trends with MMS graphs over time
• High levels of utilisation
– Increase RAM, disk IO
– Scale out
– (Having first checked Indexes etc!)
• Database profiler (covered in Indexing session)
Summary
1404   app dev series - session 8 - monitoring & performance tuning

More Related Content

PDF
Gnocchi v3
PDF
Gnocchi v4 (preview)
PDF
Gnocchi Profiling v2
PPTX
opentsdb in a real enviroment
PDF
Gnocchi Profiling 2.1.x
PPTX
Monitoring MySQL with OpenTSDB
PDF
Gnocchi v4 - past and present
PDF
Gnocchi v3 brownbag
Gnocchi v3
Gnocchi v4 (preview)
Gnocchi Profiling v2
opentsdb in a real enviroment
Gnocchi Profiling 2.1.x
Monitoring MySQL with OpenTSDB
Gnocchi v4 - past and present
Gnocchi v3 brownbag

What's hot (20)

PDF
Clickhouse Capacity Planning for OLAP Workloads, Mik Kocikowski of CloudFlare
PPTX
HBaseCon 2013: OpenTSDB at Box
PDF
ITB2019 Faster DB Development with QB - Andrew Davis
PDF
Unified Data Platform, by Pauline Yeung of Cisco Systems
PDF
MongoDB Drivers And High Availability: Deep Dive
PDF
"Работа с утечками в V8", Роман Кривцов, MoscowJS 19
PPTX
Exploring Parallel Merging In GPU Based Systems Using CUDA C.
PPTX
Cassandra Backups and Restorations Using Ansible (Joshua Wickman, Knewton) | ...
PDF
Neo4j after 1 year in production
PDF
Big Data and Beautiful Video: How ClickHouse enables Mux to Deliver Content a...
PDF
Anatomy of an action
PDF
Encrypted DNS research @ nic.at
PPTX
DUMP-2013 Serverside - О хранилище “Зебра” - Казаков Александр
PDF
Building a Fast, Resilient Time Series Store with Cassandra (Alex Petrov, Dat...
PDF
Storing metrics at scale with Gnocchi
PPTX
MongoDB - External Authentication
PDF
Dangerous on ClickHouse in 30 minutes, by Robert Hodges, Altinity CEO
PDF
Mux loves Clickhouse. By Adam Brown, Mux founder
PPTX
MongoSF 2011 - Using MongoDB for IGN's Social Platform
PDF
20140513_jeffyang_demo_openstack
Clickhouse Capacity Planning for OLAP Workloads, Mik Kocikowski of CloudFlare
HBaseCon 2013: OpenTSDB at Box
ITB2019 Faster DB Development with QB - Andrew Davis
Unified Data Platform, by Pauline Yeung of Cisco Systems
MongoDB Drivers And High Availability: Deep Dive
"Работа с утечками в V8", Роман Кривцов, MoscowJS 19
Exploring Parallel Merging In GPU Based Systems Using CUDA C.
Cassandra Backups and Restorations Using Ansible (Joshua Wickman, Knewton) | ...
Neo4j after 1 year in production
Big Data and Beautiful Video: How ClickHouse enables Mux to Deliver Content a...
Anatomy of an action
Encrypted DNS research @ nic.at
DUMP-2013 Serverside - О хранилище “Зебра” - Казаков Александр
Building a Fast, Resilient Time Series Store with Cassandra (Alex Petrov, Dat...
Storing metrics at scale with Gnocchi
MongoDB - External Authentication
Dangerous on ClickHouse in 30 minutes, by Robert Hodges, Altinity CEO
Mux loves Clickhouse. By Adam Brown, Mux founder
MongoSF 2011 - Using MongoDB for IGN's Social Platform
20140513_jeffyang_demo_openstack
Ad

Viewers also liked (20)

PPTX
Zencillo connect
PDF
Marco Curriclar Programa de Salud
PDF
MachinePoint Food Technologies
PDF
Revista "Per & Sis", nº 3 - Mayo, 2012
PPTX
Cluster Turismo guajira
PDF
Daniel Berchtold, Head Business Unit Rail Automation, Schweizer Electronic
PPT
Proyecto de la comunidad
PDF
Navidad Laúd s.a.s.
PDF
Extracción de Requerimientos
PDF
Derecho deportivo comparado reglamento de intermediarios
PDF
Beyond the Web-Based e-Communication Dashboard:Unleashing the True Value of P...
PDF
Curriculum 12
PDF
Renderfarm studios procesos y transmedia
PDF
Deadpool mata o universo marvel #2301
PPTX
La Drogadicción por Mayra Robles
PPT
Sistema ahorro agua
 
PPTX
Creatividad informática
 
PDF
Res 5170 salas maternales
PDF
Comparison of Mobile Social Networks
PPTX
IoT
Zencillo connect
Marco Curriclar Programa de Salud
MachinePoint Food Technologies
Revista "Per & Sis", nº 3 - Mayo, 2012
Cluster Turismo guajira
Daniel Berchtold, Head Business Unit Rail Automation, Schweizer Electronic
Proyecto de la comunidad
Navidad Laúd s.a.s.
Extracción de Requerimientos
Derecho deportivo comparado reglamento de intermediarios
Beyond the Web-Based e-Communication Dashboard:Unleashing the True Value of P...
Curriculum 12
Renderfarm studios procesos y transmedia
Deadpool mata o universo marvel #2301
La Drogadicción por Mayra Robles
Sistema ahorro agua
 
Creatividad informática
 
Res 5170 salas maternales
Comparison of Mobile Social Networks
IoT
Ad

Similar to 1404 app dev series - session 8 - monitoring & performance tuning (20)

PDF
MongoDB and server performance
PPTX
Performance Tuning Cheat Sheet for MongoDB
PDF
10 Key MongoDB Performance Indicators
PPTX
Monitoring MongoDB’s Engines in the Wild
DOCX
What is the significance of MongoDB and what are its usages.docx
PDF
MongoDB Tokyo - Monitoring and Queueing
KEY
Deployment Strategy
KEY
MongoDB Command Line Tools
PDF
Mongo nyc nyt + mongodb
PDF
Mongo db pefrormance tuning with MMS
PDF
Shaping the Future of Travel with MongoDB
KEY
Deployment Strategies (Mongo Austin)
PPTX
Deployment Preparedness
PPTX
Performance Tuning and Optimization
PDF
Silicon Valley Code Camp 2014 - Advanced MongoDB
PPTX
PPTX
Dev Jumpstart: Build Your First App with MongoDB
PPTX
MongoDB Memory Management Demystified
PPTX
Conceptos básicos. Seminario web 6: Despliegue de producción
PDF
Mongo performance tuning: tips and tricks
MongoDB and server performance
Performance Tuning Cheat Sheet for MongoDB
10 Key MongoDB Performance Indicators
Monitoring MongoDB’s Engines in the Wild
What is the significance of MongoDB and what are its usages.docx
MongoDB Tokyo - Monitoring and Queueing
Deployment Strategy
MongoDB Command Line Tools
Mongo nyc nyt + mongodb
Mongo db pefrormance tuning with MMS
Shaping the Future of Travel with MongoDB
Deployment Strategies (Mongo Austin)
Deployment Preparedness
Performance Tuning and Optimization
Silicon Valley Code Camp 2014 - Advanced MongoDB
Dev Jumpstart: Build Your First App with MongoDB
MongoDB Memory Management Demystified
Conceptos básicos. Seminario web 6: Despliegue de producción
Mongo performance tuning: tips and tricks

More from MongoDB (20)

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

Recently uploaded (20)

PDF
Mushroom cultivation and it's methods.pdf
PPTX
1. Introduction to Computer Programming.pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
cloud_computing_Infrastucture_as_cloud_p
PPTX
A Presentation on Artificial Intelligence
PDF
August Patch Tuesday
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
Mushroom cultivation and it's methods.pdf
1. Introduction to Computer Programming.pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Univ-Connecticut-ChatGPT-Presentaion.pdf
A comparative study of natural language inference in Swahili using monolingua...
Heart disease approach using modified random forest and particle swarm optimi...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Building Integrated photovoltaic BIPV_UPV.pdf
A comparative analysis of optical character recognition models for extracting...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
cloud_computing_Infrastucture_as_cloud_p
A Presentation on Artificial Intelligence
August Patch Tuesday
Per capita expenditure prediction using model stacking based on satellite ima...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Tartificialntelligence_presentation.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Spectral efficient network and resource selection model in 5G networks

1404 app dev series - session 8 - monitoring & performance tuning

  • 1. Application Development Series Back to Basics Monitoring & Performance Tuning Daniel Roberts @dmroberts #MongoDBBasics
  • 2. 2 • Recap from last session • Monitoring Tools – MongoDB command line and shell • Key Metrics in MongoDB • Logs – Log levels – mtools • Disk saturation Agenda
  • 3. 3 • Virtual Genius Bar – Use the chat to post questions – EMEA Solution Architecture / Support team are on hand – Make use of them during the sessions!!! Q & A
  • 4. Recap from last time….
  • 5. 5 • mongodump & mongorestore • File system copy • Files system snapshot • Don’t use mongoimport & mongoexport! Backup Tools & Approaches //mongodump Example server> mongodump -h myhost -d cms -c articles
  • 6. 6 • Creates a .bson file – (and a json metadata file) – Over network or direct from file system. Mongodump >mongodump –h myhost -d cms -c articles connected to: myhost 2014-04-16T12:54:56.758+0100 DATABASE: cms to dump/cms 2014-04-16T12:54:56.759+0100 cms.articles to dump/cms/articles.bson 2014-04-16T12:54:56.816+0100 7 documents 2014-04-16T12:54:56.817+0100 Metadata for cms.articles to dump/cms/articles.metadata.json
  • 7. 7 • Use secondary for backup – Or hidden secondary • Fsync+Lock • Balance off – In sharded cluster Backup Architecture mongodump
  • 9. 9 • Key MongoDB tools – Mongostat – Mongo shell – Mongo Management Service mms • Mtools – Logs • OS – iostat Tools
  • 14. 14 • Access to key statistics – Connect to mongod or mongos for sharded cluster stats – Shows, operations per second, memory usage, page faults, queues and more Mongostat >mongostat -h localhost --port 27017 connected to: localhost:27017 insert query update delete getmore command flushes mapped vsize res faults locked db idx miss % qr|qw ar|aw netIn netOut conn time *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:24 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:25 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:26 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:27 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:28 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:29 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:30 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:31 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.1% 0 0|0 0|0 62b 5k 2 09:08:32 *0 *0 *0 *0 0 1|0 0 1.67g 5.78g 29m 0 .:0.0% 0 0|0 0|0 62b 5k 2 09:08:33
  • 15. 15 • Commands for access metrics – db.serverStatus() – workingSet analyzer Mongo shell //to access a subset of serverStatus output specify the sub document >db.serverStatus().mem { "bits" : 64, "resident" : 266, "virtual" : 5920, "supported" : true, "mapped" : 1712, "mappedWithJournal" : 3424 }
  • 16. 16 • Estimates the ‘working set’ of the database – Number of ‘pagesInMemory’ accessed in RAM over ‘overSeconds’ number of seconds. – Default Page is 4k – overSecond – delta between oldest and newest WorkingSet analyzer >db.serverStatus({ workingSet : 1 }) { "note" : "thisIsAnEstimate", "pagesInMemory" : 723, "computationTimeMicros" : 4601, "overSeconds" : 2311 } overSeconds decreasing or small, workingSet could be larger than RAM
  • 18. 18 • Queued readers | writers • Page faults • OpCounters • Background flush process • Memory usage • Lock % • Btree misses • connections Key Metrics Available from : • MMS • db.serverStatus() • mongostat
  • 19. 19 Queued Reader | Writers • Number of operations waiting for: • Read Lock • Write Lock
  • 20. 20 Page Faults • How often we are going to disk to retrieve data? • Can be a problem if disk IO is saturated • Combine with iostat
  • 21. 21 Background Flush Process • Length of time to flush data back to disk • Again can point to disk saturation.
  • 23. 23 Lock % • Percentage of time in the global lock
  • 24. 24 btree • Accesses • Hits • Misses • Bad! • Points to Indexes not in RAM
  • 25. 25 connections • Connections to the database • Growing over time? • Check pool logic in your application code.
  • 26. Logs
  • 27. 27 • Increase the log level – See further insight to operation performance – Index efficiency – Document moves – Operation time Set log level //Increase log level verbosity from the shell > db.adminCommand( { setParameter:1, logLevel:1 } ) { "was" : 0, "ok" : 1 } > -v [ --verbose ] be more verbose (include multiple times for more verbosity e.g. -vvvvv)
  • 28. 28 • Pinpoint problems – In this example we can see that there has been a document move. Log output example 2014-05-02T13:55:02.047+0100 [conn7] update cms.articles query: { _id: ObjectId('532198379fb5ba99a6bd4063') } update: { $inc: { comment_count: 1 }, $push: { comments: { $each: [ { date: new Date(1399035302013), text: "Data locality provides an amazing performance boost over relational" } ], $slice: -10, $sort: { date: 1 } } } } nscanned:1 nscannedObjects:1 nmoved:1 nMatched:1 nModified:1 keyUpdates:0 numYields:0 locks(micros) w:33529 33ms
  • 29. 29 • Log analysis (example syntax) – Show me queries that took more than 1000 ms from 6 am to 6 pm: • Now, graph those queries: mtools prompt> mlogfilter mongodb.log --from 06:00 --to 18:00 -- slow 1000 > mongodb-filtered.log prompt> mplotqueries --logscale mongodb-filtered.log
  • 32. 32 • iostat – Disk IO usage – Use to review % utilisation of disk – High % • If it’s sustained, you may need to increase disk IO. – Sharding – RAID 1+0 – Partitioning on different disk – Provisioned IOPS OS Tools and Paramenters prompt> iostat –xmt 1
  • 34. 34 • Monitor regularly – Set alerts for changes • Quick check with command line and shell • View trends with MMS graphs over time • High levels of utilisation – Increase RAM, disk IO – Scale out – (Having first checked Indexes etc!) • Database profiler (covered in Indexing session) Summary