Presentation is loading. Please wait.

Presentation is loading. Please wait.

Agenda Review: XE Core Concepts Tracking what caused what What’s the holdup? A splitting headache So many locks (and not.

Similar presentations


Presentation on theme: "Agenda Review: XE Core Concepts Tracking what caused what What’s the holdup? A splitting headache So many locks (and not."— Presentation transcript:

1

2 Peter.Willmot@XpertEase.co.za

3 Agenda Review: XE Core Concepts Tracking what caused what What’s the holdup? A splitting headache So many locks (and not enough keys)

4 Extended Events: What and Why? SQL Server 2008 Event and Tracing Infrastructure Deep insight 254 events as of SQL Server 2008 RTM Upfront design goals Performance Flexibility Extensibility

5 Extended Events Basic Terminology Events Something happened Predicates Do we care about whether this happened? Actions Get extra data about what happened Targets We know that this happened; now what?

6 Extended Events Lifecycle “Interesting” code path encountered Continue Processing Is the event enabled? Do predicates match? Collect data and fire actions Dispatch data to targets No Yes

7 Extended Events Performance Hints Be cautious with event retention mode Better to lose event data than to sacrifice application performance If possible, avoid synchronous targets Longer wait while target data is written Configure memory partitioning to maximize performance across nodes NUMA and per-CPU partitions available

8 Extended Events Data Consumption It’s all XML There is no Profiler equivalent (yet) DBAs: Do you know XQuery yet? The XML is fairly simple and standardized across the events You will have enough samples from this session to be well on your way

9 Review: XE Core Concepts Agenda Tracking what caused what So many locks (and not enough keys) What’s the holdup? A splitting headache

10 Server Activity Is Hierarchical Request scheduled by SQLOS Data request to storage engine Page lock taken

11 One Identifier to Rule Them All In SQL Server 2008, the engine internally passes around Activity Identifiers GUIDs, generated in SQLOS when a request is scheduled Passed down the line step-by-step as a query is processed XE adds a sequence identifier, letting you track the order of operations

12 Turning on the Activity Identifier CREATE EVENT SESSION MyEventSession … WITH ( TRACK_CAUSALITY = ON );

13 Consuming the Activity Identifier //RingBufferTarget/event/action/value Use the OVER clause to answer questions like Show me all chains of events that resulted in a page split Show me all chains of events where the duration of the stored procedure was greater than 10 seconds

14 Waits and Queues Methodology First popularized in SQL Server 2000 thanks to an article by Tom Davidson DBCC SQLPERF(' waitstats') Server-level wait statistics Not documented, except very roughly on SQLDEV.NET SQL Server 2005 changed things (a bit) sys.dm_os_wait_stats All stats documented (more or less)

15 In Darker Parts of DBMS Land In 1998, Anjo Kolk of OraPerf.com introduced YAPP Yet Another Performance Profiling Method Response Time = Service Time + Wait Time Your active time and whatever time you’re waiting on shared resources Reduce the wait time and you reduce the response time - Simple!

16 Task/Resource Life Cycle: No Waits Resource needed Request made Resource available Resource “consumed” 1 2 3 4

17 Task/Resource Life Cycle: Waits Resource not available Wait for resource (Resource wait) Resource now available but task must wait for CPU (Signal wait) Resource “consumed” Special thanks to Joe Sack and Jimmy May for assistance with this slide 1 2 3 4

18 Collecting Wait Stats in XE Capture the following events: sqlos.wait_info sqlserver.sql_statement_completed Add up: wait_info Duration and Signal_Duration sql_statement_completed CPU Aggregate using Activity_Id and/or query text Tune. Rinse and repeat

19 When Is a Split not a Split? Page splits are a scary thing to most DBAs Fragmentation Bad Performance They are misunderstood “Page split” means any new page allocation It may mean data movement and fragmentation, and it may not

20 Two Kinds of Splits Leaf Internal

21 Getting Split Information from XE Use sqlserver.page_split event Exposes file_id and page_id columns Add actions: sqlserver.database_id sqlserver.sql_text Now we have database_id, file_id, page_id Enough to estimate fragmentation over time

22 Dissecting Split Information Collect the data more often than the PLE interval The pages should still be in the buffer cache Use sys.dm_os_buffer_descriptors Find the allocation unit ID … Use it to grab the associated index ID Aggregate on sql_text per unique index found For each split event, if page_id < [the previous maximum page_id found], add 1 Result is a pretty good estimate of which indexes are becoming most fragmented

23 Good Things Come in Pairs Stored procedure callssp_statement_startingsp_statement_completed File I/Oasync_io_requestedasync_io_completed Lockslock_acquiredlock_released

24 The Extended Events Pairing Target “Begin” events start to stream in “End” events start to stream in Events are matched based on the defined criteria… Matching events are dropped, leaving begin events waiting on a match

25 Pairing Up Locks Set lock_acquired as the “begin” event Set lock_released as the “end” event The buffer will contain locks acquired but not released Use tsql_text to find the statement that took the lock

26 Peter.Willmot@XpertEase.co.za

27 www.microsoft.com/teched International Content & Community http://microsoft.com/technet Resources for IT Professionals http://microsoft.com/msdn Resources for Developers www.microsoft.com/learning Microsoft Certification & Training Resources Resources Required Slide Speakers, TechEd 2009 is not producing a DVD. Please announce that attendees can access session recordings from Tech-Ed website. These will only be available after the event. Required Slide Speakers, TechEd 2009 is not producing a DVD. Please announce that attendees can access session recordings from Tech-Ed website. These will only be available after the event. Tech ·Ed Africa 2009 sessions will be made available for download the week after the event from: www.tech-ed.co.zawww.tech-ed.co.za

28 Required Slide Complete a session evaluation and enter to win! 10 pairs of MP3 sunglasses to be won

29 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. Required Slide


Download ppt "Agenda Review: XE Core Concepts Tracking what caused what What’s the holdup? A splitting headache So many locks (and not."

Similar presentations


Ads by Google