This session talks about How PSSDIAG and SQLNexus can help to troubleshoot SQL Performance issues. Moreover, it also talks about some best practices which are important for SQL Perfornance
4. SQLDIAG– Data collection utility
Windows Event Logs (Application, System, and Security) in .CSV files
System Monitor (aka Perfmon) performance counters in .BLG file/s
SQL Server Profiler traces in .TRC file/s
SQL Server error logs, configuration, point-in-time snapshots of several DMVs in a .OUT
file
System information via the Msinfo32 utility
Custom scripts for collecting blocking specific data
All configuration parameters are stored in SQLDiag.xml file and can be changed
5. PSSDIAG – Data Collection Utility
Similar to SQLDIAG utility except for the user interface
• CPU spikes on the SQL Server box
• Performance degradation during specific hours (say
between 4:00 PM and 6:00 PM daily)
• Blocking on SQL Server
• Overall performance bottlenecks in SQL Server using
wait statistics
6. SQL Nexus – Data analysis tool
Helpful in post-mortem analysis of performance issues
Uses RML utilities (Readtrace) – It’s a pre-requisite
Tool Highlights:
Trace aggregation to show TOP N most expensive queries
Wait stats analysis for visualizing blocking and other resource contention issues
Visualize loaded data via Reports – uses SSRS client side report viewer
PSSDIAG and SQL Nexus:
Nexus analyses data when SQLDiag is clubbed with SQLxxxxPerfStats script
SQLxxxxPerfStats scripts captures DMVs output including blocking information
9. I/O Troubleshooting
2015-28-08 00:00:00.00 spid1 SQL Server has encountered 192 occurrence(s) of IO requests taking longer
than 15 seconds to complete on file [E:SQLServerTestdb.mdf] in database [Testdb] (7). The OS file
handle is 0x00000000000074D4. The offset of the latest long IO is: 0x00000000022000.
The message indicates that SQL Server has been waiting on at least one I/O for 15 seconds or longer
This represents StuckStalled IO requests on SQL Server
10. I/O Troubleshooting
Tools and Techniques
• Performance Monitor Counters (Perfmon)
PhysicalDiskAv
g. Disk
sec/Transfer
(<0.015)
PhysicalDiskAv
g. Disk Queue
Length
(<2 per spindle)
PhysicalDisk%
Idle Time
(~100%)
PhysicalDiskDisk
Bytes/sec
ProcessIO Data
Bytes/sec(sqlserver)
sys.dm_io_pending_io_requests
Look out for “io_pending” column of this DMV. The io_pending column indicates 1 if the I/O is
still pending within the kernel.
13. Common Mysteries
SQL Server is using high CPU, but PSSDIAG does not show CPU getting accounted to the
queries running in SQL Server!!!
How does Rebuildreorg indexes affect statistics?
SQL Server consumes all the memory that I give!!
Why do I see huge number of child spids waiting on CXPACKET even though my MAXDOP
is set to a lower value?
15. Important Trace Flags
T4199 This trace flag is a combination of a lot of optimizer related fixes released under
different trace flags.
T1236 Enable this trace flag when you see elevated values occur for LOCK_HASH spinlock
count especially during following operations: SQL Server logins, Linked server queries,
sp_reset_connection, Transactions
T1117 This trace flag applies to the entire SQL Server instance, not just to one DB, and it
affects all files in the same file group in a database.
T1118 This trace flag forces uniform extent allocations instead of mixed page
allocations. The trace flag is commonly used to assist in TEMPDB scalability by avoiding
SGAM and other allocation contention points
T8048 This trace flag will upgrade NODE based partitioning to CPU based partitioning.
Remember this requires more memory overhead but can provide performance increases on
these highly transactional OLTP systems.
16. Power plan setting*
Max Degree of
Parallelism
Max Server Memory
Client Side Tracing
Missing Indexes DMV &
Database Tuning
Advisor
Upgrade SQL to latest
HotfixesSPs