Why are we Waiting.. - DATA Idoldataidol.com/neilhambly/wp-content/uploads/sites/5/... · External...
-
Upload
phungtuyen -
Category
Documents
-
view
233 -
download
2
Transcript of Why are we Waiting.. - DATA Idoldataidol.com/neilhambly/wp-content/uploads/sites/5/... · External...
October 11-14, Seattle, WA
Why are we Waiting..DBA-320
Neil HamblyDatabase Architect (MDSL)Founder/CTO (SQLnextSteps)
Speaker Bio: Neil Hambly
2DBA-320 | Why are we Waiting..
Permanent RolesSQLnextSteps (London) Founder/CTO - Services being launched 2012
MDSL (London) July 2010 – PresentDB Architect Editions: SQL 2005 – 2008 R2 Log-shipping, Service Broker, SSRS,SSAS
iProfile (London) Oct 2004 – June 2010DB Architect | DBA | DB Developer (Database Lead )Editions: SQL 2000 – 2005;Clustering, Service Broker, Replication, SSRS
Accenture (Dublin) June 1999– Oct 2004DBA | DB Developer (Global BI - Team Leader) Editions: SQL6.5 – 2000, Replication, DTS, OLAP
Contractor RolesBBC 14 Months (DB Support )ABN AMRO 16 Months (DB Developer )
Contact info
Neil_Hambly
http://www.linkedin.com/in/neilhambly
Email: [email protected]: http://sqlblogcasts.com/blogs/NeilHamblyUG: www.sqlserverfaq.com
London SQL Server
User Group Leader
Regular speaker &
UK SQL conferences,
regional UG events
14 years as a
SQL Professional
Background & Edition Changes
Waits & Queue Whitepaper (98 pg.) Nov 2006Author: Tom Davidson Updated: Danny Tambs, Reviewer: Sanjay Mishra
Methodology introduced and used to establish
SQL Version No of different Wait Types in edition{sys.dm_os_wait_stats} VIEW SERVER STATE permission is required to query the DMV
2000 : DBCC SQLPERF(waitstats) Still usable but does not provide max_wait_time_ms
2005 : 202 9.0.xx or 251 when used with DBCC TRACEON(8001, -1)
2008 : 484 10.0.xx includes 190 Preemptive wait_types
2008 R2 : 490 10.50.xx
Denali CTP3: 631 11.0.xx {Most of the new ones, are for new HADR functionality}
3DBA-320 | Why are we Waiting..
Different types of WaitsResource waitsResource waits occur when a worker requests access to a resource that is not available because the resource is being used by some other worker or is not yet available. Examples of resource waits are locks, latches, network and disk I/O waits. Lock and latch waits are waits on synchronization objects
Queue waitsQueue waits occur when a worker is idle, waiting for work to be assigned. Queue waits are most typically seen with system background tasks such as the deadlock monitor and deleted record clean-up tasks. These tasks will wait for work requests to be placed into a work queue.
External waitsExternal waits occur when a SQL Server worker is waiting for an external event, such as an extended stored procedure call or a linked server query, to finish. When you diagnose blocking issues, remember that external waits do not always imply that the worker is idle, because the worker may actively be running some external code.
Wait Categories• Backup
• Buffer I/O
• Buffer Latch
• Compilation
• CPU
• Full Text Search
• Idle
• Latch
• Lock
• Logging
• Memory
• Network I/O
• Other
• Parallelism
• SQLCLR
• Transaction
• User Waits
4DBA-320 | Why are we Waiting..
Note:Data Collector has categorized265 common Wait_types into these 17 Categories
Information Sources
Queues {Not covered in this session}
• Perfmon counters
Waits (DMV’s SQL 2005 & higher)Historical Waits
• sys.dm_os_wait_stats
Clear current values
DBCC SQLPERF(‘sys.dm_os_wait_stats’,CLEAR)Current Wait List
• sys.dm_os_waiting_tasksCurrent Runnable Queue
• sys.dm_exec_requests
Other Resources• Extended Events
• Datacollector
• Performance Dashboard
SQL 2000 (Before DMV’s)
DBCC SQLPERF(waitstats)
5DBA-320 | Why are we Waiting..
Anatomy of the DMV sys.dm_os_wait_stats
Column name Data type Description
wait_type nvarchar(60) Name of the wait type.
waiting_tasks_count bigint
Number of waits on this wait type.
This counter is incremented at the
start of each wait.
wait_time_ms bigint
Total wait time for this wait type in
milliseconds. This time is inclusive of
signal_wait_time_ms.
max_wait_time_ms bigintMaximum wait time on this wait
type.
signal_wait_time_ms bigint
Difference between the time that
the waiting thread was signalled
and when it started running.
6DBA-320 | Why are we Waiting..
Identify the in a Waiting State
7DBA-320 | Why are we Waiting..
A thread can be put in a waiting state if a required
resource is not immediately available .
Once the resource is available, thread is moved onto
the Runnable Queue and the time that it then takes
to traverse up this Queue to become active
“Running” is known as “Signal Time”
Minimising time spent not “Running” is key to an
efficient SQL Server system, thus by knowing the %
spent in a “waiting state” is critical important, it can
help us determine and overcome any potential
“resource bottlenecks” hindering overall peak
performance levels
Let’s look @ an example on our next slide
Signal Waits{now just waiting on CPU}
Waiting on another resource – IO, Locks, Network, Memory etc..
Images below from Waits & Queues Whitepaper
Current Wait List: sys.dm_os_waiting_tasks
Current Runnable Queue: sys.dm_exec_requests
8DBA-320 | Why are we Waiting..
Interpreting those Wait StatsWatching for / finding these
Parallelism: CXPACKET
Buffer: PAGEIOLATCH_X; PAGEIOLATCH_X
Non-Buffer: LATCH_X
I/O Issues: ASYNC_IO_COMPLETION; IO_COMPLETION,
CPU: SOS_SCHEDULER_YIELD
Trans log (Disk): WRITELOG & LOGBUFFER
Blocking: LCK_X; LCK_M_U; LCK_M_X
Memory: RESOURCE_SEMAPHORE
External: PREEMPTIVE_xxx
Backup: DISKIO_SUSPEND
SQLOS: THREADPOOL
Linked Servers: OLEDB
DBA-320 | Why are we Waiting.. 9
Some Background Waits to ignore
WHERE Wait_type NOT IN('BROKER_EVENTHANDLER','BROKER_RECEIVE_WAITFOR','BROKER_TASK_STOP','BROKER_TO_FLUSH','BROKER_TRANSMITTER','CHECKPOINT_QUEUE','CHKPT','CLR_AUTO_EVENT','CLR_MANUAL_EVENT','CLR_SEMAPHORE','DISPATCHER_QUEUE_SEMAPHORE','FT_IFTS_SCHEDULER_IDLE_WAIT','FT_IFTSHC_MUTEX','KSOURCE_WAKEUP','LAZYWRITER_SLEEP','LOGMGR_QUEUE','ONDEMAND_TASK_QUEUE','REQUEST_FOR_DEADLOCK_SEARCH','RESOURCE_QUEUE','SERVER_IDLE_CHECK','SLEEP','SLEEP_BPOOL_FLUSH','SLEEP_DBSTARTUP','SLEEP_DCOMSTARTUP','SLEEP_MSDBSTARTUP','SLEEP_SYSTEMTASK','SLEEP_TASK','SLEEP_TEMPDBSTARTUP','SNI_HTTP_ACCEPT','SQLTRACE_BUFFER_FLUSH','SQLTRACE_INCREMENTAL_FLUSH_SLEEP','Total','TRACEWRITE,WAIT_FOR_RESULTS','WAITFOR','WAITFOR_TASKSHUTDOWN','XE_DISPATCHER_JOIN'
,'XE_DISPATCHER_WAIT','XE_TIMER_EVENT')
Wait_types we can ignore #1(system & background “Queue-waits”)
DBA-320 | Why are we Waiting.. 10
Demo Time
11DBA-320 | Why are we Waiting..
Waits Demos in SSMS (Denali CTP3) & run following demo’s
#1 sp_whoisactive
#2 Extended events (Query results using XQuery)
#3 DataCollector
Response Time Analysis using Extended Events
Best way to illustrate this is to run a demo
For this demo I’m using a codeplex example
http://sqlcat.codeplex.com
12DBA-320 | Why are we Waiting..
Questions
Level 1 text are 28pt Century Gothic
• Level 2 bullet 24pt Century Gothic
• Level 3 bullet 20pt Century Gothic
• Level 4 bullet 20pt Century Gothic
• Level 5 bullet 20pt Century Gothic
13DBA-320 | Why are we Waiting..
Titles are set 36 Century Gothic, maximum 2 lines, ideally 1 line
Level 1 text are 28pt Century Gothic
• Level 2 bullet 24pt Century Gothic
• Level 3 bullet 20pt Century Gothic
• Level 4 bullet 20pt Century Gothic
• Level 5 bullet 20pt Century Gothic
14DBA-320 | Why are we Waiting..
Complete the Evaluation Form to Win!Win a Dell Mini Netbook – every day – just for submitting your completed form. Each session evaluation form represents a chance to win.
Pick up your evaluation form:• In each presentation room
• Online on the PASS Summit website
Drop off your completed form:• Near the exit of each presentation room
• At the Registration desk
• Online on the PASS Summit website
Sponsored by Dell
18DBA-320 | Why are we Waiting..
October 11-14, Seattle, WA
Thank youfor attending this session and the
2011 PASS Summit in Seattle
20DBA-320 | Why are we Waiting..
Microsoft SQL
Server Clinic
Work through your
technical issues with SQL
Server CSS & get
architectural guidance
from SQLCAT
Microsoft
Product Pavilion
Talk with Microsoft SQL
Server & BI experts to
learn about the next
version of SQL Server
and check out the new
Database Consolidation
Appliance
Ask The Experts
@ Dev Pods
Meet Microsoft SQL
Server Engineering
team members &
SQL MVPs
Hands-on Labs
Get experienced through
self-paced & instructor-
led labs on our cloud
based lab platform -
bring your laptop or use
HP provided hardware
Room 611 Expo Hall 6th Floor Lobby Room 618-620