Targeting Wait Statistics with Extended Events

Slides:



Advertisements
Similar presentations
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Advertisements

Test Case Management and Results Tracking System October 2008 D E L I V E R I N G Q U A L I T Y (Short Version)
Module 17 Tracing Access to SQL Server 2008 R2. Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine.
SQL Server Wait Statistics Capture, Report, Analyse Rob Risetto Principal Consultant with StrataDB
Connect with life Praveen Srvatsa Director | AsthraSoft Consulting Microsoft Regional Director, Bangalore Microsoft MVP, ASP.NET.
Module 18 Monitoring SQL Server 2008 R2. Module Overview Monitoring Activity Capturing and Managing Performance Data Analyzing Collected Performance Data.
Maintaining a Microsoft SQL Server 2008 Database SQLServer-Training.com.
Module 8 Improving Performance through Nonclustered Indexes.
Microsoft ® Office Access ™ 2007 Training Choose between Access and Excel ICT Staff Development presents:
Administration and Monitoring the Database Oracle 10g.
Performance Dash A free tool from Microsoft that provides some quick real time information about the status of your SQL Servers.
© 2008 Quest Software, Inc. ALL RIGHTS RESERVED. Perfmon and Profiler 101.
SQLRX – SQL Server Administration – Tips From the Trenches SQL Server Administration – Tips From the Trenches Troubleshooting Reports of Sudden Slowdowns.
Moving Beyond Standard BMV Reports Using Data Repository Session 373 Presented by: Ian Proffer.
Enterprise Database Administration & Deployment SIG ▪ 313M ▪ Sept 29, 2005 ▪ 10:15 AM SQL Server 2005 Performance Diagnosis and Tuning using SQL Tools.
Analysing Indexes SQLBits 6 th October 2007 © Colin Leversuch-Roberts Kelem Consulting Limited September 2007.
The X-Factor of the Extended Events Amit Khandelwal.
Page 1 Monitoring, Optimization, and Troubleshooting Lecture 10 Hassan Shuja 11/30/2004.
SQL SERVER AUDITING. Jean Joseph DBA/Consultant Contact Info: Blog:
Copyright Sammamish Software Services All rights reserved. 1 Prog 140  SQL Server Performance Monitoring and Tuning.
SQL Advanced Monitoring Using DMV, Extended Events and Service Broker Javier Villegas – DBA | MCP | MCTS.
Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at
Session Name Pelin ATICI SQL Premier Field Engineer.
Fixing Page Life Expectancy Steve Hood Blog: SimpleSQLServer.com.
SQL Server Magic Buttons! What are Trace Flags and why should I care? Steinar Andersen, SQL Service Nordic AB Thanks to Thomas Kejser for peer-reviewing.
SQL Saturday #509 | Brisbane 2016 #509 | Brisbane 2016 Martin Catherall Moving from Profiler to Extended Events.
The Ultimate SharePoint Admin Tool
SQL Database Management
With Temporal Tables and More
An introduction to Wait Statistics
Data Virtualization Demoette… Logging in CIS
Data Virtualization Demoette… Packaged Query Single Select Option
Essentials of UrbanCode Deploy v6.1 QQ147
Agenda Learn about the new TJ Ministry Application & Registration System Mixture of PowerPoint Slides, Demo’s and Hands-on Goals: Learn Concepts Play.
Troubleshooting SQL Server high CPU usage
Power BI Performance Tips & Tricks
SQL Server Data Collector From Every Angle
Get to know SQL Manager SQL Server administration done right 
ROUTERS AND REDUNDANCY
Query Performance Tuning: Start to Finish
Hitting the SQL Server “Go Faster” Button
SQL Server Monitoring Overview
Essentials of UrbanCode Deploy v6.1
Isolation Levels Understanding Transaction Temper Tantrums
Extend Your Knowledge with Extended Events!
Where to Start, What You Need
Simplifying XEvents Management with dbatools
Database Administration for the Non-DBA
Auditing in SQL Server 2008 DBA-364-M
Performance Monitoring Using Extended Events, DMVs & Query Store
Introducing the SQL Server 2016 Query Store
Introducing the SQL Server 2016 Query Store
Hitting the SQL Server “Go Faster” Button
Understanding and Handling Database Corruption
SQL Saturday #654 - Omaha.
Introducing the SQL Server 2016 Query Store
SQL Server 2016 Query Data Store
Statistics: What are they and How do I use them
SQL Saturday #662 - Sioux Falls, SD Hosted by (605) SQL
මොඩියුල විශ්ලේෂණය SQL Server Waits. Tables රැසක් එකට එකතු කිරීම.
Moving from SQL Profiler to xEvents
Transaction Log Internals and Performance David M Maxwell
Kris Hokanson That’s bad mmmkay! …Or, how to know when your SQL Server isn’t working as well as it could.
Ex Libris Leganto : Sharing the Love of Reading Lists
Sioux Falls, SD | Hosted by (605) SQL
Isolation Levels Understanding Transaction Temper Tantrums
Reporting 101 Keenan & Mona.
Using wait stats to determine why my server is slow
Extended Events: Successful troubleshooting recipes
This is a template for a presentation that you can use to introduce your team to Harvest. You can customize the content of the slides. You’ll want to pay.
Presentation transcript:

Targeting Wait Statistics with Extended Events David Maxwell

Obligatory Bio Slide David M Maxwell, SQL Server Consultant for UpSearch Twitter: @dmmaxwell or @UpSearchSQL Email: dmmaxwell@gmail.com or david.maxwell@upsearch.com Web: dmmaxwell.wordpress.com or upsearch.com Visit https://upsearch.com/connect-with-us and find your ideal way to stay in touch.

Overview of Technologies Involved Assembling the Solution Agenda Overview of Technologies Involved Assembling the Solution Demonstrations Today we’ll be looking at how to target wait stats for performance troubleshooting using Extended Events, in a few different ways. We’ll start with a quick review and discussion of wait statistics and what they are and are not good at. We will take a quick look at some of the dynamic management views available for examining wait stats, including DMVs that are only available in SQL 2016 and above. Then we’ll turn our attention to Extended Events, available in all supported versions of SQL Server, and how they can be used to extract information on wait statistics. We’ll continue with a discussion of how to assemble a solution for monitoring a workload, and seeing what waits are being generated at several levels, from individual queries or sessions, all the way up to databases, multi-database workloads, and beyond. Once we’ve finished our overview, we’ll walk through a few example scenarios and I’ll show you how it all comes together.

Wait Statistics – The Good, and the Not-So-Good… Performance Troubleshooting Go-To Available in SQL Server or via Perfmon (Sort of…) Can be hard to weed out false positives Can be hard to determine source of individual waits Wait statistics have been a go-to performance troubleshooting tool since they were first introduced in SQL Server 2005. Wait stats are great at showing what resources are being most frequently requested, both within the operating system, and within SQL Server. Everything from CPU and RAM, all the way to specific page latches, Wait stats are an excellent way to determine why your server isn’t running as quick as you think it should. Wait statistics can be gathered either directly from within SQL Server by queries, or by using Performance Monitor. SQL Server currently tracks almost 900 different waits within it’s DMVs. Perfmon has access to 12 of them, so it’s not an even comparison. You can still get some decent information on basic resource usage, but it’s in no way complete. Now speaking of the number of wait stats SQL server tracks, it should be noted that not all wait stats are created equal. Of over 900 different wait stats, many are only notable in specific situations, or for specific features like In-Memory processing or High-Availability configurations. In fact, most queries that people have written to examine wait statistics pre-emptively remove or ignore certain types of waits that are always present in the results. Many of these are background processes, which aren’t really bothersome when it comes to SQL Server performance. Over time SQL Server has tracked more and more types of waits as features were added to it. However, it wasn’t until SQL Server 2016 that we got a DMV that allowed us to look at Wait Statistics at more than just the instance level. Sure, there are third party tools that could extract that information, but not everyone has the budget for third party tools.

Wait Statistics – Dynamic Management Views sys.dm_os_wait_stats, sys.dm_os_waiting_tasks (Since 2005) sys.dm_exec_session_wait_stats (Since 2016) Persisted only for the life of the session Snapshot methods – not good for trending Good for performance tuning individual queries or sessions SQL Server tracks both accumulated wait stats and currently waiting tasks at the server level in a set of DMVs, and has done so since the beginning. Those are dm_os_wait_stats and dm_os_waiting_tasks. In 2016 SQL Server introduced a new DMV dm_exec_session_wait_stats that showed wait statistics at the session level, which was a good step forward. The stats gathered in this table are only persisted for the life of the session, so when a session disconnects, the statistics are dropped. That makes this DMV good for a few things. This is good for getting a point-in-time snapshot of the accumulated waits for current sessions on your system. It’s easily joined back to other DMVs to get additional information about those sessions such as user, application and database. But the short life of the information makes it difficult to get long-term information on more than simple workloads. You can, however, use this DMV to get wait info for performance tuning of individual queries or sessions.

Wait Statistics – Extended Events Extended Events – helping performance tuners since 2008 Running trace of events, including wait information Capture and examine, like profiler Good for workload profiling, but not immediate troubleshooting Requires Xquery to read output To get comprehensive information for wait stats, in a way that allows for more efficient analysis, we turn to Extended Events. Extended Events have been around since SQL Server 2008 R2, and are a much more efficient replacement for Profiler. In an extended events trace, wait statistics information can be gathered simultaneously with sql text, query plans, and a large amount of other information. Info can be gathered from a level as granular as an individual session, all the way up to an entire instance. XE sessions are like profiler in the sense that they can be watched live, but are best when captured and examined later. This is for getting a larger picture and a breakdown of what your workloads are waiting for, rather than what individual sessions are waiting for. And, they’re available in most supported versions of SQL Server.

Assembling The Solution Querying the XE DMVs Creating the XE Session Filtering Reading the output Automation

Demo Time!

Wait Stats show inefficient use of resources Summary Wait Stats show inefficient use of resources Extended Events allows for granular capture of events Consider your goal – snapshot or profile? Assemble and save your solution Automation is key

Thank You! Thanks for your time. Twitter: @dmmaxwell or @UpSearchSQL Email: dmmaxwell@gmail.com or david.maxwell@upsearch.com Web: dmmaxwell.wordpress.com or upsearch.com