Upload
isabelle-van-campenhoudt
View
1.896
Download
1
Embed Size (px)
DESCRIPTION
Citation preview
#comdaybe
Tuning SQL Server for SharePoint:
what every SharePoint consultant
should know
Isabelle Van Campenhoudt
Serge Luca
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
Credits
• Serge Luca as SharePoint accidental
DBA
• Isabelle Van Campenhoudt as the
$@!### SQL guru
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
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
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
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
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
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
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
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
Max Degree of Parallelism = 1
Set Minimum and Maximum Server Memory
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
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
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
Some basic SQL Server Concepts
Simple Recovery Model
.MDF.LDFAdd
Content
Content Database Located on Hard Drive
Checkpoint
Data
Data
Simple Recovery Model
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
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
Model db settings
Increase Initial Size Setting
Increase Autogrowth Settings (Use MB Not %)
Cannot Modify Collation on Model DB
Use Full Recovery Model
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
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
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
Install SharePoint
Setup account(sp-install)
must be:(SQL Server) Dbcreator
(SQL Server) Securityadmin
Local adminDomain account
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
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
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
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
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
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!!!
Farm Dashboard
in-SAN-ity??
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
SQL Server 2012 Always on
& Availability Groups
TWO Solutions
AlwaysOn Availability Groups
for database protection
AlwaysOn Failover Cluster Instances
for instance level protection
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.
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
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.
46
AlwaysOn Availability Groups for
SharePoint : DEMO
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
Q&A
Thanks!