Extended Events: Successful troubleshooting recipes Dennes Torres Extended Events: Successful troubleshooting recipes
Speaker Bio Senior Software Developer Trainer Ascent Software Trainer MCT, MCSE Data Platform, MCSE BI, MCSD Web Development Malta Data Platform UG Leader Malta MMDPUG http://Malta.Pass.Org Dennes.Torres @Dennes https://br.linkedin.com/in/dennestorres dennes@bufaloinfo.com.br http://youtube.com/c/dennestorres
Our generous sponsors
Why move to Extended Events On This Session Why move to Extended Events Motivation to move to Extended Events Troubleshooting recipes
Agenda Introduction Blocked Process Report Sort Spills Deadlocks Log Flushes Improving the use of the recipes Much More
Introduction
It was Deprecated in SQL Server 2014 Profiler Deprecated It was Deprecated in SQL Server 2014 There is no date to be removed It should be replaced by Extended Events
SQL Trace is the server side SQL Profiler It’s only a client tool SQL Trace is the server side SQL Trace is also deprecated
Performance http://sqlperformance.com/2012/10/sql-trace/observer-overhead-trace-extended-events
Reading Extended Events Data Watch live data Export to Table XML Queries Automated XML Queries Real time response https://www.slideshare.net/GianlucaSartori/responding-to-extended-events-in-near-real-time
Blocked Pocess
Blocked Process Problem Identify the Problem Solve the Problem Identify the source of blocking problems in a slow environment Identify the Problem Configure Blocked Process Threshold on server level Never configure for less then 5 seconds Capture information about the blocked process Solve the Problem Adjust transactions and lock hints to avoid blocking
Recipe Directions Event Filter Query Blocked_process_report None Usual XML sauce
The configuration needs to be always over 5 seconds How to Serve The configuration needs to be always over 5 seconds If you find too many repetitions, increase the configuration value
Demo Scripts BlockedProcess and BlockedProcess2
Sort Spills
Sort Spills in TempDB Problem Identifying the Problem Outdated statistics can make a SORT operation spill data to tempdb Identifying the Problem Finding the query causing the sort spill you find the outdated statistic Solving the Problem Update the outdated statistics
Recipe Directions Event Actions Query Use the event sqlserver.sort_warning Actions Sql_text and database_id are essential Query Usual XML sauce Translate the database_id
How to Serve Serve at will, no side effects
Demo Sort.sql
Deadlocks
Deadlocks Problem Identify the Problem Solve the Problem Application problems can cause deadlocks in transactions Identify the Problem We need to identify the transactions involved in the deadlock Solve the Problem Usually the solution involves changing the application
Recipe Directions Event Filter Query Use the event xml_deadlock_report Filter No filter Query The result is a XML inside the usual XE XML
How to Serve Serve at will, no side effects
Demo Deadlocks Deadlocks1 Deadlocks2
Log Flushes
Log Flushes Problem Identify the Problem Solve the Problem High amounts of log flushes in batch processes impacts performance Identify the Problem Identify the total of log fluhes and compare with other versions of the process Solve the Problem Improve the batch process
Recipe Directions Evento Filter Query Use the event log_flush_start Use the histogram output Use output to file to check the size of the log flush Filter You should filter by database Query Special XML sauce for histogram Usual XML sauce to check log flush size
How to Serve Use this recipe to identify the amount of log flushes while analyzing the performance of a batch and identify possible improvements
Demo LogFlush LogFlushData
Improving the Recipes
Making it easier Create a database for admin objects Create a function for each query over the sessions The functions should be parameterized Use the functions instead of the big queries
Demo CreatingFunctions UsingFunctions
Much More
Much More Memory_Grant_Updated_By_Feedback Adaptive_join_skiped Interleaved_Execution_failed Page_Split
Even More System_Health XE session
Speaker Bio Senior Software Developer Trainer Ascent Software Trainer MCT, MCSE Data Platform, MCSE BI, MCSD Web Development Malta Data Platform UG Leader Malta MMDPUG http://Malta.Pass.Org Dennes.Torres @Dennes https://br.linkedin.com/in/dennestorres dennes@bufaloinfo.com.br http://youtube.com/c/dennestorres