SlideShare a Scribd company logo
1 of 35
Serie Sviluppo di
Un’Applicazione
Back to Basics
Monitoring & Performance Tuning
Senior Solutions Architect, MongoDB Inc.
massimo@mongodb.com
Massimo Brignoli
#mongodb
Agenda
• Riassunto
• Tools di Monitoring
– MongoDB command line e la shell
• Metriche chiave in MongoDB
• Logs
– Livelli di Log
– mtools
• Saturazione del Disco
Q & A
• Virtual Genius Bar
– Use the chat to post
questions
– EMEASolution
Architecture / Support
team are on hand
– Make use of them
during the sessions!!!
Riassunto dell’Ultima Puntata
Tools di Backup e Approcci
• mongodump & mongorestore
• Copia del File system
• Snapshot del File system
• Non Usate mongoimport & mongoexport!
//Esempio di mongodump
server> mongodump -h myhost -d cms -c articoli
Mongodump
• Crea un file .bson
– (e un json di metadati)
– Sulla rete o direttamente sul file system
>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
Architetture di Backup
• Usate il secondary per il backup
– O un hidden secondary
• Fsync+Lock
• Il bilanciatore e’ off
– In sharded cluster
mongodump
Monitoring Tools
Tools
• I Tool chiave di MongoDB
– Mongostat
– Mongo shell
– Mongo Management Service mms
• Mtools
– Logs
• OS
– iostat
Architettura di MMS
Gli Alert di MMS
Collezione di Metriche e
Reportistica
Dati di Profile e Log
Mongostat
• Accesso alle statistiche chiave
– CollegareaunmongodounmongosfotIclusterinshardind
– Viualizzaoperazioneal secondo/memoriausate,page faults,codeecc.
>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
Mongo shell
• Comandi per accedere alle metriche
– db.serverStatus()
– workingSet analyzer
//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
}
WorkingSet analyzer
• Utile per stimare il ‘working set’ di un database
– Numero di ‘pagesInMemory’accessed in RAM su il
‘overSeconds’ numero di secondi.
– Page di Default è 4k
– overSecond – delta tra il più vecchio e il nuovo
>db.serverStatus({ workingSet : 1 })
{
"note" : "thisIsAnEstimate",
"pagesInMemory" : 723,
"computationTimeMicros" : 4601,
"overSeconds" : 2311
}
overSeconds
decreasing or small,
workingSet could be
larger than RAM
Le Metriche di MongoDB
• Queued readers | writers
• Page faults
• OpCounters
• Background flush process
• Memory usage
• Lock %
• Btree misses
• connections
Metriche Chiave
Available from :
• MMS
• db.serverStatus()
• mongostat
Queued Reader | Writers
• Numero di
operazioni in attesa
per:
• Read Lock
• Write Lock
Page Faults
• Frequenza con cui
state andando su
disco a leggere I
dati?
• Può essere un problema se
l’IO del disco è saturo
• Da usare assieme a iostat
Background Flush Process
• Quantità di tempo
per effettuare il
flush dei dati du
disco
• Anche questo può
indicare la
saturazione del disco
Memoria
• Virtual
• Mapped
• Resident
Lock %
• Percentuale di
tempo del lock
globale
Indici Btree
• Accessi
• Hits: valori trovati in
memoria
• Misses
• Male!
• Indica indici non
in memoria
Connessioni
• Connessioni al
database
• Crescono nel
tempo?
• Controllate la
logica di pool
nella vostra
applicazione
Logs
• Aumentate il livello di log
– Per vedere maggior informazioni sulle performance delle operazioni
– Efficienza degli indici
– Spostamenti di documenti
– Tempo di esecuzione delle operazioni
Definite il livello di log
//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)
• Problemi di Pinpoint
– In questoesempiopossiamovedere che c’èstatounospostamentodeldocumento
Esempio di output del Log
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
• Analisi dei Log (esempio di sintassi)
– Mostrami le query che hanno impiegato più di 1000 ms
dalle 6 di mattina alle 6 di sera:
• Ora, fai un grafico:
Mtools
prompt> mlogfilter mongodb.log --from 06:00 --to 18:00 --
slow 1000 > mongodb-filtered.log
prompt> mplotqueries --logscale mongodb-filtered.log
Mtools output
Saturazione del Disco
• iostat
– Utilizzo dell’IO dei dischi
– Controllate la % di utilizzo del disco
– Un’alta percentuale
• Se è sostenuta, dovresti aumentare l’IO del disco
– Sharding
– RAID 1+0
– Partizionare su dischi differenti
– Provisioned IOPS
Tool del Sistema Operativo
prompt> iostat –xmt 1
Riassunto
Riassunto
• Controllate regolarmente
– Settate degli allarmi a fronte di cambiamenti
• Controllate velocemente con la shell e a linea di
comando
• Controllate i trend con I grafici di MMS
• In caso di alto livello di utilizzo
– Aumentate la RAM, l’IO del disco
– Scalate orizzontalmente
– (Controllate gli indici!!)
Webinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance Tuning

More Related Content

What's hot

Back to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizioBack to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizioMongoDB
 
Back to Basics, webinar 1: Introduzione a NoSQL
Back to Basics, webinar 1: Introduzione a NoSQLBack to Basics, webinar 1: Introduzione a NoSQL
Back to Basics, webinar 1: Introduzione a NoSQLMongoDB
 
Deploy MongoDB su Infrastruttura Amazon Web Services
Deploy MongoDB su Infrastruttura Amazon Web ServicesDeploy MongoDB su Infrastruttura Amazon Web Services
Deploy MongoDB su Infrastruttura Amazon Web ServicesStefano Dindo
 
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDB
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDBAdvanced Database Models and Architectures: Big Data: MySQL VS MongoDB
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDBLuca Marignati
 
How to develop modern web application - With no money and no Javascript
How to develop modern web application - With no money and no JavascriptHow to develop modern web application - With no money and no Javascript
How to develop modern web application - With no money and no JavascriptAndrea Tosato
 
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)MongoDB
 
MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009Massimiliano Dessì
 
MongoDB User Group Padova - Overviews iniziale su MongoDB
MongoDB User Group Padova - Overviews iniziale su MongoDBMongoDB User Group Padova - Overviews iniziale su MongoDB
MongoDB User Group Padova - Overviews iniziale su MongoDBStefano Dindo
 
E suap - tecnologie client
E suap - tecnologie client E suap - tecnologie client
E suap - tecnologie client Sabino Labarile
 
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQL
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQLBack to Basics webinar 1 IT 17 - Introduzione ai NoSQL
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQLMongoDB
 
MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009Massimiliano Dessì
 

What's hot (11)

Back to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizioBack to Basics, webinar 6: Messa in esercizio
Back to Basics, webinar 6: Messa in esercizio
 
Back to Basics, webinar 1: Introduzione a NoSQL
Back to Basics, webinar 1: Introduzione a NoSQLBack to Basics, webinar 1: Introduzione a NoSQL
Back to Basics, webinar 1: Introduzione a NoSQL
 
Deploy MongoDB su Infrastruttura Amazon Web Services
Deploy MongoDB su Infrastruttura Amazon Web ServicesDeploy MongoDB su Infrastruttura Amazon Web Services
Deploy MongoDB su Infrastruttura Amazon Web Services
 
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDB
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDBAdvanced Database Models and Architectures: Big Data: MySQL VS MongoDB
Advanced Database Models and Architectures: Big Data: MySQL VS MongoDB
 
How to develop modern web application - With no money and no Javascript
How to develop modern web application - With no money and no JavascriptHow to develop modern web application - With no money and no Javascript
How to develop modern web application - With no money and no Javascript
 
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)
Back to Basics 4: Introduzione al partizionamento orizzontale (sharding)
 
MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009
 
MongoDB User Group Padova - Overviews iniziale su MongoDB
MongoDB User Group Padova - Overviews iniziale su MongoDBMongoDB User Group Padova - Overviews iniziale su MongoDB
MongoDB User Group Padova - Overviews iniziale su MongoDB
 
E suap - tecnologie client
E suap - tecnologie client E suap - tecnologie client
E suap - tecnologie client
 
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQL
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQLBack to Basics webinar 1 IT 17 - Introduzione ai NoSQL
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQL
 
MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009
 

Similar to Webinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance Tuning

MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL ClusterMySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL ClusterPar-Tec S.p.A.
 
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL DatabaseEmanuele Zanchettin
 
Implementare e mantenere un progetto azure sql database v.2
Implementare e mantenere un progetto azure sql database v.2Implementare e mantenere un progetto azure sql database v.2
Implementare e mantenere un progetto azure sql database v.2Emanuele Zanchettin
 
Jvm performance Tuning
Jvm performance TuningJvm performance Tuning
Jvm performance TuningMarco Sabatini
 
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 2
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 2MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 2
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 2MongoDB
 
Soluzioni distribuite per l’analisi di dati biomedici in ambiente Virtual Dat...
Soluzioni distribuite per l’analisi di dati biomedici in ambiente Virtual Dat...Soluzioni distribuite per l’analisi di dati biomedici in ambiente Virtual Dat...
Soluzioni distribuite per l’analisi di dati biomedici in ambiente Virtual Dat...Giuseppe Luciano
 
SQL Saturday 2019 - Event Processing with Spark
SQL Saturday 2019 - Event Processing with SparkSQL Saturday 2019 - Event Processing with Spark
SQL Saturday 2019 - Event Processing with SparkAlessio Biasiutti
 
Azure Day Rome Reloaded 2019 - Ingestion nel datalake passando tramite API Ma...
Azure Day Rome Reloaded 2019 - Ingestion nel datalake passando tramite API Ma...Azure Day Rome Reloaded 2019 - Ingestion nel datalake passando tramite API Ma...
Azure Day Rome Reloaded 2019 - Ingestion nel datalake passando tramite API Ma...azuredayit
 
SQL Server Workload Profiling
SQL Server Workload ProfilingSQL Server Workload Profiling
SQL Server Workload ProfilingGianluca Hotz
 
SQL Server Benchmarking, Baselining and Workload Analysis
SQL Server Benchmarking, Baselining and Workload AnalysisSQL Server Benchmarking, Baselining and Workload Analysis
SQL Server Benchmarking, Baselining and Workload AnalysisGianluca Sartori
 
XE - Azure in the real world
XE - Azure in the real worldXE - Azure in the real world
XE - Azure in the real worldAlessio Biasiutti
 
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL DatabaseEmanuele Zanchettin
 
Le novita di MongoDB 3.6
Le novita di MongoDB 3.6Le novita di MongoDB 3.6
Le novita di MongoDB 3.6MongoDB
 
Studio di una Architettura per un Sistema Distributivo ad Alta Affidabilità
Studio di una Architettura per un Sistema Distributivo ad Alta AffidabilitàStudio di una Architettura per un Sistema Distributivo ad Alta Affidabilità
Studio di una Architettura per un Sistema Distributivo ad Alta AffidabilitàRoberto Peruzzo
 
Introduzione a GeoServer ed ai servizi OGC
Introduzione a GeoServer ed ai servizi OGCIntroduzione a GeoServer ed ai servizi OGC
Introduzione a GeoServer ed ai servizi OGCGeoSolutions
 

Similar to Webinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance Tuning (20)

MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL ClusterMySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
 
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
 
Implementare e mantenere un progetto azure sql database v.2
Implementare e mantenere un progetto azure sql database v.2Implementare e mantenere un progetto azure sql database v.2
Implementare e mantenere un progetto azure sql database v.2
 
Jvm performance Tuning
Jvm performance TuningJvm performance Tuning
Jvm performance Tuning
 
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 2
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 2MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 2
MongoDB Atlas: il modo migliore per eseguire MongoDB in ambiente cloud 2
 
Soluzioni distribuite per l’analisi di dati biomedici in ambiente Virtual Dat...
Soluzioni distribuite per l’analisi di dati biomedici in ambiente Virtual Dat...Soluzioni distribuite per l’analisi di dati biomedici in ambiente Virtual Dat...
Soluzioni distribuite per l’analisi di dati biomedici in ambiente Virtual Dat...
 
Azure functions
Azure functionsAzure functions
Azure functions
 
SQL Saturday 2019 - Event Processing with Spark
SQL Saturday 2019 - Event Processing with SparkSQL Saturday 2019 - Event Processing with Spark
SQL Saturday 2019 - Event Processing with Spark
 
Azure Day Rome Reloaded 2019 - Ingestion nel datalake passando tramite API Ma...
Azure Day Rome Reloaded 2019 - Ingestion nel datalake passando tramite API Ma...Azure Day Rome Reloaded 2019 - Ingestion nel datalake passando tramite API Ma...
Azure Day Rome Reloaded 2019 - Ingestion nel datalake passando tramite API Ma...
 
SQL Server Workload Profiling
SQL Server Workload ProfilingSQL Server Workload Profiling
SQL Server Workload Profiling
 
SQL Server Benchmarking, Baselining and Workload Analysis
SQL Server Benchmarking, Baselining and Workload AnalysisSQL Server Benchmarking, Baselining and Workload Analysis
SQL Server Benchmarking, Baselining and Workload Analysis
 
XE - Azure in the real world
XE - Azure in the real worldXE - Azure in the real world
XE - Azure in the real world
 
OrientDB & Big Data
OrientDB & Big DataOrientDB & Big Data
OrientDB & Big Data
 
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database2014.11.14 Implementare e mantenere un progetto Azure SQL Database
2014.11.14 Implementare e mantenere un progetto Azure SQL Database
 
Le novita di MongoDB 3.6
Le novita di MongoDB 3.6Le novita di MongoDB 3.6
Le novita di MongoDB 3.6
 
Presentazione
PresentazionePresentazione
Presentazione
 
#dd12 Applicazioni a tre voci (Android e Domino)
#dd12 Applicazioni a tre voci (Android e Domino)#dd12 Applicazioni a tre voci (Android e Domino)
#dd12 Applicazioni a tre voci (Android e Domino)
 
MyTask
MyTaskMyTask
MyTask
 
Studio di una Architettura per un Sistema Distributivo ad Alta Affidabilità
Studio di una Architettura per un Sistema Distributivo ad Alta AffidabilitàStudio di una Architettura per un Sistema Distributivo ad Alta Affidabilità
Studio di una Architettura per un Sistema Distributivo ad Alta Affidabilità
 
Introduzione a GeoServer ed ai servizi OGC
Introduzione a GeoServer ed ai servizi OGCIntroduzione a GeoServer ed ai servizi OGC
Introduzione a GeoServer ed ai servizi OGC
 

More from MongoDB

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 AtlasMongoDB
 
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
 
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
 
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 MongoDBMongoDB
 
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
 
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 DataMongoDB
 
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 StartMongoDB
 
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
 
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.2MongoDB
 
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
 
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
 
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 MindsetMongoDB
 
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 JumpstartMongoDB
 
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
 
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
 
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
 
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 DiveMongoDB
 
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 & GolangMongoDB
 
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
 
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...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...
 

Webinar Italiano: Back-to-Basics: Sessione 8 - Monitoraggio e Performance Tuning

  • 1. Serie Sviluppo di Un’Applicazione Back to Basics Monitoring & Performance Tuning Senior Solutions Architect, MongoDB Inc. massimo@mongodb.com Massimo Brignoli #mongodb
  • 2. Agenda • Riassunto • Tools di Monitoring – MongoDB command line e la shell • Metriche chiave in MongoDB • Logs – Livelli di Log – mtools • Saturazione del Disco
  • 3. Q & A • Virtual Genius Bar – Use the chat to post questions – EMEASolution Architecture / Support team are on hand – Make use of them during the sessions!!!
  • 5. Tools di Backup e Approcci • mongodump & mongorestore • Copia del File system • Snapshot del File system • Non Usate mongoimport & mongoexport! //Esempio di mongodump server> mongodump -h myhost -d cms -c articoli
  • 6. Mongodump • Crea un file .bson – (e un json di metadati) – Sulla rete o direttamente sul file system >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. Architetture di Backup • Usate il secondary per il backup – O un hidden secondary • Fsync+Lock • Il bilanciatore e’ off – In sharded cluster mongodump
  • 9. Tools • I Tool chiave di MongoDB – Mongostat – Mongo shell – Mongo Management Service mms • Mtools – Logs • OS – iostat
  • 12. Collezione di Metriche e Reportistica
  • 14. Mongostat • Accesso alle statistiche chiave – CollegareaunmongodounmongosfotIclusterinshardind – Viualizzaoperazioneal secondo/memoriausate,page faults,codeecc. >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. Mongo shell • Comandi per accedere alle metriche – db.serverStatus() – workingSet analyzer //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. WorkingSet analyzer • Utile per stimare il ‘working set’ di un database – Numero di ‘pagesInMemory’accessed in RAM su il ‘overSeconds’ numero di secondi. – Page di Default è 4k – overSecond – delta tra il più vecchio e il nuovo >db.serverStatus({ workingSet : 1 }) { "note" : "thisIsAnEstimate", "pagesInMemory" : 723, "computationTimeMicros" : 4601, "overSeconds" : 2311 } overSeconds decreasing or small, workingSet could be larger than RAM
  • 17. Le Metriche di MongoDB
  • 18. • Queued readers | writers • Page faults • OpCounters • Background flush process • Memory usage • Lock % • Btree misses • connections Metriche Chiave Available from : • MMS • db.serverStatus() • mongostat
  • 19. Queued Reader | Writers • Numero di operazioni in attesa per: • Read Lock • Write Lock
  • 20. Page Faults • Frequenza con cui state andando su disco a leggere I dati? • Può essere un problema se l’IO del disco è saturo • Da usare assieme a iostat
  • 21. Background Flush Process • Quantità di tempo per effettuare il flush dei dati du disco • Anche questo può indicare la saturazione del disco
  • 23. Lock % • Percentuale di tempo del lock globale
  • 24. Indici Btree • Accessi • Hits: valori trovati in memoria • Misses • Male! • Indica indici non in memoria
  • 25. Connessioni • Connessioni al database • Crescono nel tempo? • Controllate la logica di pool nella vostra applicazione
  • 26. Logs
  • 27. • Aumentate il livello di log – Per vedere maggior informazioni sulle performance delle operazioni – Efficienza degli indici – Spostamenti di documenti – Tempo di esecuzione delle operazioni Definite il livello di log //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. • Problemi di Pinpoint – In questoesempiopossiamovedere che c’èstatounospostamentodeldocumento Esempio di output del Log 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. • Analisi dei Log (esempio di sintassi) – Mostrami le query che hanno impiegato più di 1000 ms dalle 6 di mattina alle 6 di sera: • Ora, fai un grafico: Mtools prompt> mlogfilter mongodb.log --from 06:00 --to 18:00 -- slow 1000 > mongodb-filtered.log prompt> mplotqueries --logscale mongodb-filtered.log
  • 32. • iostat – Utilizzo dell’IO dei dischi – Controllate la % di utilizzo del disco – Un’alta percentuale • Se è sostenuta, dovresti aumentare l’IO del disco – Sharding – RAID 1+0 – Partizionare su dischi differenti – Provisioned IOPS Tool del Sistema Operativo prompt> iostat –xmt 1
  • 34. Riassunto • Controllate regolarmente – Settate degli allarmi a fronte di cambiamenti • Controllate velocemente con la shell e a linea di comando • Controllate i trend con I grafici di MMS • In caso di alto livello di utilizzo – Aumentate la RAM, l’IO del disco – Scalate orizzontalmente – (Controllate gli indici!!)

Editor's Notes

  1. mongodump -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
  2. mongodump -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