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

2,504 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,504
On SlideShare
0
From Embeds
0
Number of Embeds
23
Actions
Shares
0
Downloads
74
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

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

  1. 1. #comdaybe Tuning SQL Server for SharePoint: what every SharePoint consultant should know Isabelle Van Campenhoudt Serge Luca
  2. 2. 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 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 2
  3. 3. Credits • Serge Luca as SharePoint accidental DBA • Isabelle Van Campenhoudt as the $@!### SQL guru
  4. 4. 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
  5. 5. 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
  6. 6. 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
  7. 7. 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
  8. 8. 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
  9. 9. 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
  10. 10. SQL Server 2008 R2 or SQL Server 2012 for SharePoint 2013 • SQL 2012 SP1 for the BI Stack Don’t share the instance Run the service with sp-sqlsvc • No special permission Don’t install SSMS on the SQL Server machine Use Named Instances: SharePoint
  11. 11. 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
  12. 12. Max Degree of Parallelism = 1
  13. 13. Set Minimum and Maximum Server Memory
  14. 14. 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
  15. 15. 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
  16. 16. Some basic SQL Server Concepts User databases Model : template for other dbs Msdb : for automation System databases Master : similar to the SP configDB Tempdb : temporarily results The SP db
  17. 17. Some basic SQL Server Concepts Simple Recovery Model Content Database Located on Hard Drive Data Add Content .LDF Checkpoint Data Simple Recovery Model .MDF
  18. 18. Some basic SQL Server Concepts Full Recovery Model Content Database Located on Hard Drive Data Add Content .LDF Checkpoint .MDF Data Full Recovery Model (Recommended)
  19. 19. Model db : recovery model = full Contend DB = full Tempdb : recovery model = simple SharePoint DB : recovery model ? Config DB = simple Services App Dbs = its depends: •http://technet.micros oft.com/enus/library/cc678868.a spx
  20. 20. Model db settings Increase Initial Size Setting Increase Autogrowth Settings (Use MB Not %) Cannot Modify Collation on Model DB Use Full Recovery Model
  21. 21. 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
  22. 22. 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
  23. 23. 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
  24. 24. Install SharePoint Setup account (sp-install) must be: (SQL Server) Dbcreator (SQL Server) Securityadmin Local admin Domain account
  25. 25. SQL Server and SharePoint Integration Content database contains multiple site collections (2,000 Default Setting) Farm has several databases; >20 if spousal installation Site Collections only reside in one database If Site Collection > 100GB store in own content database Use SharePoint to control size of content database •Soft limit maximum size <= 200 GB • Quota Templates • Maximum Number of Site Collections
  26. 26. Planning Site Collections and Databases Need 800 Site Collections at 500MB Each Web Application 200GB 200GB 200GB 200GB 250 250 250 250 Site Collection Site Collection Site Collection Site Collection HR Sites Projects Sites Sales Sites Student Sites
  27. 27. SP Health Analyzer Job will defragment the indices Job will update statistics If fragment > 30% & rowcount > 10.000 AUTO_CREATE _STATISTICS should be set to OFF
  28. 28. Verify Integrity of databases Check REPAIR_REBUILD Option to Fix Errors (Not Always Possible) DBCC CheckDB Time Consuming Operation, Run During Non-Peak Hours For Very Large DBs consider using option MAXDOP=1 REPAIR_ALLOW_DATA_ LOSS Not Supported
  29. 29. 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
  30. 30. Tools CPU I/O (and use SQL I/O to check your SAN) Network Memory Run a trace of Performance Counters (24 hours)     Run PAL(Performance Analysis of Logs)  Provides templates of accurate counters  Analyse regarding thresholds Generate meaningfull reports Use this trace as a baseline!!!
  31. 31. Farm Dashboard
  32. 32. in-SAN-ity??
  33. 33. 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
  34. 34. SQL Server 2012 Always on & Availability Groups
  35. 35. TWO Solutions AlwaysOn Failover Cluster Instances for instance level protection AlwaysOn Availability Groups for database protection
  36. 36. AlwaysOn Availability Groups Database Active Log Synchronization Database Active Log Synchronization Windows Server Failover Cluster Availability Group uses Windows Server Failover Cluster (WSFC)   Inter-node health detection, Failover coordination,   Primary health detection, Distributed data store for settings and state, Distributed change notifications   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. 43
  37. 37. Client connection 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 Client only knows the VNN No change to the connection string Client must establish a new connection 44
  38. 38. AlwaysOn Availability Groups for SharePoint Improving Data Tier High Availability and Disaster Recovery Allows multicopy 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.
  39. 39. AlwaysOn Availability Groups for SharePoint : DEMO 46
  40. 40. Comparison of AlwaysOn with other SQL HA Greatly Improved HA and DR 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 Hours Hours -to-days No Not during a restore High Availability and Disaster Recovery SQL Server Solution Backup, Copy, Restore
  41. 41. Q&A
  42. 42. Thanks!

×