How to configure SQL Server like a pro

Post on 14-Apr-2017

516 views 1 download

transcript

CONFIGURING SQL SERVER FOR PERFORMANCE LIKE A MICROSOFT CERTIFIED MASTER

TIM CHAPMAN

PREMIERE FIELD ENGINEER

MICROSOFT

THOMAS LAROCK

HEAD GEEK

SOLARWINDS

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.

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.

A LITTLE ABOUT

SOLARWINDS…

#Datachat

Network Management

System Management

IT Security

Database Management

solarwinds.com/products

• Talk about configuration options

• Questions

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

AGENDA

THE MANY LAYERS OF SQL

SERVER

Windows Server™ O/S

SQL Server™ instance (SQLOS)

SQL Server™ Database(s)

Every server has the same

constraints:

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Every server has the same

constraints:

• Memory

• CPU

• Disk

• Network

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

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.

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.

Disk

• Mount points

• Clustering options

• SAN configuration

• Storage spaces

• 64K Allocation Unit Sizes

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Network

• Named Instances

• Non-default ports

• Firewalls

• Anti-virus exclusions

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

Service Account Permissions

• Instant File Initialization

• Lock Pages in Memory

SERVER OS CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

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.

Cost Threshold for Parallelism

• Default is 5

• OLAP workloads = 25

• OLTP workloads = 40

INSTANCE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

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.

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.

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.

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.

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.

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.

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.

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.

Filegroups

• Default is one (PRIMARY)

• Create at least two:

• System

• User

• Tables and indexes

DATABASE CONFIGURATION OPTIONS

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

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.

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.

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.

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.

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.

Standard OS builds

Consider using sysprep for SQL installations

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

5 THINGS YOU CAN DO BETTER

Scripted installs

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

5 THINGS YOU CAN DO BETTER

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

Understand RPO and RTO, as they

impact your configuration choices

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

5 THINGS YOU CAN DO BETTER

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

Use Policy Based Management

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

5 THINGS YOU CAN DO BETTER

• Talk about configuration options

• Questions

© 2015 SOLARWINDS WORLDWIDE, LLC. ALL RIGHTS RESERVED.

AGENDA

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.

• 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