SQL Server Maintenance für SharePoint


Was immer mal wieder gefragt wird ist, was man denn genau für SharePoint Datenbanken für Maintenance Tasks machen muss und welche Operationen auf SharePoint Datenbanken erlaubt sind und welche nicht.

Ich habe im Folgenden mal alles, was eigentlich auch im Technet bekannt aber verstreut oder unübersichtlich ist, zusammengefasst. Zusätzlich gibt es einen SQL Best Practice Skript, der die benötigten Aktionen automaisch erstellt. Viel Spass beim lesen

So long, Samuel

Inhalt

1       Database Maintenance Plan for SharePoint. 2

1.1        Databases in SharePoint 2013. 2

1.2        Database Maintenance. 4

1.3        Supported and Unsupported Chagnes on SharePoint DBs. 5

1.3.1         Unsupported Database Changes. 5

1.3.2         Supported database modifications. 6

1.3.3         Read operations addendum.. 7

2       SQL Maintenance Script7

 

 

 

 

1         Database Maintenance Plan for SharePoint

1.1         Databases in SharePoint 2013

Source: http://technet.microsoft.com/en-us/library/cc678868(v=office.15).aspx

Database Recommended Recovery Model Backup Method Size Characteristics Notes
Config Simple SP BackkupSQL Backup Small Read intensisve
  • Must be Co-Located with CA DB
  • Recovery Model must be full for Mirroring
  • Scale up, only one DB per Farm
Central Administration Content Full SP BackupSQL Backup Small Varies
  • Must be Co-Located with Config DB
  • Can grow over the period of 365 days if Power Pivot is used
  • Scale up, only one DB per Farm
Content Databases Full SP BackupSQL Backup Small to Big Varies by Usage
  • Limit Size to 200GB per Content DB
  • Scale out, Scale up (a Site Collection can sit in only 1 DB)
App Management Full SP BackupSQL Backup Small Write heavy
  • Only write heavy during App installation
  • Scale up, Scale out only on Office 365
Business data Connectivity Full SP BackupSQL Backup Small Read heavy
  • Scale up, only one DB per Farm
Search – Admin Simple SP BackupSQL Backup Medium Read Write
  • Scale up, Scale out only by creating additional Service Applications
Search – Analytics Simple SP BackupSQL Backup Medium to Large Write heavy
  • Nightly Analytics update
  • Scale out by Split Operation when DB becomes > 200GB
Search – Crawl Simple SP BackupSQL Backup Medium Read heavy
  • Scale out by creating new DBs for every 20mio Items crawled
Search – Link Simple SP BackupSQL Backup Medium to Large Write heavy
  • Affected by Content processing
  • Scale out by creating new DBs for 60mio Items crawled and for expected 100mio querys per year
Secure Store Full SP BackupSQL Backup Small Equal Read Write
  • Scale up, Scale out by creating new Service Applications
Usage Simple SQL Backup XLarge Write heavy
  • Scale up, only one DB per Farm
Subscription Settings Full SP BackupSQL Backup Small Read heavy
  • Scale up, Scale out by creating new Service Applications
User Profile – Profile Simple SP BackkupSQL Backup Medium to Large Read heavy
  • Scale up, Scale out by creating new Service Applications
User Profile – Sync Simple SP BackupSQL Backup Medium to Large Equal Read Write
  • Scale up, Scale out by creating new Service Applications
User Profile – Social Simple SP BackupSQL Backup Small to XLarge Read heavy
  • Scale up, Scale out by creating new Service Applications
Word Automation Full SP BackupSQL Backup Small Read heavy
  • Scale up, Scale out by creating new Service Applications
  • Traffic is Affected by Word Conversions only
Managed Metadata Full SP BackupSQL Backup Medium Read heavy
  • Scale up, Scale out by creating new Service Applications
Machine Translation Full SP BackupSQL Backup Small Read heavy
  • Scale up, Scale out by creating new Service Applications
Project Server Full SP BackupSQL Backup Small to Medium Read heavy
  • Scale up
  • One Database per Project WebApp
PowerPivot Full SP BackupSQL Backup Small Read heavy
  • Scale up
Performance Point Full SP BackupSQL Backup Small Read heavy
  • Scale up, Scale out by creating new Service Applications
State Service Full SP BackupSQL Backup Medium to Large Read heavy
  • Scale out by creating additional Databases
Master Simple SQL Backup Small Varies
Model Full SQL Backup Small Varies
Msdb Simple SQL Backup Small Varies
Tempdb Simple SQL Backup Medium Varies
  • Locate on fast Disks and split Database to several Datafiles
Report Server – Catalog Full SQL Backup Small Read heavy
  • Scale Up
Report Server – Temp Full SQL Backup Small to XLarge Read heavy
  • Scale Up
Report server – Alerting Full SQL Backup Small to XLarge Equal Read Write heavy
  • Scale Up
  • Must be on same Server as the Repprt Server – Catalog

1.2         Database Maintenance

Source: http://technet.microsoft.com/en-us/library/cc262731(v=office.14).aspx

These advices were published for SharePoint 2010 but mainly still apply for SharePoint 2013. Only the Timer Jobs might have changed that do automatic Index Maintenance. For all Databases that are used for SharePoint 2013 Content do regularly Database Maintenance.

Action Databases Frequency Notes
DBCC CHECKDB All SharePoint DBs Weekly of before each Full Backup
  • You cannot run DBCC CHECKDB WITH REPAIR_ALLOW_DATA_LOSS.
  • You can run DBCC_CHECKDB WITH REPAIR_FAST and REPAIR_REBUILD
Index Rebuilding All SharePoint DBs Depends on:-          If Database has a Timer Job

–          Fragmentation Level

 

Fragmentation methods

 

Fragmentation level Defragmenta-tion method
Up to 10% Reorganize (online)
10-75% Rebuild (online)
75% Rebuild (offline)
  • Online Index Rebuild only for SQL Enterprise
  • Fallback from Online to Offline Index Rebuild might occur on special occasions (e.g. for LOB Columns)
  • Many of the SP Indexes are rebuilt Offline because of LOB Content (like documents, Pictures etc.)
  • Offline and Online Index Rebuild result in Locks or inaccessibility of Indexes and should therefore be done in low activity times
  • Use “sys.dm_db_index_physical_stats” to measure Fragmentation. Values from 0 to 10 in Column “avg_fragmentation_in_percent” are acceptable
  • SharePoint Timer Jobs (Health Rules) are doing a part of Index defragmentation and Stats updates
  • Timer Jobs look for its associated databases and performs proc_DefragmentIndices stored procedure on int. Indexes with Fragmentation > 30% are considered for reindex
  • Not all Databases have Timer Jobs and should be monitored manually
  • Using DROP INDEX or CREATE INDEX Operations are NOT supported on SharePoint Databases
AutoShrink All SharePoint DBs Never
  • Better Solution is to create a new database, move the Site Collections and delete the old database
  • Only if there is definitely a very high amount of unused space and you do not plan to reuse it and only for Content Databases
  • EMPTYFILE Option is not supported
  • TRUNCATEONLY Option is not supported
Maintenance Cleanup All SharePoint DBs Weekly or with scheduled maintenance plans

 

1.3         Supported and Unsupported Chagnes on SharePoint DBs

The Microsoft Office server products store data in Microsoft SQL Server databases. These products use various stored procedures for regular processing. Therefore, the Microsoft SQL Server databases are important to the successful operation of these products.

SharePoint Products were tested by using a database structure as designed by the SharePoint Development Team and were approved for release based on that structure. Microsoft cannot reliably predict the effect to the operation of these products when parties other than the Microsoft SharePoint Development Team or Microsoft SharePoint Support agents make changes to the database schema, modify its data, or execute ad hoc queries against the SharePoint databases. Exceptions are described in the „Supported Database Modifications“ section.

1.3.1        Unsupported Database Changes

Examples of unsupported database changes include, but are not limited to, the following:

  • Adding database triggers
  • Adding new indexes or changing existing indexes within tables
  • Adding, changing, or deleting any primary or foreign key relationships
  • Changing or deleting existing stored procedures
  • Calling existing stored procedures directly, except as described in the SharePoint Protocols documentation
  • Adding new stored procedures
  • Adding, changing, or deleting any data in any table of any of the databases for SharePoint
  • Adding, changing, or deleting any columns in any table of any of the databases for SharePoint
  • Making any modification to the database schema
  • Adding tables to any of the databases for SharePoint
  • Changing the database collation
  • Running DBCC_CHECKDB WITH REPAIR_ALLOW_DATA_LOSS (However, running DBCC_CHECKDB WITH REPAIR_FAST and REPAIR_REBUILD is supported, as these commands only update the indexes of the associated database.)
  • Enabling SQL Server change data capture (CDC)
  • Enabling SQL Server transactional replication
  • Enabling SQL Server merge replication

If an unsupported database modification is discovered during a support call, the customer must perform one of the following procedures at a minimum:

  • Perform a database restoration from the last known good backup that did not include the database modifications
  • Roll back all the database modifications

 

If a previous version of the database that does not include the unsupported modifications is unavailable, or if the customer cannot roll back the database modifications, the customer must recover the data manually. The database must be restored to an unmodified state before Microsoft SharePoint Support can provide any data migration assistance.

If it is determined that a database change is necessary, a support case should be opened to determine whether a product defect exists and should be addressed.

1.3.2        Supported database modifications

Exceptions to the prohibition against database modifications are made for specific usage scenarios:

  • Operations that are initiated from the SharePoint administrative user interface
  • SharePoint specific tools and utilities that are provided directly by Microsoft (for example, Ststadm.exe)
  • Changes that are made programmatically through the SharePoint Object Model and that are in compliance with the SharePoint SDK documentation
  • Activities that are in compliance with the SharePoint Protocols documentation

Additionally, in rare circumstances during a support incident, Microsoft SharePoint Support agents may give customers scripts that modify the databases that are used by SharePoint. In these cases, all modifications are reviewed by the SharePoint Development Team to ensure that the operations being performed will not result in an unstable or unsupported database state. Database changes that are made with the guidance of a Microsoft SharePoint Support agent during the course of a support incident will not result in an unsupported database state. Customers may not reapply the scripts or changes provided by Microsoft SharePoint Support outside of a support incident.

1.3.3        Read operations addendum

Reading from the SharePoint databases programmatically, or manually, can cause unexpected locking within Microsoft SQL Server which can adversely affect performance. Any read operations against the SharePoint databases that originate from queries, scripts, .dll files (and so on) that are not provided by the Microsoft SharePoint Development Team or by Microsoft SharePoint Support will be considered unsupported if they are identified as a barrier to the resolution of a Microsoft support engagement.

If unsupported read operations are identified as a barrier to the resolution of support engagement, the database will be considered to be in an unsupported state. To return the database to a supported state, all unsupported read activities must stop.

2         SQL Maintenance Script

Source: http://ola.hallengren.com/scripts/MaintenanceSolution.sql

The SQL Server Maintenance Solution comprises scripts for running backups, integrity checks, and index and statistics maintenance on all editions of Microsoft SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, and SQL Server 2014. The solution is based on stored procedures, the sqlcmd utility, and SQL Server Agent jobs. I designed the solution for the most mission-critical environments, and it is used in many organizations around the world. Numerous SQL Server community experts recommend the SQL Server Maintenance Solution, which has been a Gold winner in the 2013, 2012, 2011, and 2010 SQL Server Magazine Awards. The SQL Server Maintenance Solution is free.

 

Collaboration beginnt im Kopf – nicht bei der Technik


Schon vor einiger Zeit habe ich mal in einer schlaflosen Nacht eine Präsentation über die Voraussetzungen von Kollaboration erstellt. Es geht dabei darum, dass Kollaboration nicht mit Technik beginnt, sondern in den Köpfen der Menschen. In der Art und Weise wie wir miteinander umgehen.

Wie sollen die Mitarbeiter zusammenarbeiten, einander helfen, sich gegenseitig unterstützen, wenn wir doch in einem System der Selbstbezogenheit, der Gewinnmaximierung und ROI Wahnsinn leben? Wenn es fast nur noch darum geht, was für mich drin ist? Wir es gewohnt sind, dass man uns alles zuträgt? Sit back and kick the TV on…

In dieser Präsentation habe ich mir über diese Themen Gedanken gemacht. Was müssen wir in unserer Zusammenarbeitskultur tun, damit wir auch mit den uns zur Verfügung stehenden Systemen zusammenarbeiten? Natürlich gebe ich die Präsentation auch mal gerne in euren Teammeetings oder auf Tagungen.

So Long, Samuel

 

SQL Script für die Erstellung von Best Practice SharePoint Datenbanken


Na dass wird aber auch Zeit. Endlich poste ich auch hier zur Vollständigkeit den Post, welchen ich im SharePointAdvent gepostet habe. Er ist die Fortsetzung vom Post Best Practice SQL Setup.

Wie in meinem letzten Post erläutert, macht es durchaus Sinn, sich im Bereich SharePoint auch über das Backend Gedanken zu machen. Ein Teil davon ist die Erstellung der Datenbanken. Eigentlich sollte es den Button "Add new Content Database" in SharePoint gar nicht geben.

addcontentdb1

Warum? Hier sind die Gründe:

SharePoint erstellt eine neue Datenbank ab der Model und diese ist von Natur aus so konfiguriert:

  • 2MB gross (oder besser gesagt klein)
  • Ein einzelnes File in der Primary Filegroup
  • Growth ist auf 1 MB Unlimited Growth
  • Logfile ist 1MB gross
  • Growth ist 10%

model

Nach dem Erstellen einer leeren SharePoint Datenbank ist diese 2o MB gross, das heisst, sie ist bereits 18x gewachsen. Durch das Wachstum einer DB wird sie fragmentiert und wie man weiss, ist alles was fragmentiert ist langsamer, da die Datenstücke nicht aneinander hängen, sondern verteilt sind. Diese Verteilung muss vom DB Management System aufgefangen werden. Dieser Reibungsverlust schlägt sich in der Performance nieder.

DiskSpaceGrowth

Wenn ich nun die DB Stats abfrage, bekomme ich den Fragmentierungslevel der neuen Datenbank mitgeteilt, ACHTUNG: Es handelt sich notabene um eine leere SharePoint Datenbank, die noch überhaupt keinen Content enthält. SELECT * FROM sys.dm_db_index_physical_stats (DB_ID(‚DB Name‘), Null, Null, Null, Null);

DBStats

Ich erhalte hier 230 Rows, jede Row enthält den Hinweis auf einen Index. Meine Datenbank ist also schon sehr stark fragmentiert, obwohl sie leer ist. Da kann man sich vorstellen, dass dies an der Performance nagt.

Ein weiterer Punkt ist, dass allea auf einem Datenfile abgeht. Heute haben Prozessoren mehrere Kerne, und jeder hackt auf dem armen File rum. Viel besser ist es, wenn jeder Kern sich auf ein anderes File konzentrieren kann. Wenn eine DB in mehrere Files unterteilt ist, so wird abwechselnd auf die Files eingedroschen, was sich wiederum positiv auf die Performance auswirkt. Die Fausregel sagt, dass pro Prozessorkern 0.25 bis 0.5 Files angelegt werden sollten, mindestens aber 4. Bei mehr als 8 Files ist dann kein grosser Unterschied mehr spürbar. Beachten Sie folgendes:

  • Berechnen Sie vorab, wie viel Content später mal in die DB rein soll
  • Erstellen Sie die initiale DB Grösse entsprechend ein (wir sprechen von GB nicht von BYTES)
  • Stellen Sie das Wachstum auf eine vernünftige Grösse ein
  • Stellen Sie das LOG auch auf 1GB oder teilbar durch 8GB

Hier kommt der Script vorher noch im SQL Mgmt Studio unter "Query" den "SQL CMD Mode" aktivieren, alles was rot ist muss von euch noch customized werden (auch der User ganz am Ende, da kommt der Farm Admin rein:

/*—————————————————————————————
  Disclaimer – Thoroughly test this script, execute at your own risk.
  —————————————————————————————
 
  set variables (Filesizes in MB)*/
:setvar DBName MyAdventDB
:setvar LoginitialMB 1024
:setvar LoggrowMB 1024
:setvar DatainitialMBperFile 341
:setvar DatagrowMBperFile 341
:setvar DataPath “C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA”
:setvar LogPath “C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA”
 
CREATE DATABASE [$(DBName)] ON  PRIMARY
/*no grow on Primary-File (its only for sys tables and Service Broker Queues)*/
( NAME = N’$(DBName)Data01′, FILENAME = N’$(DataPath)\$(DBName)Data01.mdf‘ , SIZE = 128MB , FILEGROWTH = 0),
/* 0.25-1 file per cpu core (each with same initial and grow size)*/
( NAME = N’$(DBName)_Data02′, FILENAME = N’$(DataPath)\$(DBName)_Data02.ndf‘ , SIZE = $(DatainitialMBperFile)MB , FILEGROWTH = $(DatagrowMBperFile)MB ),
( NAME = N’$(DBName)_Data03′, FILENAME = N’$(DataPath)\$(DBName)_Data03.ndf‘ , SIZE = $(DatainitialMBperFile)MB , FILEGROWTH = $(DatagrowMBperFile)MB ),
( NAME = N’$(DBName)_Data04′, FILENAME = N’$(DataPath)\$(DBName)_Data04.ndf‘ , SIZE = $(DatainitialMBperFile)MB , FILEGROWTH = $(DatagrowMBperFile)MB ),
( NAME = N’$(DBName)_Data05′, FILENAME = N’$(DataPath)\$(DBName)_Data05.ndf‘ , SIZE = $(DatainitialMBperFile)MB , FILEGROWTH = $(DatagrowMBperFile)MB )
LOG ON
/* place tlog on another diskarray, use best practice size for optimal vlf handling (1GB/8GB)*/
( NAME = N’$(DBName)_log‘, FILENAME = N’$(LogPath)\$(DBName)_log.ldf‘ , SIZE = $(LoginitialMB)MB , FILEGROWTH = $(LoggrowMB)MB )
/* collation for database */
COLLATE Latin1_General_CI_AS_KS_WS
GO
/* 90=2005/100=2008*/
ALTER DATABASE [$(DBName)] SET COMPATIBILITY_LEVEL = 100
GO
ALTER DATABASE [$(DBName)] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [$(DBName)] SET ANSI_NULLS OFF
GO
/* set ANSI_PADDING True, refer to BOL for more information, not default setting*/
ALTER DATABASE [$(DBName)] SET ANSI_PADDING ON
GO
ALTER DATABASE [$(DBName)] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [$(DBName)] SET ARITHABORT OFF
GO
ALTER DATABASE [$(DBName)] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [$(DBName)] SET AUTO_CREATE_STATISTICS ON
GO
/* never use AUTO_SHRINK on a production DB*/
ALTER DATABASE [$(DBName)] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [$(DBName)] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [$(DBName)] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [$(DBName)] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [$(DBName)] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [$(DBName)] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [$(DBName)] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [$(DBName)] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [$(DBName)] SET  DISABLE_BROKER
GO
ALTER DATABASE [$(DBName)] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [$(DBName)] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [$(DBName)] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [$(DBName)] SET  READ_WRITE
GO
/* use same recovery model for each db in an instance (exceptions in olap environments)*/
ALTER DATABASE [$(DBName)] SET RECOVERY FULL
GO
ALTER DATABASE [$(DBName)] SET  MULTI_USER
GO
/* change all dbs to checksum since 2005*/
ALTER DATABASE [$(DBName)] SET PAGE_VERIFY CHECKSUM
GO
 
/* change db owner*/
USE [$(DBName)]
GO
EXEC dbo.sp_changedbowner @loginame = N’domain\user‘, @map = false
GO

 

Am Ende noch mit Powershell an SharePoint anhängen und gut ist.

New-SPContentDatabase -Name <ContentDbName> -WebApplication <WebApplicationName>

So long, Samuel

Best Practice SQL Setup in einer SharePoint Umgebung


Diesen Post habe ich heute auf www.sharepointadvent.de gepostet, ein Gemeinschaftsprojekt der deutschsprachigen MVPs. Ich will ihn euch nicht vorenthalten Zwinkerndes Smiley

Sehr oft wird SharePoint eingesetzt, ohne dass durchwegs bekannt wäre, welche Komponenten alle berücksichtigt werden müssen. Mit dem Begriff “SharePoint” wird dann vor Allem eine Office ähnliche Software gemeint, mit welcher man zusammenarbeiten kann.

Nicht weniger oft wird dann SharePoint mit weiter, weiter, Fertigstellen installiert, und damit hat sich’s dann. Best Practices werden zwar im Bereich AD, Windows Server usw. bereits vielerorts angewandt, aber SharePoint ist oft ein Buch mit sieben Siegeln. Auch dafür gibt es ganz viele Grundlagen, die man berücksichtigen muss. Auf eine dieser Grundlagen will ich heute eingehen.

Es gibt eine ganz einfache Grundregel im Bereich Performance und die heisst SQL Server langsam = SharePoint langsam. SharePoint ist eine Webapplikation und von dieser erwartet der Enduser eine Klick and Run Experience. Wenn er diese nicht erhält, dann wird sofort auf SharePoint geschimpft, obwohl das Problem in den meisten Fällen an einem anderen Ort liegt. Ein Frontend kann 15 bis 20’000 User bedienen mit einer 10% Concurrency. Heisst, alle Kleinen und mittleren Unternehmen könnten mit einem starken Frontend auskommen. Das zweite Frontend wird meist nur für die Ausfallsicherheit eingesetzt.

Wo liegt also oft das Problem? Primär an zwei Orten:

  1. Dem SQL Server
  2. Dem Disksubsystem

Es gibt Regeln, wie ein SQL Server aufgesetzt werden sollte, um die Performance zu erhöhen. Auch gibt es Regeln, wie ein Disksubsystem sein sollte, wenn man SharePoint Datenbanken darauf hosten will.

Der SQL Server

Hier ein paar Grundregeln, wie der SQL Server konfiguriert werden muss:

Beginnen wir einmal bei der Aufteilung der Datenbanken. Wir unterscheiden High und Low Traffic Datenbanken, verschiedene Zugriffsmuster und die Logfiles.

Die Suchdatenbank ist grundsätzlich die User DB mit dem grössten Traffic Read und Write. In grösseren Umgebungen macht es sinn, diese komplett in eine eigene Instanz auszulagern, um die restliche SharePoint Installation nicht zu gefährden. In kleinen bis mittleren Farmen kann diese auch in die normale SharePoint Instanz integriert sein. Grundsätzlich sollte aber in einer SharePoint Instanz nichts anderes laufen als SharePoint.

Stellen Sie sicher, dass Transaction Log, User DBs und die Temp DB auf eigenen LUNs in ihrem SAN liegen, d diese ein komplett unterschiedliches Zugriffsmuster haben. T-Log ist Sequential Write, User DBs sind verschieden: Content DBs sind Moderate Read und die Search ist Heavy Read/Write. Die Temp DB ist die schlimmste und ist Heavy Read/Write. Wenn nicht zumindest die Aufteilung wie oben erwähnt gemacht wird, werden sich die verschiedenen Daten gegenseitig ausbremsen.

Kommen wir zu den Einstellungen auf dem SQL Server:

Multiple Datafiles

Stellen Sie sicher, dass alle Datenbanken auf mehrere Datenfiles aufgeteilt sind. Dies erhöht die Performance erheblich. Erstellen Sie die DBs per Script und nicht per “Create New Content DB” Button. Details dazu in meinem nächsten Post später im Advent.

Fill Factor auf 70% setzen

Diese Einstellung stellt sicher, dass Ihr Index weniger schnell fragmentiert. Wenn neue Datensätze eingefügt werden müssen, so werden diese in die leeren 30% eingefügt. Normalerweise ist der Fillfactor auf 100% und somit fragmentiert der Index beim ersten Insert. Jede Fragmentierung verlangsamt den SQL Server

T-Log Backup alle 15min bis max. 24h

Dies ist weniger ein Performance Issuer als ein Platzfresser. SharePoint Datenbanken sind per Standard auf Fullrecovery Mode eingestellt. Wenn Sie keine Log Backups machen, wird Ihnen das Logfile unter Umständen immer weiter wachsen. Ein Logbackup stellt sicher, dass alles in die DB geschrieben wurde und gibt das Log frei zum überschreiben. Zudem haben Sie eine zusätzliche Sicherheit zu Ihren Backups im Desasterfall.

Disable Boost SQL Server Priority

Diese Einstellung verleitet oft zum einschalten, ist aber im SharePoint Umfeld aufgrund der speziellen Konstellation von SharePoint eher hinderlich.

Max Degree of Parallelism 1 (für SharePoint only Instanzen)

Hier wird geregelt, wie viele Threads gleichzeitig für eine Query auf die Prozessoren verteilt werdne. Normalerweise ist die Einstellung auf 0, und der SQL entscheidet. Für SharePoint ist es besser, wenn eine Query immer nur auf eine Thread läuft, dies hat sich in Tests gezeigt.

Min und Max Memory konfigurieren

Stellen Sie sicher, dass der SQL Server genügend Memory bekommt, dass das Betriebssystem aber nicht zu leiden beginnt. Faustregel ist Memory Installed – 3GB = Max Memory. Wenn man die automatische Einstellung lässt, nimmt sich SQL was er bekommt. Wenn das Betriebssystem anfängt zu schreien, gibt er nach und nach frei, doch dann ist es meist bereits zu spät.

Temp DB auf 10GB und 4 Files verteilen, Autogrowth 1GB

Die Temp DB ist die meist belastete DB bei SharePoint, da jede Liste die in irgendeiner Art gruppiert oder sortiert ist, zuerst durch die Temp DB läuft. Machen Sie diese genug gross und verteilen Sie die DB auf mehrere Datenfiles. So wird die DB beim Start immer 10GB sein und wird somit durch die Wachserei und dadurch die Fragmentierung nicht langsam.

Lock Pages in Memory (für SQL Std. –T845) und Perform Volume Maintennance Tasks für SQL Account setzen

Lock Pages in Memory erlaubt dem SQL Server direkt Memory zu allozieren. Perform Volume Maintennance Tasks gibt SQL das Recht, beim Erstellen der DB Start und Endpunkt auf der Disk zu setzen, die Erstellung wird dadurch erheblich schneller. wird der Diskspeicher mit lauter Nullen aufgefüllt.

Traceflag 1117 (-T1117) für gleichmässigen Filegrowth

Dies ist ein Undocumented Flag und wird in den Startup Parametern der SQL Instanz gesetzt. Es garantiert den gleichzeitigen Growth mehrerer Datenfiles. Warum man mehrere Datenfiles machen sollte und wie, dazu später im Adventsblog. Wird dieses Flag nicht gesetzt, so füllt SQL alle Files gleichzeitig, wenn alle voll sind wächst File 1 und wird zuerst wieder gefüllt dann wächst File 2 etc… Das ist gerade nicht der Effekt, den man sich von mehreren Datenfiles erhofft.

Backupcompression einschalten

Das Backup wird schneller und kleiner. Was will man mehr? Dies geht zu Lasten der CPU, doch das ist vernachlässigbar.

Index Maintennance <=30% Reorganisation, sonst Rebuild

Der Index trägt nachhaltig zur Geschwindigkeit der Datenbanken bei. Man sollte darauf achten, dass periodisch die Indizes geprüft werden. Unter 30% Fragmentierung ist eine Reorganisation möglich, sonst muss der Index rebuildet werden.

Für den Indexrebuild empfhiehlt es sich, Max Degree of Parallelism wieder auf 0 zu stellen, da die Reorganisation bzw. der Rebuild schneller über die Bühne geht. Danach wieder zurück auf 1.

Update Statistics täglich, DBCC Checkdb vor Fullbackup

Mit Update Statistics wird der Einstiegspunkt festgelegt, damit nicht immer ein Fulltablescan gemacht werden muss. DBCC Checkdb verifiziert die Datenbanken auf ihre Konsistenz. ACHTUNG Repair with Dataloss ist im SharePoint nicht supportet!

To BLOB or not to BLOB

Zu guter letzt sollte man sich auch Gedanken über RBS machen. Es gab eine Studie, wonach Files < 1MB schneller vom SQL und >1 MB schneller vom Filesystem gestreamt werden. Auch kann der RBS auf günstigeren Disks liegen, was die Gesamtkosten der Infrastruktur senkt. Bitte aber genau prüfen, bevor man da einsteigt. Die Backup Restore Szenarien verkomplizieren sich nämlich durch RBS 😉

Und noch was zum Schluss: Never Virtualize an SQL Server (meine persönliche Meinung, die ein paar Cracks der Microsoft Consulting Services mit mir teilen…)

Das Disksubsystem

Disk Alignement

Auch auf dem Disksubsystem gibt es einiges zu beachten. Wenn nämlich mal der SQL mal sauber aufgesetzt und konfiguriert ist, kommt noch das Disksubsystem, auf welchem die Daten liegen. Of wird dies als “Grosser Kübel” hingestellt und gut ist. Dass sich aber Threads gegenseitig ausbremsen, daran denkt niemand. Beginnen wir mal ganz unten, nämlich beim Disk Alignement. Wurde das Disk Alignement falsch gemacht, verursachen sie dem Disksubsystem Schmerzen, da es defakto die selbe Info zweimal schrieben muss. Einmal auf die Partition und dann noch auf die physische Disk. Stellen Sie sicher, dass die Partitionierung mit einer Blockgrösse von 64KB gemacht wurde. Ältere Systeme haben eine Blockgrösse von 4KB was denkbar schlecht ist.

Hier die Performanceunterschiede mit Aligned und Unaligned Disks:

DiskPartitionAlignmentFig1.jpg

Microsoft hat ein Whitepaper zum Disk Alignement und SQL Server 2008 bereitgestellt, welches exakt zeigt, wie man es einstellt, prüft und korrigiert. Auch werden die Auswirkungen detailiert aufgezeigt.
Hier der Link: http://download.microsoft.com/download/C/E/7/CE7DA506-CEDF-43DB-8179-D73DA13668C5/DiskPartitionAlignment.docx

Performance, IOPS und Anzahl Disks

Es gibt ganz viele Hersteller, die behautpen, das beste Disksubsystem für SharePoint zu haben. Ich sage dazu nur eines: Kein RAID10, kein gutes Disksubsystem für SharePoint. Grundsätzlich geht es um Performance, und da ist RAID10 nicht zu überbieten, auch wenn es notabene das verschwenderischste ist, da die zwei Platten welche zusammen mehr performance ergeben und zusätzlich noch gespiegelt werden. Man kann also genau 50% des eingekauften Speicherplatzes effektiv nutzen, was eigentlich eine schlechte Ausbeute ist.

Wir wollen aber Performance und daher wird auch von Microsoft dringend RAID10 empfohlen. Dann können Sie auch als Grundregel nehem, was unter 140 MB/s Throughput hat ist zu langsam. Diese Rechenmethode hat ihre Grenzen, denn sie sagt alleine nicht viel aus.

Sicherer ist mit IPOS zu rechnen. Hier ist die Faustregel 2 IOPS pro GB Daten. Da wird schnell klar, dass wir schnell mal ein paar IOPS auf unserem Disksubsystem brauchen.

Wichtige Grundregel beim Disksubsystem ist auch die Anzahl Disks, nicht nur der benötigte Platz sonder die Anzahl Spindeln, welche den IO verarbeiten sind hier die wichtigen Faktoren.

Es empfiehlt sich, einige Tests mit SQLIO zu machen.
Zum Tool: http://www.microsoft.com/download/en/details.aspx?id=20163
zur Beschreibung: http://technet.microsoft.com/en-us/library/cc966412.aspx

So, nun habe ich erstmal genug losgelassen, ich lass euch das ganze erst mal verdauen.

So long, Samuel

Präsentation SharePoint 2010 Best Practice Setup


Was ja bei mir bereits voraussehbar gewesen ist…

Hier natürlich noch die Präsentation, welche ich anlässlich des ShareTrain vom Juni 2011 gehalten habe. Inhalt waren Vorgehensweisen und Tipps für ein Best Practice Setup von SharePoint 2010. Auf der Tonspur gab es natürlich noch viiieeelll mehr, doch auch in der Präsentation sind viele nützliche Tipps und Blogposts hinterlegt.

So long, Samuel