Search This Blog

Saturday, July 29, 2017

Few tips to improve SharePoint site Performance

According to my practical experience, here are some tips to improve SharePoint site performance.
Note: covered only the area where we don’t need to write any code, there are also some more tips over the internet if you need to improve the site using C# code where one should follow the Best SharePoint development practices.
1) Web.Config changes
web.config file Path on Web server C:\inetpub\wwwroot\wss\VirtualDirectories
– stop debuging <compilation debug=”false”>
– enable blob cache <BlobCache enabled=”true”
– Custom errors mode ON <customErrors mode=”On” />
2) Implement caching, i use the HTML 5 local storage for our client. i have also add some code to refresh the cache after two Hours
– Store result set in the object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var storageKey = "EmployeesDataSaved"
localStorage.removeItem(storageKey);
var object = { StoredData: "YourResultSet", timestamp: new Date() }
localStorage.setItem(storageKey, JSON.stringify(object));
//To Get the data
var localStorageObj = JSON.parse(localStorage.getItem(storageKey));
        if (GetDateDiffInHours(localStorageObj) >= 2) {
            //code to get data from the database to refresh cache
        }
         else
            localStorageObj.StoredData; //loading the data from cache
 
function GetDateDiffInHours(localStorageObj) {
    var savedDate = parseInt(new Date(localStorageObj.timestamp).getTime() / 1000);
    var currentDate = new Date().getTime() / 1000;
    var hoursDiff = (currentDate - savedDate) / 3600;
    return hoursDiff;
}
3) Managing Styles and Scripts
– remove all inline styles and scripts, put them in a separate file
– Minify all JS and CSS files
4) Reduce HTTP Number of requests
– Use CSS Sprite images for icons and small images
– use SVG for images as it will go to the server only once to load the one image and for the rest, we are just using the Hash # sign to get relevant image e.g /images/icons.svg#email, /images/icons.svg#phone etc
– Try to combine all CSS files into one file as much as possible
– Try to combine/merge all js files into one file
5) Optimize / compress Images
– Optimize all images that are being used in the site using online websites like tiny png
– reduce image size
– use the Progressive images intead of standard JPEG, for refernece click here

Test Your Site using the following sites


No comments:

Post a Comment