SQL Saturday – Performance Troubleshooting

Slides:



Advertisements
Similar presentations
The following 10 questions test your knowledge of client site assignment in Configuration Manager Configuration Manager 2007 Client Site Assignment.
Advertisements

The following 10 questions test your knowledge of Internet-based client management in Configuration Manager Configuration Manager 2007 Internet-Based.
The following 10 questions test your knowledge of desired configuration management in Configuration Manager Configuration Manager Desired Configuration.
SQL Server 2012 New Performance Tuning Tools. Who am I? Menzo Steinhorst Senior Premier Field Engineer SQLRAP, WS+ SQL Server Performance Tuning, WS+
Conditions and Terms of Use
Open XML Developer Workshop DrawingML Basics. Open XML Developer Workshop Disclaimer The information contained in this slide deck represents the current.
SpreadsheetML Advanced
SpreadsheetML Basics.
DrawingML Basics.
© 2014 Microsoft Corporation. All rights reserved.
Module 17 Tracing Access to SQL Server 2008 R2. Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine.
System Center 2012 Configuration Manager Concepts & Administration
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
Open XML Developer Workshop SpreadsheetML Advanced.
Amit Banerjee Support Escalation Engineer Microsoft Corporation SQL Server FAQ: TroubleshootingSQL:
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
Connect with life Praveen Srvatsa Director | AsthraSoft Consulting Microsoft Regional Director, Bangalore Microsoft MVP, ASP.NET.
Open XML Developer Workshop SpreadsheetML Advanced.
The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication.
Course Topics Administering SQL Server 2012 Jump Start 01 | Install and Configure SQL Server04 | Manage Data 02 | Maintain Instances and Databases05 |
Vital Signs: Performance Monitoring Windows Server
Office Open XML Developer Workshop SpreadsheetML Basics.
® IBM Software Group © 2012 IBM Corporation OPTIM Data Studio – Jon Sayles, IBM/Rational November, 2012.
Key Concepts About Performance Factors Affecting SQL Performance SQL Performance Tuning Methodologies SQL Performance Tuning Tools 1.
Conditions and Terms of Use
© 2012 Microsoft Corporation. All rights reserved.
Learningcomputer.com SQL Server 2008 – Profiling and Monitoring Tools.
Systems Management Server 2.0: Backup and Recovery Overview SMS Recovery Web Site location: Updated.
Troubleshooting SQL Server Performance: Tips &Tools Amit Khandelwal.
Ramesh Meyyappan SQL Server Performance Tuning Consultant & Trainer SQLWorkshops.comSQLWorkshops.com / SQLIO.comSQLIO.com.
1 Chapter Overview Monitoring Access to Shared Folders Creating and Sharing Local and Remote Folders Monitoring Network Users Using Offline Folders and.
Connect with life Praveen Srivatsa Founder and CEO – AstraSoft.NET Vinod Kumar Technology Evangelist – Databases and BI.
Open XML Developer Workshop XSLT and Open XML. Open XML Developer Workshop Disclaimer The information contained in this slide deck represents the current.
SQL Advanced Monitoring Using DMV, Extended Events and Service Broker Javier Villegas – DBA | MCP | MCTS.
This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information.
Event Title Event Date. Module 05—Publishing and Accessing Reports with Reporting Services Name Title Microsoft Corporation.
Microsoft Confidential © 2012 Microsoft Corporation. All rights reserved.
Microsoft Dynamics AX Credit and Collections
Using Parallelspace TEAM Models to Design and Create Custom Profiles
Monitoring SQL with System Center
Troubleshooting SQL Server high CPU usage
MODULE 10 – PROJECT SERVER
Troubleshooting SQL IO issues with Xperf
XSLT and Open XML.
Query Performance Tuning: Start to Finish
AlwaysOn Readable Secondary
SQL Server Monitoring Overview
Customize Office 365 Search and create result sources
Parallelspace PowerPoint Template for ArchiMate® 2.1 version 1.1
Parallelspace PowerPoint Template for ArchiMate® 2.1 version 2.0
Test Upgrade Name Title Company 9/18/2018 Microsoft SharePoint
Microsoft Build /20/2018 5:17 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
Amit Banerjee Sr. Program Manager Microsoft Data Platform Group
Automation in an XML Authoring Environment
SQL Server 2016 Query Data Store
Turbo-Charged Transaction Logs
ASP.NET 4.0 State Management Improvements – Deep Dive
LitwareHR v2: an S+S reference application
Using Power Bi to troubleshoot SQL Server instances
Andrew Fryer Microsoft UK
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
04 | Performance and the Premium SKU
5/8/2019 3:20 AM bQuery-Tool 3.0 A new and elegant way to create queries and ad-hoc reports on your Baan/Infor ERP LN data. This Baan session is a query.
5/16/2019 Windows Performance Jump Start Chell Sterioff Milad Aslaner Sr. Program Manager Premier Field Engineer Microsoft Corporation Microsoft.
Office 365 Performance Management
Using wait stats to determine why my server is slow
Azure SQL Database Lessons Learned From the Trenches Best practices, Tips and Tricks on monitoring and improving performance. Fernando Cobo.
Microsoft Virtual Academy
Microsoft Virtual Academy
Presentation transcript:

© 2012 Microsoft Corporation. All rights reserved. Microsoft Confidential © 2012 Microsoft Corporation Microsoft Confidential

SQL Saturday – Performance Troubleshooting Methodology and Tools Microsoft Confidential © 2012 Microsoft Corporation Microsoft Confidential

Conditions and Terms of Use Microsoft Confidential This training package is proprietary and confidential, and is intended only for uses described in the training materials. Content and software is provided to you under a Non-Disclosure Agreement and cannot be distributed. Copying or disclosing all or any portion of the content and/or software included in such packages is strictly prohibited. The contents of this package are for informational and training purposes only and are provided "as is" without warranty of any kind, whether express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, and non- infringement. Training package content, including URLs and other Internet Web site references, is subject to change without notice. Because Microsoft must respond to changing market conditions, the content should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. Unless otherwise noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. Copyright and Trademarks © 2012 Microsoft Corporation. All rights reserved. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. For more information, see Use of Microsoft Copyrighted Content at http://www.microsoft.com/about/legal/permissions/ Microsoft®, Internet Explorer®, and Windows® are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other Microsoft products mentioned herein may be either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. All other trademarks are property of their respective owners. © 2012 Microsoft Corporation Microsoft Confidential

Microsoft Confidential Who am I ? What is PFE? Joe McTaggart Native Texan Working with SQL since 2001 Worked with SQL 6.5 - 2012 Premier Field Engineering Reactive and Proactive support for Premier customers Architecture/Project Guidance Team Mentoring Deliver workshops Troubleshooting Microsoft Confidential © 2012 Microsoft Corporation Microsoft Confidential

Microsoft Confidential Overview Methodology – Breaking down the problem What is the problem? Isolate the problem What are my bottlenecks Tools SQLDiag Perfmon Profiler and extended events DMV’s Microsoft Confidential © 2012 Microsoft Corporation Microsoft Confidential

Troubleshooting Methodology Microsoft Confidential

What’s your problem? “MyApp is slow today.” “MyWebPage is slow when I click on some button.” “MyApp is slow because of blocking in the database.” Users reporting problems are often nebulas and biased. What changed? When did the problem start? Is it always slow or only at certain times of day? Is anything else behaving differently? What does “slow” mean? Ask Questions A problem not defined is impossible to solve Smaller scope means less data to look at Narrow the problem Microsoft Confidential © 2012 Microsoft Corporation Microsoft Confidential

Microsoft Confidential Divide and Conquer Isolate the issue as much as possible Ruling out possible causes is as important to finding the actual problem. Play “20 questions” Client or Server problem Windows or SQL All SQL Servers or just one All databases or just one Microsoft Confidential © 2012 Microsoft Corporation Microsoft Confidential

What resource is my bottleneck? System CPU Memory Disk Network SQL Blocking Internal memory Latches Application Consuming results Transaction times App Server and Client machines Microsoft Confidential

SQL Bottleneck Is there high CPU yes Some other process High CPU on sqlservr.exe What are the expensive queries? Are statistics up to date? Missing indexes no Waiting Locks IO Network Other Waits Microsoft Confidential

Microsoft Confidential High CPU User or Privileged time? Privileged time represents time in the kernel AntiVirus IO Filter drivers Other Xperf utility can help identify cause of kernel time User time represents normal process activity spent in application code. Sqlservr.exe high CPU Find expensive queries Look for expensive operations like sorts, hashes, or scans CPU and IO tend to go hand in hand. Find high IO queries Common Causes Poor estimates Stale Statistics Poor Query Design Missing Indexes Microsoft Confidential

Microsoft Confidential IO Bottleneck PAGEIOLATCH_EX and PAGEIOLATCH_SH Latches that indicate a query is waiting on an IO to complete Is SQL asking for too much? Identify high read/write queries Sys.dm_io_virtual_file_stats – Identify which db files are busiest Profiler Common solutions Adding Indexes Updating statistics Query Redesign Are the disks performance correctly? Perfmon counters can help analyze Throughput IOPS Latency Microsoft Confidential

Microsoft Confidential Memory Bottleneck External Pressure Ensure there is free memory available to the OS Is there paging? Causes sql server to reduce it’s memory caches Internal Pressure Under pressure, data/index pages and query plans are aged out of memory Less page reuse May see more query compilations Many times memory pressure manifests as IO issues Microsoft Confidential

Microsoft Confidential Blocking Find the lead blocker Sys.dm_exec_requests Sys.dm_tran_locks Is it running, idle, or waiting on some resource Running Tune the query Idle Investigate the client Orphaned transaction Waiting What resource is it waiting on Too high Isolation Level? Snapshot? Normal concurrency? Microsoft Confidential

Microsoft Confidential Deadlock Two or more processes holding resources in a circular locking chain SQL Server will detect deadlocks (not just lock deadlocks) How to identify Client error message Profiler trace Xevent Trace Flag 1222 Most likely a design issue Different processes accessing resources in different orders Unnecessarily long transactions Poorly tuned queries Microsoft Confidential

Network waits, must be a problem with the network. Async_Network_IO waits Sql is sending result sets to the client Slow Network Packets are taking a long time to get to the destination Network issues causing lots of resends Client not consuming results Far more common Perf issue on client Poor design Microsoft Confidential

Microsoft Confidential Data Collection Microsoft Confidential

Microsoft Confidential Performance Monitor Perfmon is particularly useful for: Collecting information on system resource utilization Collecting performance information over a long period of time. Base lining server and application performance. Microsoft Confidential

General Perfmon Counters The following counters are useful for just about any server and any application. All Counters for: LogicalDisk Memory Network Interface (optional) Process Processor These counters cover your basic system resource monitoring. Microsoft Confidential

Microsoft Confidential Perfmon Sql Counters Buffer Manager -- These counters work to give you an idea of the overall memory pressure within the sql server process. Free Pages Lazy Writes/Sec Page Life Expectancy In general this should be above 300 sec (5 minutes) General Statistics User Connections Locks Number of Deadlocks/sec Quick way to identify if deadlocks are occurring. Requires follow up with Profiler and DMV information to troubleshoot. Microsoft Confidential

Perfmon SQL Counters (cont.) Memory Manager Target Server Memory Total Server Memory If target is below total this is an indication that the OS is under memory pressure and sql server is trying to give memory back to the OS. At startup, Target will be above Total as sql server is acquiring memory as needed. Sql Statistics Batch Request/sec How busy is the server Sql Compilations and Sql Re-Compilations Is sql server spending a lot of time compiling queries. Microsoft Confidential

Microsoft Confidential Profiler Profiler is a performance tuning and troubleshooting tool. Profiler is good at: Capturing queries responsible for periodic performance events Auditing security and activity (beware overhead). Benchmarking, stress testing, baselining activity and throughput. (Replay.) Visualizing deadlock behavior Viewing SHOWPLAN results for each query captured Capturing events for Database Engine Tuning Advisor Microsoft Confidential

General Events to collect Errors And Warning Group All events Tend to have very few hits and typically very informative Locks Deadlock Graph Lock Escalation Security Audit Audit Login Audit Logout Sessions Existing Connections Stored Procedures RPC:Completed TSQL SQL:BatchCompleted Transactions SQL Transaction DTC Transaction Microsoft Confidential

Microsoft Confidential Detailed Events Use with caution as these may impact performance. SP:StmtCompleted and SQL:Stmtcompleted Only use if you have isolated the problem down to a batch and/or stored procedure and need to determine which query in the batch is the root cause. Many times there are only one statement per batch or the problem query in a batch is obvious. Stmt level events will typically generate many events which can cause trace level waits on the sql server as processes have to wait to write to the trace file before moving on. Performance: Any of the Showplan events The Showplans will generate statement level query plans. Expensive to produce and large events Starting Events (SQL and RPC) Useful for replay traces Microsoft Confidential

Profiler Best Practices Run Server side Trace always If possible avoid the GUI when capturing. If not, then run GUI with server side trace Trace to a file not to a table Never Trace to a UNC Path Capture Events Judiciously XML_SHOWPLAN Events are expensive Statement level events may be expensive depending on how busy a server Default to a Batch Level Trace Monitor running traces with sys.traces Trace filtering reduces Trace size but increases CPU burden Capture on a drive different that Data drive for the databases Microsoft Confidential

Microsoft Confidential Trace Analysis Tools RML ReadTrace is a utility inside of the RML tools that can parse and aggregate sql trace files. RML can also be used to replay traces and do stress testing. http://support.microsoft.com/kb/944837 SQL Nexus Contains the ReadTrace piece of RML but also has parsers for Perfmon and the perf stats script from PSSDiag. http://sqlnexus.codeplex.com/ Microsoft Confidential