Вы находитесь на странице: 1из 19

Extended Events

The Top Features for efficient Tracing

Andreas Wolter, MCM, MCSM, MVP

About: Andreas Wolter


Consultant, Trainer & Speaker
Microsoft Certified Master SQL Server 2008
+ Solutions Master Data Platform (SQL Server 2012)
• Datawarehouse & OLTP-System Architecture
• Performance Tuning
• Security

Email: a.wolter AT SarpedonQualityLab.com


Web: www.andreas-wolter.com
Blog: www.insidesql.org/blogs/andreaswolter/
Facebook: www.facebook.com/SarpedonQualityLab
LinkedIn: www.linkedin.com/in/andreaswolter
Twitter: @AndreasWolter
My most important project:

SQL Server® 2012

SQL Server SSAS, SSRS, SSIS

Andreas Wolter (SQLMCM) 1


Our Sponsors

Agenda

 Configuration for Performance


 Effective filtering
 Scenarios
 Advanced analysis directly inside the GUI - Searching top slowest
identical statements
 Module-Level Waits
 Log Database- and Table-access without Auditing
 The System_health session
 Deadlock-Capturing for free
 Best Practices
 A word on Security

Andreas Wolter (SQLMCM) 2


CONFIGURATION-OPTIONS FOR PERFORMANCE

Event Retention and Dispatching

Andreas Wolter (SQLMCM) 3


Memory Buffer Configuration Options

Predicates

Andreas Wolter (SQLMCM) 4


Demo

Advanced Predicates

10

Advanced analysis directly inside the GUI

 Searching top slowest queries


 Searching top slowest distinct queries (by pattern)

11

Andreas Wolter (SQLMCM) 5


Let‘s Trace
Advanced analysis directly inside the GUI - Searching
top slowest identical statements

12

Database-access without Auditing

14

Andreas Wolter (SQLMCM) 6


Demo

Tracing Database-access
without Auditing

15

Waits on database & procedure level

16

Andreas Wolter (SQLMCM) 7


Module-level waits

17

For even more internals: Stack-walking

18

Andreas Wolter (SQLMCM) 8


SYSTEM_HEALTH SESSION

20

System Health Event Session

21

Andreas Wolter (SQLMCM) 9


Isn‘t that nasty?

23

Does this look prettier?

24

Andreas Wolter (SQLMCM) 10


How about this?

25

Demo

Deadlock-analysis

26

Andreas Wolter (SQLMCM) 11


Free SQL Deadlock Collector & Parser
http://j.mp/SQL_DL_CP
 Free deadlock collector & parser from codeplex
 Based on system_health
 Ring Buffer – hours
 File Target – days
 Depending on amount of errors
 Zero extra tracing overhead
 Parses first 2 involved Processes into respective columns
 Views and Reports for Quick Overview
 Includes query Plans
 Only needs a collection job
 Stores parsed deadlock data inside a table
 Extendable with reports
 sqldeadlockcollector.codeplex.com/releases/
 Article: www.insidesql.org/blogs/andreaswolter/2015/02/free-
deadlock-collector-parser-based-on-extended-events-system_health-
session

27

Multi-Victim Deadlocks
Profiler vs XEvents

28

Andreas Wolter (SQLMCM) 12


If we have time left

Using the Pair-matching target

29

WRAP UP

30

Andreas Wolter (SQLMCM) 13


Best Practices

 Forget TraceFlags 1222, 1205, or 1204 – the data is already there

 Avoid NO_EVENT_LOSS

 For High end machines


 MEMORY_PARTITION_MODE=PER_NODE | PER_CPU
 Increase MAX_MEMORY

 Correlating Events from Different Connections


 TRACK_CAUSALITY=ON
 Avoid expensive Events e.g. showplan and Actions e.g. callstack

 When extracting and storing data via Xquery it is often more efficient to use a temporary table
as an intermediate step

31

Danke für das Interesse an diesem Thema


How did you like it?
Please give us feedback!
to the event:
www.sqlsaturday.com/579/eventeval.aspx

to me as a speaker: www.sqlsaturday.com/579/sessions/sessionevaluation.aspx

Andreas Wolter

Contact: andreas.wolter AT SarpedonQualityLab.com


Blog: www.insidesql.org/blogs/andreaswolter/
Linkedin: www.linkedin.com/in/andreaswolter
Twitter: @AndreasWolter

32

Andreas Wolter (SQLMCM) 14


Thank You!

33

Sarpedon Quality Lab:


Ihr Spezialist für Datenbank-Systeme
basierend auf SQL Server Technologien
Wir sind die einzige Firma der gesamten DACH-Region,
die die höchsten technischen Zertifizierungen von Microsoft für
sowohl SQL Server 2008 als auch SQL Server 2012 erreicht hat.

Wir unterstützen und setzen unser Know-How gern zu Ihrem Vorteil ein.

Unsere Dienste umfassen:


• SQL Server Supportverträge & Hotline
• SQL Server Health Checks
• Architektur-Planung, Beratung und Implementierung
• Performance Analyse & Tuning
• Disaster-Recovery & SLA-Compliance-Checks
• Security-Checks
• Datenrettung bei Korruption
Partner des besten Troubleshooting & Performance-Monitoring
• Training: Tools für SQL Server auf dem Markt: SQLSentry
Fragen Sie uns nach speziellen Rabatten und Abo-Modell
Fragen Sie uns: info@Sarpedon.de

35

Andreas Wolter (SQLMCM) 15


APPENDIX

36

Ressources
 Extended Event Team Blog
 http://blogs.msdn.com/b/extended_events/
 Jonathan Kehayias articles
 https://www.sqlskills.com/blogs/jonathan/category/extended-events/
 My articles on XEvents so far:
 Free Deadlock-Collector & -Parser, based on Extended Events session system_health
 Performance overhead of tracing with Extended Event targets vs SQL Trace under CPU
Load
 Comparing Extended Events vs SQL Trace – or why SQL Trace & Profiler are just a thing of
the past :-)
 New Extended Events for Tracing in SQL Server 2014
 Tracing Analysis Services (SSAS) with Extended Events – Yes it works and this is how
 Extended Event File Target size vs SQL Server Trace trace file - a comparison

37

Andreas Wolter (SQLMCM) 16


Connect Items, which love to get your vote 
 Extended Events UI Export Display Settings: include grouping
 To improve the XEvent GUI in terms of saving view settings incl. grouping
 Support SQL Broker Service to be a target of Extended Events
 Providing a special Server principal for Database Ownership
 To solve the problem with the database owner, which unfortunately is sa in 80% of all
servers – with all the security risks – explained in my blog:
 http://www.insidesql.org/blogs/andreaswolter/2013/12/survey-sql-server-database-
ownership-datenbankbesitzer
 Allow the use of saved Credentials/Proxy Accounts for Reporting Services
Subscriptions
 Shared Datsets with spatial data - no preview in map pane and as well as in spatial
data + analytical dat…
 Group Managed Service Accounts Support for SQL Server Failover Clusters

38

Extended Events ‘system health’ Dashboards for SQL Server


2012
http://blogs.msdn.com/b/sql_pfe_blog/archive/2013/04/15/sql-2012-system-health-reporting-
dashboard-visualizing-sp-server-diagnostics-results.aspx

39

Andreas Wolter (SQLMCM) 17


XEvents vs SQL Prof*** Events – SQL 2016

 New events and even actions added in SQL 2016

guess

Blog-Article: www.insidesql.org/blogs/andreaswolter/2013/11/extended-events-vs-sql-trace-comparison-top-features

40

Performance SQL Trace versus XEvents

 SQL Trace
 4ms / Event
 Eventloss not
influencable
 XEvents
 2 µs / event
 Memory dispatching
configurable
 Event loss configurable

Unter CPU Load,


www.insidesql.org/blogs/andreaswolter/2013/08/performance-overhead-
tracing-extended-events-sql-trace-under-cpu-load

41

Andreas Wolter (SQLMCM) 18


Some lesser known capabilities of Extended Events

 (almost) everything that worked with Profiler

+
 Deadlock-Analysis
 Via system-health (completely free  ) even historically!
 Connection abortions (Queries that were not completed)
 Waits of certain Queries
 Latches of certain Queries
 Spinlocks of certain Queries
 Identify problematic Pagesplits
 Collecting a stack dump of a certain thread
 Correlate OS and SQL Server activities via ETW Kernel Provider
 End-to-End Tracing using Client API
 Correlation ID between Client and Server from SNAC11 / TDS 7.4

42

Ressources

 SQL Server 2016 in 15 Minuten


 https://channel9.msdn.com/Series/SQLServer-2016-in-15-Minuten

 SQL PASS Austria Homepage


 http://austria.sqlpass.org

 SQL PASS Austria Meeting Archive


 http://sdrv.ms/ZFVdnM

43

Andreas Wolter (SQLMCM) 19

Вам также может понравиться