500 likes | 642 Views
OSP333. Best Practices for Building Your Website for Scale with Microsoft SharePoint 2010 . Spencer Harbar Microsoft Corporation. Best Practices for Capacity Management. Capacity Planning. Workload In this case, read-heavy WCM environment Dataset
E N D
OSP333 Best Practices for Building Your Website for Scale with Microsoft SharePoint 2010 Spencer Harbar Microsoft Corporation
Capacity Planning • Workload • In this case, read-heavy WCM environment • Dataset • How much content? How often will you update it? • Multilingual? • Performance & availability targets • For a read-heavy WCM site, maximize throughput (RPS) • Effective use of caching helps tremendously
The case for caching # of Front-end Web Servers
Where’s the bottleneck? Front-end web server(s) • CPU • Memory • Disk I/O • Disk space xn Application server(s) • Disk I/O • Memory • CPU xn Database servers • Database locks • Disk I/O • CPU • Memory • Disk space
Web server CPU utilization should be the bottleneck • CPU • Memory • Disk I/O • Disk space Front-end web server(s) xn Application server(s) • Disk I/O • Memory • CPU xn Database servers • Database locks • Disk I/O • CPU • Memory • Disk space
Key Scale Tools: The Caches Output cache Compiled pages Object cache SPQuery result sets BLOB Cache Static files Web server memory Web server disk
Output cache • How to set it up • Site Settings Site Collection Cache Profiles • Site Settings Site Collection Output Cache • Cache profiles give you granularity • Anonymous vs. authenticated • Different caching behavior for certain page layouts • “Vary By” parameters
Recommended cache configuration • For site visitors • Public Internet cache profile • Don’t enable “check for changes” • Minimize vary by parameters • For authors/admins (authenticated users) • Consider not caching
Tip: 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: Can’t use “Developer Dashboard” (because it gets cached with the page). • Use SQL Profiler instead
Monitoring the output cache • A cache miss is more expensive than rendering a page without caching • Lots of cache trimming? Tweak duration or scale up web servers
A classical debate to be fresh …or fast?
ASP.Net Post-Cache Substitution • Sometimes you want completely “dynamic” content elements on an otherwise cached page.
ASP.NetPost-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.
SharePoint Object Cache • What 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. • You’re probably already using it! (And it’s “always on”)
Configuring the Object Cache (Cont’d) • Key Configuration Decisions
Configuring the Object Cache (Cont’d) • Configure the two “super” accounts used by the Object Cache via PowerShell: $wa = Get-SPWebApplication -Identity "<WebApplication>" $wa.Properties["portalsuperuseraccount"] = "<SuperUser>" $wa.Properties["portalsuperreaderaccount"] = "<SuperReader>" $wa.Update()
What happens when you don’t 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.
Using the Object Cache from client-side code • To 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 queries • Make sure your solution calls your web service. Do NOT use the SharePoint client object model… it is un-cached.
SharePoint Disk-based BLOB cache • What is it? • A cache that stores files on the web-front end’s disk drive. • Why should you use it? • Less rendering work for SharePoint • Fewer bytes-over-the-wire for users visiting your site • Support for HTTP range requests for media files
Configuring the BLOB cache • Edit the following line in web.config: <BlobCache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="10" max-age="86400" enabled=“true"/> Write to a separate drive (GB) more is better (ms) more is better
A quick note about CDNs • The appeal of CDNs • Less load on your server per-user • Browsers will load more files in parallel (2 connection per-server limit) • Geo-distribution • For content (e.g. BLOBs) • Resources are effectively “external” URLs and you trade-off CMS goodness • For “system” files • Easy win: If you’re using jQueryor Modernizr, load them from the ASP.Net AJAX CDN
IIS Compression • We STRONGLY recommend enabling static compression.
Content Deployment – Recap of Authoring Models • Author-in-place • Content Deployment • Authors and visitors share the same site collection. • Variable distributions of read and write operations throughout a given day. • Specialized environments for authoring and viewing. • Scheduled deployment jobs “replay” operations from Authoring to Production.
Content Deployment • Authoring Farm • Production Farm Content DB Content DB Content Deployment Crawl Crawl SSP Proxy Search Index Search Index SSP Proxy EMM Term Store
Content Deployment – Value Proposition Content Deployment is great for customers who: • Have a business/regulatory/legal requirement that no user can have contributor permissions on their production site. • Will be reviewing/staging ALL content before it goes live. Content Deployment adds LATENCY between when Content is authored/approved & when it goes live. • Latency is proportional to the volume of changes since last deployment. • And if you have multiple targets, things will be temporarily out of sync.
Who shouldn’t use Content Deployment today? • I want to review/stage everything before it’s “in production” • High availability (including geo-rep)/disaster recovery • Site relaunch/redesign • I want to schedule the load from write operations
Content Deployment Best Practice #1: SQL Server Enterprise Edition & Snapshots Content Deployment + SQL Server Enterprise = No export failures due to on-going authoring activity.
Content Deployment Best Practice #1: SQL 2008 Enterprise Edition & Snapshots (Cont’d) Central Administration Manage Content Deployment Paths and Jobs <Your Job>
Content Deployment Best Practice #2: Custom Solutions & Content Deployment Custom Solutions MUST be “aware” of Content Deployment Many custom solutions add/modify Content DB objects (and fail if they can’t add/modify the objects). The pattern we see in many custom solutions: • Admin activates solution on SOURCE of Content Deployment • Objects are added to the Content DB • Content Deployment will then do the following on the TARGET: • Deploy the content objects to the target Content DB • Automatically activate the custom solution (FAIL)
Custom Solutions & Content Deployment • How to write Content Deployment-friendly code: using Microsoft.SharePoint.Deployment.SPImportContext; if (SPImportContext.Current.IsRunning) { // You’re running during Content Deployment import, so // Don’t try to re-create items that were // already created on source site collection. } else { // Add/modify Content DB objects }
Content Deployment and Caching • Cache profiles and settings are deployed, too • You override cache profiles in web.config • <OutputCacheProfiles • useCacheProfileOverrides=“true" • varyByHeader="" • varyByParam="*" • varyByCustom="" • varyByRights="true" • cacheForEditRights=“true" />
Variations – Best Practices At Scale • Avoid “Multilingual Afterthought Syndrome” • If you think you may need Variations in the future, set up Variations early on. • If you do this later, you’ll have to copy a LOT of content from the root web to your source label. • Consider On-Demand Page Propagation: • It can save a LOT of unnecessary copy operations.
Variations – On-Demand Page Propagation • Automatic • Manual • On-demand
Content Deployment and Variations Production SPSite Authoring SPSite / Root SPWeb / Root SPWeb /en-us Source SPWeb /en-us Source SPWeb /Pages/ /Pages/ /fr-fr Target SPWeb /fr-fr Target SPWeb Content Deployment /Pages/ /Pages/
On-Demand Page Propagation: PowerShell Enable On-Demand Page Propagation: [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") $site = new-object Microsoft.SharePoint.SPSite("http://yourserver/sites/abc") $folder = $site.RootWeb.Lists["Relationships List"].RootFolder $folder.Properties.Add("DisableAutomaticPropagation", "True") $folder.Update();
Variationsfixuptool • What is it for? • PRIME migration of content into the source label • Repairing broken Relationships (major assumptions) • Generating reports of the Relationships List • No longer: • Breaking down Create Hierarchies into more discrete units (possible OOB) • Causing Create Hierarchies to run in the timer service (OOB)
In Review: Session Objectives and Takeaways Best Practices backed up with testing and customer stories • How to make best use of cachingfor dynamic sites • When to use Content Deployment and alternatives • How features interact with Content Deployment • Strategies for using Variations • What the “Variationsfixuptool” is for and when to use it
Related Content • OSP335 - Exploring the Power of Page Layouts in SharePoint 2010 WCM Sites OSP52-HOL - Branding a Microsoft SharePoint 2010 Site from an Existing Web Design OSP04-TLC - Microsoft SharePoint 2010 Demo Station
The Business Collaboration Platform for the Enterprise and the Internet The Business Collaboration Platform for the Enterprise & the Internet • Deliver the Best Productivity Experience • Cut Costs with a Unified Infrastructure • Rapidly Respond to Business Needs The capabilities of SharePoint 2010 provide a powerful business collaboration platform
Project and SharePoint Better Together Manage Resources Improve efficiency and save money by better managing work and allocation of resources Maximize Portfolio Returns Make informed investment decisions and effectively communicate results across a portfolio of projects Keep Teams ProductiveSave time and improve project results by centralizing team collaboration on deliverables and tasks Improve SharePoint ROI Effectively manage requests to maximize the ROI of your SharePoint environment • www.sharepoint.microsoft.com • www.microsoft.com/project
Resources Learning TechNet • Connect. Share. Discuss. • Microsoft Certification & Training Resources http://europe.msteched.com www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet http://microsoft.com/msdn
Evaluations Submit your evals online http://europe.msteched.com/sessions
© 2012 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.