EOH: A Microsoft Partner INTRODUCTION TO EXTENDED EVENTS
What is XE Extended Events: – Replacement for SQL Profiler (Deprecated) – XE features on all editions Event handling framework for systems Used for diagnostics, tracing and auditing XE combines information from SQL Server and OS
XE Architecture – Courtesy BOL
Packages Parent container contained attributes of events within the package Three Types – Package0 – SQLServer – SQLOS – 1 Internal XE Components
Events Two Categories – 4 Channels (Grouping of Events) – Keyword (Specific) Defined point in task XE Components
Targets Consume events & output event data Six target types – File – Histogram – Counter – Pairing – ETW – Ring Buffer XE Components
Actions Response\s to an event. All actions are SYNC. Collects object details from EVENT. – TSQL capture\ Plan handle\ Numa ID etc. Certain events can have unique actions. XE Components
Predicates Boolean expressions that have a failure on first false evaluation. Applied per event not per session. Order of predicates can affect performance. Rich evaluation and filtering contexts XE Components
GLOBAL EVENT SESSION DATA sys.server_event_sessions sys.server_event_session_target sys.server_event_session_fields sys.server_event_session_actions sys.server_event_session_events Metadata – System Views
EVENT SYSTEM DATA sys.dm_xe_packages sys.dm_xe_objects sys.dm_xe_object_columns sys.dm_xe_map_values Metadata - DMVs
ACTIVE SESSION DATA sys.dm_xe_sessions sys.dm_xe_session_targets sys.dm_xe_events sys.dm_xe_event_actions Meta Data - DMVs
Querying XE system Tables And DMVs DEMO
CREATE EVENT SESSION…ON SERVER ALTER EVENT SESSION…ON SERVER DROP EVENT SESSION…ON SERVER COMMON OPTIONS: – MAX_DISPATCH_LATENCY – MAX_MEMORY – STARTUP_STATE – EVENT_RETENTION_MODE SINGLE MULTIPLE NONE XE DDL
XE DDL DEMO
Real-time amendment of events and predicates. SSMS GUI interface. Different stores for output. Event correlation available. Profiler Deprecated (Repeat ) Less Overhead. SQL Trace vs XE
sys.trace_xe_event_map sys.trace_xe_action_map sp_BlitzTrace Migrating Profiler to XE
Deadlocks Page splits – fill factor Auditing – Internal Use only CPU and IO tracking Wait stats Queries by duration General troubleshooting Use Case Scenarios
USE CASES DEMO
Additional XE objects added. Live data view. GUI interface. Aggregation and filtering in UI New session wizard Create new session Templates View Target Data Customizing View Live Data watch Enhancements in SQL 2012\4
SSMS XE GUI DEMO
Pair Matching considerations. Partitioning nodes. Predicates. Use the MAX option to control overhead. Use sampling to minimize result sets. Best Practices & Considerations
Idera XE Profiler sp_BlitzTrace – Brent Ozar Jonathan Kehayias – SQLSkills XE SSMS 2008 Add-In (codeplex) Deep Dive Blogs (msdn & sqlskills.com) Mike Wachel – MSFT XE Engine developer XTrace (WinSDK) Tools for OS\SQL\APP debug Useful Resources
Donovan White Questions & Answers