44
#comdaybe Tuning SQL Server for SharePoint: what every SharePoint consultant should know Isabelle Van Campenhoudt Serge Luca

Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

#comdaybe

Tuning SQL Server for SharePoint:

what every SharePoint consultant

should know

Isabelle Van Campenhoudt

Serge Luca

Page 2: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Us.About()Serge Luca

• SharePoint MVP & MCT

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

• Author SharePoint Pro Magazine

• Works with SharePoint since 2001

• Co-author of a book on SharePoint 2013

• Working on a book on Workflows in SharePoint 2013

2

Isabelle Van Campenhoudt

SQL MVP & MCT

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

Works with SQL Server since 2000

Co-author of a book on SharePoint 2013

Page 3: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Credits

• Serge Luca as SharePoint accidental

DBA

• Isabelle Van Campenhoudt as the

$@!### SQL guru

Page 4: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Agenda

Basic SharePoint DB Concepts

Operating System settings

Installing SQL Server

Database settings

SharePoint and SQL Server Integration concepts

Tuning SQL Server

HA and DR : SQL 2012 Always On Availability Groups & SharePoint 2013

Page 5: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Agenda

Basic SharePoint DB Concepts

Operating System settings

Installing SQL Server

Database settings

SharePoint and SQL Server Integration concepts

Tuning SQL Server

HA and DR : SQL 2012 Always On Availability Groups & SharePoint 2013

Page 6: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Basic SharePoint Concepts

95% 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 content db

All Web Apps have at least one content

db

Farm has several databases; >20 if

spousal installation

Page 7: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Agenda

Basic SharePoint DB Concepts

Operating System settings

Installing SQL Server

Database settings

SharePoint and SQL Server Integration concepts

Tuning SQL Server

HA and DR : SQL 2012 Always On Availability Groups & SharePoint 2013

Page 8: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

NTFS Allocation Unit Size

64K is optimal, 4K = 30% Performance

Penalty

Use chkdsk <drive>Verify

Use Format to Configure:

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

Page 9: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Agenda

Basic SharePoint DB Concepts

Operating System settings

Installing SQL Server

Database settings

SharePoint and SQL Server Integration concepts

Tuning SQL Server

HA and DR : SQL 2012 Always On Availability Groups & SharePoint 2013

Page 10: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

SQL Server 2008 R2 or SQL Server 2012 for SharePoint 2013

•SQL 2012 SP1 for the BI Stack

Don’t install SSMS on the SQL Server machine

Use Named Instances: \SharePoint

Don’t share the instance

Run the service with sp-sqlsvc

•No special permission

Page 11: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Set default collation settings to

Latin1_General_CI_AS_KS_WS (for SP db)

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

SP uses this collation when it creates its own db

Cannot be changed after the setup

Page 12: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Max Degree of Parallelism = 1

Page 13: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Set Minimum and Maximum Server Memory

Page 14: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Use alias for the connection string

• Client alias or DNS alias (preferred)

• Or (see later) Always On Availability Group Listener

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

Page 15: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Agenda

Basic SharePoint DB Concepts

Operating System settings

Installing SQL Server

Database settings

SharePoint and SQL Server Integration concepts

Tuning SQL Server

HA and DR : SQL 2012 Always On Availability Groups & SharePoint 2013

Page 16: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

System databases

Master : similarto the SP configDB

Model : template for

other dbs

Tempdb : temporarily

results

Msdb : for automation

User databases The SP db

Some basic SQL Server Concepts

Page 17: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Some basic SQL Server Concepts

Simple Recovery Model

.MDF.LDFAdd

Content

Content Database Located on Hard Drive

Checkpoint

Data

Data

Simple Recovery Model

Page 18: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Full Recovery Model

.LDF

Data

Data

.MDFAdd

Content

Content Database Located on Hard Drive

Checkpoint

Data

Data

Full Recovery Model (Recommended)

Some basic SQL Server Concepts

Page 19: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Model db : recovery model = full

Tempdb : recoverymodel = simple

SharePoint DB : recovery model ?

Contend DB = full Config DB = simple

Services App Dbs = itsdepends:

•http://technet.microsoft.com/en-us/library/cc678868.aspx

Page 20: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Model db settings

Increase Initial Size Setting

Increase Autogrowth Settings (Use MB Not %)

Cannot Modify Collation on Model DB

Use Full Recovery Model

Page 21: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Tempdb settings

Configure Tempdb Data Files

•#files = #cores

• (on sql server 2012 Max 8 if #cores > 8)

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

Page 22: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

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

Page 23: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Agenda

Basic SharePoint DB Concepts

Operating System settings

Installing SQL Server

Database settings

SharePoint and SQL Server Integration concepts

Tuning SQL Server

HA and DR : SQL 2012 Always On Availability Groups & SharePoint 2013

Page 24: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Install SharePoint

Setup account(sp-install)

must be:(SQL Server) Dbcreator

(SQL Server) Securityadmin

Local adminDomain account

Page 25: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

SQL Server and SharePoint Integration

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

Use SharePoint to control size of content database

•Quota Templates

•Maximum Number of Site Collections

Page 26: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Planning Site Collections and Databases

250 250 250 250

Site Collection Site Collection Site Collection

200GB 200GB 200GB 200GB

HR

SitesProjects

Sites

Sales

Sites

Student

Sites

Web Application

Site Collection

Need 800 Site Collections at 500MB Each

Page 27: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

SP Health Analyzer

Job will defragment the indices

If fragment > 30% &

rowcount > 10.000

Job will update statistics

AUTO_CREATE_STATISTICS

should be set to OFF

Page 28: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

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

Page 29: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Agenda

Basic SharePoint DB Concepts

Operating System settings

Installing SQL Server

Database settings

SharePoint and SQL Server Integration concepts

Tuning SQL Server

HA and DR : SQL 2012 Always On Availability Groups & SharePoint 2013

Page 30: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Tools

CPU

I/O (and use SQL I/O to check your SAN)

Network

Memory

Run a trace of Performance Counters (24 hours)

Provides templates of accuratecounters

Analyse regarding thresholds

Generate meaningfull reports

RunPAL(PerformanceAnalysis of Logs)

Use this trace as a baseline!!!

Page 31: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Farm Dashboard

Page 32: Tuning Sql Server for SharePoint--- Community Day Belgium 2013
Page 33: Tuning Sql Server for SharePoint--- Community Day Belgium 2013
Page 34: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

in-SAN-ity??

Page 35: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Agenda

Basic SharePoint DB Concepts

Operating System settings

Installing SQL Server

Database settings

SharePoint and SQL Server Integration concepts

Tuning SQL Server

HA and DR : SQL 2012 Always On Availability Groups & SharePoint 2013

Page 36: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

SQL Server 2012 Always on

& Availability Groups

Page 37: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

TWO Solutions

AlwaysOn Availability Groups

for database protection

AlwaysOn Failover Cluster Instances

for instance level protection

Page 38: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

AlwaysOn Availability Groups

43

Inter-node health detection,

Failover coordination,

Primary health detection,

Distributed data store for settings and

state,

Distributed change notifications

Windows Server Failover Cluster

Database

Active Log Synchronization DatabaseActive Log Synchronization

Availability Group uses Windows Server Failover Cluster (WSFC)

Automatic failover clustering requires servers to have the proper number of votes to ‘turn on’ a database copy.

There must always be a majority of votes to enable the node.

If a majority cannot be reached (for example, if there are only an even number

of votes) the DBs will remain offline.

Page 39: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Client connection

44

Client must establish a new connection

Client only knows the VNN No change to the connection string

Group Listener expose a unique Virtual Network Name (VNN)

The listener port (listens for incoming requests against the listener name)

One or more Virtual IPs (VIPs) that are configured for one or more subnets to which the availability group can failover

Configured to use either DHCP or a static IP

Page 40: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

AlwaysOn Availability Groups for

SharePointImproving Data Tier High Availability and Disaster Recovery

Allows multi-copy database server failover on multiple replicas at the same time

SharePoint no longer needs to be ‘aware’ of the mirrored copy

SharePoint 2010 Service Pack 1 supports SQL 2012 fully

CAVEAT: Be sure to understand that synchronous mirroring copies need to be in close proximity and have very good bandwidth, as data needs to be written into all replicas before the transaction is committed. SharePoint will lock up if there are any interruptions at the data tier.

Page 41: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

46

AlwaysOn Availability Groups for

SharePoint : DEMO

Page 42: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

High Availability and Disaster Recovery

SQL 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 during

a restore

Backup, Copy, Restore Hours Hours

-to-days

No Not during

a restore

Comparison of AlwaysOn with other SQL

HA Greatly Improved HA and DR

Page 43: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Q&A

Page 44: Tuning Sql Server for SharePoint--- Community Day Belgium 2013

Thanks!