SQL Server Baselining, Benchmarking and Workload Analysis

Slides:



Advertisements
Similar presentations
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Advertisements

Advanced Tuning: Unconventional Solutions to Everyday Problems Robert L Davis.
#RefreshCache Database Performance Tuning October 9-11, 2011 Tom Powers IT Applications Team Manager Southeast Christian Church Louisville, KY
SQL Server Wait Statistics Capture, Report, Analyse Rob Risetto Principal Consultant with StrataDB
Chapter 14 Chapter 14: Server Monitoring and Optimization.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Managing and Monitoring SQL Server 2005 Shankar Pal Program Manager SQL Server, Redmond.
Connect with life Praveen Srvatsa Director | AsthraSoft Consulting Microsoft Regional Director, Bangalore Microsoft MVP, ASP.NET.
Copyright © 2007 Quest Software The Changing Role of SQL Server DBA’s Bryan Oliver SQL Server Domain Expert Quest Software.
Module 18 Monitoring SQL Server 2008 R2. Module Overview Monitoring Activity Capturing and Managing Performance Data Analyzing Collected Performance Data.
Course Topics Administering SQL Server 2012 Jump Start 01 | Install and Configure SQL Server04 | Manage Data 02 | Maintain Instances and Databases05 |
Maintaining a Microsoft SQL Server 2008 Database SQLServer-Training.com.
Connect Learn Share Performance Optimization for Microsoft Dynamics CRM Presented by: Walter Grow Austin Jones.
Learningcomputer.com SQL Server 2008 – Profiling and Monitoring Tools.
© 2008 Quest Software, Inc. ALL RIGHTS RESERVED. Perfmon and Profiler 101.
Enterprise Database Administration & Deployment SIG ▪ 313M ▪ Sept 29, 2005 ▪ 10:15 AM SQL Server 2005 Performance Diagnosis and Tuning using SQL Tools.
Troubleshooting SQL Server Performance: Tips &Tools Amit Khandelwal.
Your Data Any Place, Any Time Performance and Scalability.
Connect with life Praveen Srivatsa Founder and CEO – AstraSoft.NET Vinod Kumar Technology Evangelist – Databases and BI.
Diagnosing Performance with Wait Statistics Robert L Davis Principal Database
SQL Advanced Monitoring Using DMV, Extended Events and Service Broker Javier Villegas – DBA | MCP | MCTS.
Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at
No more waiting. Sponsors About me  Database Technology Specialist  MVP  Blogger  Author 3
This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information.
Session Name Pelin ATICI SQL Premier Field Engineer.
Getting the Most from SQL Server 2005 Don Vilen Program Manager SQL Server Microsoft Corporation.
MANAGEMENT DATA WAREHOUSE AND DATA COLLECTOR Ian Lanham.
Dr. Authentication Or, How I Learned To Stop Worrying And Love The Azure MFA
Windows App Studio- Windows apps for 45 minutes
An introduction to Wait Statistics
Benchmarking like a PRO
SQL Saturday – Performance Troubleshooting
Kako uspešno vpeljati IPv6 v Windows okolje in preživeti
Troubleshooting SQL Server high CPU usage
Hibridni oblak: Osnove infrastrukture kot storitve (IaaS)
SQL Server Data Collector From Every Angle
Query Performance Tuning: Start to Finish
SQL Server Monitoring Overview
Installation and database instance essentials
Where to Start, What You Need
Microsoft Dumps Question Answer - Dumps4download
Upgrading to SQL Server 2016
Simplifying XEvents Management with dbatools
Performance Monitoring Using Extended Events, DMVs & Query Store
Dynamics AX Performance
Troubleshooting SQL Server Basics
SQLSaturday 393- May 16, Redmond, WA
SQL Server on Linux Troubleshooting tips and tricks
Performance Tuning for Mere Mortals Part II
Proving Hardware Bottlenecks &
Troubleshooting Availability Group Failovers
Wellington, SQLSaturday#706
Migrating your SQL Server Instance
SQL Server 2016 Query Data Store
Performance Tuning for Mere Mortals Part II
මොඩියුල විශ්ලේෂණය SQL Server Waits. Tables රැසක් එකට එකතු කිරීම.
Targeting Wait Statistics with Extended Events
Transaction Log Internals and Performance David M Maxwell
Using Power Bi to troubleshoot SQL Server instances
Статистика ожиданий или как найти место "где болит"
Andrew Fryer Microsoft UK
Analyzing Performance Problems Using XEvents, DMVs & Query Store
Performance And Scalability In Oracle9i And SQL Server 2000
Jean Joseph DBA/Developer
04 | Performance and the Premium SKU
Your Data Any Place, Any Time
Using wait stats to determine why my server is slow
Advanced Database Topics
Analyzing Performance Problems Using XEvents, DMVs & Query Store
SharePoint 2013 Best Practices
Presentation transcript:

SQL Server Baselining, Benchmarking and Workload Analysis Gianluca Sartori sqlconsulting.it

Gianluca Sartori Independent SQL Server consultant SQL Server MVP, MCTS, MCITP, MCT Works with SQL Server since version 7 DBA @ Scuderia Ferrari Blog: spaghettidba.com Twitter: @spaghettidba

AGENDA Baselining Workload Analysis Benchmarking What happens in “normal” conditions? Workload Analysis How are applications and databases interacting with each other? Benchmarking What if…?

Health Check Why? When? How? Improve performance Improve manageability Regularly  Assessment Continuously  Monitoring How? A methodology is needed

Health Check

Baselining Let’s establish what’s normal 9/10/2018 6:34 PM © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

What is a baseline? Describes system performance in «normal» conditions Used a comparison basis Monitoring Troubleshooting Trend Analysis and Capacity Planning

Creating a baseline What to capture? How to capture? How often? Where to store the captured data? How long to keep it? How to analyze it?

What to capture? General information System SQL Server Version HW (CPU, RAM, disk…) SQL Server Version and edition Configuration options Database inventory File size and placement

What to capture? Performance indicators Wait Stats Performance Counters Dynamic Management Objects Query Stats

Wait Stats DMV  sys.dm_os_wait_stats Tracks time spent by processes in a wait queue Wait times are cumulative (since last server restart) Great starting point for troubleshooting Allows to identify problems from their symptoms Shows which areas need attention Not all wait classes are meaningful!

Wait Stats Common wait classes Resource Class Example 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 Parallelism CXPACKET

Demo WAIT STATS

Performance Counters Which counters? CPU Memory Disk SQL – specific … More than 400 in SQL Server 2016!!!

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… Not all DMOs are performance related

Which DMOs? 141 DMOs in SQL Server 2016!!! SELECT name ,type_desc Periodic Table of SQL Server Dynamic Management Objects 141 DMOs in SQL Server 2016!!! SELECT name ,type_desc FROM sys.all_objects WHERE name LIKE 'dm[_]%' ORDER BY name http://thesqlagentman.com/periodic-table/

What to capture? How do you work with 400 performance counters and 141 DMOs? Glenn Berry’s Diagnostic Information Queries http://www.sqlskills.com/blogs/glenn/category/dmv-queries/ 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/

Performance Data Collector Available in all editions (except Express) Contains System Collection Sets Extensible model, custom Collection Sets Extended T-SQL Collector http://extendedtsqlcollector.codeplex.com Captures data at regular intervals Data saved in a Management Datawarehouse Multiple instances can share the same MDW May be integrated with Utility Control Point Comes with reports to read and analyze the data Reports can be centralized on Reporting Services: http://blogs.msdn.com/b/billramo/archive/tags/mdw+reports/

How long to keep the data? It depends on Available disk space Depth of analysis required Volatility of the environment

Which data participate the baseline? Select a subset of the data captured for monitoring Select baseline regularly “Implicit” selection  previous day/week/month “Explicit” selection  extract a snapshot Only one baseline? Depends on business cycle Depends on applications

Business Cycle

Monitoring Baseline Compare the instant value of the performance metric with its baseline Baseline must be chosen keeping the business cycle in mind

Workload Analysis What drives the load on SQL Server? 9/10/2018 6:34 PM Workload Analysis What drives the load on SQL Server? © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Workload Analysis Performance  effect Workload  cause Workload analysis allows to correlate cause and effect Outcome of analysis is a plan

Query Statistics DMV  sys.dm_exec_query_stats Information on all queries in plan cache Rank queries in terms of: IO Reads Writes CPU Execution count

Plan cache analysis Correlate wait stats and query stats Identify problematic queries Missing indexes Implicit conversions Identify application issues “Plan cache bloat” Since 2012, DTA can use plan cache as a source

Query Store New in SQL Server 2016 Data is persisted throughout restarts Allows to find plan regressions Allows “fixing” rogue plans with no effort

Demo PLAN CACHE ANALYSIS

Trace Often query stats are not enough What to capture with traces? Volatile Don’t capture queries marked as RECOMPILE What to capture with traces? Events Columns Filters Collection tools Profiler vs. SQLTrace

Extended Events Introduced in SQL Server 2008 (eg: Audit) Expose events deep inside SQLOS Often not available otherwise Lightweight Configurable Replacement for SQL Trace (since 2012) Used to lack some features Analysis tools Replay tools Now 100% covered

Workload Analysis What to analyze Analysis tools Depends on what you captured Correlate with performance counters Analysis tools RML Utilities (ReadTrace) Watch out for trace file version  http://bit.ly/1T9vJwV conversion PSSDIAG SQL Nexus ClearTrace

Demo CLEARTRACE

Benchmarking Imagine new scenarios… 9/10/2018 6:34 PM © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

What is a benchmark? Describes performance in different scenarios Evaluates whatif scenarios: Hardware/Software Upgrade Virtualization Helps rating tuning efforts Server-wide configuration changes Addition/removal of indexes Code changes

Performance benchmarking

Workload capture Which tool? Which events should you capture? SQL Trace vs. Profiler  Prefer SQL Trace Which events should you capture? Which columns should you capture? RML Utilities Trace definition script Backup the database First issue a full backup, then start the trace First run the trace, then issue a full backup Filter the trace

Workload replay Prepare the test environment Must be a complete clone Restore User Databases Keep original database_id! Logins Watch out for orphaned users! Jobs SSIS Packages Database Mail Test environment must be isolated from production!

Workload replay Which tool? Profiler RML Utilities - Ostress Distributed Replay Introduced in SQL Server 2012 Can replay a workload form multiple clients Same query rate of the original trace (synchronization mode)

Distributed replay 3 core elements: Administration tool Distributed Replay Controller Distributed Replay Client

Workload replay Which tool?

Baseline Capture Reset performance metrics DBCC SQLPERF("sys.dm_os_wait_stats",CLEAR); DBCC FREEPROCCACHE(); DBCC FREESYSTEMCACHE('ALL'); DBCC DROPCLEANBUFFERS(); Take a snapshot for each database Start collection Performance Monitor Collection Set SQLTrace – RML Template

Benchmark Capture Revert to snapshot Apply changes Start collection of performance metrics Start replay

Benchmark Analysis Analysis = compare with Baseline Analysis tools: RML Utilities https://support.microsoft.com/en-us/kb/944837 SQLNexus http://sqlnexus.codeplex.com/ ClearTrace http://www.scalesql.com/cleartrace/default.aspx Qure Analyzer http://www.dbsophic.com/qure-analyzer

Demo QURE ANALYZER

Questions & Answers 9/10/2018 6:34 PM © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Izpolnite anketo! Vam je bilo predavanje všeč? Ste se naučili kaj novega? Vaše mnenje nam veliko pomeni! Da bo NT konferenca prihodnje leto še boljša, vas prosimo, da izpolnite anketo o zadovoljstvu, ki jo najdete v svojem NTK spletnem profilu.

9/10/2018 6:34 PM © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.