22
PERFORMANCE TUNING GETTING BIG BANG FOR YOUR BUCK Monica Rathbun Consultant Denny Cherry & Associates Consulting

PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

PERFORMANCE TUNING

GETTING BIG BANG

FOR YOUR BUCK

Monica Rathbun

Consultant

Denny Cherry & Associates Consulting

Page 2: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

Consultant

Denny Cherry & Associates Consulting

PASS Mid-Atlantic Regional Mentor

User Group Leader: Hampton Roads VA

SQL Saturday VA Beach Organizer

[email protected]

@SQLEspresso

sqlespresso.com

linkedin.com/in/sqlespresso

MONICA RATHBUN

Page 3: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

Always Ask Questions

Interrupt MeThis is a two-way conversation, let’s

learn from each other’s

experiences

PRESENTATION RULES

Page 4: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

BEST PRACTICESStart with the basics

Tempdb

Memory

Patching

Services

Power Plan

Friends

Page 5: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

POWER PLAN Windows Control Panel Power Options

Page 6: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

SERVICESWhy are you running this?

Page 7: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

PATCHINGBug Fixes

Performance Degradations

ImprovementSQL 2016 SP1

Optimizer

Support Microsoft Support

Drivers on VM and NICs

Windows Patches

Build Listhttps://sqlserverbuilds.blogspot.com/

Page 8: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

MEMORYProper configuration is vital

Min and Max Memory

Multiple Instances

Extra Services SSRS, SSIS, SSAS

Lock Pages in Memory *

Set Memory Reservation for Your VM on the Host

Don’t over allocate!

Page 9: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

TEMPDB

Pin to High Performing Disk

Multiple Files

1 file per CPU core up to 8 files

Trace flag 1118/1117

Pre 2016

Heavy Contention in Metadata fixed

2016 CU 8 and 2017 CU 5

Trace Flag 2453 allows table

variables to trigger recompile

Everything Uses TEMPDB - Make sure you don’t ignore it.

Page 10: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

Their baby might be ugly

MAKE FRIENDS WITH NETWORK & STORAGE ADMINS

Page 11: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

VIRTUAL ENVIRONMENTS Over Provisioned Hosts

Thin Provisioning

What Happens on One VM Now Affects Another

Too Many VMs on One Host

VM Over/Under CPU Allocation

Thin Provisioning

Page 12: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

COMPRESSIONMore data in memory – It’s the GOLDEN EGG!

Row/Page Compression -More Data In MEMORY

Saves Space on Disk

Backup Compression: Less Data in STORAGE

Costs CPU speed, but worth it

Page 13: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

Snapshot Isolation

Is updated row versions for each

transaction are maintained in tempdb.

ALLOW SNAPSHOT ISOLATION &

READ COMMITED SNAPSHOT ISOLATION (RCSI)

RCSI option

Allows access to versioned rows under the

default READ COMMITTED isolation level.

If set to OFF, you must explicitly set the level

for each session in order to access

versioned rows

READERS CANT BLOCK WRITERS AND

WRITERS CANT BLOCK READERS Default Isolation Level in Azure SQL DB

Page 14: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

Maintain Keep These Up To Date!

Updates Sync vs Async

Large Table Trace Flag 2371

Missing Stats Did You Know You Can Make Your Own?

STATISTICSThis is the magic sauce that helps the optimizer.

Defaulted in SQL 2016

Page 15: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

MAX Degree of Parallelism (MaxDop)

Cost Threshold for Parallelism (CTfP)

PARALLELISMCAUTION: Using too many cores = more overhead to put things back together

Page 16: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

Initialized instantaneously to avoid zeroing operations / Reclaims used disk space INSTANT FILE INITIALIZATION (IFI)

FAST EXECUTION On

Data Files*

SQL Server service account Perform Volume Maintenance Taskssecurity policy in windows. Use AD Group Policy to grant this to

service accounts in your domain

Restore

Add Data/Log

Files

Create Database

Increase File Size &

Autogrowth

Page 17: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

WINNING RESULTS

Page 18: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

MINIMAL LOGGING • SELECT INTO • INSERT SELECT • CREATE INDEX • MERGE

Data Warehouse or

Repeatable Loads

High Volume Data Loads

FasterLog Files Smaller

No Point in Time

RecoverySimple or

Bulked Logged

Logs Extent Allocation &

Metadata

Trace Flag 610

SQL Server 2008 – 2014 *2016 Defaulted Bulked Logged

Page 19: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

Performance boost on startup, insert/update/delete & backup/restore operations.

VIRTUAL LOG FILES

A large number of VLFs can slow things down.

VLF counts under 100 ideally

Shrink files to two VLFs

Grow in chunks back to the current size

DBCC LOG INFO or sys.dm_db_log_stats (2016 SP2)

Page 20: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

Wasted Write Disk IO

Disable then Delete

Wasted Read IO

Avoid Duplicates

Consolidate Indexes

Specific Query Tuning – Key

Lookups

INDEXES

Remove Un-Used Indexes

Find Missing Indexes

Covering Indexes

These are not set it and forget it

Page 21: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

EXECUTION PLANSEasy things to look at

Index Needs

More Granular Review

Missing Includes

Scans

Sorts Does the data need to be sorted?

Can it be done elsewhere?

Key Lookups

Extra Reads

Easily Avoided in Most Cases

Spills Spills to TempDB

Forced to go to Disk

Page 22: PERFORMANCE TUNING GETTING BIG BANG FOR ......MEMORY Proper configuration is vital Min and Max Memory Multiple Instances Extra Services SSRS, SSIS, SSAS Lock Pages in Memory * Set

Contact Information

[email protected]

@SQLEspresso

sqlespresso.com

linkedin.com/in/sqlespresso