Best Practices for Building Your Website for Scale with Microsoft SharePoint 2010 Josh Stickler...

51
Best Practices for Building Your Website for Scale with Microsoft SharePoint 2010 Josh Stickler Program Manager Microsoft Corporation OSP333

Transcript of Best Practices for Building Your Website for Scale with Microsoft SharePoint 2010 Josh Stickler...

Best Practices for Building Your Website for Scale with Microsoft SharePoint 2010

Best Practices for Building Your Website for Scale with Microsoft SharePoint 2010 Josh SticklerProgram ManagerMicrosoft CorporationOSP3336/14/2012 3:01 PM 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

1

Best Practices for Capacity Management3Capacity PlanningWorkloadIn this case, read-heavy WCM environment

DatasetHow much content? How often will you update it?Multilingual?

Performance & availability targetsFor a read-heavy WCM site, maximize throughput (RPS)Effective use of caching helps tremendously4The case for caching

# of Front-end Web Servers5Wheres the bottleneck?

Front-end web server(s)x nCPUMemoryDisk I/ODisk spaceApplication server(s)

x nDisk I/OMemoryCPUDatabase servers

Database locksDisk I/OCPUMemoryDisk space

Web server CPU utilization should be the bottleneck

Front-end web server(s)x nCPUMemoryDisk I/ODisk spaceApplication server(s)

x nDisk I/OMemoryCPUDatabase servers

Database locksDisk I/OCPUMemoryDisk space

Key Scale Tools: The CachesOutput cache

Compiled pagesObject cache

SPQuery result setsBLOB Cache

Static filesWeb server memoryWeb server diskOutput cacheHow to set it upSite Settings Site Collection Cache ProfilesSite Settings Site Collection Output Cache

Cache profiles give you granularityAnonymous vs. authenticatedDifferent caching behavior for certain page layoutsVary By parametersRecommended cache configurationFor site visitorsPublic Internet cache profileDont enable check for changesMinimize vary by parameters

For authors/admins (authenticated users)Consider not cachingTip: Making sure the output cache is working Enable debug info in Site Collection Output Cache Settings

Viewing the source for pages shows the cache timestamp

Monitoring DB traffic: Cant use Developer Dashboard (because it gets cached with the page).Use SQL Profiler instead

11Monitoring the output cacheA cache miss is more expensive than rendering a page without caching

Lots of cache trimming? Tweak duration or scale up web serversWhat maxing out web server CPU looks like

A classical debate

to be freshor fast?Fast and fresh

ASP.Net Post-Cache Substitution

Sometimes you want completely dynamic content elements on an otherwise cached page.

16ASP.Net Post-Cache Substitution You can achieve exactly this behavior, by writing a custom control that inherits from the System.Web.UI.WebControls.Substitution class. The rest of the page will be output-cached, but this control will be called to render on every request.

Key consideration: Your control will be run on EVERY request plan carefully.

17SharePoint Object CacheWhat is the Object Cache?An in-memory cache of results to Cross-List Queries against your SharePoint site.Used to cache the results of queries that can span lists and sites within a Site Collection.But also good for caching results of queries within a single list.

Youre probably already using it! (And its always on)Configuring the Object Cache (Contd)Key Configuration DecisionsParameter NameDecisionGeneral PrincipleObject Cache SizeHow big do you want the Object Cache to be?Bigger is better (make sure you have enough RAM)Cache ChangesDo I want a purely time-based cache, or should every request check to see if cache is still valid? Checking for changes == more work per cached requestResults MultiplierShould we cache more results than the user asked for? Only useful in scenarios where different users have different permissions19Configuring the Object Cache (Contd)Configure the two super accounts used by the Object Cache via PowerShell:

$wa = Get-SPWebApplication -Identity "" $wa.Properties["portalsuperuseraccount"] = "" $wa.Properties["portalsuperreaderaccount"] = "" $wa.Update()

Account NamePermissions it should haveSuperUserFull Control User Policy for the Web ApplicationSuperReaderFull Read User Policy for the Web ApplicationWhat happens when you dont use the Object Cache

21What happens when you dont use the Object Cache What went wrong?The hero control (which was implemented as a Sandboxed Solution) was using the non-cached SharePoint API, instead of the cached API.The site was launched, and as soon as it got real load, the Sandboxed Solution throttling system (correctly) stopped executing the control.GoodPublishing.CrossListQueryCache.GetSiteData (SPWeb, SPSiteDataQuery)BadSPList.GetItems(SPQuery)22Using the Object Cache from client-side codeTo build a client-side solution (Silverlight/AJAX/Flash/etc.) that queries SharePoint data:Write a web service that wraps the Object Cache and executes cache queriesMake sure your solution calls your web service.

Do NOT use the SharePoint client object model it is un-cached.

23SharePoint Disk-based BLOB cacheWhat is it?A cache that stores files on the web-front ends disk drive.

Why should you use it?Less rendering work for SharePointFewer bytes-over-the-wire for users visiting your siteSupport for HTTP range requests for media files24Configuring the BLOB cacheEdit the following line in web.config: