Top 10 DBA mistakes that affect the SQL Server performance

Slides:



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

Burt King We will cover: Essentials --No command line needed here (mott) What is SQL Server How does it come to life What are the.
MCTS GUIDE TO MICROSOFT WINDOWS 7 Chapter 10 Performance Tuning.
Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
SharePoint and SQL Server integration Demo: SQL Server Optimizing Configurations SQL Server 2014 for SharePoint 2013 Avoiding ginormous transaction.
MCDST : Supporting Users and Troubleshooting a Microsoft Windows XP Operating System Chapter 10: Collect and Analyze Performance Data.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
Optimizing SQL Server 2012 for SharePoint 2013 SharePoint Saturday/Friday, Honolulu March 27, 2015.
NovaBACKUP 10 xSP Technical Training By: Nathan Fouarge
Virtual Memory Tuning   You can improve a server’s performance by optimizing the way the paging file is used   You may want to size the paging file.
Stephan Hurni Consultant Trivadis AG, SQL Server notes from the field.
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
MCTS Guide to Microsoft Windows 7
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
Module 3: Managing Database Files. Overview Introduction to Data Structures Creating Databases Managing Databases Placing Database Files and Logs Optimizing.
TEMPDB Capacity Planning. Indexing Advantages – Increases performance – SQL server do not have to search all the rows. – Performance, Concurrency, Required.
Srik Raghavan Principal Lead Program Manager Kevin Cox Principal Program Manager SESSION CODE: DAT206.
Troubleshooting SQL Server Performance: Tips &Tools Amit Khandelwal.
Transaction Log Internals Dharmendra Keshari President - KDSSG.
MISSION CRITICAL COMPUTING Siebel Database Considerations.
1 Copyright © 2005, Oracle. All rights reserved. Following a Tuning Methodology.
TOP 10 Thinks you shouldn’t do with/in your database
Does the Optimistic Concurrency resolve your blocking problems Margarita Naumova, SQL Master Academy.
SQL Server High Availability Introduction to SQL Server high availability solutions.
Configuring SQL Server for a successful SharePoint Server Deployment Haaron Gonzalez Solution Architect & Consultant Microsoft MVP SharePoint Server
Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at
A deep dive into SQL Server Plan Cache Management.
You Inherited a Database Now What? What you should immediately check and start monitoring for. Tim Radney, Senior DBA for a top 40 US Bank President of.
No more waiting. Sponsors About me  Database Technology Specialist  MVP  Blogger  Author 3
This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information.
Doing fast! Optimizing Query performance with ColumnStore Indexes in SQL Server 2012 Margarita Naumova | SQL Master Academy.
Hitting the SQL Server “Go Faster” Button Rob Douglas #509 | Brisbane 2016.
An introduction to Wait Statistics
Get the Most out of SQL Server Standard Edition
You Inherited a Database Now What?
Data, Space and Transaction Processing
Inside transaction logging
Troubleshooting SQL Server high CPU usage
SQL Server Performance Tuning
SharePoint Solutions Architect, Protiviti
Hitting the SQL Server “Go Faster” Button
SQL Server Internals Overview
UFC #1433 In-Memory tables 2014 vs 2016
MCTS Guide to Microsoft Windows 7
SQL Server Monitoring Overview
Designing Database Solutions for SQL Server
Installation and database instance essentials
Performance Tuning 101: Parallelism
Chapter Overview Understanding the Database Architecture
The Top 5 SQL Server Mistakes
Upgrading to Microsoft SQL Server 2014
Boring is stable, stable is good - best practices in practice
Parallel Database Maintenance with 24/7 Systems and Huge DBs
Dynamics AX Performance
Hitting the SQL Server “Go Faster” Button
Configuring SQL Server
Performance Tuning for Mere Mortals Part II
What’s new in SQL Server 2016 Availability Groups
Peter Shore SQL Saturday Cleveland 2016
Inside transaction logging
Turbo-Charged Transaction Logs
Performance Tuning for Mere Mortals Part II
SQL Server performance tuning on Azure IaaS
Configuring SQL Server
It’s TEMPDB Why Should You Care?
Transaction Log Internals and Performance David M Maxwell
You Inherited a Database Now What?
Transaction Log Performance Tuning
Jean Joseph DBA\DEVELOPER
Using wait stats to determine why my server is slow
Presentation transcript:

Top 10 DBA mistakes that affect the SQL Server performance Margarita Naumova

Our Sponsors

Magi Naumova www.SQLMasterAcademy.com Working with SQL Server from v6.5 MCT from 1998 SQL Server Trainer and Consultant for more than 15 years, having more over 100 projects in Bulgaria, Finland, Germany, UK, Greece.. 5 years Senior Consultant in Microsoft Microsoft Certified Master SQL Server 2008 MVP SQL Server SolidQ Mentor & Trainer Now I am running SQL Master Academy training program www.SQLMasterAcademy.com

10. Playing with tempting settings db_level Auto-Close Queries can time out, significant delays occurs Typically the ON state is coming from SQL Server Express Should be OFF! Auto-Shrink Leads to significant I/Os on a periodic basis Leads to high amount of logging Leads to huge fragmentation of clustered indexes

demo

9. Playing with tempting settings SQL Server Level Priority Boost IO AFFINITY MAX Worker Threads Lightweight Pooling (Fiber Mode) All of them could potentially be harmful Should be left with their defaults!!

9. Playing with tempting settings Priority Boost Deprecated Dangerous for non-SQL Server threads could lead to hanging and unresponsive processes incl false failovers, network connection problems Should be OFF

9. Playing with tempting settings IO AFFINITY Sounds “great” to optimize the I/O, probably licensing or just make it faster Actually setting it leads to high increasing of context switching and consuming significant amount of CPU resources Should NOT be configured in vast majority of instances especially on 64bit

9. Playing with tempting settings Max Worker Threads Sounds like giving more speed Sometimes in response to weird error messages But actually the problems get worse Instead of playing with Max worker threads better do Monitor THREADPOOL waits Blocking Connection pooling

10. Playing with tempting settings Lightweight Pooling (Fiber Mode) Changes the way workers interact with Windows – fibers instead of threads As a result some features could not work or they may behave erratically, especially when the system is under load (CLR, XP, SQLXML , SQLMail, replication, etc) High Context switches can occur Rarely enhances performance or scalability on the typical system Do not use!

8. Not Optimizing for AdHoc Plan cache fills up with single use plans each of which 16K as a min Can cause internal memory pressure as memory is taken from data cache Usually CMEMTHREAD wait type occurs Optimize for AdHoc server level setting Only plan stub is saved (300B) Should be enabled by default on every Instance

7. Keeping default settings for parallel executions Max Degree of Parallelism The max number of threads to use in a branch of a parallel plan Lots of processes running parallel tasks can cause threat starvation Performance is severely affected If a DOP value of 4 is used, the number of estimated threads for executing this query is 4 * 2 = 8.

7. Keeping default settings for parallel executions Cost Threshold of Parallelism The cost of a plan above which the QP goes with a parallel execution Default setting is 5 which is too low As a result lo of queries go above the default setting, with parallel plan CXPACKET waits and thread starvations are most likely to occur especially in high concurrent OLTP or mixed workload

7. Keeping default settings for parallel executions Max Degree of Parallelism Reduce MaxDOP to allow increase concurrency and throughput of executions - http://support.microsoft.com/kb/2806535 You can do it per query with OPTION hint Cost threshold for parallelism Fix the high used plans to reduce their cost Raise cost threshold of parallelism from the default of 5 Tuning ‘cost threshold for parallelism’ from the Plan Cache, Jonathan Kehayias Use sp_blitzcache by Brent Ozar

6. Not configuring Instant File Initialization Skip initializing files with zeros As a result the following events performs faster Large database files creation Database file growth Database Restores Cons Is not used for transaction log files Could lead to exposing deleted files on disk Instant File Initialization should be configured on every instance!

5. Using default settings for files and growth Database Initial Size – 3MB or 5MB (or the size of the model db, 10MB in 2012) Database Growth - by 1MB! (or according to msdb settings, 8MB in 2012) Leaving defaults leads to: High amount of DB Growth events, which are too “expensive” to be accepted in production environment Reducing Transactions/data loading performance Fragmentation on database file (NTFS-level fragmentation) It DOES affect performance of large scans

4. Not configuring the log Defaults: Initial size 2MB; growth: 10% New VLFs are created depending on the Growth Size and the File Chunk rues File Chunk Number of VLFS <64MB 4 VLFs >=64MB and <1GB 8 VLFs >=1GB 16 VLFs Example: If the Tlog needs to grow from 1MB to 1GB: With 1MB steps it needs 1024 steps*4VLFs each = 4096 VLFs !!! With 512MB steps it needs 2 steps*8VLFs each = 16 VLFs !!!

5. Not configuring the log Excessive file auto‐growth causes: Numerous VLFs to be added – this can negatively affect performance of the log Synchronous slight pause on auto‐grow operation New portions of the log are always zero initialized Windows call to extend a file (may cause file fragmentation)

demo

5. Using default settings for files and growth Recommendations Manually manage file sizes Monitor auto‐growth for a limited period of time using Trace (Data File Auto Grow event class) or xEvents in order to know your pattern Define proper settings. Always have file growth as a fixed amount, not a percentage Manually growing files allows YOU to decide in advance which files to grow and how much Auto‐grow should be left enabled ‘just in case’

4. Not configuring the log Recommendations Configure the log initial size and growth Monitor the log for a specific period of time in order to have its pattern and tune settings if needed. Your goals: To not allow Log fragmentation (keep VLFs<100) To not allow dramatic file growths (keep stable log) You are allowed to play with Config settings (initial size) Backup strategy (backup log frequency) Maintenance strategy (change to bulk mode during the maintenance if appropriate)

3. Keeping defaults on TempDB Generally thee are 3 common problems with tempdb, all of them are result of misconfiguration I/O bottleneck i.e. slow tempdb DDL/allocation contention Out of space problem It is always better to configure in advance Multiple files all with equal size Enough size in order to avoid autogrowth Fast drive T1118

2. Not configuring SQL Server Memory MAX SERVER MEMORY should not be left default The Buffer Pool size is calculated based on Target Memory The Plan cache size and the size of cache stores are calculated based on Target Memory In case of misconfiguration External and Internal memory pressure events occur It affects both Bpool and Plan caches

2. Not configuring SQL Server Memory There is no separate categorization "Multi-Page allocations" Multi-Page allocations and CLR allocations are also included in memory limits Memory configuration and sizing considerations in SQL Server 2012 - http://support.microsoft.com/kb/2663912 24

1. No troubleshooting/PTO methodology You have to have a baseline Compare with the baseline on a regular basis Check a list of configurations on multiple servers (PBM works perfectly in this case) and apply policy Have a list of thinks and tools that you will check first

Summary We manage to increase performance by 40% only by fixing some of those settings Check your Instances and databases and fix those settings Learn more at SQL Master Academy: Magi.Naumova@SQLMasterAcademy.com www.maginaumova.com www.SQLMasterAcademy.com

Thank You!