Download presentation
Presentation is loading. Please wait.
Published byPhillip Stanley Modified over 9 years ago
1
© 2008 Quest Software, Inc. ALL RIGHTS RESERVED. Perfmon and Profiler 101
2
About Me: Brent Ozar SQL Server Expert for Quest Software Former SQL DBA Managed >80tb SAN, VMware Dot-com-crash experience Specializes in performance tuning
3
Today’s Agenda The Honda Civic and the Nissan GT-R Metrics, Trace, Mitigations A New Secret Weapon Resources and Q&A
4
If You Don’t Need to Go Fast… From http://flickr.com/photos/stevekeys/2755142278/
5
But The Faster You Want To Go
6
The More You Have To Measure
7
Windows “Check Engine” Light
8
And If You Wanna Go Fast:
9
Two Approaches to Detection Exceptions Monitoring: Check Engine Proactive Monitoring: Detailed Gauges
10
Where Do We Start? Hardware Windows SQL Server Tables, Indexes Query
11
Capture Metrics With Perfmon Performance Monitor, aka Perfmon Ships with all Windows versions Polls any server from your desktop Pulls performance metrics Writes them to a file Requires some OS permissions Does not include alerts or analytics
12
11
14
Memory Counters Memory – Available Mbytes Paging File - % Usage SQLServer:Buffer Manager – –Buffer cache hit ratio –Page life expectancy SQLServer:Memory Manager – Memory Grants Pending
15
Storage Metrics: Physical Disk % Disk Time Avg. Disk Queue Length Avg. Disk sec/Read Avg. Disk sec/Write Disk Reads/sec Disk Writes/sec
16
CPU Metrics Processor - % Processor Time System – Processor Queue Length SQLServer:General Statistics – User Connections (not CPU, just “other”)
17
16 The Raw Output: CSV Files
18
17 Adding Analytical Formulas
19
18 That’s a Lot of Zeroes!
20
19 Sorting High to Low
21
What To Look For, In Order System – Processor Queue Length Memory – Available Mbytes Lock pages in memory!
22
What To Look For Next Disk metrics on the page file drive Disk metrics on the log file drive Disk metrics on the data file drive Disk metrics on the TempDB drive
23
Got Everything on One Drive? Narrow it down with the DMV sys.dm_io_virtual_file_stats
24
What If We Could Data Mine It?
25
Table Analysis Tools For The Cloud
26
Detecting Categories of Load
27
Capture Queries with a Trace
28
Columns to Capture What’s Going On Text Data DatabaseID and/or DatabaseName Login Name Host Name Application Name What The Impact Was CPU Reads Writes Duration Start Time End Time
29
Profiler’s Results: A Trace Table
30
Order By Duration Descending
31
Casting and Grouping
32
Another Cloud Analytics Candidate
33
Another Way: Perf Dashboard
34
Correlate Metrics & Trace Show a cause and effect relationship Fields to mentally “join” on: –Date/Time ranges –CPU –Reads/Writes –Duration
35
Sample Problem #1 Metrics tell us: –Very high disk queue lengths on data drive Trace tells us: –Report queries doing table scans w/o indexes –Many scheduled reports run simultaneously
36
Ways We Can Mitigate It Add covering indexes Modify existing indexes Run reports serially, not all at once Add hard drives to the data file array Add memory to cache scanned tables
37
Sample Problem #2 Metrics tell us: –Page file drive queue lengths average >20 –Page file use averages >1% –Available memory averages <200mb –Buffer cache hit ratio and page life expectancy are high Trace tells us: –No unusual queries
38
Memory Configuration Server: 4gb ram OS: 1gb SQL: 3gb App: 1gb
39
Ways We Can Mitigate It Add memory and enable AWE/PAE Add memory and upgrade to 64-bit Reduce SQL’s min/max memory sizes Move the app to its own server
40
Sample Problem #3 Metric looks OK, but every 15 minutes: –Long drive queues on the log file drive –Page life expectancy drops near zero –Network traffic jumps Trace tells us: –Transaction log backups are running
41
Ways We Can Mitigate It Stop doing log backups Put the databases in simple mode Add drives to the transaction log array Throttle the transaction log backups
42
Sample Problem #4 Metrics tell us: –CPU average is high –Disk, memory look OK Trace tells us: –Queries are using cursors –Operating on individual records, not sets
43
How We Can Mitigate It Change cursor to set-based query Buy really fast processors Spend a lot on licensing
44
Wrapping Things Up Double-check the event log first Don’t get overwhelmed: focus with the Metric – Trace – Mitigation process Show a clear cause and effect Use cloud-based BI to get an edge
45
Resources On The Web My posts about Perfmon and analytics: www.BrentOzar.com/perfmon www.BrentOzar.com/perfmoncloud Excel Table Analysis Tools for the Cloud: www.SQLServerDataMining.com/cloud SQL Server community: SQLServerPedia.com
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.