Where to Start, What You Need Baseline Basics: Where to Start, What You Need Erin Stellato Senior Database Engineer Hyland Software, Inc.
Erin Stellato erin@erinstellato.com @erinstellato Blog: www.erinstellato.com Email: erin@erinstellato.com Twitter: www.twitter.com/erinstellato http://www.erinstellato.com/performance
Storage and Application Once Upon a Time… Windows 2003 Windows 2008 R2 Server SQL Server 2000 SQL Server 2008 SQL Server Stayed the same Storage and Application
What’s a Baseline? Data that represents the “normal” or typical state of the environment Not a point in time; data is captured over time and averaged You will have multiple baselines e.g. business hours, end of month, peak
Why Baseline? Reference point for determining whether performance is better or worse going forward Determine usage patterns, trending Starting point for growth and capacity planning Establishing a Performance Baseline http://technet.microsoft.com/en-us/library/cc781394(WS.10).aspx http://msdn.microsoft.com/en-us/library/ms190943.aspx
Who?
Why you? Establishing a Performance Baseline http://technet.microsoft.com/en-us/library/cc781394(WS.10).aspx http://msdn.microsoft.com/en-us/library/ms190943.aspx
What data, and from where? PerfMon CPU Memory Disk SQL Server Counters Trace DMVs Wait stats, database info, index usage
How? How do you capture the data? How often? How long should it be kept? How should the data be analyzed?
When? It depends… DBA resources Business cycle Volatility of the environment
Roadmap PerfMon PAL Trace ClearTrace RMLUtils Qure DMVs WhoIsActive All utilities are included with Windows or SQL Server or are free
PerfMon First determine the counters you want to capture
Kevin Kline – PerfMon Counters http://kevinekline.com/2010/09/05/free-poster-sql-server-perfmon-counters/ PDF http://www.quest.com/backstage/images/promotions/SQLServer-Perfmonance-Poster.pdf
http://blogs.msdn.com/b/jimmymay/archive/2008/10/15/perfmon-objects-counters-thresholds-utilities-for-sql-server.aspx
PerfMon Counters(1) Processor - % Processor Time System - Processor Queue Length
PerfMon Counters(2) Memory – Available Mbytes Paging File - % Usage SQL Server: Buffer Manager – Page Life Expectancy SQL Server: Memory Manager Total Server Memory Target Server Memory
PerfMon Counters(3) Physical Disk Avg Disk sec/Read Avg Disk sec/Write Disk Reads/sec Disk Writes/sec
PerfMon Counters(4) SQL Server: Access Methods Page Splits/sec Page Allocated/sec Range Scans/sec Full Scans/sec Index Searches/sec
PerfMon Counters(5) SQL Server: SQL Statistics Compilations/sec Recompilations/sec SQL Server: General Statistics – User Connections SQL Server: Databases – Transactions/sec
PerfMon Determine: the counters you want to capture the frequency the duration to capture when to capture Be consistent
PerfMon Data Analysis Excel Database PAL
PerfMon Data Analysis – Database (demo) SQL Server Native Client cannot be used with perfmon. Perfmon is a Windows tool that can only be used with DSNs that use the MDAC SQLODBC driver included with Windows. Relog: http://blogs.technet.com/b/richard_macdonald/archive/2008/04/08/3032386.aspx http://sqlserverpedia.com/blog/sql-server-bloggers/using-the-relog-utility-%E2%80%93-part-2/
Performance Analysis of Logs (PAL) Available from Codeplex Utilizes PowerShell GUI interface, creates HTML output with data and graphs Analyzes PerfMon data for thresholds Use default templates, or can create your own (demo) http://pal.codeplex.com/ http://pal.codeplex.com/
Trace Capture baselines Utilize when performance issues arise Set up template for live tracing Always filter Profiler GUI vs. trace Server side vs. Client side Grant Fritchey – Set up and Schedule a Server Side Trace http://www.sqlservercentral.com/articles/Performance/71549/
Trace Data Analysis Database ClearTrace RMLUtils Qure (demo)
Profiler Data Analysis – ClearTrace Developed by Bill Graziano Available from ScaleSQL consulting site In a 2008 R2 instance, data from 2005 can be imported (demo) http://www.scalesql.com/cleartrace/download.aspx http://www.scalesql.com/cleartrace/download.aspx
Profiler Data Analysis – RML Utilities Developed by Microsoft Used by Customer Service and Support (CSS) SQL 2008R2 can only import files from the same release (demo) x86: http://www.microsoft.com/downloads/en/details.aspx?FamilyId=7EDFA95A-A32F-440F-A3A8-5160C8DBE926&displaylang=en x64: http://www.microsoft.com/downloads/en/details.aspx?FamilyId=B60CDFA3-732E-4347-9C06-2D1F1F84C342&displaylang=en http://sqlcat.com/technicalnotes/archive/2008/02/01/precision-performance-for-microsoft-sql-server-using-rml-utilities-9-0.aspx
Profiler Data Analysis – Qure Developed by DBSophic Useful when you want to compare two trace files (demo) http://www.dbsophic.com/qure-analyzer.html
DMVs Information does not between persist between restarts Requires VIEW SERVER STATE permission Excellent references: Glenn Berry Tim Ford Glenn Berry http://sqlserverperformance.wordpress.com/ Tim Ford: http://thesqlagentman.com/
DMVs Determine what data you want to capture Wait stats File stats Table reads/writes Index usage Snapshot the data to a table at regular intervals Store in a separate database (demo) Wait stats post from Paul Randal: http://www.sqlskills.com/BLOGS/PAUL/post/Wait-statistics-or-please-tell-me-where-it-hurts.aspx
DMVs – Bad NC Indexes Output
WhoIsActive Developed by Adam Machanic Useful for troubleshooting and obtaining some baseline information (demo) http://sqlblog.com/files/default.aspx
WhoIsActive: sessions Kendra Little post for creating destination table: http://www.littlekendra.com/2011/02/01/whoisactive/
Summary Determine what is most important to baseline and capture Start simple, work up Be consistent Have scripts/methods at the ready to check current values when problems strike
Thank you!