Private CDN for hosting data on SharePoint for improving performance

Premier Developer

Premier

App Dev Manager Michael Mano shares some tips to improve SharePoint performance using a CDN.


When we target performance issues with SharePoint, the focus is generally on database related queries and all the requests that are being made to critical assets for the site like images, JavaScript files, CSS etc.  A quick response time for these resources are vital for your page to function optimally.

One way to significantly improve performance around this content is to use Private CDN for assets that change very infrequently. This can be done by hosting the assets in a CDN and then referencing them from the CDN endpoint.  Depending on the amount of data you host in the CDN, this approach can dramatically improve performance.

The implementation is relatively simple. All you have to do is create a Private CDN in O365, move the files, then reference it in your code– SharePoint takes care of the rest.

Here is a sample to configure a web part:

  1. Install the new (version 16.0.6008.1200) Tenant Administration PS from https://www.microsoft.com/en-us/download/details.aspx?id=35588
  2. Using SharePoint Online Management Shell to connect to the tenant admin
  3. Set-SPOTenantCdnEnabled -CdnType Private -Enable $true
  4. Add-SPOTenantCdnOrigin -CdnType Private -OriginUrl site/subsite/picturelib
    1. (use relative path)
  5. Wait for up to 15 minutes for the configuration to propagate through the farm

You can configure any of your libraries to use the CDN as well with the steps above this will drastically improve your overall site performance.​

Here are some helpful links to get started with CDN.

CDN –

https://docs.microsoft.com/en-us/office365/enterprise/content-delivery-networks?redirectSourcePath=%252farticle%252fContent-delivery-networks-0140f704-6614-49bb-aa6c-89b75dcd7f1f

CDN with SPO –

https://docs.microsoft.com/en-us/office365/enterprise/use-office-365-cdn-with-spo

Management shell

https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/connect-sharepoint-online?view=sharepoint-ps

Premier Developer
Premier Developer

Premier Support for Developers

Follow Premier   

0 comments

    Leave a comment