SharePoint Saturday Montreal - 2017 - SpSQL

Rendre son SharePoint 2013/2016
extrêmement rapide
en monitorant & optimisant SQL Server
SharePoint Saturday
Montreal
Serge Luca & Isabelle Van Campenhoudt
ShareQL
May 13th 2017
#SPSMontreal
SharePoint Saturday Montreal
#SPSMontreal
Bronze
Gold
Thanks to our sponsors !
SharePoint Saturday Montreal
Isabelle Van Campenhoudt
SQL Server MVP, Brussels
Consultant, speaker, trainer, PASS V-Chapter Leader
Managing partner de www.ShareQL.com
SQL Server since 1999
Blog: http://thesqlgrrrl.wordpress.com/
Isabelle Van
Campenhoud
t
Isabelle
Van Campenhoudt
[email protected]
@thesqlgrrrl
globalfrench.sqlpass.org
Serge Luca
10 x SharePoint MVP, Brussels
Consultant, speaker, trainer
Managing partner of www.ShareQL.com
SharePoint since 2001
Blog: http://sergeluca.wordpress.com/
[email protected]
Serge Luca
Serge Luca
@SergeLuca
Credits
Serge Luca
Accidental DBA
Isabelle
Van Campenhoudt
SQL guru
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
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
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
Optimize Hardware
CPU
RAM
DISK
Network
Network (dedicated
subnet for SQL)
Latency 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
• Recommended if mirroring or Always On Sync (see later)
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
• 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
High
0.5-0.75 IOPS/ GB (4
TB supported:
Read
0.25IOPS/GB , ideally:
2 IOPS/GB)
Transaction Log
High
2 IOPS/GB
Search Crawl database
10 IOPS per 1
Medium to high IOPS document per second Write
(DPS) crawl rate.
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.
Write
• IOMeter (free)
• SQLIO (free)
• …
• In production : be careful
• Test with a file > than SAN cache
• Test reading/writing , random 64k (for data)and
sequential (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
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
Use a dedicated
instance
Run the service with
a Managed account
No specific
permission
Don’t install SSMS on
the SQL Server
computer
Use named instances
\ SharePoint
Latin1_General_CI_AS_KS_WS
(for SharePoint databases)
SP uses this collation when it
creates its own db
(Any CI collation is supported for
tempDBs, master, but Latin1_xxx_
is recommended)
Cannot be changed after the setup
!!!
Max degree of
parallelism
Maxdop=1
Specify memory
limits
Backups
Compression
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
Master : similar to
the SP configDB
Model : template
for other dbs
Msdb : for
automation
Tempdb :
temporarily results
System
databases
User databases
The SharePoint databases
Content Database
instru
ctions
Add
Content
.LDF
Checkpoint
instru
ctions
Simple Recovery Model
.MDF
Data Files and Log files should be on different drives (and not the System drive)
Content Database
instru
Data
ctions
Add
Content
.LDF
Checkpoint
.MDF
instru
Data
ctions
Full Recovery Model (Recommended)
Model db : recovery
model = full
Tempdb : recovery model
= simple
SharePoint DB : recovery
model ?
Services App DBs= it
depends :
Contend DB = full
Config DB= simple
• http://technet.microsoft.com/enus/library/cc678868.aspx
Always On Availability groups: recovery = full !
(UAT & Production)
Developer Workstation /Test Farm: recovery = simple!
Increase Initial size
Increase Autogrowth
(MB , not %)
Don’t modify Model db
collation
Full Recovery Model
Configure 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 Biggest
Content DB’s Size
Tempdb Database Settings
•Increase Initial Size Setting
•Increase Autogrowth Settings (Use MB Not %)
•Use Simple Recovery Model
•Place on Different Drive Than Content Databases
Priority (Fastest to
Slowest Drive)
Use Multiple Data Files
for Content and Search
DB’s
 Tempdb Data and
Transaction Log Files
 Content DataBase
Transaction Log Files
 Search Database Data Files
 Content Database Data
Files
 Distribute Equally-Sized Data
Files Across Separate Disks
 Number of Data Files
Should Be <= Number of
Processor Cores
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
Setup account
(sp-install)
Must be:
(SQL Server)
DBcreator
(SQL Server)
Securityadmin
Local admin
Domain account
Farm has several
databases; >20 if
spousal installation
If Site Collection >
100GB store in own
content database
• Soft limit maximum
size <= 200 GB
Site Collections only
reside in one
database
Content database
contains multiple site
collections (2,000
Default Setting)
Job will defragment the
indices
Job will update statistics
If fragment >
30% &
rowcount >
10.000
AUTO_CREATE
_STATISTICS
OFF
Check REPAIR_REBUILD
Option to Fix Errors (Not REPAIR_ALLOW_DATA_
Always Possible)
LOSS Not Supported
DBCC CheckDB
For Very Large DBs
consider using option
MAXDOP=1
Time Consuming
Operation, Run During
Non-Peak Hours
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
Run a trace of
Performance
Counters (24 hours)




CPU
I/O (Iometer is a tool to check your SAN)
Network
Memory
In production (live) Or Use Visual Studio (for Web performance
Tests, simulate actions, number of users)
Use PAL (free)
(« Performance
Analysis of Logs ») or
SCOM
 Provides templates of accurate
counters
 Analyse regarding thresholds
 Generate meaningfull reports
Use this trace as a baseline!!!
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)
38
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
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
FARM 1
Synchronous
SQL 1
SQL 2
High
Availabilty
FARM 1
Synchronous
SQL 1
High
Availabilty
SQL 2
Database
Supported
Database
Supported
Admin Content
Yes
Search Crawl
Yes
App Management
Yes
Search Links
Yes
BDC
Yes
Secure Store
Yes
Config
Yes
State Service
Yes
Content
Yes
Subscription Settings
Yes
Managed Metadata
Yes
Translation Services
Yes
PerformancePoint
Yes
UPA Profile
Yes
PowerPivot
Not Tested
UPA Social
Yes
Project
Yes
UPA Sync
Yes
Search Analytic Reporting
Yes
Usage(=loggingDB)
Yes – NR
Search Admin
Yes
Word Automation
Yes
FARM 1
Synchronous
SQL 1
FARM 2
Asynchronous
SQL 2
SQL 3
Disaster
Recovery
Database
Supported
Database
Supported
Admin Content
No
Search Crawl
No
App Management
Yes
Search Links
No
BDC
Yes
Secure Store
Yes
Config
No
State Service
No
Content
Yes
Subscription Settings
Yes
Managed Metadata
Yes
Translation Services
Yes
PerformancePoint
Yes
UPA Profile
Yes
PowerPivot
Not Tested*
UPA Social
Yes
Project
Yes
UPA Sync
No
Search Analytic Reporting
No
Usage
Yes – NR
Search Admin
No
Word Automation
Yes
5h00 PM
3971 Ontario E
#SPSMontreal
SharePoint Saturday Montreal
Merci !
@thesqlgrrrl
@sergeluca