5 Amazing Reasons DBAs Need to Love Extended Events
Jason Strate
b: www.jasonstrate.com
t: StrateSQL
Resources jasonstrate.com/go/xevents
Introduction
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
• Founded 2008 by MSFT MVP Brian Knight• Focused on the MSFT SQL Server Platform• Provides services, training and software• MSFT/HP “go to” partner: • Gold Certified:
o BIo Data Managemento SQL Performance
• Team led by multiple MVP’s• Offices throughout the US with Corporate
HQ in Jacksonville, FL
Pragmatic Works Company History
Extended Events
Extended Events
Dynamic, highly configurable tracing tool that provides access to events and
related information from the event.
Amazing!
Love!
5 Amazing Reasons DBAs Need to Love Extended Events
Data Survivability
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Data Survivability
Scenario• Weekend performance
issues expected• Configure SQL Trace to
capture statistics• You enjoy your weekend• Sysadmin/junior DBA
restarts instance on Friday night
• Monday morning… GO!
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Data Survivability
Scenario• Performance issue shows
up• Start Profiler to collect
some events• Initial analysis deems
– New events are needed– New columns are needed
• Collected data is still important
• Change the trace… GO!
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Data Survivability
• Solution exists with SQL Trace/Profiler
– Configure startup stored procedures
– Save off data
• Extended events
– Keep the session, restart on SQL Server startup
– Add events and columns on the fly
– Existing target unaffected
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
DATA SURVIVABILITY
Demo
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Key Points on Data Survivability
• Extended events are highly configurable
• Active sessions
– Events can be added/removed
– Columns can be added/removed
• Sessions
– Retained on startup
– Can automatically restart
Get What You Want
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Get What You Want
Mo’ Problems• Performance issue shows
up• Start Profiler to collect
some events• Initial analysis deems
– New events are needed– New columns are needed
• Collected data is still important
• Change the trace… GO!
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Get What You Want
Mo’ Problems
• Textdata returns parameterized T-SQL
• Do you need BigintData1 and BigintData2?
• Aggregate data for trends
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Get What You Want
Mo’ Solutions• Actions
– Plan_handle– Query_handle– Query_hash– TSQL_stack– Is_system
• Targets– Histogram/Bucketizer– Event_coutner– Event_stream
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
GET WHAT YOU WANT
Demo
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Key Points on Get What You Want
• Extended events are highly configurable
– STILL!!
• Actions
– Add in the columns that you need
– Create actionable traces
• Targets
– More options that are useful
DMV Integration
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
DMV Integration
DMV Information
• Summary information
• Deeper information
DMV Columns
• Plan_handle
• Query_handle
• Query_hash
• TSQL_stack
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
DMV INTEGRATION
Demo
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Key Points on DMV Integration
• DMVs allow expansion of trace results
– More detail
– Link other items together
• Build the complete picture
– Analyze all at once
• No intermediate levels of aggregation
Wait Stat Tracing
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Waits & Queues Methodology
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Wait Stat Tracing
DMVs
• Sys.dm_os_wait_stats
• Sys.dm_os_waiting_tasks
Problem
• High level
• Aggregate
• Point in time
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Wait Stat Tracing
Scenario• Instance has been online for
months.• Code change deployed
recently• CPU spiked from 40% to 100% • High SOS_SCHEDULER_YIELD
waits and counts– Death by a million cuts
• High CPU items in DMVs are overnight maintenance jobs
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
WAIT STAT TRACING
Demo
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Key Points on Wait Stat Tracing
• Waits & Queues is a popular methodology– Difficult to track waits to statement
• DBAs empowered in Waits & Queues– Truly perform root cause analysis
• Specific waits can be traced and captured– Instance
– Database
– Application
– User
Latch Tracing
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Latch Tracing
Latch: Lightweight synchronization activity.
Examples: • Page allocations• Disk-to-memory transfers• In-memory transfers
DMV• Sys.dm_os_latch_stats
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Latch Tracing
Scenario• New application deployed• High volume of users• High number of LATCH_EX waits
– Non-buffer latching– Exclusive
• Other applications appear to be affected
• Application is much slower than in test
• Where’s the problem… GO!
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
LATCH TRACING
Demo
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Key Points on Latch Tracing
• Latch issues can be hard to troubleshoot
• Typically happening out of sight
• Latches can be traced and captured
– Instance
– Database
– Application
– User
5 Amazing Reasons DBAs Need to Love Extended Events
Loving Extended Events
Data Survivability
Get What You Want
DMV Integration
Wait Stat Tracing
Latch Tracing
Learn More About Extended Events
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
ServicesSpeed development through training, and rapid development services from Pragmatic Works.
ProductsBI products to covert to a Microsoft BI platform and simplify development onthe platform.
FoundationHelping those who do not have themeans to get into information technologyachieve their dreams.
For more information…
Name: Jason Strate
Email: [email protected]
Blog: www.jasonstrate.com
Resource: jasonstrate.com/go/xevents