38
CONFIGURING SQL SERVER FOR PERFORMANCE LIKE A MICROSOFT CERTIFIED MASTER TIM CHAPMAN PREMIERE FIELD ENGINEER MICROSOFT THOMAS LAROCK HEAD GEEK SOLARWINDS

How to configure SQL Server like a pro

Embed Size (px)

Citation preview

Page 1: How to configure SQL Server like a pro

CONFIGURING SQL SERVER FOR PERFORMANCE LIKE A MICROSOFT CERTIFIED MASTER

TIM CHAPMAN

PREMIERE FIELD ENGINEER

MICROSOFT

THOMAS LAROCK

HEAD GEEK

SOLARWINDS

Page 2: How to configure SQL Server like a pro

A LITTLE ABOUT TIM…

Tim is a Microsoft Dedicated Field Engineer (PFE) specializing in performance tuning and high availability.

He has over 14 years experience with databases, database architecture, programming, and administration.

Page 3: How to configure SQL Server like a pro

A LITTLE ABOUT ME…

Thomas has over 15 years experience in roles including programmer, developer, analyst, and DBA.

He is a frequent speaker, published author, and avid blogger on data related technologies.

He enjoys working with data, probably too much to be healthy, really.

Page 4: How to configure SQL Server like a pro

A LITTLE ABOUT

SOLARWINDS…

#Datachat

Network Management

System Management

IT Security

Database Management

solarwinds.com/products

Page 5: How to configure SQL Server like a pro

• Talk about configuration options

• Questions

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

AGENDA

Page 6: How to configure SQL Server like a pro

THE MANY LAYERS OF SQL

SERVER

Windows Server™ O/S

SQL Server™ instance (SQLOS)

SQL Server™ Database(s)

Page 7: How to configure SQL Server like a pro

Every server has the same

constraints:

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 8: How to configure SQL Server like a pro

Every server has the same

constraints:

• Memory

• CPU

• Disk

• Network

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 9: How to configure SQL Server like a pro

Memory

• 32 v 64 bit

• Limits for Standard edition (64GB,

128GB)

• Virtualized host servers may be

over-allocated

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 10: How to configure SQL Server like a pro

CPU

• Power settings can cause CPU issues

• May need to set in BIOS

• Virtualized host servers may be over-allocated

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 11: How to configure SQL Server like a pro

Disk

• Mount points

• Clustering options

• SAN configuration

• Storage spaces

• 64K Allocation Unit Sizes

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 12: How to configure SQL Server like a pro

Network

• Named Instances

• Non-default ports

• Firewalls

• Anti-virus exclusions

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 13: How to configure SQL Server like a pro

Service Account Permissions

• Instant File Initialization

• Lock Pages in Memory

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 14: How to configure SQL Server like a pro

Memory

• Set your min/max values

• Default min = 0, max =

2147483647

• Max = 0, tells SQL to be dynamic

MIN((95% physical), (50% avail))

• Multi-instance don’t talk to each

other

INSTANCE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 15: How to configure SQL Server like a pro

Cost Threshold for Parallelism

• Default is 5

• OLAP workloads = 25

• OLTP workloads = 40

INSTANCE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 16: How to configure SQL Server like a pro

Cost Threshold for Parallelism

• Default is 5

• OLAP workloads = 25

• OLTP workloads = 40

Max Degree of Parallelism

• Default is 0

• Consider NUMA when setting

INSTANCE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 17: How to configure SQL Server like a pro

Optimize for Ad-hoc Workloads

• Disabled by default

• You should enable this

• Unless you already know you

shouldn’t

INSTANCE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 18: How to configure SQL Server like a pro

Physical file layouts

• Default is system install drive

• Set this during installation of

SQL Server

• Distinct drives for data, log,

backups

• Think about recovery first

INSTANCE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 19: How to configure SQL Server like a pro

tempdb configuration

• Default is system install drive

• SQL 2016 enhancements

• Ensure files are the same size

• Enable TF 1118

• <8 Cores: tempdb files = cores>=8 Cores: tempdb files = 8Add 4 at a time after that

INSTANCE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 20: How to configure SQL Server like a pro

SQL login passwords

• Authentication mode chosen

during installation (mixed-mode)

• Set strong password for ‘sa’, then

disable

• Default is CHECK_POLICY = ON

• PWDCOMPRE() system function

INSTANCE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 21: How to configure SQL Server like a pro

Resource Governor

• Default is system pool only

• Use RG for dedicated

workloads

• Example: Hekaton workloads,

Maintenance

• Related: Query Governor

INSTANCE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 22: How to configure SQL Server like a pro

Backup compression

• Consider enabling

• Increases CPU – consider using

RG

Cycle error logs

• sp_cycle_errorlog

• TF to turn off log backup

messages in error log - 3226

INSTANCE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 23: How to configure SQL Server like a pro

System Health event session

• Add event file

• Modify ring buffer (2008, R2)

Blocked Process report

• Consider changing from default

value of 0

• Capture for blocked processes

INSTANCE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 24: How to configure SQL Server like a pro

Filegroups

• Default is one (PRIMARY)

• Create at least two:

• System

• User

• Tables and indexes

DATABASE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 25: How to configure SQL Server like a pro

Compression

• Row and Page

• Can dramatically reduce data size

• Will be some overhead

• Must be set for each object

manually (no database option)

DATABASE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 26: How to configure SQL Server like a pro

Auto defaults

• Autogrowth

• Configure smart values

• Update statistics

• Large tables consider TF 2371

• Create statistics

DATABASE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 27: How to configure SQL Server like a pro

Compatibility mode

• Default is either model (new db

created) or whatever the restore

had previously

• Match instance version (SQL2014

= 120)

• Test this for your environment

DATABASE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 28: How to configure SQL Server like a pro

Optimistic Isolation

• Read Committed Snapshot

Isolation (RCSI)

• Should be considered when

workloads have high amount

locking/blocking

• Some tempdb overhead

DATABASE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 29: How to configure SQL Server like a pro

Forced Parameterization

• Default is SIMPLE

• Leave it SIMPLE

• Unless you are the 1%

Trustworthy

• Default is OFF

• Leave it OFF

DATABASE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Page 30: How to configure SQL Server like a pro

Standard OS builds

Consider using sysprep for SQL installations

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

5 THINGS YOU CAN DO BETTER

Page 31: How to configure SQL Server like a pro

Scripted installs

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

5 THINGS YOU CAN DO BETTER

Page 32: How to configure SQL Server like a pro

Build checklist

Esp helpful AFTER applying SPs/CUs/Upgrades

Automate system checks© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

5 THINGS YOU CAN DO BETTER

Page 33: How to configure SQL Server like a pro

Understand RPO and RTO, as they

impact your configuration choices

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

5 THINGS YOU CAN DO BETTER

Page 34: How to configure SQL Server like a pro

Understand RPO and RTO, as they

impact your configuration choices

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

5 THINGS YOU CAN DO BETTER

HA <> DR

Page 35: How to configure SQL Server like a pro

Use Policy Based Management

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

5 THINGS YOU CAN DO BETTER

Page 36: How to configure SQL Server like a pro

• Talk about configuration options

• Questions

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

AGENDA

Page 37: How to configure SQL Server like a pro

Thank You!

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

The SOLARWINDS and SOLARWINDS & Design marks are the exclusive property of SolarWinds Worldwide, LLC, are registered with the U.S.

Patent and Trademark Office, and may be registered or pending registration in other countries. All other SolarWinds trademarks, service

marks, and logos may be common law marks, registered or pending registration in the United States or in other countries. All other trademarks

mentioned herein are used for identification purposes only and may be or are trademarks or registered trademarks of their respective

companies.

Page 38: How to configure SQL Server like a pro

• http://tinyurl.com/pwdcompare

• http://tinyurl.com/query-gov

• http://tinyurl.com/trace-flags

• http://tinyurl.com/cycle-errorlog

• http://tinyurl.com/blocked-process-report

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

FOR MORE INFORMATION