SlideShare a Scribd company logo
#SPSBE




Boosting Performance on
    Publishing sites
            #SPSBE14


        Karine Bosch
         SharePoint MVP
A big thanks to our sponsors
Platinum Sponsors




Gold Premium Sponsors            Venue Sponsor




Gold Sponsors
About me
• SharePoint MVP since 2008
• Technical assistent of Patrick Tisseghem till September 2008
• Developer of the U2U CAML Builder
• Technical Lead SharePoint Competence Center @ ING


• Blog: http://karinebosch.wordpress.com
• Twitter: kbosie
Agenda
• Introduction
• Caching data
• Techniques to reduce the page load
• Tools to measure performance
Introduction
• Data is stored in SQL Server database
• User requests require data
                                                      No Caching

                                   2. SQL Get Data

                  1. HTTP GET      3. Data Returned

                4. HTTP Response




• No caching limits scalability
• SharePoint caches run on the WFE(s)
• Caches maintain copies of data locally on WFE
• User requests are served from cache on WFE
Types of Caching
• Caching data
   • BLOB Cache       => caches files stored in the content database
   • IIS Cache        => caches files stored in the _layouts folder
   • Output Cache     => caches .aspx pages
   • Object Cache     => caches data objects


• Require addintional system resources
BLOB Cache
• BLOB = Binary Large Object
• BLOB cache is configured on Web Application level in
  web.config
• BLOB cache stores files from content database on a local
  directory of each WFE
   • Images, CSS files, JavaScript files
• Second request serves file from disk
• Tradeoff:
   • Extra roundtrips to SQL Server to fetch file
• Cache Invalidation
BLOB Cache
• BLOB Cache is highly optimized to serve anonymous requests
     • Images and SiteCollectionImages library have AllowEveryoneViewItems
       property set to True.
     • No SQL Server roundtrip to check user ACLs


•   Adds cache control headers to HTTP Responses to save file in user’s
    browser cache
BLOB Cache
• BLOB Caching is useful when
   • Resources are frequently accessed
   • Rich media is used (videos, etc)


• BLOB Caching is less useful when
   • Resources are not frequently accessed
   • Files are modified frequently
Configuring BLOB Cache
• BLOB Cache is configured in web.config of WFE
   • Local directory on WFE
   • Files with specific extensions
       • List of extensions can be configured
   • Size limit


 <BlobCache location="C:blobCache"
            path=".(gif|jpg|png|css|js)$"
            maxSize="10" max-age="86400"
            enabled="true"/>
Demo



  BLOB Cache
IIS Cache
• Files stored in _layouts/images folder of WFE
• Files are cached on
  local browser cache
• Default invalidation
  period: 365 days
Demo



  IIS Caching
Output Cache
• SharePoint Server uses ASP.NET output cache
   • In-memory cache that stores rendered ASPX pages per ASP.NET application
   • Reduces CPU load and SQL Server roundtrips
• In SharePoint Server only Publishing pages can be cached
   •   Publishing Feature fetches page layout and then content of the page
• Configured per site collection
• Output Cache is highly optimized for anonymous access
• Memory requirements:
   • (2 x page size) + 32 KB of memory per rendered copy of a page
Output Cache Profiles
• Configuration of Cache profiles
   • Specify the different variants of a page that can be stored in cache
   • Vary By


• Default cache profiles
   • Organaized by
        • user access rights
        • Browser type
Configuring Output Cache
• Following features must be enabled:
    • Publishing Infrastructure site collection feature
    • Publishing site feature


• Site collection settings
    > Site collection output cache
    • Enable output cache check box
Configuring Cache Profiles
• Cache Profiles specify the different variants of a page that can
  be stored in cache
• Site collection settings > Site collection cache profiles
• Fields that can be configured
    • Enabled
    • Duration
    • Check for Changes
    • Vary By Parameter
    • Perform ACL check
    • …
Demo



  Output Cache
Object Cache
• Stores data objects in-memory on WFEs
• Publishing features must be activated
• Some SharePoint artifacts use object cache mechanism by
  design:
   • Cross-list Query Cache
   • Content By Query Web Part
   • PortalSiteMapProvider API
   • Search Query Box
   • Metadata navigation
• HttpRuntime.Cache
Object Cache
• Data is cached based on user rights
   • PortalSuperUserAccount
   • PortalSuperReaderAccount
• Cache invalidation
• Size: allocate 500KB RAM per site collection
Configuring Object Cache
• Set up Portal Super Accounts
        $wa = Get-SPWebApplication -Identity "<WebApplication>"
        $wa.Properties["portalsuperuseraccount"] = "<SuperUser>"
        $wa.Properties["portalsuperreaderaccount"] = "<SuperReader>"
        $wa.Update()


• Site collection settings > Site collection object cache
• Tuning options
    • Max size
    • Flushing
    • Cache Invalidation
HttpRuntime.Cache Code Sample
•   ASP.NET cache class             string cacheKey = "BeersOfTheWeek";
                                    List<Beer> beerList = null;
•   Cache key
                                    // check the cache
                                    object o = HttpRuntime.Cache.Get(cacheKey);
•   Lock before retrieving data
    from database                   if (o == null)
                                    {
                                        object lockHandle = new object();
•   Insert object(s) in cache for       lock (lockHandle)
                                        {
    a certain period of time                // check again if cache is not filled again
                                            o = HttpRuntime.Cache.Get(cacheKey);
                                            if (o == null)
                                            {
                                                beerList = RetrieveWithQuery();
                                                if (beerList != null)
                                                {
                                                   // add the list to the cache
                                                   HttpRuntime.Cache.Insert(cacheKey, beerList,
                                                     null, DateTime.Now.AddMinutes(15.0),
                                                     TimeSpan.Zero);
                                                 }
                                              }
                                              else
                                                beerList = (List<Beer>)o;
                                        }
                                    }
                                    else
                                       beerList = (List<Beer>)o;
Demo



  Object Caching
Tools
• Tools to measure performance and page load
   • Firebug
   • Yslow
   • Developer Dashboard
   • SPMonitoredScope
Developer Dashboard
• Disabled by default
• Can be enabled via
   • Object Model
   • Stsadm
   • PowerShell
• Display levels
   • On
   • Off
   • On Demand
SPMonitoredScope
• Included for web parts
• Not included for custom controls
       using (SPMonitoredScope breweryBannerScope =
            new SPMonitoredScope(“Brewery Banner control”)
       {
          // your code goes here
       }
Demo



 Developer Dashboard and SPMonitoredScope
Reduce the Page Load
• Suppress JavaScript files and CSS files that are not used in
  anonymous mode
• Minimize JavaScript files
• Sprites
   • Images
   • CSS
Conclusion
• Improve performance using caching mechanisms:
   • BLOB cache       =>    files in document libraries
   • IIS cache        =>    files in _layouts folder
   • Output cache     =>    publishing pages
   • Object cache     =>    data objects


• Caching takes place on:
   • Web front ends
   • Client browser
We need your feedback!

                Scan this QR code or visit
                http://svy.mk/sps2012be


                Our sponsors:

More Related Content

PDF
Best practices para publicar un WebSite con SharePoint Server 2010
Juan Andrés Valenzuela
 
PDF
Rails Caching: Secrets From the Edge
Fastly
 
PPTX
Accelerating Rails with edge caching
Michael May
 
PDF
Spring java config
Sukjin Yun
 
PDF
Hosting huge amount of binaries in JCR
Woonsan Ko
 
PPTX
Mini-Training: To cache or not to cache
Betclic Everest Group Tech Team
 
PPTX
Windows Azure Drive
Pavel Revenkov
 
PDF
Varnish Cache
Mike Willbanks
 
Best practices para publicar un WebSite con SharePoint Server 2010
Juan Andrés Valenzuela
 
Rails Caching: Secrets From the Edge
Fastly
 
Accelerating Rails with edge caching
Michael May
 
Spring java config
Sukjin Yun
 
Hosting huge amount of binaries in JCR
Woonsan Ko
 
Mini-Training: To cache or not to cache
Betclic Everest Group Tech Team
 
Windows Azure Drive
Pavel Revenkov
 
Varnish Cache
Mike Willbanks
 

What's hot (20)

PPTX
Caching 101 - WordCamp OC
Eugene Kovshilovsky
 
PDF
Relevance trilogy may dream be with you! (dec17)
Woonsan Ko
 
PDF
Mobile & Desktop Cache 2.0: How To Create A Scriptable Cache
Blaze Software Inc.
 
PDF
PHP projects beyond the LAMP stack
Codemotion
 
PDF
From SQL to MongoDB
Nuxeo
 
PDF
Building low latency java applications with ehcache
Chris Westin
 
PDF
Asp.net caching
Mindfire Solutions
 
PPTX
Caching in asp.net mvc
KarthikaDevi Rajasekaran
 
PDF
Introduction to AJAX
Abzetdin Adamov
 
PDF
Nuxeo World Session: CMIS - What's Next?
Nuxeo
 
PPTX
SQL Server Integration Services Tips & Tricks
Guillermo Caicedo
 
PPT
Html5 drupal7 with mandakini kumari(1)
Mandakini Kumari
 
PPTX
Fluent 2012 v2
Shalendra Chhabra
 
PDF
Automating complex infrastructures with Puppet
Kris Buytaert
 
PDF
Jolokia - JMX on Capsaicin (Devoxx 2011)
roland.huss
 
PDF
Node.js and couchbase Full Stack JSON - Munich NoSQL
Philipp Fehre
 
PPT
Aspnet Caching
rainynovember12
 
PPTX
Windows Azure Caching
Pavel Revenkov
 
KEY
Web Optimization Level: Paranoid
robin_sy
 
PPTX
Caching Enhancement in ASP.NET 4.0
Abhijit Jana
 
Caching 101 - WordCamp OC
Eugene Kovshilovsky
 
Relevance trilogy may dream be with you! (dec17)
Woonsan Ko
 
Mobile & Desktop Cache 2.0: How To Create A Scriptable Cache
Blaze Software Inc.
 
PHP projects beyond the LAMP stack
Codemotion
 
From SQL to MongoDB
Nuxeo
 
Building low latency java applications with ehcache
Chris Westin
 
Asp.net caching
Mindfire Solutions
 
Caching in asp.net mvc
KarthikaDevi Rajasekaran
 
Introduction to AJAX
Abzetdin Adamov
 
Nuxeo World Session: CMIS - What's Next?
Nuxeo
 
SQL Server Integration Services Tips & Tricks
Guillermo Caicedo
 
Html5 drupal7 with mandakini kumari(1)
Mandakini Kumari
 
Fluent 2012 v2
Shalendra Chhabra
 
Automating complex infrastructures with Puppet
Kris Buytaert
 
Jolokia - JMX on Capsaicin (Devoxx 2011)
roland.huss
 
Node.js and couchbase Full Stack JSON - Munich NoSQL
Philipp Fehre
 
Aspnet Caching
rainynovember12
 
Windows Azure Caching
Pavel Revenkov
 
Web Optimization Level: Paranoid
robin_sy
 
Caching Enhancement in ASP.NET 4.0
Abhijit Jana
 
Ad

Viewers also liked (7)

PPTX
SharePoint Saturday Belgium 2014 - How to make your CEO understand or how to ...
BIWUG
 
PPTX
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
BIWUG
 
PPT
BIWUG 01/09/2005 IW Technologies, what's to come in 2006?
BIWUG
 
PDF
Penny coventry auto-bp-spsbe31
BIWUG
 
PPTX
SharePoint Saturday Belgium 2014 Killer combos: SharePoint, Project Siena and...
BIWUG
 
PPTX
SharePoint Saturday Belgium 2014 - Best Practices for Configuring the ShareP...
BIWUG
 
PPT
BIWUG 20/02/2006 Backup & Restore with SharePoint 2003
BIWUG
 
SharePoint Saturday Belgium 2014 - How to make your CEO understand or how to ...
BIWUG
 
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
BIWUG
 
BIWUG 01/09/2005 IW Technologies, what's to come in 2006?
BIWUG
 
Penny coventry auto-bp-spsbe31
BIWUG
 
SharePoint Saturday Belgium 2014 Killer combos: SharePoint, Project Siena and...
BIWUG
 
SharePoint Saturday Belgium 2014 - Best Practices for Configuring the ShareP...
BIWUG
 
BIWUG 20/02/2006 Backup & Restore with SharePoint 2003
BIWUG
 
Ad

Similar to Karine bosch caching-spsbe14 (20)

PDF
Rails Caching Secrets from the Edge
Michael May
 
PPTX
More Cache for Less Cash (DevLink 2014)
Michael Collier
 
PDF
SPSUtah 2014 SharePoint 2013 Performance (Admin)
Brian Culver
 
PDF
Boost the Performance of SharePoint Today!
Brian Culver
 
PDF
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
SPTechCon
 
PPTX
Boost your website by running PHP on Nginx
Harald Zeitlhofer
 
PPTX
Build a Node.js Client for Your REST+JSON API
Stormpath
 
PDF
Nginx caching
reneedv
 
PPTX
Hdv309 - Real World Sandboxed Solutions
woutervugt
 
KEY
MozTW Jetpack Workshop: Taipei
littlebtc
 
PDF
JavaScript Service Worker Design Patterns for Better User Experience
reeder29
 
PDF
MozTW Jetpack Workshop: Taichung
littlebtc
 
PPTX
CloudStack Object Storage Framework & Demo
ShapeBlue
 
PPTX
In-browser storage and me
Jason Casden
 
PDF
SharePoint Saturday The Conference DC - How the client object model saved the...
Liam Cleary [MVP]
 
PDF
Pre-render Blazor WebAssembly on static web hosting at publishing time
Jun-ichi Sakamoto
 
PDF
SharePoint TechCon 2009 - 803
Andreas Grabner
 
PDF
Where is my cache architectural patterns for caching microservices by example
Rafał Leszko
 
PPTX
Where to save my data, for devs!
SharePoint Saturday New Jersey
 
PPTX
Mvc 4.0
Ram Ayyalaraju
 
Rails Caching Secrets from the Edge
Michael May
 
More Cache for Less Cash (DevLink 2014)
Michael Collier
 
SPSUtah 2014 SharePoint 2013 Performance (Admin)
Brian Culver
 
Boost the Performance of SharePoint Today!
Brian Culver
 
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
SPTechCon
 
Boost your website by running PHP on Nginx
Harald Zeitlhofer
 
Build a Node.js Client for Your REST+JSON API
Stormpath
 
Nginx caching
reneedv
 
Hdv309 - Real World Sandboxed Solutions
woutervugt
 
MozTW Jetpack Workshop: Taipei
littlebtc
 
JavaScript Service Worker Design Patterns for Better User Experience
reeder29
 
MozTW Jetpack Workshop: Taichung
littlebtc
 
CloudStack Object Storage Framework & Demo
ShapeBlue
 
In-browser storage and me
Jason Casden
 
SharePoint Saturday The Conference DC - How the client object model saved the...
Liam Cleary [MVP]
 
Pre-render Blazor WebAssembly on static web hosting at publishing time
Jun-ichi Sakamoto
 
SharePoint TechCon 2009 - 803
Andreas Grabner
 
Where is my cache architectural patterns for caching microservices by example
Rafał Leszko
 
Where to save my data, for devs!
SharePoint Saturday New Jersey
 

More from BIWUG (20)

PPTX
Biwug20190425
BIWUG
 
PDF
Working with PowerShell, Visual Studio Code and Github for the reluctant IT Pro
BIWUG
 
PPTX
Global Office 365 Developer Bootcamp
BIWUG
 
PPTX
Deep dive into advanced teams development
BIWUG
 
PPTX
SharePoint wizards - no magic needed, just use Microsoft Flow
BIWUG
 
PPTX
Make IT Pro's great again: Microsoft Azure for the SharePoint professional
BIWUG
 
PPTX
Modern collaboration in teams and projects with Microsoft 365
BIWUG
 
PDF
Mining SharePoint data with PowerBI
BIWUG
 
PPTX
Don't simply deploy, transform! Build your digital workplace in Office 365
BIWUG
 
PPTX
Connect SharePoint Framework solutions to APIs secured with Azure AD
BIWUG
 
PPTX
Cloud First. Be Prepared
BIWUG
 
PPTX
APIs, APIs Everywhere!
BIWUG
 
PPTX
Advanced PowerShell for Office 365
BIWUG
 
PPTX
New era of customizing site provisioning
BIWUG
 
PDF
Understanding SharePoint Framework Extensions
BIWUG
 
PPTX
Microsoft Flow in Real World Projects: 2 Years later & What's next
BIWUG
 
PPTX
Microsoft Stream - Your enterprise video portal unleashed
BIWUG
 
PDF
What's new in SharePoint Server 2019
BIWUG
 
PPTX
Why you shouldn't probably care about Machine Learning
BIWUG
 
PPTX
Transforming your classic team sites in group connected team sites
BIWUG
 
Biwug20190425
BIWUG
 
Working with PowerShell, Visual Studio Code and Github for the reluctant IT Pro
BIWUG
 
Global Office 365 Developer Bootcamp
BIWUG
 
Deep dive into advanced teams development
BIWUG
 
SharePoint wizards - no magic needed, just use Microsoft Flow
BIWUG
 
Make IT Pro's great again: Microsoft Azure for the SharePoint professional
BIWUG
 
Modern collaboration in teams and projects with Microsoft 365
BIWUG
 
Mining SharePoint data with PowerBI
BIWUG
 
Don't simply deploy, transform! Build your digital workplace in Office 365
BIWUG
 
Connect SharePoint Framework solutions to APIs secured with Azure AD
BIWUG
 
Cloud First. Be Prepared
BIWUG
 
APIs, APIs Everywhere!
BIWUG
 
Advanced PowerShell for Office 365
BIWUG
 
New era of customizing site provisioning
BIWUG
 
Understanding SharePoint Framework Extensions
BIWUG
 
Microsoft Flow in Real World Projects: 2 Years later & What's next
BIWUG
 
Microsoft Stream - Your enterprise video portal unleashed
BIWUG
 
What's new in SharePoint Server 2019
BIWUG
 
Why you shouldn't probably care about Machine Learning
BIWUG
 
Transforming your classic team sites in group connected team sites
BIWUG
 

Recently uploaded (20)

PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Beyond Automation: The Role of IoT Sensor Integration in Next-Gen Industries
Rejig Digital
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Architecture of the Future (09152021)
EdwardMeyman
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
Software Development Company | KodekX
KodekX
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Doc9.....................................
SofiaCollazos
 
Software Development Methodologies in 2025
KodekX
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Beyond Automation: The Role of IoT Sensor Integration in Next-Gen Industries
Rejig Digital
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Architecture of the Future (09152021)
EdwardMeyman
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
This slide provides an overview Technology
mineshkharadi333
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 

Karine bosch caching-spsbe14

  • 1. #SPSBE Boosting Performance on Publishing sites #SPSBE14 Karine Bosch SharePoint MVP
  • 2. A big thanks to our sponsors Platinum Sponsors Gold Premium Sponsors Venue Sponsor Gold Sponsors
  • 3. About me • SharePoint MVP since 2008 • Technical assistent of Patrick Tisseghem till September 2008 • Developer of the U2U CAML Builder • Technical Lead SharePoint Competence Center @ ING • Blog: http://karinebosch.wordpress.com • Twitter: kbosie
  • 4. Agenda • Introduction • Caching data • Techniques to reduce the page load • Tools to measure performance
  • 5. Introduction • Data is stored in SQL Server database • User requests require data No Caching 2. SQL Get Data 1. HTTP GET 3. Data Returned 4. HTTP Response • No caching limits scalability • SharePoint caches run on the WFE(s) • Caches maintain copies of data locally on WFE • User requests are served from cache on WFE
  • 6. Types of Caching • Caching data • BLOB Cache => caches files stored in the content database • IIS Cache => caches files stored in the _layouts folder • Output Cache => caches .aspx pages • Object Cache => caches data objects • Require addintional system resources
  • 7. BLOB Cache • BLOB = Binary Large Object • BLOB cache is configured on Web Application level in web.config • BLOB cache stores files from content database on a local directory of each WFE • Images, CSS files, JavaScript files • Second request serves file from disk • Tradeoff: • Extra roundtrips to SQL Server to fetch file • Cache Invalidation
  • 8. BLOB Cache • BLOB Cache is highly optimized to serve anonymous requests • Images and SiteCollectionImages library have AllowEveryoneViewItems property set to True. • No SQL Server roundtrip to check user ACLs • Adds cache control headers to HTTP Responses to save file in user’s browser cache
  • 9. BLOB Cache • BLOB Caching is useful when • Resources are frequently accessed • Rich media is used (videos, etc) • BLOB Caching is less useful when • Resources are not frequently accessed • Files are modified frequently
  • 10. Configuring BLOB Cache • BLOB Cache is configured in web.config of WFE • Local directory on WFE • Files with specific extensions • List of extensions can be configured • Size limit <BlobCache location="C:blobCache" path=".(gif|jpg|png|css|js)$" maxSize="10" max-age="86400" enabled="true"/>
  • 11. Demo BLOB Cache
  • 12. IIS Cache • Files stored in _layouts/images folder of WFE • Files are cached on local browser cache • Default invalidation period: 365 days
  • 13. Demo IIS Caching
  • 14. Output Cache • SharePoint Server uses ASP.NET output cache • In-memory cache that stores rendered ASPX pages per ASP.NET application • Reduces CPU load and SQL Server roundtrips • In SharePoint Server only Publishing pages can be cached • Publishing Feature fetches page layout and then content of the page • Configured per site collection • Output Cache is highly optimized for anonymous access • Memory requirements: • (2 x page size) + 32 KB of memory per rendered copy of a page
  • 15. Output Cache Profiles • Configuration of Cache profiles • Specify the different variants of a page that can be stored in cache • Vary By • Default cache profiles • Organaized by • user access rights • Browser type
  • 16. Configuring Output Cache • Following features must be enabled: • Publishing Infrastructure site collection feature • Publishing site feature • Site collection settings > Site collection output cache • Enable output cache check box
  • 17. Configuring Cache Profiles • Cache Profiles specify the different variants of a page that can be stored in cache • Site collection settings > Site collection cache profiles • Fields that can be configured • Enabled • Duration • Check for Changes • Vary By Parameter • Perform ACL check • …
  • 18. Demo Output Cache
  • 19. Object Cache • Stores data objects in-memory on WFEs • Publishing features must be activated • Some SharePoint artifacts use object cache mechanism by design: • Cross-list Query Cache • Content By Query Web Part • PortalSiteMapProvider API • Search Query Box • Metadata navigation • HttpRuntime.Cache
  • 20. Object Cache • Data is cached based on user rights • PortalSuperUserAccount • PortalSuperReaderAccount • Cache invalidation • Size: allocate 500KB RAM per site collection
  • 21. Configuring Object Cache • Set up Portal Super Accounts $wa = Get-SPWebApplication -Identity "<WebApplication>" $wa.Properties["portalsuperuseraccount"] = "<SuperUser>" $wa.Properties["portalsuperreaderaccount"] = "<SuperReader>" $wa.Update() • Site collection settings > Site collection object cache • Tuning options • Max size • Flushing • Cache Invalidation
  • 22. HttpRuntime.Cache Code Sample • ASP.NET cache class string cacheKey = "BeersOfTheWeek"; List<Beer> beerList = null; • Cache key // check the cache object o = HttpRuntime.Cache.Get(cacheKey); • Lock before retrieving data from database if (o == null) { object lockHandle = new object(); • Insert object(s) in cache for lock (lockHandle) { a certain period of time // check again if cache is not filled again o = HttpRuntime.Cache.Get(cacheKey); if (o == null) { beerList = RetrieveWithQuery(); if (beerList != null) { // add the list to the cache HttpRuntime.Cache.Insert(cacheKey, beerList, null, DateTime.Now.AddMinutes(15.0), TimeSpan.Zero); } } else beerList = (List<Beer>)o; } } else beerList = (List<Beer>)o;
  • 23. Demo Object Caching
  • 24. Tools • Tools to measure performance and page load • Firebug • Yslow • Developer Dashboard • SPMonitoredScope
  • 25. Developer Dashboard • Disabled by default • Can be enabled via • Object Model • Stsadm • PowerShell • Display levels • On • Off • On Demand
  • 26. SPMonitoredScope • Included for web parts • Not included for custom controls using (SPMonitoredScope breweryBannerScope = new SPMonitoredScope(“Brewery Banner control”) { // your code goes here }
  • 27. Demo Developer Dashboard and SPMonitoredScope
  • 28. Reduce the Page Load • Suppress JavaScript files and CSS files that are not used in anonymous mode • Minimize JavaScript files • Sprites • Images • CSS
  • 29. Conclusion • Improve performance using caching mechanisms: • BLOB cache => files in document libraries • IIS cache => files in _layouts folder • Output cache => publishing pages • Object cache => data objects • Caching takes place on: • Web front ends • Client browser
  • 30. We need your feedback! Scan this QR code or visit http://svy.mk/sps2012be Our sponsors:

Editor's Notes

  • #6: A SharePoint Server installation consists of an instance of Microsoft® SQL Server® and at least one front-end web server. When users request data (for example, a page or document) from SharePoint Server, the SharePoint application, running on the front-end web server, retrieves all the relevant data from SQL Server to handle the user request. Although this ensures that all users always see the most up-to-date data, it has the downside of requiring constant data traffic between SQL Server and the front-end web server.
  • #8: Extra roundtrips are to fetch permission and other metadata so the cache can serve the file securely. Also, to avoid serving stale content, the BLOB cache will toss out files if there is any chance that the cached copy might be out of date. After a file has been removed from the cache, the first hit penalty applies again to re-cache the file.In addition to reducing SQL Server round trips, the BLOB cache also helps reduce the time it takes to reload web pages by adding cache control headers to the HTTP responses for the files it serves. These headers tell the user’s browser to save these files in the browser’s cache. When the browser needs one of the cached files, it can use its cache instead of making requests to SharePoint Server. This results in fewer HTTP requests and a significantly reduced page load time.If there is content in the site that doesn’t have to be secured it would be beneficial to enable anonymous access to those files to take advantage of the BLOB cache’s optimizations for anonymous authentication.How BLOB cache can be configured with extended web app: pg 6
  • #9: Extra roundtrips are to fetch permission and other metadata so the cache can serve the file securely. Also, to avoid serving stale content, the BLOB cache will toss out files if there is any chance that the cached copy might be out of date. After a file has been removed from the cache, the first hit penalty applies again to re-cache the file.In addition to reducing SQL Server round trips, the BLOB cache also helps reduce the time it takes to reload web pages by adding cache control headers to the HTTP responses for the files it serves. These headers tell the user’s browser to save these files in the browser’s cache. When the browser needs one of the cached files, it can use its cache instead of making requests to SharePoint Server. This results in fewer HTTP requests and a significantly reduced page load time.If there is content in the site that doesn’t have to be secured it would be beneficial to enable anonymous access to those files to take advantage of the BLOB cache’s optimizations for anonymous authentication.How BLOB cache can be configured with extended web app: pg 6
  • #10: Example:The BLOB cache handles multiple requests for the same file by sharing the cached copy with all the requests. It can even do this before the file has been completely read from SQL Server. For example, a 500 MB video of a keynote presentation is posted on SharePoint Server and then a link to this video is sent out via email. There can be many users accessing the file at the same time. SharePoint Server (without the BLOB cache) would fetch the video from SQL Server once for every user requesting it. That would have huge performance implications for anyone else using the site. With the BLOB cache, even if the video isn’t yet fully cached, the video would be retrieved only once (per front-end web server) from SQL Server to handle all the requests. This optimization makes the BLOB cache indispensible for serving large files from SharePoint Server.
  • #12: Configuring the application poolWhen you enable the BLOB cache, increase the startup and shutdown time limits for the application pool. The recommended setting is at least 300 seconds. This will allow the BLOB cache enough time to initialize or serialize its index on startup or shutdown. Setting this value to 300 seconds does not cause it to take 300 seconds to start or stop, but it does prevent IIS from terminating the application pool until 300 seconds have elapsed. Increasing this limit, especially the shutdown limit, prevents the application from being terminated – possibly when the cache is serializing its index. If the index isn’t completely serialized it is considered corrupted and the cache is flushed on the next startup.Maintaining the BLOB cache: pg 19
  • #14: QUESTION: why store images in content database and not all in _layoutsfolder? ANSWER: updatable by users/content editors. Otherwisedeployment of Administratorrequested.
  • #16: This cache can help increase page throughput and reduce CPU load on the front-end web server and the instance of SQL Server because pages won’t have to be re-rendered on each request. If a site is configured for anonymous access, the front-end web servers won’t even have to request data from SQL Server to do a permission check for cached requests. In SharePoint Server only Publishing pages can be cached in the output cache. When a Publishing page is rendered, the Publishing feature assembles the page dynamically. To do this, Publishing must first fetch the page layout and then fetch the contents of the page. Both of these operations incur SQL Server round trips that affect throughput and latency. To increase throughput and scalability, Publishing pages can use the output cache so that pages aren’t rendered on each request.Publishing is a feature in SharePoint Server that allows the separation of content and its presentation. In this model a page layout is created that defines the place holders for content; pages are the containers for the content. The target scenario for this feature is an Internet facing web site that has multiple content contributors where all of the content shares a common page structure.Cache ProfilesThe cache profile is a collection of settings and parameters that are used to determine if and how a page will be cached. For example, a profile might require that pages are not cached when the requestor is someone that can edit the page so that the user can see the latest version. Another profile might specify that different copies of the pages should be generated depending on what browser is making the request. Along with those settings, the cache profile also specifies how pages in the cache are invalidated. When a page is invalidated, the next request for that page is re-rendered. This new rendered copy replaces the invalidated copy in the cache.+ pg 11Vary Bypg 11
  • #17: This cache can help increase page throughput and reduce CPU load on the front-end web server and the instance of SQL Server because pages won’t have to be re-rendered on each request. If a site is configured for anonymous access, the front-end web servers won’t even have to request data from SQL Server to do a permission check for cached requests. In SharePoint Server only Publishing pages can be cached in the output cache. When a Publishing page is rendered, the Publishing feature assembles the page dynamically. To do this, Publishing must first fetch the page layout and then fetch the contents of the page. Both of these operations incur SQL Server round trips that affect throughput and latency. To increase throughput and scalability, Publishing pages can use the output cache so that pages aren’t rendered on each request.Publishing is a feature in SharePoint Server that allows the separation of content and its presentation. In this model a page layout is created that defines the place holders for content; pages are the containers for the content. The target scenario for this feature is an Internet facing web site that has multiple content contributors where all of the content shares a common page structure.Cache ProfilesThe cache profile is a collection of settings and parameters that are used to determine if and how a page will be cached. For example, a profile might require that pages are not cached when the requestor is someone that can edit the page so that the user can see the latest version. Another profile might specify that different copies of the pages should be generated depending on what browser is making the request. Along with those settings, the cache profile also specifies how pages in the cache are invalidated. When a page is invalidated, the next request for that page is re-rendered. This new rendered copy replaces the invalidated copy in the cache.+ pg 11Vary Bypg 11
  • #18: QUESTION: why store images in content database and not all in _layoutsfolder? ANSWER: updatable by users/content editors. Otherwisedeployment of Administratorrequested.
  • #19: More detailspg 22, 23
  • #21: Examples: properties of SPWeb or SPList, custom objects.Remark: don’t store SPWebobject in object cache!The PortalSiteMapProvider is a public API that can be used to execute a query, and the results that are returned will be cached. For example, an image rotator could be written that would query a list to get the URLs of 10 images.
  • #22: When a control asks the object cache to make a query to get data, the cache will not make the query as the user making the request but instead will make the query twice: once as a user called the PortalSuperUserAccount (referred to as Super User) and once as PortalSuperReaderAccount (referred to as Super Reader). The results for the Super User query will include draft items and the results for the Super Reader query will include only published items. The cache detects duplicates and single instances the results set. The cache will then check the ACLs for the user that initiated the request and will return the appropriate results to that user. Because of the Portal Super Account users, the cache only has to store results for two users which will increase hit count and decrease the cache’s memory footprint.Out of the box, the Super User account is the web application’s System Account and the Super Reader account is NT Authority\\Local Service. Farm administrators are advised to change the default accounts for the following reasons. Some items get checked out to System Account (In Place Records is a feature that does this). When a query is made that includes these items, the checked-out version of the items is returned instead of the latest published version. That is usually not what is expected to be returned and the cache has to make a second query to fetch the versions of the file that is not checked out. This extra SQL Server round trip results in a performance hit for every query that includes these checked out items. The same would be true for any user account if that account were used for the Super User account and the user had items checked out. The user configured to be the Super User or Super Reader should not be an account that is used to log into the site or run programs that use the SharePoint API to make changes to a site. This is a precaution that will ensure the Portal accounts aren’t inadvertently used to check items out. Also, don’t use the application pool account or any account that has “Runs as System” checked in the user policy on the web application because these accounts will have the same undesirable behavior as the default account. Finally, the cache needs to have results from users who can and cannot see drafts so the Super User and Super Reader accounts must not be the set to the same account. The cache will not perform correctly if the Super User and Super Reader accounts are set to the same account.SharePoint always returns the checked-out version for items that a user has checked out.Cache invalidation: pg 15
  • #23: Intro: The object cache cannotbedisabled and thereislittlethatcanbeconfigured. None of the out of box settings should have to be changed, but there are two user accounts that should be set up to ensure the best performance. Configure Portal Super Accounts: pg 25Tuning options: pg 26Configure object cache max size: pg 27
  • #24: In web.configIn code:portalSiteMapProvider = siteMapProvider as PortalSiteMapProvider; portalSiteMapProvider.DynamicChildLimit = 0; portalSiteMapProvider.EncodeOutput = true; portalSiteMapProvider.IncludePages = PortalSiteMapProvider.IncludeOption.Always; portalSiteMapProvider.IncludeSubSites = PortalSiteMapProvider.IncludeOption.Never;