Introducing                  SQL Server                2012 Extended                    Events                Enhancements...
Agenda•   About us•   Introduction to Extended Events•   Extended Events 2008•   Extended Events Practical Terminology•   ...
Agenda•   About us•   Introduction to Extended Events•   Extended Events 2008•   Extended Events Practical Terminology•   ...
About 888• 888.com is a global online gaming company.• Our purpose is to provide quality  entertainment for people who enj...
888 Database Environment50 Production Instances300 Development Instances400 Databases250 TB Of Data24*7 Availability99.95 ...
Agenda•   About us•   Introduction to Extended Events•   Extended Events 2008•   Extended Events Practical Terminology•   ...
Extended Events• General event-handling system for windows  servers• Used for problem diagnosis and info gathering  and au...
Extended Events• Support 7 different types of targets• Event and consumer agnostic  – Any event can be processed by any co...
Agenda•   About us•   Introduction to Extended Events•   Extended Events 2008•   Extended Events Practical Terminology•   ...
Extended Events 2008                        •            Profiler-   •                        •                        •
Extended Events 2008        drawbacks• XE required extensive understanding of  system catalog views and DMVs• Event Sessio...
Extended Event Metadata•   Catalog views for defined session info     –   server_event_sessions     –   server_event_sessi...
DemoCapture errors with XE 2008• Find events and actions• Create a new event session• View the output
Agenda•   About us•   Introduction to Extended Events•   Extended Events 2008•   Extended Events Practical Terminology•   ...
Extended Events Objects                          Module                          PackagesEvents    Targets   Actions      ...
Packages• Packages are metadata containers• Packages register at module load time• 9 available packages     • package0 - X...
Events•   An event is a well known point in code•   Unique schema for each event•   Supports optional fields•   Events fir...
Actions• programmatic response or series of responses  to an event• Can be added to any event• Adds data to the event payl...
DemoCapture errors using the XE UI• Create an event session• Configure action• Watch live data
Targets• Target is an event consumer  – Can be synchronous or asynchronous• Target types  –   event_file  –   event_counte...
DemoMonitor locksPresent different types of targets•   Ring buffer•   Event file•   Event counter•   Histogram•   Pair Mat...
Predicates• Predicates are a set of logical rules that are  used to evaluate events when they are  processed.• Boolean exp...
DemoActivity TrackingPresent different types of Predicates• Event Predicates• Action Predicates• Global Predicates
Event Session• The materialization of combination of metadata  elements of XE architecture• Multiple targets per session• ...
Event Session
Event life cyclePre-Collect                       Collection                             Predicate evaluation             ...
Agenda•   About us•   Introduction to Extended Events•   Extended Events 2008•   Extended Events Practical Terminology•   ...
Extended Events 2012        Enhancements• User Interface  – Advanced & Wizard UI for creating and managing  – Display & An...
User Interface• Event Session list  – Provides a list of Event Sessions• New Session Wizard  – Provides a simplified exper...
DemoCapture queries and group by query hash• Grouping• Aggregation• Save XE to a table
Extended Events Management        API• Management API provides the ability to create  and modify event sessions• Provides ...
Agenda•   About us•   Introduction to Extended Events•   Extended Events 2008•   Extended Events Practical Terminology•   ...
Extended Event Use Cases• Proactive monitoring  – Application errors  – Errors log  – Event grouping• Troubleshooting  – P...
The Profiler’s grave
Summary• SQL Server 2012 offers simplified diagnostic  tracing with Extended Events  – Management Studio integration provi...
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
Upcoming SlideShare
Loading in...5
×

SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events

1,186

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,186
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Event: sql_statement_completedActions:plan_handle, query_hash, session_id, sql_textTargets: histogram on query_hash, event fileIn target display – choose columns: cpu_time, duration, logical_reads, query_hashGroup by query_hashFrom XE menu – aggregate by cpu_time and durationSave to table
  • http://www.sqlserver.co.il/?p=1574
  • Demo – extended event 2008 . Create session that record log wait.Start session Read result Stop session -- system catalog?
  • Catching errors with profiler: errors and warnings -> user error message -> column filters -> severity >= 16Can’t see the actual query that caused the errorXE allows us to add additional fields like sql_text, using an uncomfortable UI to create the capture and then script to parse the xml data
  • Module – exe or dllPackage - a container for XE objects
  • package0 - XE system objects (default)sqlserver - SQL Server related objectssqlos - SQL Server Operating System (SQLOS) related objects
  • monitoring points of interest the code
  • Actions are:programmatic response or series of responses to an eventActions are invoked synchronously on the thread that fired the eventActions can:Capture a stack dump and inspect data.Store state information in a local context using variable storage.Aggregate event data.Append data to event data.Examples of actions:Stack dumperExecution plan detection (SQL Server only)Transact-SQL stack collection (SQL Server only)Run time statistics calculationGather user input on exception
  • Create event session Event: error_reportedActions: client_app_name, database_name, session_id, sql_text(no target)
  • Events: lock_acquired, lock_releasedActions: client_app_name, database_name, session_id, sql_textTargets:Ring buffer – store data in the memory, cyclic. Watch live data view target (xml)Parse ring buffer XMLEvent file –data is saved in a file, can be archived and reviewed at different timesView targetEvent counter – Counts the number of eventsHistogram – aggregate data on specific event data field or actionFilter on lock_acquiredBase buckets on field mode (type of lock)Pair Matching – pair two related events and output only events that are not matchedBegin with: lock_acquired, end with: lock_releasedActions: session_id, resource_0, resource_1, resource_2Etw_classic_sync_targetLocks types: 0=NULL - Compatible with all other lock modes (LCK_M_NL)1=Schema Stability lock (LCK_M_SCH_S)2=Schema Modification Lock (LCK_M_SCH_M)3=Shared Lock (LCK_M_S)4=Update Lock (LCK_M_U)5=Exclusive Lock (LCK_M_X)6=Intent Shared Lock (LCK_M_IS)7=Intent Update Lock (LCK_M_IU)8=Intent Exclusive Lock (LCK_M_IX)9=Shared with intent to Update (LCK_M_SIU)10=Shared with Intent Exclusive (LCK_M_SIX)11=Update with Intent Exclusive (LCK_M_UIX)12=Bulk Update Lock (LCK_M_BU)13=Key range Shared/Shared (LCK_M_RS_S)14=Key range Shared/Update (LCK_M_RS_U)15=Key Range Insert NULL (LCK_M_RI_NL)16=Key Range Insert Shared (LCK_M_RI_S)17=Key Range Insert Update (LCK_M_RI_U)18=Key Range Insert Exclusive (LCK_M_RI_X)19=Key Range Exclusive Shared (LCK_M_RX_S)20=Key Range Exclusive Update (LCK_M_RX_U)21=Key Range Exclusive Exclusive (LCK_M_RX_X)
  • This enables the Extended Events user to selectively capture event data based on specific criteria.New operator – modulus, gt mod, lt mod….
  • Fix template…?
  • The mapping between package objects and sessions is many to many, which means that that an object can appear in several sessions, and a session can contain several objects.
  • The materialization of combination of metadata elements of XE architecture
  • Not sure is needed
  • UI for creation and management
  • Event: sql_statement_completedActions:plan_handle, query_hash, session_id, sql_textTargets: histogram on query_hash, event fileIn target display – choose columns: cpu_time, duration, logical_reads, query_hashGroup by query_hashFrom XE menu – aggregate by cpu_time and durationSave to table
  • dbo.trace_xe_event_maphttp://blogs.msdn.com/b/extended_events/archive/2010/12/10/migrating-from-sql-trace-to-extended-events.aspxUSE MASTER; GO USE MASTER; GO SELECT DISTINCT    tb.trace_event_id,    te.name AS 'Event Class',    em.package_name AS 'Package',    em.xe_event_name AS 'XEvent Name',    tb.trace_column_id,    tc.name AS 'SQL Trace Column',    am.xe_action_name as 'Extended Events action' FROM (sys.trace_eventsteLEFT OUTER JOIN sys.trace_xe_event_mapem    ON te.trace_event_id = em.trace_event_id) LEFT OUTER JOIN sys.trace_event_bindingstb    ON em.trace_event_id = tb.trace_event_idLEFT OUTER JOIN sys.trace_columnstc    ON tb.trace_column_id = tc.trace_column_idLEFT OUTER JOIN sys.trace_xe_action_map am    ON tc.trace_column_id = am.trace_column_id ORDER BY te.name, tc.name
  • SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events

    1. 1. Introducing SQL Server 2012 Extended Events EnhancementsKeren BartalTzahi Hakikat888 holdings
    2. 2. Agenda• About us• Introduction to Extended Events• Extended Events 2008• Extended Events Practical Terminology• Extended Events 2012 Enhancements• Summary
    3. 3. Agenda• About us• Introduction to Extended Events• Extended Events 2008• Extended Events Practical Terminology• Extended Events 2012 Enhancements• Summary
    4. 4. About 888• 888.com is a global online gaming company.• Our purpose is to provide quality entertainment for people who enjoy gambling.• Giving them the opportunity to do so in a safe, fun, fair, regulated and secure environment.
    5. 5. 888 Database Environment50 Production Instances300 Development Instances400 Databases250 TB Of Data24*7 Availability99.95 Uptime
    6. 6. Agenda• About us• Introduction to Extended Events• Extended Events 2008• Extended Events Practical Terminology• Extended Events 2012 Enhancements• Summary
    7. 7. Extended Events• General event-handling system for windows servers• Used for problem diagnosis and info gathering and auditing• The Extended Events infrastructure supports the correlation of data from SQL Server and OS
    8. 8. Extended Events• Support 7 different types of targets• Event and consumer agnostic – Any event can be processed by any consumer – New events can be added, immediately useable• Rich predicate system for filtering• Less overhead than server-side trace queues – 10,000 events processed will consume 1% of single 2GHz processor
    9. 9. Agenda• About us• Introduction to Extended Events• Extended Events 2008• Extended Events Practical Terminology• Extended Events 2012 Enhancements• Summary
    10. 10. Extended Events 2008 • Profiler- • • •
    11. 11. Extended Events 2008 drawbacks• XE required extensive understanding of system catalog views and DMVs• Event Sessions could only be managed through the use of DDL commands• Reading target data requires the use of XQuery
    12. 12. Extended Event Metadata• Catalog views for defined session info – server_event_sessions – server_event_session_target – server_event_session_fields – server_event_session_actions – server_event_session_events• DMVs for Event System Metadata – dm_xe_package – dm_xe_objects – dm_xe_object_columns – dm_xe_map_values• DMVs for currently active session info – dm_xe_sessions – dm_xe_session_targets – dm_xe_events – dm_xe_event_actions – dm_xe_object_columns
    13. 13. DemoCapture errors with XE 2008• Find events and actions• Create a new event session• View the output
    14. 14. Agenda• About us• Introduction to Extended Events• Extended Events 2008• Extended Events Practical Terminology• Extended Events 2012 Enhancements• Summary
    15. 15. Extended Events Objects Module PackagesEvents Targets Actions Types Predicates Maps
    16. 16. Packages• Packages are metadata containers• Packages register at module load time• 9 available packages • package0 - XE system objects (default) • sqlserver - SQL Server related objects • sqlos - SQL Server Operating System (SQLOS) related objects• SQL audit uses private XE package
    17. 17. Events• An event is a well known point in code• Unique schema for each event• Supports optional fields• Events fire synchronously• 264 events in 2008 R2• 618 events in 2012
    18. 18. Actions• programmatic response or series of responses to an event• Can be added to any event• Adds data to the event payload• Actions are invoked synchronously• Trigger a memory dump
    19. 19. DemoCapture errors using the XE UI• Create an event session• Configure action• Watch live data
    20. 20. Targets• Target is an event consumer – Can be synchronous or asynchronous• Target types – event_file – event_counter – histogram – etw_classic_sync_target – pair_matching – ring_buffer – event_stream
    21. 21. DemoMonitor locksPresent different types of targets• Ring buffer• Event file• Event counter• Histogram• Pair Matching• Etw_classic_sync_target
    22. 22. Predicates• Predicates are a set of logical rules that are used to evaluate events when they are processed.• Boolean expressions using flexible operators • Event data • Action data • Global State
    23. 23. DemoActivity TrackingPresent different types of Predicates• Event Predicates• Action Predicates• Global Predicates
    24. 24. Event Session• The materialization of combination of metadata elements of XE architecture• Multiple targets per session• Event can be in many sessions – Actions/Predicates are per event• Event Session can specify what to do if target cant keep up• Event Session defines data retention• Event session can add or remove events on runtime
    25. 25. Event Session
    26. 26. Event life cyclePre-Collect Collection Predicate evaluation Customizable attribute checkIsEnabled check Predicate evaluation Event data collected Publish Actions executed Synchronous targets served Event data buffered for asynchronous targets
    27. 27. Agenda• About us• Introduction to Extended Events• Extended Events 2008• Extended Events Practical Terminology• Extended Events 2012 Enhancements• Summary
    28. 28. Extended Events 2012 Enhancements• User Interface – Advanced & Wizard UI for creating and managing – Display & Analysis• Expanded to other systems – Analysis Services, Replication, PDW• Managed code – Powershell object model for runtime and meta data – Reader API for XEL files and near real time stream
    29. 29. User Interface• Event Session list – Provides a list of Event Sessions• New Session Wizard – Provides a simplified experience for creating an Event Session• Extended Events display – Tabbed windows that display Extended Events trace data
    30. 30. DemoCapture queries and group by query hash• Grouping• Aggregation• Save XE to a table
    31. 31. Extended Events Management API• Management API provides the ability to create and modify event sessions• Provides a complete object model for XE usage by managed applications• Provides a XEReader API for reading event files and event streams coming from a running event session on a server
    32. 32. Agenda• About us• Introduction to Extended Events• Extended Events 2008• Extended Events Practical Terminology• Extended Events 2012 Enhancements• Summary
    33. 33. Extended Event Use Cases• Proactive monitoring – Application errors – Errors log – Event grouping• Troubleshooting – Page Split – blocking• Audit – Monitor the access of privileged and non privileged users
    34. 34. The Profiler’s grave
    35. 35. Summary• SQL Server 2012 offers simplified diagnostic tracing with Extended Events – Management Studio integration provides SQL Server Profiler functionality for Extended Events allowing Event Sessions to be created, modified, and scripted – Management API allows managed applications to be developed that leverage Extended Events
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×