📜 ⬆️ ⬇️

Accelerate Sharepoint to the speed of highload internet site

As you know, one of the not very pleasant moments when developing a Sharepoint website is its performance. But this is not a verdict and you can fight it.

In this article I will briefly describe the basic caching features, using which you can significantly speed up the work of the portal.

First, you can enable Sharepoint caching mechanisms via the web interface.
')
It is possible to enable object caching and use caching in the web parts and controls that you developed.

There is a blob cache and IIS compression.

It is necessary to do page optimization and page master, that is, disable core.js and core.css where they are not needed, remove unnecessary controls. Put your own assemblies in the GAC and be sure to sign them. Use <SharePointWebControls:ScriptLink runat="server"/> and <SharePoint:CssLink ID="CssLink1" runat="server" /> to connect css and js instead of analogs from html.


Now let's go in order.

Output caching caching


Managed at the sharepoint node collection level. Page output caching can be interrupted for master pages and child nodes. You can have different caching settings for anonymous and authenticated users. The standard package contains 4 profiles that are suitable for most scenarios. The page for applying a caching profile to a site collection looks like this:



Now imagine that we need to, when changing any parameter in the address string (query string), the page is not taken from the cache, but displayed and received information again. This can be achieved by writing the “*” symbol in the Vary by Query String Parameters field



What if the page should have controls with dynamic information while the rest of the page should be cached? You need to use Post-Cache Substitution control (http://www.nikhilk.net/PostCacheSubstitution.aspx)

File Caching (Blob cache)


Blob Cache puts SharePoint items on disk on the server. The option is disabled. To enable it, you need to edit web.config.


Caching requests and objects (Object cache)


Activated by default. Used for quick access to the elements:

By default, the object cache is 100MB and this can be changed via the web interface.


IIS compression


You can add compression for JS and CSS by running the command line on the server:

cscript adsutil.vbs set w3svc/filters/compression/gzip/hcfileextensions "htm" "html" "txt" "js" "css"

cscript adsutil.vbs set w3svc/filters/compression/deflate/hcfileextensions "htm" "html" "txt" "js" "css"

iisreset


IHttpModule and hard optimization


Advice for those who simply infuriates a lot of unnecessary text in the page returned by the browser because it is an esthete or geek (cross out the unnecessary), or the task is to make the pages quite small and light. To do this, IHttpModule is written in which, in the Init method of the page, everything unnecessary is removed from the returned result. Only it is necessary to remove exactly the excess, i.e. then without which your page will continue to work normally;)

Conclusion


The preparation of the article involved the brain, UFOs and materials with MSDN:

Output Caching and Cache Profiles
Object caching
Disk-based Caching for Binary Large Objects
Creating and Registering a Custom HTTP Module
Post-Cache Substitution

Source: https://habr.com/ru/post/55981/


All Articles