0
Perfmon and Profiler 101<br />
About Me: Brent Ozar<br />SQL Server Expert for Quest Software<br />Former SQL DBA<br />Managed &gt;80tb SAN, VMware<br />...
Today’s Agenda<br />The Civic & Godzilla<br />Metrics, Trace, Mitigations<br />Taking Before and After Pictures<br />Helpf...
If You Don’t Need to Go Fast…<br />Photo Licensed With Creative Commons From http://flickr.com/photos/stevekeys/2755142278...
But The Faster You Want To Go<br />
The More You Have To Measure<br />
Windows “Check Engine” Light<br />
And If You Wanna Go Fast:<br />
Two Approaches to Detection<br />Exceptions Monitoring: <br />Check Engine Light<br />Reactive Actions<br />Proactive Moni...
Metrics-Trace-Mitigation Process<br />
Where Do We Start?<br />
Capture Metrics With Perfmon<br />Performance Monitor, aka Perfmon<br />Ships with all Windows versions<br />Polls any ser...
12<br />
Memory Counters<br />Memory – Available Mbytes<br />Paging File - % Usage<br />SQLServer:Buffer Manager – <br />Buffer cac...
Storage Metrics: Physical Disk<br />Avg. Disk Queue Length<br />Avg. Disk sec/Read<br />Avg. Disk sec/Write<br />Disk Read...
CPU & Other Metrics<br />Processor - % Processor Time<br />System – Processor Queue Length<br />SQLServer:General Statisti...
16<br />The Raw Output: CSV Files<br />
17<br />Adding Analytical Formulas<br />
18<br />That’s a Lot of Zeroes!<br />
19<br />Sorting High to Low<br />
What To Look For, In Order<br />System – Processor Queue Length<br />Memory – Available Mbytes<br />Lock pages in memory!<...
What To Look For Next<br />Disk metrics on the page file drive<br />Disk metrics on the log file drive<br />Disk metrics o...
Got Everything on One Drive?<br />Narrow it down with the DMV sys.dm_io_virtual_file_stats<br />
Capture Queries with a Trace<br />
Columns to Capture<br />What’s Going On<br />Text Data<br />DatabaseID and/or DatabaseName<br />Login Name<br />Host Name<...
Profiler’s Results: A Trace Table<br />
Order By Duration Descending<br />
Casting and Grouping<br />
Correlate Metrics & Trace<br />Show a cause and effect relationship<br />Fields to mentally “join” on:<br />Date/Time rang...
Metrics-Trace-Mitigation Process<br />
If Our Servers Were Houses…<br />Before<br />After<br />
Consistent and Repeatable<br />100 users accessing the web site<br />Closing a typical financial period<br />10 users runn...
When To Take A Picture<br />Before<br />Adding new hardware<br />Installing a SQL Server service pack<br />Changing storag...
Plus Monitoring For…<br />Before<br />Things break<br />Populations change over time<br />Budgeting<br />Need to enforce s...
Save Perfmon & Profiler Data<br />Central file share<br />Even better: in a database<br />Name by server, by date<br />Rev...
Tool: Performance Dashboard<br />
Tool: Data Mining<br />
Table Analysis Tools For The Cloud<br />
Detect Categories of Load<br />
Works for Profiler Results Too<br />
Tool: ClearTrace<br />
Cleans Up Queries<br />
Sample Problem #1<br />Metrics tell us:<br />Very high disk queue lengths on data drive<br />Trace tells us:<br />Report q...
Ways We Can Mitigate It<br />Add covering indexes<br />Modify existing indexes<br />Add hard drives to the data file array...
Sample Problem #2<br />Metrics tell us:<br />Page file drive queue lengths average &gt;20<br />Page file use averages &gt;...
Memory Configuration<br />
Ways We Can Mitigate It<br />Add memory and enable AWE/PAE<br />Add memory and upgrade to 64-bit<br />Move the app to its ...
Sample Problem #3<br />Metric looks OK, but every 15 minutes:<br />Long drive queues on the log file drive<br />Page life ...
Ways We Can Mitigate It<br />Stop doing log backups<br />Put the databases in simple mode<br />Add drives to the transacti...
Sample Problem #4<br />Metrics tell us:<br />CPU average is high <br />Disk, memory look OK<br />Trace tells us:<br />Quer...
How We Can Mitigate It<br />Buy really fast processors<br />Spend a lot on licensing<br />Change cursor to set-based query...
Wrapping Things Up<br />Double-check the event log first<br />Don’t get overwhelmed: focus with the Metric – Trace – Mitig...
Resources On The Web<br />My blog about Perfmon:www.BrentOzar.com/perfmon<br />Excel Table Analysis Tools for the Cloud:ww...
Upcoming SlideShare
Loading in...5
×

Perfmon And Profiler 101

612

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
612
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
29
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "Perfmon And Profiler 101"

  1. 1. Perfmon and Profiler 101<br />
  2. 2. About Me: Brent Ozar<br />SQL Server Expert for Quest Software<br />Former SQL DBA<br />Managed &gt;80tb SAN, VMware<br />Dot-com-crash experience<br />Specializes in performance tuning<br />
  3. 3. Today’s Agenda<br />The Civic & Godzilla<br />Metrics, Trace, Mitigations<br />Taking Before and After Pictures<br />Helpful Tools<br />Sample Scenarios<br />Resources and Q&A<br />
  4. 4. If You Don’t Need to Go Fast…<br />Photo Licensed With Creative Commons From http://flickr.com/photos/stevekeys/2755142278/<br />
  5. 5. But The Faster You Want To Go<br />
  6. 6. The More You Have To Measure<br />
  7. 7. Windows “Check Engine” Light<br />
  8. 8. And If You Wanna Go Fast:<br />
  9. 9. Two Approaches to Detection<br />Exceptions Monitoring: <br />Check Engine Light<br />Reactive Actions<br />Proactive Monitoring: <br />Detailed Gauges<br />Preventative Actions<br />
  10. 10. Metrics-Trace-Mitigation Process<br />
  11. 11. Where Do We Start?<br />
  12. 12. Capture Metrics With Perfmon<br />Performance Monitor, aka Perfmon<br />Ships with all Windows versions<br />Polls any server from your desktop<br />Pulls performance metrics<br />Writes them to a file<br />Requires some OS permissions<br />Does not include alerts or analytics<br />
  13. 13. 12<br />
  14. 14. Memory Counters<br />Memory – Available Mbytes<br />Paging File - % Usage<br />SQLServer:Buffer Manager – <br />Buffer cache hit ratio<br />Page life expectancy<br />SQLServer:Memory Manager – Memory Grants Pending<br />
  15. 15. Storage Metrics: Physical Disk<br />Avg. Disk Queue Length<br />Avg. Disk sec/Read<br />Avg. Disk sec/Write<br />Disk Reads/sec<br />Disk Writes/sec<br />% Disk Time<br />
  16. 16. CPU & Other Metrics<br />Processor - % Processor Time<br />System – Processor Queue Length<br />SQLServer:General Statistics – User Connections<br />
  17. 17. 16<br />The Raw Output: CSV Files<br />
  18. 18. 17<br />Adding Analytical Formulas<br />
  19. 19. 18<br />That’s a Lot of Zeroes!<br />
  20. 20. 19<br />Sorting High to Low<br />
  21. 21. What To Look For, In Order<br />System – Processor Queue Length<br />Memory – Available Mbytes<br />Lock pages in memory!<br />
  22. 22. What To Look For Next<br />Disk metrics on the page file drive<br />Disk metrics on the log file drive<br />Disk metrics on the data file drive<br />Disk metrics on the TempDB drive<br />
  23. 23. Got Everything on One Drive?<br />Narrow it down with the DMV sys.dm_io_virtual_file_stats<br />
  24. 24. Capture Queries with a Trace<br />
  25. 25. Columns to Capture<br />What’s Going On<br />Text Data<br />DatabaseID and/or DatabaseName<br />Login Name<br />Host Name<br />Application Name<br />What The Impact Was<br />CPU<br />Reads<br />Writes<br />Duration<br />Start Time<br />End Time<br />
  26. 26. Profiler’s Results: A Trace Table<br />
  27. 27. Order By Duration Descending<br />
  28. 28. Casting and Grouping<br />
  29. 29. Correlate Metrics & Trace<br />Show a cause and effect relationship<br />Fields to mentally “join” on:<br />Date/Time ranges<br />CPU<br />Reads/Writes<br />Duration<br />
  30. 30. Metrics-Trace-Mitigation Process<br />
  31. 31. If Our Servers Were Houses…<br />Before<br />After<br />
  32. 32. Consistent and Repeatable<br />100 users accessing the web site<br />Closing a typical financial period<br />10 users running a report<br />Importing 100,000 records for a nightly ETL process<br />Think scripts, think load generation tool<br />Capture statistics during test run<br />
  33. 33. When To Take A Picture<br />Before<br />Adding new hardware<br />Installing a SQL Server service pack<br />Changing storage configurations<br />New application versions<br />Every quarter<br />After<br />
  34. 34. Plus Monitoring For…<br />Before<br />Things break<br />Populations change over time<br />Budgeting<br />Need to enforce standards<br />We’re not the only ones working on the house<br />After<br />
  35. 35. Save Perfmon & Profiler Data<br />Central file share<br />Even better: in a database<br />Name by server, by date<br />Revisit every budget season<br />Use for new hire training<br />
  36. 36. Tool: Performance Dashboard<br />
  37. 37. Tool: Data Mining<br />
  38. 38. Table Analysis Tools For The Cloud<br />
  39. 39. Detect Categories of Load<br />
  40. 40. Works for Profiler Results Too<br />
  41. 41. Tool: ClearTrace<br />
  42. 42. Cleans Up Queries<br />
  43. 43. Sample Problem #1<br />Metrics tell us:<br />Very high disk queue lengths on data drive<br />Trace tells us:<br />Report queries doing table scans w/o indexes<br />Many scheduled reports run simultaneously<br />
  44. 44. Ways We Can Mitigate It<br />Add covering indexes<br />Modify existing indexes<br />Add hard drives to the data file array<br />Add memory to cache scanned tables<br />Run reports serially, not all at once<br />
  45. 45. Sample Problem #2<br />Metrics tell us:<br />Page file drive queue lengths average &gt;20<br />Page file use averages &gt;1%<br />Available memory averages less than 250mb<br />Trace tells us:<br />No unusual queries<br />
  46. 46. Memory Configuration<br />
  47. 47. Ways We Can Mitigate It<br />Add memory and enable AWE/PAE<br />Add memory and upgrade to 64-bit<br />Move the app to its own server<br />Reduce SQL’s min/max memory sizes<br />
  48. 48. Sample Problem #3<br />Metric looks OK, but every 15 minutes:<br />Long drive queues on the log file drive<br />Page life expectancy drops near zero<br />Network traffic jumps<br />Trace tells us:<br />Transaction log backups are running<br />
  49. 49. Ways We Can Mitigate It<br />Stop doing log backups<br />Put the databases in simple mode<br />Add drives to the transaction log array<br />Throttle the transaction log backups<br />
  50. 50. Sample Problem #4<br />Metrics tell us:<br />CPU average is high <br />Disk, memory look OK<br />Trace tells us:<br />Queries are using cursors<br />Operating on individual records, not sets<br />
  51. 51. How We Can Mitigate It<br />Buy really fast processors<br />Spend a lot on licensing<br />Change cursor to set-based query<br />
  52. 52. Wrapping Things Up<br />Double-check the event log first<br />Don’t get overwhelmed: focus with the Metric – Trace – Mitigation process<br />Show a clear cause and effect<br />Use pro tools to get an edge<br />
  53. 53. Resources On The Web<br />My blog about Perfmon:www.BrentOzar.com/perfmon<br />Excel Table Analysis Tools for the Cloud:www.SQLServerDataMining.com/cloud<br />ClearTrace: http://www.cleardata.biz/cleartrace/<br />SQL Server community:SQLServerPedia.com<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×