PASS VC: SQL Server Performance Monitoring and Baselining

24
Parikshit Savjani (@talktosavjani) Senior Program Manager Data Group SQL Server Performance Monitoring & Baselining

Transcript of PASS VC: SQL Server Performance Monitoring and Baselining

Page 1: PASS VC: SQL Server Performance Monitoring and Baselining

Parikshit Savjani (@talktosavjani)Senior Program ManagerData Group

SQL Server Performance Monitoring & Baselining

Page 2: PASS VC: SQL Server Performance Monitoring and Baselining

2

About MeSenior Program Manager (SQL Tiger Team)

8 Years@talktosavjani

http://www.sqlserverfaq.nethttps://blogs.msdn.microsoft.com/sql_server_team/https://blogs.msdn.microsoft.com/sqlreleaseservices/

@mssqltiger

Page 3: PASS VC: SQL Server Performance Monitoring and Baselining

Session Objectives And Takeaways

Understand What SQL Performance Baselining means and why is it required ?

Understand the tools available for establishing a baseline in SQL Server and monitoring

Learn how to use the performance baseline tools to understand and troubleshoot performance issues

See an performance baselining and monitoring solution using SQL Server and SSRS

Page 4: PASS VC: SQL Server Performance Monitoring and Baselining

Why Performance Baseling?

Page 5: PASS VC: SQL Server Performance Monitoring and Baselining

Why SQL Performance Baselining is required?

• How slow is slow?• How fast is fast?

Performance is relative

• Identifying Hardware Reqs based on current workload and resource utilization

Capacity Planning

• Identifying the current workload, resource utilization

Consolidation

• Estimate VM Size/configuration • Estimate Cost

Virtualization\Migration to Cloud (Azure)

Page 6: PASS VC: SQL Server Performance Monitoring and Baselining

What is Baselining?• Performance Baselining is capturing last known good state metrics

which can be used as a starting point for comparison.

• Performance Monitoring is required for Baselining.

• The goal of performance monitoring for baselining should be, to be non-invasive with minimum overhead.

• Baselining requires capturing the performance metrics across time dimension.

• Historical Analysis of Performance Metrics is useful to understand any anomaly or to predict the future behavior.

Page 7: PASS VC: SQL Server Performance Monitoring and Baselining

Performance Monitoring Tools

Page 8: PASS VC: SQL Server Performance Monitoring and Baselining

Performance Monitoring Tools• Perfmon (Performance Monitor Logs)

• DMVs (Dynamic Management Views)

• Xevents (Extended Events)

Page 9: PASS VC: SQL Server Performance Monitoring and Baselining

Monitoring Resource Utilization•Processor(*)% Processor Time•Process(sqlservr)% Processor Time•Processor(*)% Privileged Time•Process(sqlservr)% Privileged Time

PROCESSOR

•Available Mbytes•Memory Pages/sec•Process(sqlservr)Private Bytes•Process(sqlservr)Working Set•SQLServer: Memory Manager Total Server Memory•SQLServer: Memory Manager Target Server Memory

Memory

•PhysicalDisk(*)Avg. Disk sec/Read•PhysicalDisk(*)Avg. Disk sec/Write•PhysicalDisk Avg. Disk Queue Length•Disk Bytes/sec•Avg Disk Bytes/Transfer •Process(sqlservr)IO Data Operations/sec

PHYSICAL DISK

•Network InterfaceBytes Received/sec •Network InterfaceBytes Sent/sec•Network Interface(*)Output Queue Length

Network IO

Page 10: PASS VC: SQL Server Performance Monitoring and Baselining

Monitoring SQL Server Activity• SQL Server: SQL Statistics Batch Requests/sec• SQL Server: SQL Statistics SQL Compilations/sec• SQL Server: SQL Statistics SQL Recompilations/sec• sys.dm_exec_requests• Sys.dm_exec_sessions• sys.dm_exec_connections

SQL Workload

• SQL Server: Wait Statistics• Sys.dm_os_waiting_tasks• Sys.dm_os_wait_stats

SQL Waits

• Sys.dm_db_index_physical_stats• Sys.dm_db_index_operational_stats• Sys.dm_db_index_usage_stats

Database Index fragmentation

Page 11: PASS VC: SQL Server Performance Monitoring and Baselining

Monitoring SQL Server system health

• Max Workers• Workers Created • Idle Workers• Deadlocks

Query Processing Health

• Latch Waits > 15 sec• Locks > 30 sec• IO Latch Timeouts• Long IO Status

Lock & Latch Waits

• Deadlocked Scheduler• Non-Yielding Scheduler• Access Violations• OOM• Corrupt Pages Status

Fatal Issues

• API Name• Error Code

Security Errors

Page 12: PASS VC: SQL Server Performance Monitoring and Baselining

SQL Server Tiger Team

System Health Session Monitoring• Data Collected in ring buffer target & *.xel files

in Log Folder ( 4 Rollover Files of 5MB)• Increase System Health Xel File retention

ALTER EVENT SESSION [system_health] ON SERVER STATE = STOPgoALTER EVENT SESSION [system_health] ON SERVER DROP TARGET package0.event_fileALTER EVENT SESSION [system_health] ON SERVER ADD TARGET package0.event_file

(SET filename=N'system_health.xel' ,max_file_size=(25), max_rollover_files=(5))

GOALTER EVENT SESSION [system_health] ON SERVER STATE = STARTgo

Page 13: PASS VC: SQL Server Performance Monitoring and Baselining

Lets Bring them all togetherSQL Performance baselining and Monitoring solution

Page 14: PASS VC: SQL Server Performance Monitoring and Baselining

Performance Monitoring and Baselining Solution• Should be non-invasive

• Should be scalable

• Performant

• Low Cost

Page 15: PASS VC: SQL Server Performance Monitoring and Baselining

ArchitectureMonitoring

Server

SQL1 SQL2 SQL3 SQLN

SQL Servers in the Environment

db2db1

dba_local

db2db1

dba_local

db2db1

dba_local

db2db1

dba_local

Central Monitoring Server

SSRS Portal

SQL Server Version, Configuration, OS information,Database Properties, Size,DataFile File Size,Storage, Backup Information SQL Server Resource Utilization, Performance Data, Wait statistics

Page 16: PASS VC: SQL Server Performance Monitoring and Baselining

DEMOSQL Performance baselining and Monitoring solutionhttps://github.com/amitmsft/MSSQLTIGERDemos

Page 17: PASS VC: SQL Server Performance Monitoring and Baselining

SQL Performance Baseline Report

Parameters:

StartDate: 08/01/2015EndDate: 08/16/2015

Page 18: PASS VC: SQL Server Performance Monitoring and Baselining

SQL Hourly Performance TrendParameters:SQL Server: <server-name> Date: 08/17/2015

Page 19: PASS VC: SQL Server Performance Monitoring and Baselining

SQL Memory Hourly Trend

Page 20: PASS VC: SQL Server Performance Monitoring and Baselining

User Session Status

Page 21: PASS VC: SQL Server Performance Monitoring and Baselining

Database Storage Report

Page 22: PASS VC: SQL Server Performance Monitoring and Baselining

Database Index Fragmentation Report

Page 23: PASS VC: SQL Server Performance Monitoring and Baselining

System Health Reports

Page 24: PASS VC: SQL Server Performance Monitoring and Baselining

Thank you !!

@talktosavjani@mssqltiger