0% found this document useful (0 votes)
11 views27 pages

Module 3 SQL Server Tools - 3 - Performance Tools - Perfmon and PAL

Uploaded by

valerie gurshman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views27 pages

Module 3 SQL Server Tools - 3 - Performance Tools - Perfmon and PAL

Uploaded by

valerie gurshman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Microsoft

Services

SQL Server
Performance Tuning and
Optimization
SQL Server Tools -
Performance Tools
Performance Monitor
and Performance
Analysis of Logs (PAL)

Microsoft
Services
Lesson Objectives
• In this Lesson you will learn the following:
• SQL Server Management Studio (SSMS) Performance Tools
• Extended Events
• Performance Tools
• Other Performance Tools
• Tuning Methods
SQL Server Management
Studio (SSMS) Performance
Tools
Introduction to
Performance Monitor (perfmon)
Introduction
• Perfmon is a GUI tool to
monitor system resources
(memory, CPU, IO, network)
• Graphs are useful for real-
time monitoring
• Logs are useful for
extended monitoring and
off-site analysis
• Objects to monitor:
Memory, process,
processor, physical disk,
logical disk, and some SQL
Server objects
Leveraging Perfmon
• Performance Monitor (perfmon) is often used without
options when opening a .csv or .blg file or for active
monitoring
• Perfmon can be viewed as a Line Graph (Default),
Histogram bar, or a Report
• The perfmon output can be printed or saved as an
HTML Document / Report (.tsv)
• Key extended perfmon capabilities:
• ‘Connect to another computer ‘– Windows Core, Central Monitoring
Station
• Creating a Custom Data Collector Set – Leveraging existing perfmon
templates, Creating / Viewing User and System Diagnostic and
Performance Reports
Creating Perfmon Collections
• Output to a .CSV or .BLG file
• Can be re-opened in Perfmon for further analysis
• Can be passed to Performance Analysis of Logs (PAL) for analysis
• When analyzing in perfmon, use Report View to
analyze values
• Easier to view and tells you what you need to know

Choose your Set your sampling Collection


objects and interval and produced
counters as usual collection
schedule
The longer the
Rolled up into a schedule, the higher Can be saved and
Data Collector Set the sampling reused
interval
Perfmon Templates
• Perfmon Switches
• /sys - launch Reliability and Performance Monitor in standalone
Performance Monitor mode (formerly System Monitor).
• /sys /comp - allows for comparison overlay between two open
instances of Performance Monitor.
• /report - launch Reliability and Performance Monitor in a standalone
window, run the Diagnosis report for 60 seconds, and display the
resulting report.
• /rel - launch Reliability and Performance Monitor in standalone
Reliability Monitor mode.
• /res - launch Reliability and Performance Monitor in standalone
Resource Monitor mode.
Demonstration:
Creating a Perfmon
Template
SQL Server Management
Studio (SSMS) Performance
Tools
Performance Counters
Analyzing Performance Counters with
Perfmon
• Look for abnormally high or low counters
• Compare to baseline of good performance
• Comparisons can be made to periods of acceptable performance in the
same log file
• If one counter indicates a problem area, look for
supporting counters and confirm with other tools
and counters to test your hypothesis
Performance Monitor Counters
Important Operating System
Counters
• % Processor Time
• Less than 80% is preferred

• Disk Reads/sec, Writes/sec and


Transfers/sec
• Indicates the IOPS as perceived by the operating
system. This value could differ from the
hardware IOPS
• Avg. Disk sec/Read and Avg. Disk
sec/Write
• Indicates the responsiveness of the disks
• Reads should not exceed 25ms for data files
• Writes should be 1ms or less for log files
Performance Monitor Counters
Important SQL Server
Counters
• Buffer Manager\Buffer cache
hit ratio
• Must be as close to 100% as possible

• Buffer Manager\Page life


expectancy
• A drop of more than 30% should be
investigated
• Buffer Manager\Page
lookups/sec
• Buffer Manager\Page reads/sec
• Plan Cache\Cache Hit Ratio
• Must be higher than 95%
Performance Monitor Counters
Important SQL Server
Counters
• SQL Errors\Errors/sec
• Error types must be investigated and possibly
resolved
• SQL Statistics\Batch
Requests/sec
• SQL Statistics\SQL
Compilations/sec
• A high number can be an indicator of ad hoc
queries, this must be cross referenced with ad
hoc plans in the plan cache
• SQL Statistics\SQL
Recompilations/sec
• Close to zero as possible
Demonstration:
Using Perfmon to
Collect Counters
SQL Server Management
Studio (SSMS) Performance
Tools
Performance Analysis of Logs
Performance Analysis of Logs
• Tool developed by an engineer at
Microsoft
• A passion for automated performance
analysis
• Analyzes collected perfmon data
against best practice thresholds
• Processes *.BLG and *.CSV files
• Produces a HTML report detailing the
findings
• Simple, easy-to-use interface
• Built-in thresholds exist for many
products,
including SQL Server

• Note: PAL tool can be download from


the following link:
PAL (Performance Analysis of Logs)
• PAL analyses counter logs (.csv or .blg) and creates an HTML report
• Free and public download available at http://pal.codeplex.com
• The PAL installation uses Windows Installer (.msi)
• The PAL 2.0 has the following prerequisites:
• Windows PowerShell 2.0 (free)
• .NET Framework 3.5 (free)
• Microsoft Chart Controls for .NET Framework 3.5 (free)
• Not supported by Microsoft
• Written by Clint Huffman [email protected]
• For support, use the forums at http://pal.codeplex.com
• Designed to be used for remote analysis
• PAL supports most of the major Microsoft products
• SQL Server 2012 is out, we are working on 2014 
• Export thresholds to a counter log template
• Threshold files are exposed and can be edited to fit your baseline
Export Thresholds
• To take full advantage of the thresholds, export a threshold file
to a counter log template
• Counter log templates can be saved as .htm (Windows Server
2003/Windows XP), .xml (Windows Server 2008/Windows 7), or
.txt (logman)
HTML Report
• After the analysis, an HTML report is created
• The report has a table of contents showing the number of
alerts in each section. Alerts are counter values that are
outside established thresholds
Interpreting the Report
• Each analysis has a description, the thresholds it
uses, references to more information, charts,
and alerts
Alerts
• Alerts are thrown when thresholds are broken.
The overall counter stats as well as each time
slice is analyzed
Demonstration:
PAL End to End:
Using PAL to Analyze
Perfmon Output
Performance Monitoring Using DMVs
• The DMV sys.dm_os_performance_counters is useful for
getting SQLOS performance data
• Limited to the SQLOS (Windows OS, Reporting Services, SSIS, etc. are not available)

• Some performance counters need to be interpreted


appropriately before they can be used
• Returns a row per performance counter maintained by SQL
Server
• Example:
SELECT object_name, counter_name,
instance_name, cntr_value, cntr_type
FROM sys.dm_os_performance_counters
WHERE counter_name = 'Page life
expectancy'
Demonstration:
Using SYS.DM_OS_
PERFORMANCE_
COUNTERS
Other Methods of Capturing Perfmon
Data
• PowerShell
• SQLDIAG / PSSDIAG
• Produces .blg file for perfmon analysis
• Note: This is currently what we need for PAL (Binary Log
File)
• Has the ability to capture SQL Trace Files (.trc)
• Captures SQL Server, Application, and System Error
Logs
• Captures blocking output, system health information
• Captures SQL Server Perf Stats Script (SQL Nexus)
• Allows custom diagnostics
© 2015 Microsoft Corporation. All rights reserved.

You might also like