What are you waiting for

430 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
430
On SlideShare
0
From Embeds
0
Number of Embeds
95
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

What are you waiting for

  1. 1. What Are You Waiting For? Performing Wait Stat Analysis
  2. 2. IntroductionJason e: jstrate@pragmaticworks.comStrate e: jasonstrate@gmail.com b: www.jasonstrate.com t: StrateSQLResources jasonstrate.com/go/Waits MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  3. 3. What Are You Waiting For?You…• SQL Server• Developers• DBAs
  4. 4. AgendaDefining Collecting Viewing Reviewing
  5. 5. AgendaDefining Collecting Viewing Reviewing
  6. 6. Wait, wait… I’ll Tell YouWaits: Resource waits occur when a workerrequests access to a resource that is notavailable because the resource is being used bysome other worker or is not yet available.
  7. 7. So What?!
  8. 8. Wait Statistics IdentityPrioritize Measure
  9. 9. Execution Model (Simplified)Grocery Store• Cashier – Scheduler• Customer – Query• Checkout Line – Queue • Running • Runnable • Suspended
  10. 10. Execution Model (Simplified) RUNNING
  11. 11. Execution Model (Simplified) RUNNABLE RUNNING
  12. 12. Execution Model (Simplified) RUNNABLE RUNNING WAIT SUSPENDED
  13. 13. Execution Model (Simplified) RUNNABLE RUNNING SUSPENDED
  14. 14. Execution Model (Simplified) RUNNABLE RUNNINGWAIT TIME SUSPENDED
  15. 15. Execution Model (Simplified) RUNNABLE RUNNING SUSPENDED
  16. 16. Execution Model (Simplified) RUNNABLE RUNNING SUSPENDED
  17. 17. Execution Model (Simplified) RUNNABLE RUNNINGSIGNAL WAIT SUSPENDED TIME
  18. 18. Agenda-ingDefining Collecting Viewing Reviewing
  19. 19. Wait DMVs• sys.dm_os_wait_stats – Accumulated statistics on tasks that have waited for resources• sys.dm_os_waiting_tasks – Information on queued tasks waiting for resources
  20. 20. Waits Stats
  21. 21. Waits Stats Name of the wait type.
  22. 22. Waits StatsNumber of waits on this wait type. This counter is incremented at the start of each wait.
  23. 23. Waits StatsTotal wait time for this wait type in milliseconds. This time is inclusive of signal_wait_time_ms.
  24. 24. Waits StatsMaximum wait time on this wait type.
  25. 25. Waits StatsDifference between the time that the waiting thread was signaled and when it started running.
  26. 26. Waiting Tasks
  27. 27. Waiting Tasks
  28. 28. Waiting TasksID of the session associated with the task.
  29. 29. Waiting TasksTotal wait time for this wait type, in milliseconds. This time is inclusive of signal_wait_time.
  30. 30. Waiting Tasks Name of the wait type.
  31. 31. Waiting TasksID of the session that is blocking the request. If this column is NULL, the request is not blocked, or the session information of the blocking session is not available
  32. 32. Waiting TasksDifference between the time that the waiting thread was signaled and when it started running.
  33. 33. DemoVIEWING WAIT STATS
  34. 34. AgendaDefining Collecting Viewing Reviewing
  35. 35. DMV Stats
  36. 36. Management Data Warehouse
  37. 37. Do-It-YourselfCollect Summarize Analyze
  38. 38. DemoDO-IT-YOURSELF
  39. 39. AgendaDefining Collecting Viewing Reviewing
  40. 40. Wait Types• Tied to process – Audit – Buffer – I/O – Indexing – Lock – SQLOS• Categories – Background – External – Queue
  41. 41. Background WaitsCLR_SEMAPHORE CHECKPOINT_QUEUELAZYWRITER_SLEEP XE_TIMER_EVENTRESOURCE_QUEUE BROKER_TO_FLUSHSLEEP_TASKNot all inclusive BROKER_TASK_STOPSLEEP_SYSTEMTASK CLR_MANUAL_EVENTWAITFOR CLR_AUTO_EVENTLOGMGR_QUEUE XE_DISPATCHER_WAIT
  42. 42. CXPACKETTranslation• Contention with queries the at are executing in parallel; across multiple CPUs. Generally due to unbalanced execution across CPUs or tasks ahead of query executing longer than expected.Guideline• >5% for OLTP• >10% for data warehousesResolution• Review indexing• Tune queries• Adjust Max Degree of parallelism• Research cost threshold for parallelism
  43. 43. OLEDBTranslation• Occurs when SQL Server calls the Microsoft SQL Native Client OLE DB Provider. It indicates the duration of calls to the OLE DB provider.Guideline• Examine when it is a top wait and exceeds background waits. (TOP 5)Resolution• Identify queries with OLE DB waits with extended events or sys.dm_os_waiting_tasks• Check application placement and Disk secs/Read and Disk secs/Write• Tune transactions using RPC, Distributed (Linked Server), and Full Text Search
  44. 44. PAGEIOLATCH_xTranslation• Contention caused by disk to memory transfer. Typically suggests disk IO subsystem issues.Guideline• Examine when it is a top wait and exceeds background waits. (TOP 5)Resolution• Review Physical disk: disk seconds/read and Physical disk: disk seconds/write and SQL Server Buffer Manager: Page Life Expectancy• Review information for virtual file stats• Reconfigure disk to improve IO throughput• Analyze indexes to reduce need to move data to memory• Increase memory to increase data available to SQL Server
  45. 45. PAGELATCH_xTranslation• Contention between short term light weight synchronization objects. Latches are not held for the duration of a transaction. Occur in the buffer pool but unrelated to IO requests.Guideline• Examine when it is a top wait and exceeds background waits. (TOP 5)Resolution• Check tempdb configuration • Additional data files • Trace Flag 1118• Troubleshoot memory pressure
  46. 46. LATCH_xTranslation• Contention between short term light weight synchronization objects. Latches are not held for the duration of a transaction. Non buffer pool related.Guideline• Examine when it is a top wait and exceeds background waits. (TOP 5)Resolution• Review T-SQL generating LATCH waits using extended events.• Examine memory items in sys.dm_os_latch_stats• Partition table across multiple files
  47. 47. Additional Resources Waits and Queues • http://is.gd/qWGGnd SQLServerPedia • http://is.gd/gvD80N SQL Server Wait Type • http://is.gd/r59976 Repository Wait Stats Introductory • http://is.gd/khsduZ References Joe Sack • http://is.gd/dQWFwC • http://is.gd/VlH71lManagement Data Warehouse • http://is.gd/xggZSA DMVstats • http://sqldmvstats.codeplex.com
  48. 48. For more information… Name: Jason Strate Email: jstrate@pragmaticworks.com Blog: www.jasonstrate.com Resource: jasonstrate.com/go/waits Products Services FoundationBI products to covert to a Microsoft BI Speed development through training, and Helping those who do not have theplatform and simplify development on rapid development services from means to get into information technologythe platform. Pragmatic Works. achieve their dreams.

×