SlideShare ist ein Scribd-Unternehmen logo
1 von 53
SPONSORED BY
28-29 maggio 2013
Milano
#sqlc2013
SPONSORED BY
THANKS TO
SQLSERVER 2012
BASELINING,
BENCHMARKING AND
WORKLOAD ANALYSIS
Gianluca Sartori
SQL338
sqlconsulting.it, owner
gianluca.sartori@sqlconsulting.it
GIANLUCA SARTORI
• Consulente Freelance
• 10 anni di esperienza SQL Server, dalla v. 7
• Specializzato in performance tuning
• MCTS, MCITP, MCT
• DBA @ Scuderia Ferrari
AGENDA
• Baselining
• Cosa succede in condizioni “normali”?
• Workload Analysis
• Come interagiscono le applicazioni e il database?
• Benchmarking
• Cosa succederebbe se…?
Health Check
Controllo la «salute» del mio server
• Perché?
• Migliorare le prestazioni
• Migliorare la gestione
• Quando?
• Regolarmente  Assessment
• Continuamente  Monitoring
• Come?
• Serve una metodologia
Health Check
Workload
Analysis
Piano di
Intervento
Test Modifiche
Ambiente Test
Deploy in
Produzione
Ripetere
Regolarmente
Benchmark
Baseline
Raccolta
Informazioni
Monitoring
BASELINING
Stabiliamo cosa è normale
Cos’è una baseline?
Descrive le performance in condizioni “normali”
• Serve come termine di confronto
• Monitoring
• Troubleshooting
• Trend Analysis e Capacity Planning
Creare una baseline
• Quali dati raccogliere?
• Come raccoglierli?
• Con quale frequenza?
• Dove salvarli?
• Quanto serve mantenerli?
• Come analizzarli?
Quali dati raccogliere?
• Informazioni generali
• Sistema
• Versione
• Dotazione HW (CPU, RAM, disco)
• SQL Server
• Versione e edizione
• Parametri di configurazione
• Inventario dei database
• Dimensione e posizionamento dei file sullo storage
Quali dati raccogliere?
• Indicatori di performance
• Wait Stats
• Performance Counters
• Dynamic Management Objects
• Query Stats
Wait Stats
DMV  sys.dm_os_wait_stats
• Traccia il tempo speso dai processi in attesa di risorse
• Tempi di attesa cumulativi (ultimo riavvio dell’istanza)
• Ottimo punto di partenza per il troubleshooting
• Consente di identificare i problemi dai sintomi
• Mostra quali aree richiedono attenzione
• Non tutte le classi di wait sono significative!
Wait Stats
COMUNI CLASSI DI WAIT
Risorsa Classe Esempio
Locking LCK_*
LCK_M_S
LCK_M_X
Latching
LATCH_*
PAGELATCH_*
LATCH_EX
PAGELATCH_UP
I/O
PAGEIOLATCH_*
*_COMPLETION
WRITELOG
PAGEIOLATCH_SH
IO_COMPLETION
ASYNC_IO_COMPLETION
CPU
THREADPOOL
SOS_SCHEDULER_YIELD
Network ASYNC_NETWORK_IO
Parallelismo CXPACKET
DEMOWait Stats
Performance Counters
• CPU
• Memoria
• Disco
• SQL – specific
• …
Quali contatori?
• In SQL Server 2012 ce ne sono più di 400!!!
DMO
• sys.dm_os_ OS information
• sys.dm_io_ Disk performance
• sys.dm_exec_ Sessions, requests, connections
• sys.dm_db_ Database info
• sys.dm_tran_ Transactions, locks
• sys.dm_... Audits, broker, CDC, FileStream,
FTS, HADR, Repl, RG, XE…
• Non tutte le DMV riguardano le performance
Quali DMO?
Periodic Table of SQL Server Dynamic Management
Objects
SELECT name
,type_desc
FROM sys.all_objects
WHERE name LIKE 'dm[_]%'
ORDER BY name
In SQL Server 2012
ce ne sono 141 !!
http://thesqlagentman.com/periodic-table/
Quali dati raccogliere?
Come orientarsi tra 400 performance counters e 141 DMO?
• Glenn Berry’s Diagnostic Information Queries
http://sqlserverperformance.wordpress.com/
• Davide Mauri’s SYS2 DMVs
http://sys2dmvs.codeplex.com/
• Brent Ozar’s sp_Blitz
http://www.brentozar.com/blitz/
• Kendall van Dyke’s SQLPowerDoc
https://sqlpowerdoc.codeplex.com/
Come consultare i dati?
• Real-time
• Consultazione dei dati in tempo reale
• Monitoring e Alerting
• Mancano i punti di riferimento!
• Continuous
• Raccolta di informazioni in un repository storico
• Monitoring
• Troubleshooting
• Baselining  uso i dati raccolti per il monitoring
seleziono un sottoinsieme
Strumenti di monitoring continuo
• Strumenti built-in di Windows
• Reliability and Performance Monitor
• XPERF
• Perfmon automation
• logman.exe
• relog.exe
• PAL [open source]
• http://pal.codeplex.com/
• Offre Collector Set specifici per diversi prodotti MS
Strumenti di monitoring continuo
• Suite commerciali
• Soluzioni custom
• Pro e contro
• Strumenti Built-in di SQL Server
• Performance Data Collector
Performance Data Collector
• Presente in tutte le edizioni (no Express)
• Contiene 3 Collection Sets di sistema
• Modello estensibile con Collection Sets custom
• Raccoglie i dati a intervalli predefiniti
• I dati vengono salvati in un Management Datawarehouse
• Più istanze possono condividere lo stesso MDW
• Può essere integrato con Utility Control Point
• E’ corredato da report per analisi e consultazione dei dati
• Report centralizzati su Reporting Services:
http://blogs.msdn.com/b/billramo/archive/tags/mdw+reports/
Quanto serve mantenerli?
• Dipende da
• Capacità disponibile
• Profondità dell’analisi richiesta
• Volatilità dell’ambiente
Quali dati formano la baseline?
• Seleziono un sottoinsieme dei dati raccolti per il
monitoring
• Periodicamente seleziono la baseline
• Selezione “implicita”  giorno o mese precedente
• Selezione “esplicita”  estraggo uno snapshot
• Una sola baseline?
• Dipende dal business cycle
• Dipende dalle applicazioni
Business Cycle
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00
ERP ETL
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00
SITE ETL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
APP MAINT BILLING
Monitoring Baseline
• Raffronto tra il valore istantaneo dell’indicatore
di performance e la sua baseline
• La baseline con cui confrontare va scelta in
relazione al business cycle
WORKLOAD ANALYSIS
Cosa determina il carico su SQL Server?
Workload Analysis
• Performance  effetto
• Workload  causa
• Analisi del workload permette di correlare cause
ed effetti
• L’analisi produce un piano di intervento
Query Statistics
• DMV  sys.dm_exec_query_stats
• Informazioni su tutte le query presenti in plan cache
• Possibile ottenere le query più costose in termini di:
• IO
• Reads
• Writes
• CPU
• Execution count
Plan cache analysis
• Correlare le wait stats con le query stats
• Identificare query problematiche
• Indici mancanti
• Conversioni implicite
• Individuare problemi applicativi
• “Plan cache bloat”
• DTA 2012 può usare la plan cache come source
workload
DEMOPlan cache analysis
Trace
• Query stats non sono sempre sufficienti
• Sono volatili
• Non catturano le query marcate con WITH RECOMPILE
• Quale trace raccogliere
• Eventi
• colonne
• Filtri
• Strumenti di raccolta
• Profiler vs. SQLTrace
Extended Events
• Introdotti in SQL Server 2008 (es: Audit)
• Espongono eventi che avvengono del Database Engine
• Moltissimi eventi sono intercettabili solo con XE
• Performanti
• Configurabili
• Sostituiranno SQL Trace (deprecata da SQL Server 2012)
• Mancano ancora alcune funzionalità
• Strumenti di analisi
• Strumenti di replay
Workload analysis
• Cosa analizzare
• Dipende dalla traccia catturata
• Correlare con i performance counter
• Strumenti di analisi
• RML Utilities (ReadTrace)
Non compatibile con SQL2012  www.spaghettidba.com conversione
• PSSDIAG
• SQL Nexus
• ClearTrace
BENCHMARKING
Immaginiamo diversi scenari
Cos’è un benchmark?
Descrive le performance in diversi scenari
• Serve come per valutare scenari whatif:
• Upgrade hardware
• Virtualizzazione
• Serve per vagliare gli interventi di tuning
• Modifiche a configurazioni server-wide
• Aggiunta/rimozione di indici
• Interventi sul codice
Performance benchmarking
WORKLOAD
CAPTURE
REPLAY COLLECT
ANALYZEADJUST
PRODUCTION TEST
BASELINE
BENCHMARK
Workload capture
• Quale strumento?
• SQL Trace vs. Profiler
• Utilizziamo una SQL Trace
• Quali eventi catturare?
• Quali colonne catturare?
• RML Utilities
• Trace definition script
• Backup database
• Prima effettuare il backup, poi avviare la traccia
• Prima avviare la traccia, poi effettuare il backup
• Filtrare la traccia
WORKLOAD
CAPTURE
Workload replay
Preparare l’ambiente di test
• L’ambiente deve essere un clone completo
• Restore User Databases
• Attenzione ai database_id!
• Logins
• Attenzione agli utenti orfani!
• Job
• Package SSIS / DTS
• Database Mail
• L’ambiente di test deve essere isolato dalla produzione!
REPLAY COLLECT
ANALYZEADJUST
Workload replay
Quale strumento?
• Profiler
• RML Utilities - Ostress
• Distributed Replay
• Novità di SQL Server 2012
• Può eseguire un workload da più client
• Stesso query rate della traccia originale
(synchronization mode)
REPLAY COLLECT
ANALYZEADJUST
Distributed replay
• E’ composto da tre elementi:
• Administration tool
• Distributed Replay Controller
• Distributed Replay Client
REPLAY COLLECT
ANALYZEADJUST
Workload replay
Quale strumento?
REPLAY COLLECT
ANALYZEADJUST
Baseline Capture
• Resettare gli indicatori di performance
• DBCC SQLPERF("sys.dm_os_wait_stats",CLEAR);
• DBCC FREEPROCCACHE();
• DBCC FREESYSTEMCACHE('ALL');
• DBCC DROPCLEANBUFFERS();
• Effettuare uno snapshot di ogni database
• Avviare gli strumenti di raccolta prestazioni
• Performance Monitor Collection Set
• SQLTrace – RML Template
REPLAY COLLECT
ANALYZEADJUST
Benchmark Capture
• Revert snapshot
• Applicare le modifiche
• Avviare gli strumenti di raccolta
• Avviare il replay
REPLAY COLLECT
ANALYZEADJUST
Benchmark Analysis
Analisi = confronto con la Baseline
Strumenti per l’analisi:
• RML Utilities
http://support.microsoft.com/kb/944837/en-us
• SQLNexus
http://sqlnexus.codeplex.com/
• ClearTrace
http://www.scalesql.com/cleartrace/default.aspx
• Qure Analyzer
http://www.dbsophic.com/qure-analyzer
REPLAY COLLECT
ANALYZEADJUST
DEMOQure Analyzer
QUESTIONS&
ANSWERS
Links
• Technical Conferences
www.technicalconferences.it
• SQL Server & Business Intelligence Conference
www.sqlconference.it
• Gianluca Sartori - blog
www.spaghettidba.com
Grazie.Non dimenticare di riempire il modulo di feedback
SQL338
#sqlc2013
© EventHandler S.r.l. All rights reserved. Microsoft, Windows, Windows 8 and other product names are or may be registered trademarks and/or trademarks in
the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation.
EventHandler cannot guarantee the accuracy of any information provided after the date of this presentation.
EVENTHANDLER MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Weitere ähnliche Inhalte

Was ist angesagt?

SQL Server Back to Basics: Sicurezza
SQL Server Back to Basics: SicurezzaSQL Server Back to Basics: Sicurezza
SQL Server Back to Basics: SicurezzaGianluca Hotz
 
SQL Server Failover Cluster Instances con Amazon FSx in AWS
SQL Server Failover Cluster Instances con Amazon FSx in AWSSQL Server Failover Cluster Instances con Amazon FSx in AWS
SQL Server Failover Cluster Instances con Amazon FSx in AWSGianluca Hotz
 
Azure PaaS databases
Azure PaaS databasesAzure PaaS databases
Azure PaaS databasesGianluca Hotz
 
Come utilizzare AWS Database Migration Service per migrare SQL Server ad Amaz...
Come utilizzare AWS Database Migration Service per migrare SQL Server ad Amaz...Come utilizzare AWS Database Migration Service per migrare SQL Server ad Amaz...
Come utilizzare AWS Database Migration Service per migrare SQL Server ad Amaz...Gianluca Hotz
 
SQL Server Data Virtualization with Polybase
SQL Server Data Virtualization with PolybaseSQL Server Data Virtualization with Polybase
SQL Server Data Virtualization with PolybaseGianluca Hotz
 
Azure SQL Database Ledger
Azure SQL Database LedgerAzure SQL Database Ledger
Azure SQL Database LedgerGianluca Hotz
 
SQL Server Modern Query Processing
SQL Server Modern Query ProcessingSQL Server Modern Query Processing
SQL Server Modern Query ProcessingGianluca Hotz
 
SQL Server Failover Cluster Instances con Azure Managed Disks
SQL Server Failover Cluster Instances con Azure Managed DisksSQL Server Failover Cluster Instances con Azure Managed Disks
SQL Server Failover Cluster Instances con Azure Managed DisksGianluca Hotz
 
Mettere in sicurezza ambienti sql server
Mettere in sicurezza ambienti sql serverMettere in sicurezza ambienti sql server
Mettere in sicurezza ambienti sql serverGianluca Hotz
 
Come utilizzare AWS DMS per migrare SQL Server ad Amazon Aurora
Come utilizzare AWS DMS per migrare SQL Server ad Amazon AuroraCome utilizzare AWS DMS per migrare SQL Server ad Amazon Aurora
Come utilizzare AWS DMS per migrare SQL Server ad Amazon AuroraGianluca Hotz
 

Was ist angesagt? (10)

SQL Server Back to Basics: Sicurezza
SQL Server Back to Basics: SicurezzaSQL Server Back to Basics: Sicurezza
SQL Server Back to Basics: Sicurezza
 
SQL Server Failover Cluster Instances con Amazon FSx in AWS
SQL Server Failover Cluster Instances con Amazon FSx in AWSSQL Server Failover Cluster Instances con Amazon FSx in AWS
SQL Server Failover Cluster Instances con Amazon FSx in AWS
 
Azure PaaS databases
Azure PaaS databasesAzure PaaS databases
Azure PaaS databases
 
Come utilizzare AWS Database Migration Service per migrare SQL Server ad Amaz...
Come utilizzare AWS Database Migration Service per migrare SQL Server ad Amaz...Come utilizzare AWS Database Migration Service per migrare SQL Server ad Amaz...
Come utilizzare AWS Database Migration Service per migrare SQL Server ad Amaz...
 
SQL Server Data Virtualization with Polybase
SQL Server Data Virtualization with PolybaseSQL Server Data Virtualization with Polybase
SQL Server Data Virtualization with Polybase
 
Azure SQL Database Ledger
Azure SQL Database LedgerAzure SQL Database Ledger
Azure SQL Database Ledger
 
SQL Server Modern Query Processing
SQL Server Modern Query ProcessingSQL Server Modern Query Processing
SQL Server Modern Query Processing
 
SQL Server Failover Cluster Instances con Azure Managed Disks
SQL Server Failover Cluster Instances con Azure Managed DisksSQL Server Failover Cluster Instances con Azure Managed Disks
SQL Server Failover Cluster Instances con Azure Managed Disks
 
Mettere in sicurezza ambienti sql server
Mettere in sicurezza ambienti sql serverMettere in sicurezza ambienti sql server
Mettere in sicurezza ambienti sql server
 
Come utilizzare AWS DMS per migrare SQL Server ad Amazon Aurora
Come utilizzare AWS DMS per migrare SQL Server ad Amazon AuroraCome utilizzare AWS DMS per migrare SQL Server ad Amazon Aurora
Come utilizzare AWS DMS per migrare SQL Server ad Amazon Aurora
 

Andere mochten auch

The goo goo dolls presentation- Mickayla Bailey
The goo goo dolls presentation- Mickayla BaileyThe goo goo dolls presentation- Mickayla Bailey
The goo goo dolls presentation- Mickayla Baileymickaylabailey
 
Exercises to improve your form and protect your calves
Exercises to improve your form and protect your calvesExercises to improve your form and protect your calves
Exercises to improve your form and protect your calvesmclsto
 
ASSEMBLEA GENERALE ANDIL 2014
ASSEMBLEA GENERALE ANDIL 2014ASSEMBLEA GENERALE ANDIL 2014
ASSEMBLEA GENERALE ANDIL 2014ANDIL_laterizi
 
ASLGConf2014LizDandDonnaOD 2016
ASLGConf2014LizDandDonnaOD 2016ASLGConf2014LizDandDonnaOD 2016
ASLGConf2014LizDandDonnaOD 2016Liz Dore
 
All Aboard LILAC 2016 4 290216
All Aboard LILAC 2016 4 290216All Aboard LILAC 2016 4 290216
All Aboard LILAC 2016 4 290216Liz Dore
 
Țintirea inflației (mai 2012) - Raport trimestrial asupra inflației
Țintirea inflației (mai 2012) - Raport trimestrial asupra inflațieiȚintirea inflației (mai 2012) - Raport trimestrial asupra inflației
Țintirea inflației (mai 2012) - Raport trimestrial asupra inflațieiBanca Națională a României
 
аз жаргалтай үлгэр
аз жаргалтай үлгэраз жаргалтай үлгэр
аз жаргалтай үлгэрNyamzaya Gerelzaya
 
Learn Database Design with MySQL - Chapter 6 - Database design process
Learn Database Design with MySQL - Chapter 6 - Database design processLearn Database Design with MySQL - Chapter 6 - Database design process
Learn Database Design with MySQL - Chapter 6 - Database design processEduonix Learning Solutions
 
68 transaction scheduling in distributed real time systems
68 transaction scheduling in distributed real time systems68 transaction scheduling in distributed real time systems
68 transaction scheduling in distributed real time systemsRoyalzig Luxury Furniture
 
Țintirea inflației (feb 2012) - Raport trimestrial asupra inflației
Țintirea inflației (feb 2012) - Raport trimestrial asupra inflațieiȚintirea inflației (feb 2012) - Raport trimestrial asupra inflației
Țintirea inflației (feb 2012) - Raport trimestrial asupra inflațieiBanca Națională a României
 
Wilson chemicals ltd
Wilson chemicals ltdWilson chemicals ltd
Wilson chemicals ltdCamilh
 
My Query is slow, now what?
My Query is slow, now what?My Query is slow, now what?
My Query is slow, now what?Gianluca Sartori
 
Serendipity for SharePoint: The Power of Automated Metadata Tagging
Serendipity for SharePoint: The Power of Automated Metadata TaggingSerendipity for SharePoint: The Power of Automated Metadata Tagging
Serendipity for SharePoint: The Power of Automated Metadata TaggingFirestring
 
Midlands PAMI press statement-final
Midlands PAMI press statement-finalMidlands PAMI press statement-final
Midlands PAMI press statement-finalZELA_infor
 

Andere mochten auch (17)

The goo goo dolls presentation- Mickayla Bailey
The goo goo dolls presentation- Mickayla BaileyThe goo goo dolls presentation- Mickayla Bailey
The goo goo dolls presentation- Mickayla Bailey
 
Recycling
RecyclingRecycling
Recycling
 
Exercises to improve your form and protect your calves
Exercises to improve your form and protect your calvesExercises to improve your form and protect your calves
Exercises to improve your form and protect your calves
 
ASSEMBLEA GENERALE ANDIL 2014
ASSEMBLEA GENERALE ANDIL 2014ASSEMBLEA GENERALE ANDIL 2014
ASSEMBLEA GENERALE ANDIL 2014
 
ASLGConf2014LizDandDonnaOD 2016
ASLGConf2014LizDandDonnaOD 2016ASLGConf2014LizDandDonnaOD 2016
ASLGConf2014LizDandDonnaOD 2016
 
All Aboard LILAC 2016 4 290216
All Aboard LILAC 2016 4 290216All Aboard LILAC 2016 4 290216
All Aboard LILAC 2016 4 290216
 
Țintirea inflației (mai 2012) - Raport trimestrial asupra inflației
Țintirea inflației (mai 2012) - Raport trimestrial asupra inflațieiȚintirea inflației (mai 2012) - Raport trimestrial asupra inflației
Țintirea inflației (mai 2012) - Raport trimestrial asupra inflației
 
Londres cris jas
Londres cris jasLondres cris jas
Londres cris jas
 
аз жаргалтай үлгэр
аз жаргалтай үлгэраз жаргалтай үлгэр
аз жаргалтай үлгэр
 
t4 e6 cardona
t4 e6 cardonat4 e6 cardona
t4 e6 cardona
 
Learn Database Design with MySQL - Chapter 6 - Database design process
Learn Database Design with MySQL - Chapter 6 - Database design processLearn Database Design with MySQL - Chapter 6 - Database design process
Learn Database Design with MySQL - Chapter 6 - Database design process
 
68 transaction scheduling in distributed real time systems
68 transaction scheduling in distributed real time systems68 transaction scheduling in distributed real time systems
68 transaction scheduling in distributed real time systems
 
Țintirea inflației (feb 2012) - Raport trimestrial asupra inflației
Țintirea inflației (feb 2012) - Raport trimestrial asupra inflațieiȚintirea inflației (feb 2012) - Raport trimestrial asupra inflației
Țintirea inflației (feb 2012) - Raport trimestrial asupra inflației
 
Wilson chemicals ltd
Wilson chemicals ltdWilson chemicals ltd
Wilson chemicals ltd
 
My Query is slow, now what?
My Query is slow, now what?My Query is slow, now what?
My Query is slow, now what?
 
Serendipity for SharePoint: The Power of Automated Metadata Tagging
Serendipity for SharePoint: The Power of Automated Metadata TaggingSerendipity for SharePoint: The Power of Automated Metadata Tagging
Serendipity for SharePoint: The Power of Automated Metadata Tagging
 
Midlands PAMI press statement-final
Midlands PAMI press statement-finalMidlands PAMI press statement-final
Midlands PAMI press statement-final
 

Ähnlich wie SQL Server Benchmarking, Baselining and Workload Analysis

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
 
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
 
Marco Zani: Come dimensionare Magento per raggiungere i Key Performance Indic...
Marco Zani: Come dimensionare Magento per raggiungere i Key Performance Indic...Marco Zani: Come dimensionare Magento per raggiungere i Key Performance Indic...
Marco Zani: Come dimensionare Magento per raggiungere i Key Performance Indic...Meet Magento Italy
 
SQL Server Data Virtualization with polybase
SQL Server Data Virtualization with polybaseSQL Server Data Virtualization with polybase
SQL Server Data Virtualization with polybaseGianluca Hotz
 
Quanto mi costa SQL Pool Serverless Synapse
Quanto mi costa SQL Pool Serverless SynapseQuanto mi costa SQL Pool Serverless Synapse
Quanto mi costa SQL Pool Serverless SynapseMarco Pozzan
 
Dot netcampus2015 green-template
Dot netcampus2015 green-templateDot netcampus2015 green-template
Dot netcampus2015 green-templateDotNetCampus
 
DSTORIE DALLA TRINCEA: TEAM FOUNDATION SERVER IN CASI LIMITE E NON SOLO...
DSTORIE DALLA TRINCEA: TEAM FOUNDATION SERVER IN CASI LIMITE E NON SOLO...DSTORIE DALLA TRINCEA: TEAM FOUNDATION SERVER IN CASI LIMITE E NON SOLO...
DSTORIE DALLA TRINCEA: TEAM FOUNDATION SERVER IN CASI LIMITE E NON SOLO...DotNetCampus
 
PASS Virtual Chapter - Unit Testing su SQL Server
PASS Virtual Chapter - Unit Testing su SQL ServerPASS Virtual Chapter - Unit Testing su SQL Server
PASS Virtual Chapter - Unit Testing su SQL ServerAlessandro Alpi
 
Application insights - Power is nothing without control
Application insights - Power is nothing without controlApplication insights - Power is nothing without control
Application insights - Power is nothing without controlRoberto Albano
 
Azure PaaS databases
Azure PaaS databasesAzure PaaS databases
Azure PaaS databasesGianluca Hotz
 
Metadata Driven Pipeline with Microsoft Fabric
Metadata Driven Pipeline  with Microsoft FabricMetadata Driven Pipeline  with Microsoft Fabric
Metadata Driven Pipeline with Microsoft FabricMarco Pozzan
 
Azure dayroma java, il lato oscuro del cloud
Azure dayroma   java, il lato oscuro del cloudAzure dayroma   java, il lato oscuro del cloud
Azure dayroma java, il lato oscuro del cloudRiccardo Zamana
 
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQLMySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQLPar-Tec S.p.A.
 
Visual Studio Performance Tools
Visual Studio Performance ToolsVisual Studio Performance Tools
Visual Studio Performance ToolsAndrea Tosato
 
Kubernetes as HA time series server, a proposal
Kubernetes as HA time series server, a proposalKubernetes as HA time series server, a proposal
Kubernetes as HA time series server, a proposalGiuliano Latini
 
Servizi DBA da remoto
Servizi DBA da remotoServizi DBA da remoto
Servizi DBA da remotoAt Work
 
Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...MariaDB plc
 
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source controlAlessandro Alpi
 

Ähnlich wie SQL Server Benchmarking, Baselining and Workload Analysis (20)

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
 
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
 
Marco Zani: Come dimensionare Magento per raggiungere i Key Performance Indic...
Marco Zani: Come dimensionare Magento per raggiungere i Key Performance Indic...Marco Zani: Come dimensionare Magento per raggiungere i Key Performance Indic...
Marco Zani: Come dimensionare Magento per raggiungere i Key Performance Indic...
 
SQL Server Data Virtualization with polybase
SQL Server Data Virtualization with polybaseSQL Server Data Virtualization with polybase
SQL Server Data Virtualization with polybase
 
Quanto mi costa SQL Pool Serverless Synapse
Quanto mi costa SQL Pool Serverless SynapseQuanto mi costa SQL Pool Serverless Synapse
Quanto mi costa SQL Pool Serverless Synapse
 
Dot netcampus2015 green-template
Dot netcampus2015 green-templateDot netcampus2015 green-template
Dot netcampus2015 green-template
 
DSTORIE DALLA TRINCEA: TEAM FOUNDATION SERVER IN CASI LIMITE E NON SOLO...
DSTORIE DALLA TRINCEA: TEAM FOUNDATION SERVER IN CASI LIMITE E NON SOLO...DSTORIE DALLA TRINCEA: TEAM FOUNDATION SERVER IN CASI LIMITE E NON SOLO...
DSTORIE DALLA TRINCEA: TEAM FOUNDATION SERVER IN CASI LIMITE E NON SOLO...
 
PASS Virtual Chapter - Unit Testing su SQL Server
PASS Virtual Chapter - Unit Testing su SQL ServerPASS Virtual Chapter - Unit Testing su SQL Server
PASS Virtual Chapter - Unit Testing su SQL Server
 
Application insights - Power is nothing without control
Application insights - Power is nothing without controlApplication insights - Power is nothing without control
Application insights - Power is nothing without control
 
Azure PaaS databases
Azure PaaS databasesAzure PaaS databases
Azure PaaS databases
 
Metadata Driven Pipeline with Microsoft Fabric
Metadata Driven Pipeline  with Microsoft FabricMetadata Driven Pipeline  with Microsoft Fabric
Metadata Driven Pipeline with Microsoft Fabric
 
Azure dayroma java, il lato oscuro del cloud
Azure dayroma   java, il lato oscuro del cloudAzure dayroma   java, il lato oscuro del cloud
Azure dayroma java, il lato oscuro del cloud
 
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQLMySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
 
Visual Studio Performance Tools
Visual Studio Performance ToolsVisual Studio Performance Tools
Visual Studio Performance Tools
 
Kubernetes as HA time series server, a proposal
Kubernetes as HA time series server, a proposalKubernetes as HA time series server, a proposal
Kubernetes as HA time series server, a proposal
 
Azure sql database
Azure sql databaseAzure sql database
Azure sql database
 
Servizi DBA da remoto
Servizi DBA da remotoServizi DBA da remoto
Servizi DBA da remoto
 
Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...Come l’Open Source può essere alla base di un business di successo: il caso H...
Come l’Open Source può essere alla base di un business di successo: il caso H...
 
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
 

Mehr von Gianluca Sartori

SQL Server 2016 New Security Features
SQL Server 2016 New Security FeaturesSQL Server 2016 New Security Features
SQL Server 2016 New Security FeaturesGianluca Sartori
 
Responding to extended events in near real time
Responding to extended events in near real timeResponding to extended events in near real time
Responding to extended events in near real timeGianluca Sartori
 
Sql server security in an insecure world
Sql server security in an insecure worldSql server security in an insecure world
Sql server security in an insecure worldGianluca Sartori
 
SQL Server Worst Practices - EN
SQL Server Worst Practices - ENSQL Server Worst Practices - EN
SQL Server Worst Practices - ENGianluca Sartori
 
TSQL Advanced Query Techniques
TSQL Advanced Query TechniquesTSQL Advanced Query Techniques
TSQL Advanced Query TechniquesGianluca Sartori
 

Mehr von Gianluca Sartori (7)

Benchmarking like a pro
Benchmarking like a proBenchmarking like a pro
Benchmarking like a pro
 
Sql server infernals
Sql server infernalsSql server infernals
Sql server infernals
 
SQL Server 2016 New Security Features
SQL Server 2016 New Security FeaturesSQL Server 2016 New Security Features
SQL Server 2016 New Security Features
 
Responding to extended events in near real time
Responding to extended events in near real timeResponding to extended events in near real time
Responding to extended events in near real time
 
Sql server security in an insecure world
Sql server security in an insecure worldSql server security in an insecure world
Sql server security in an insecure world
 
SQL Server Worst Practices - EN
SQL Server Worst Practices - ENSQL Server Worst Practices - EN
SQL Server Worst Practices - EN
 
TSQL Advanced Query Techniques
TSQL Advanced Query TechniquesTSQL Advanced Query Techniques
TSQL Advanced Query Techniques
 

SQL Server Benchmarking, Baselining and Workload Analysis

  • 4. SQLSERVER 2012 BASELINING, BENCHMARKING AND WORKLOAD ANALYSIS Gianluca Sartori SQL338 sqlconsulting.it, owner gianluca.sartori@sqlconsulting.it
  • 5. GIANLUCA SARTORI • Consulente Freelance • 10 anni di esperienza SQL Server, dalla v. 7 • Specializzato in performance tuning • MCTS, MCITP, MCT • DBA @ Scuderia Ferrari
  • 6. AGENDA • Baselining • Cosa succede in condizioni “normali”? • Workload Analysis • Come interagiscono le applicazioni e il database? • Benchmarking • Cosa succederebbe se…?
  • 7. Health Check Controllo la «salute» del mio server • Perché? • Migliorare le prestazioni • Migliorare la gestione • Quando? • Regolarmente  Assessment • Continuamente  Monitoring • Come? • Serve una metodologia
  • 8. Health Check Workload Analysis Piano di Intervento Test Modifiche Ambiente Test Deploy in Produzione Ripetere Regolarmente Benchmark Baseline Raccolta Informazioni Monitoring
  • 10. Cos’è una baseline? Descrive le performance in condizioni “normali” • Serve come termine di confronto • Monitoring • Troubleshooting • Trend Analysis e Capacity Planning
  • 11. Creare una baseline • Quali dati raccogliere? • Come raccoglierli? • Con quale frequenza? • Dove salvarli? • Quanto serve mantenerli? • Come analizzarli?
  • 12. Quali dati raccogliere? • Informazioni generali • Sistema • Versione • Dotazione HW (CPU, RAM, disco) • SQL Server • Versione e edizione • Parametri di configurazione • Inventario dei database • Dimensione e posizionamento dei file sullo storage
  • 13. Quali dati raccogliere? • Indicatori di performance • Wait Stats • Performance Counters • Dynamic Management Objects • Query Stats
  • 14. Wait Stats DMV  sys.dm_os_wait_stats • Traccia il tempo speso dai processi in attesa di risorse • Tempi di attesa cumulativi (ultimo riavvio dell’istanza) • Ottimo punto di partenza per il troubleshooting • Consente di identificare i problemi dai sintomi • Mostra quali aree richiedono attenzione • Non tutte le classi di wait sono significative!
  • 15. Wait Stats COMUNI CLASSI DI WAIT Risorsa Classe Esempio Locking LCK_* LCK_M_S LCK_M_X Latching LATCH_* PAGELATCH_* LATCH_EX PAGELATCH_UP I/O PAGEIOLATCH_* *_COMPLETION WRITELOG PAGEIOLATCH_SH IO_COMPLETION ASYNC_IO_COMPLETION CPU THREADPOOL SOS_SCHEDULER_YIELD Network ASYNC_NETWORK_IO Parallelismo CXPACKET
  • 17. Performance Counters • CPU • Memoria • Disco • SQL – specific • … Quali contatori? • In SQL Server 2012 ce ne sono più di 400!!!
  • 18. DMO • sys.dm_os_ OS information • sys.dm_io_ Disk performance • sys.dm_exec_ Sessions, requests, connections • sys.dm_db_ Database info • sys.dm_tran_ Transactions, locks • sys.dm_... Audits, broker, CDC, FileStream, FTS, HADR, Repl, RG, XE… • Non tutte le DMV riguardano le performance
  • 19. Quali DMO? Periodic Table of SQL Server Dynamic Management Objects SELECT name ,type_desc FROM sys.all_objects WHERE name LIKE 'dm[_]%' ORDER BY name In SQL Server 2012 ce ne sono 141 !! http://thesqlagentman.com/periodic-table/
  • 20. Quali dati raccogliere? Come orientarsi tra 400 performance counters e 141 DMO? • Glenn Berry’s Diagnostic Information Queries http://sqlserverperformance.wordpress.com/ • Davide Mauri’s SYS2 DMVs http://sys2dmvs.codeplex.com/ • Brent Ozar’s sp_Blitz http://www.brentozar.com/blitz/ • Kendall van Dyke’s SQLPowerDoc https://sqlpowerdoc.codeplex.com/
  • 21. Come consultare i dati? • Real-time • Consultazione dei dati in tempo reale • Monitoring e Alerting • Mancano i punti di riferimento! • Continuous • Raccolta di informazioni in un repository storico • Monitoring • Troubleshooting • Baselining  uso i dati raccolti per il monitoring seleziono un sottoinsieme
  • 22. Strumenti di monitoring continuo • Strumenti built-in di Windows • Reliability and Performance Monitor • XPERF • Perfmon automation • logman.exe • relog.exe • PAL [open source] • http://pal.codeplex.com/ • Offre Collector Set specifici per diversi prodotti MS
  • 23. Strumenti di monitoring continuo • Suite commerciali • Soluzioni custom • Pro e contro • Strumenti Built-in di SQL Server • Performance Data Collector
  • 24. Performance Data Collector • Presente in tutte le edizioni (no Express) • Contiene 3 Collection Sets di sistema • Modello estensibile con Collection Sets custom • Raccoglie i dati a intervalli predefiniti • I dati vengono salvati in un Management Datawarehouse • Più istanze possono condividere lo stesso MDW • Può essere integrato con Utility Control Point • E’ corredato da report per analisi e consultazione dei dati • Report centralizzati su Reporting Services: http://blogs.msdn.com/b/billramo/archive/tags/mdw+reports/
  • 25. Quanto serve mantenerli? • Dipende da • Capacità disponibile • Profondità dell’analisi richiesta • Volatilità dell’ambiente
  • 26. Quali dati formano la baseline? • Seleziono un sottoinsieme dei dati raccolti per il monitoring • Periodicamente seleziono la baseline • Selezione “implicita”  giorno o mese precedente • Selezione “esplicita”  estraggo uno snapshot • Una sola baseline? • Dipende dal business cycle • Dipende dalle applicazioni
  • 27. Business Cycle 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00 ERP ETL 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00 SITE ETL 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 APP MAINT BILLING
  • 28. Monitoring Baseline • Raffronto tra il valore istantaneo dell’indicatore di performance e la sua baseline • La baseline con cui confrontare va scelta in relazione al business cycle
  • 29. WORKLOAD ANALYSIS Cosa determina il carico su SQL Server?
  • 30. Workload Analysis • Performance  effetto • Workload  causa • Analisi del workload permette di correlare cause ed effetti • L’analisi produce un piano di intervento
  • 31. Query Statistics • DMV  sys.dm_exec_query_stats • Informazioni su tutte le query presenti in plan cache • Possibile ottenere le query più costose in termini di: • IO • Reads • Writes • CPU • Execution count
  • 32. Plan cache analysis • Correlare le wait stats con le query stats • Identificare query problematiche • Indici mancanti • Conversioni implicite • Individuare problemi applicativi • “Plan cache bloat” • DTA 2012 può usare la plan cache come source workload
  • 34. Trace • Query stats non sono sempre sufficienti • Sono volatili • Non catturano le query marcate con WITH RECOMPILE • Quale trace raccogliere • Eventi • colonne • Filtri • Strumenti di raccolta • Profiler vs. SQLTrace
  • 35. Extended Events • Introdotti in SQL Server 2008 (es: Audit) • Espongono eventi che avvengono del Database Engine • Moltissimi eventi sono intercettabili solo con XE • Performanti • Configurabili • Sostituiranno SQL Trace (deprecata da SQL Server 2012) • Mancano ancora alcune funzionalità • Strumenti di analisi • Strumenti di replay
  • 36. Workload analysis • Cosa analizzare • Dipende dalla traccia catturata • Correlare con i performance counter • Strumenti di analisi • RML Utilities (ReadTrace) Non compatibile con SQL2012  www.spaghettidba.com conversione • PSSDIAG • SQL Nexus • ClearTrace
  • 38. Cos’è un benchmark? Descrive le performance in diversi scenari • Serve come per valutare scenari whatif: • Upgrade hardware • Virtualizzazione • Serve per vagliare gli interventi di tuning • Modifiche a configurazioni server-wide • Aggiunta/rimozione di indici • Interventi sul codice
  • 40. Workload capture • Quale strumento? • SQL Trace vs. Profiler • Utilizziamo una SQL Trace • Quali eventi catturare? • Quali colonne catturare? • RML Utilities • Trace definition script • Backup database • Prima effettuare il backup, poi avviare la traccia • Prima avviare la traccia, poi effettuare il backup • Filtrare la traccia WORKLOAD CAPTURE
  • 41. Workload replay Preparare l’ambiente di test • L’ambiente deve essere un clone completo • Restore User Databases • Attenzione ai database_id! • Logins • Attenzione agli utenti orfani! • Job • Package SSIS / DTS • Database Mail • L’ambiente di test deve essere isolato dalla produzione! REPLAY COLLECT ANALYZEADJUST
  • 42. Workload replay Quale strumento? • Profiler • RML Utilities - Ostress • Distributed Replay • Novità di SQL Server 2012 • Può eseguire un workload da più client • Stesso query rate della traccia originale (synchronization mode) REPLAY COLLECT ANALYZEADJUST
  • 43. Distributed replay • E’ composto da tre elementi: • Administration tool • Distributed Replay Controller • Distributed Replay Client REPLAY COLLECT ANALYZEADJUST
  • 45. Baseline Capture • Resettare gli indicatori di performance • DBCC SQLPERF("sys.dm_os_wait_stats",CLEAR); • DBCC FREEPROCCACHE(); • DBCC FREESYSTEMCACHE('ALL'); • DBCC DROPCLEANBUFFERS(); • Effettuare uno snapshot di ogni database • Avviare gli strumenti di raccolta prestazioni • Performance Monitor Collection Set • SQLTrace – RML Template REPLAY COLLECT ANALYZEADJUST
  • 46. Benchmark Capture • Revert snapshot • Applicare le modifiche • Avviare gli strumenti di raccolta • Avviare il replay REPLAY COLLECT ANALYZEADJUST
  • 47. Benchmark Analysis Analisi = confronto con la Baseline Strumenti per l’analisi: • RML Utilities http://support.microsoft.com/kb/944837/en-us • SQLNexus http://sqlnexus.codeplex.com/ • ClearTrace http://www.scalesql.com/cleartrace/default.aspx • Qure Analyzer http://www.dbsophic.com/qure-analyzer REPLAY COLLECT ANALYZEADJUST
  • 50. Links • Technical Conferences www.technicalconferences.it • SQL Server & Business Intelligence Conference www.sqlconference.it • Gianluca Sartori - blog www.spaghettidba.com
  • 51. Grazie.Non dimenticare di riempire il modulo di feedback SQL338
  • 53. © EventHandler S.r.l. All rights reserved. Microsoft, Windows, Windows 8 and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation. EventHandler cannot guarantee the accuracy of any information provided after the date of this presentation. EVENTHANDLER MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.