Presentation is loading. Please wait.

Presentation is loading. Please wait.

Troubleshooting SQL Server Basics

Similar presentations


Presentation on theme: "Troubleshooting SQL Server Basics"— Presentation transcript:

1 Troubleshooting SQL Server Basics

2 Luan Moreno M. Maciel Sr. Database Consultant at Pythian [BI Team]
MCT | MCSE Data Platform & BI Microsoft MVP - SQL Server

3 Luan Moreno M. Maciel

4 Agenda Patterns Waits Concepts Analysis Step by Step

5 Analysis Step by Step Types? Where? Interpretation? Methodology?

6 Where? DMV’s (Dynamic Management Views) Performance Counters
Execution Plan Analysis Custom-TSQL MDW Where? Tools

7 Types? Historical Live

8 Methodology? Symptom Root Cause Solution

9 Interpretation? Colect Correct Data Daily Snapshots of the Data
Verify and Validate Data Understanding of the Data Collected Find Patterns Internet Tips Daily Snapshots of the Data Interpretation?

10 Process and Thread Process Contains Thread Thread – Unit of Execution

11 Worker Threads SQL Server use O.S Threads Threads = SO
Thread of Pools - Requests

12 Parallelism Guarantee Parallelism? Multi-Processor Available Resource?
Utilization of Multiple Threads Split to Win! Query Optimizer – Serial Plan or Parallel Plan Parallel Plan <> Execution in Parallel Guarantee Parallelism? Multi-Processor Available Resource? MaxDop Cost Threshold of Parallelism

13 Cost Threshold for Parallelism
Parallelism Options MaxDop Cost Threshold for Parallelism MaxDop = 4 Thread 1 Thread 2 Thread 0 Thread 3 Thread 4

14 Thread Scheduling SQL Server Controls Threads
Non-Preemptive Scheduling Processor = Scheduler

15 Components of the Scheduler
Processor Waiter List Runnable Queue One Thread per Time Wait Statistics Resource Wait Waiting

16 SQL Server Schedulers 4 Physical Cores + Hyper-Threading Processor
Waiter List Runnable Queue Processor Waiter List Runnable Queue Processor Waiter List Runnable Queue Processor Waiter List Runnable Queue Processor Waiter List Runnable Queue Processor Waiter List Runnable Queue Processor Waiter List Runnable Queue Processor Waiter List Runnable Queue

17 Demo 1 Schedulers

18 Thread States Processor Waiter List Runnable Queue SPID 88 - Running

19 SPID 88 – CX_PACKET (Suspended)
Thread States Processor Waiter List Runnable Queue SPID 88 – CX_PACKET (Suspended)

20 Thread States Processor Waiter List Runnable Queue SPID 88 (Runnable),

21 Example Processor SPID 88 - Running Runnable Queue Waiter List
SPID 97 – IO_COMPLETION SPID 13 – Runnable SPID 56 – PAGEIOLATCH_SH SPID 27 – Runnable SPID 43 – CX_PACKET

22 Example Processor SPID 88 - Running Runnable Queue Waiter List
SPID 97 – IO_COMPLETION SPID 13 – Runnable SPID 56 – PAGEIOLATCH_SH SPID 27 – Runnable SPID 43 – Runnable

23 Example Processor Runnable Queue Waiter List SPID 88 - LATCH_EX
SPID 13 – Runnable SPID 97 – IO_COMPLETION SPID 27 – Runnable SPID 56 – PAGEIOLATCH_SH SPID 43 – Runnable

24 Example Processor Runnable Queue Waiter List SPID 88 - LATCH_EX
SPID 13 – Running SPID 88 - LATCH_EX SPID 27 – Runnable SPID 97 – IO_COMPLETION SPID 43 – Runnable SPID 56 – PAGEIOLATCH_SH

25 Demo 2 Thread States

26 Waits Waiting Unavailable Resource Tracked by SQL Server

27 Waits & Queues Methodology
Waits and Queues Tom Davidson [2005] - SQLCAT Tracked on SQL Server Right Direction to Find Issue ! 2005 – Performance Dashboards 2008/2012 – MDW & EX

28 sys.dm_os_wait_stats sys.dm_os_waiting_tasks sys.dm_exec_requests
Demo 3 sys.dm_os_wait_stats sys.dm_os_waiting_tasks sys.dm_exec_requests

29 Troubleshooting Patterns (Most Common)
Paul S. Randal – Worldwide Survey bit.ly/fSWeO5 1.800 SQL Server Instances Top 3 – Detailed Anaylisis CX_PACKET ASSYNC_NETWORK_IO WRITELOG

30 CX_Packet Wait Type Parallel Plans Executing
Adjust MaxDop = 1[Knee-Jerk] Verify Plans with Large Scan Operation Check Requests with CX_PACKET Wait Statistics Set MaxDop and Cost Threshold

31 PAGEIOLATCH_Wait Type
Waiting Data Page to go to Buffer Pool SH – Read or EX - Changed I/O Issue = 1[Knee-Jerk] Check Disk Latency Examine Plans with CONVERT_IMPLICT NonClustered Index Creation Statistics Memory

32 ASSYNC_NETWORK_IO_Wait Type
SQL Server Waits Ack Network Issue = 1[Knee-Jerk] Analyze Application Code Analyze Network RBAR Problem – Row By Agonizing Row – Row By Row Huge Table Scans

33 Hands On...... [DBA Curaçao Team]
Production Server Hands On [DBA Curaçao Team]

34 Thank You....


Download ppt "Troubleshooting SQL Server Basics"

Similar presentations


Ads by Google