sql server tuning for sharepoint : what every consultant must know (office 365 saturday copenhagen -...

Post on 13-Apr-2017

989 Views

Category:

Software

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Office 365 Saturday CopenhagenMarch 12, 2016

#o365sdk2016spbg.dk

Tuning SQL Server for SharePoint

Serge Luca, Isabelle Van Campenhoudt ShareQL, Brussels

Platin

Gold

Silver

Supporting the

community

Thanks to our sponsors

#o365sdk2016spbg.dk

About Us

ShareQL

3

Isabelle Van Campenhoudt

MVP SQLTheSQLgrrrl.wordpress.com

Serge LucaMVP SharePointSergeluca.wordpress.com

ShareQL.com

About Us

Serge Luca

SharePoint MVP

Consultant, speaker, trainer- Brussels (Belgium)

Managing partner of www.ShareQL.com

Works with SharePoint since 2001

Blog: http://sergeluca.wordpress.com/

sergeluca@ShareQL.com

@SergeLucaSerge Luca

About us

Isabelle Van Campenhoudt

SQL Server MVP

Consultant, speaker, trainer-Brussels (Belgium)

Managing partner of www.ShareQL.com

Works with SQL Server since 1999

Blog: http://thesqlgrrrl.wordpress.com/

ivc@ShareQL.com

@thesqlgrrrl

Isabelle Van

Campenhoudt

Credits

Serge Luca Accidental DBA

IsabelleVan Campenhoudt

SQL guru

AgendaBasic SharePoint DB concepts

Operating System settings

SQL Server configuration

Databases configuration

SharePoint and SQL Server integration concepts

SQL Server optimization

HA and DR : Always On Availability Groups & SP 2013

Agenda

Basic SharePoint DB concepts

Operating System settings

SQL Server configuration

Databases configuration

SharePoint and SQL Server integration concepts

SQL Server optimization

HA and DR : Always On Availability Groups & SP 2013

Agenda

Basic SharePoint Concepts

99.9% of SharePoint content stored in SQL

Server

Farm Configuration information stored in

configuration db

Central Administration content stored in own

content db

Most Service Applications have at

least one db

All Web Applications have at least one

content db

Farm has several databases; >20 if

spousal installation

Basic SharePoint DB concepts

Operating System settings

SQL Server configuration

Databases configuration

SharePoint and SQL Server integration concepts

SQL Server optimization

HA and DR : Always On Availability Groups & SP 2013

Agenda

Operating System settings

Optimize Hardware

CPU RAM DISK Network

11

Latency

NetworkLatency between web front ends and SQL

Server

• Mandatory for stretched farm, but good practice:• < 1 ms during10 minutes (1% failure max) • 1 Giga bits / sec

• Mandatory if mirroring or Always On Sync (see later)

NTFS Allocation Unit Size

64K is optimal, 4K = 30% Performance

Penalty (data files, not log files)

Use chkdsk <drive>to Verify

Use Format to Configure:• Format <drive> /Q /FS:NTFS /A:64K /V:<volume> /Y

14

IOPS

• As part of capacity plan• Determine how much GB you need• Talk to the SAN team

Because…

Database name IOPS requirements Typical load on I/O subsystem. Optimization

TempDB High 2 IOPS/GB Write

Content DB High0.5-0.75 IOPS/ GB (4 TB supported: 0.25IOPS/GB , ideally: 2 IOPS/GB)

Read

Transaction Log High 2 IOPS/GB Write

Search Crawl database Medium to high IOPS10 IOPS per 1 document per second (DPS) crawl rate.

Write

Search Link database Medium IOPS 10 IOPS per 1 million items in the search index.

Search administration database Low IOPS Not applicable.

Search Analytics reporting database Medium IOPS Not applicable.

How can you check if you SAN support these IOPS ?

• IOMeter (free)• SQLIO (free)• …

• In production : be careful• Test with a file > than SAN cache• Test reading/writing , random 64k (for data)and serial

(for transaction log)

Basic SharePoint DB concepts

Operating System settings

SQL Server configuration

Databases configuration

SharePoint and SQL Server integration concepts

SQL Server optimization

HA and DR : Always On Availability Groups & SP 2013

Agenda

SQL Server configuration

For SharePoint 2013:• SQL Server 2008 R2 SP1• SQL Server 2012 (SP1 for BI)• SQL Server 2014 (SP2013 SP1 & April CU)

For SharePoint 2016:• SQL Server 2014• SQL Server 2016

Don’t install SSMS on the SQL Server computer

Use named instances\ SharePoint

Use a dedicated instance

Run the service with a Managed account

•No specific permission

Collation settings

Latin1_General_CI_AS_KS_WS (for SharePoint databases)

(Any CI collation is supported for tempDBs, master, but Latin1_xxx_ is recommended)

SP uses this collation when it creates its own db

Cannot be changed after the setup !!!

Max degree of parallelismMaxdop=1

Specify memory limits

BackupsCompression

SQL server Configuration

Use alias for the connection string• Client alias or DNS alias (preferred)

Good practice : every SP Content db must be created (and documented) by a DBA after a strict capacity plan

Basic SharePoint DB concepts

Operating System settings

SQL Server configuration

Databases configuration

SharePoint and SQL Server integration concepts

SQL Server optimization

HA and DR : Always On Availability Groups & SP 2013

Agenda

System databases

Master : similar to the SP configDB

Model : template for other dbs

Tempdb : temporarily results

Msdb : for automation

User databases The SharePoint databases

SQL Server basic concepts

SQL Server basic concepts

Simple Recovery Model

.MDF .LDFAddContent

Content Database Located on Hard Drive

Checkpoint

Data

Data

Simple Recovery Model

Full Recovery Model

.LDF

Data

Data

.MDFAddContent

Content Database Located on Hard Drive

Checkpoint

Data

Data

Full Recovery Model (Recommended)

SQL Server basic concepts

Model db : recovery model = full

Tempdb : recovery model = simple

SharePoint DB : recovery model ?

Contend DB = full Config DB= simple

Services App DBs= it depends :•http://

technet.microsoft.com/en-us/library/

cc678868.aspx

Always On Availability groups: recovery = full !

SQL Server basic concepts

Model DB settings

Increase Initial sizeIncrease Autogrowth

(MB , not %)

Don’t modify Model db collation Full Recovery Model

Tempdb settingsConfigure Tempdb files•#files = #cores •(on sql server 2012 Max 8 if #cores > 8)

•Same size for every file

Configure Tempdb Size •At Least 10% of Total Content DB’s Size or

•Size of Largest Table - Whichever Greater

Tempdb Database Settings•Increase Initial Size Setting•Increase Autogrowth Settings (Use MB Not %)•Use Simple Recovery Model•Place on Different Drive Than Content Databases

Files Placement

Priority (Fastest to Slowest Drive)

Tempdb Data and Transaction Log Files

DataBase Transaction Log Files

Search Database Data Files Content Database Data

Files

Use Multiple Data Files for Content and Search DB’s

Distribute Equally-Sized Data Files Across Separate Disks

Number of Data Files Should Be <= Number of Processor Cores

Multiple Data Files Not Supported for Other DBs

Basic SharePoint DB concepts

Operating System settings

SQL Server configuration

Databases configuration

SharePoint and SQL Server integration concepts

SQL Server optimization

HA and DR : Always On Availability Groups & SP 2013

Agenda

Installing SharePoint

Setup account (sp-install)Must be:

(SQL Server) DBcreator

(SQL Server) Securityadmin

Local admin Domain account

Integrating SharePoint and SQL Serveur

Farm has several databases; >20 if spousal installation

Site Collections only reside in one database

Content database contains multiple site collections (2,000 Default Setting)

If Site Collection > 100GB store in own content database•Soft limit maximum size <= 200 GB

SP Health Analyzer

Job will defragment the indices

If fragment > 30% &

rowcount > 10.000

Job will update statistics

AUTO_CREATE_STATISTICS

OFF

Verify Integrity of databases

DBCC CheckDB

Check REPAIR_REBUILD Option to Fix Errors (Not

Always Possible)REPAIR_ALLOW_DATA_

LOSS Not Supported

Time Consuming Operation, Run During

Non-Peak Hours

For Very Large DBs consider using option

MAXDOP=1

Basic SharePoint DB concepts

Operating System settings

SQL Server configuration

Databases configuration

SharePoint and SQL Server integration concepts

SQL Server optimization

HA and DR : Always On Availability Groups & SP 2013

Agenda

Tools CPU I/O (Iometer is a tool to check

your SAN) Network Memory

Run a trace of Performance Counters (24 hours)

Provides templates of accurate counters

Analyse regarding thresholds

Generate meaningfull reports

Use PAL (free)(« Performance Analysis of Logs ») or SCOM Use this trace as a

baseline!!!

In production (live) Or Use Visual Studio (for Web performance Tests, simulate actions, number of users)

39

Main Counters

Counters: Should be:

Memory: Available Bytes At least 4 GB for the system

Logical Disk: Disk Reads/sec Between 15 and 25 ms

Logical Disk: Disk Writes/sec Between 15 and 25 ms

Process: cpu/working set/io SQLsrve.exe % other processes

Processor Max 40%

SQL Server: Buffer Manager: Buffer Cache Hit Ratio

>97%

SQLServer: Buffer Manager: Page life expectancy > 300 sec (but do a baseline)

Dashboard

Check performance counters & set a baseline

Check performance counters & set a baseline

In-SAN-ity ?

Using SQL Server Resource Governor to optimize Search Database usage

Part of SQL Server Enterprise (since SQL 2008)

Limits CPU and memory usage on some DBs (and IO in SQL Server 2014)• like search DBs

Allow less CPU & mem & IO usage during work hours

Allow more CPU & mem & IO usage during off hours

44

Basic SharePoint DB concepts

Operating System settings

SQL Server configuration

Databases configuration

SharePoint and SQL Server integration concepts

SQL Server optimization

HA and DR : Always On Availability Groups & SP 2013

Agenda

Terminology

Service Level Agreement

HA DR RPO RTO

Always On Availability Groups & SharePoint

SQL 1

FARM 1

SQL 2

ProductionToronto

High Availabilty

Synchronous

Always On Availability Groups & SharePoint

SQL 1

FARM 1

SQL 2

Synchronous

ProductionToronto

High Availabilty

Database Support – Sync Commit

Database Supported

Admin Content Yes

App Management Yes

BDC Yes

Config Yes

Content Yes

Managed Metadata Yes

PerformancePoint Yes

PowerPivot Not Tested

Project Yes

Search Analytic Reporting Yes

Search Admin Yes

Database Supported

Search Crawl Yes

Search Links Yes

Secure Store Yes

State Service Yes

Subscription Settings Yes

Translation Services Yes

UPA Profile Yes

UPA Social Yes

UPA Sync Yes

Usage(=loggingDB) Yes – NR

Word Automation Yes

WE

Always On Availability Groups & SharePoint

SQL 1

FARM 1

SQL 2

FARM 2

SQL 3

ProductionToronto

DRMontréal

Asynchronous

DisasterRecovery

Synchronous

Database Support – Async Commit

Database Supported

Admin Content No

App Management Yes

BDC Yes

Config No

Content Yes

Managed Metadata Yes

PerformancePoint Yes

PowerPivot Not Tested*

Project Yes

Search Analytic Reporting No

Search Admin No

Database Supported

Search Crawl No

Search Links No

Secure Store Yes

State Service No

Subscription Settings Yes

Translation Services Yes

UPA Profile Yes

UPA Social Yes

UPA Sync No

Usage Yes – NR

Word Automation Yes

WE

Q&A

Comparison Always On and other SQL Servers HA & DR

High Availability and Disaster RecoverySQL Server Solution

Potential Data Loss

(RPO)

Potential Recovery

Time (RTO)Automatic Failover

Readable Secondaries

AlwaysOn Availability Group - synchronous-commit Zero Seconds Yes 0 – 2

AlwaysOn Availability Group - asynchronous-commit Seconds Minutes No 0 - 4

AlwaysOn Failover Cluster Instance NA Seconds-to-minutes

Yes NA

Database Mirroring - High-safety (sync + witness) Zero Seconds Yes NA

Database Mirroring - High-performance (async) Seconds Minutes No NA

Log Shipping Minutes Minutes-to-hours

No Not duringa restore

Backup, Copy, Restore Hours Hours-to-days

No Not duringa restore

top related