SharePoint 2013 BLOB Cache

Copper Contributor

We have a question that wanted someone to clarify/confirm.

 

When we enable BLOB cache on a SharePoint Server 2013 WFE and specify the file types, then those file types will be cached at the WFE server at the location specified for the max age specified in the web.config of the web application.

 

So, now a user A requests a page for the first time i.e. assuming that the site is being accessed for the very first by a user, it will trigger and download the files from SQL Server and in the WFE cache.

 

Questions:

  1. Now, a user B access the same page for the first time, would he get the files from the WFE cache or not? Assuming that the content shown the page is exactly the same for both the user i.e. no user specific contennt and it consists of CSS, images, JS files.
  2. Now, user A again access the same page i.e. after closing the browser (say in few mins) would he get the files from the WFE cache?

Thanks

 

4 Replies

Hi Devendra,

 

There is an old, but still relevant article in MSDN blogs, describing SharePoint's BLOB Caches nicely. Good to have the reference here.

 

<BlobCache 
location="D:\BlobCache"
path="\.(gif|jpg|png|css|js)$"
maxSize="10"
max-age="86400"
enabled="false"
/>


In the preceding example:

  • location is the directory where the cached files will be stored
  • path specifies in the form of a regular expression which files are cached based on the file extension
  • maxSize is the maximum allowable size of the disk-based cache in gigabytes
  • max-age specifies the maximum amount of time in seconds that the client browser caches BLOBs downloaded to the client computer. If the downloaded items have not expired since the last download, the same items are not re-requested when the page is requested. The max-age attribute is set by default to 86400 seconds (that is, 24 hours), but it can be set to a time period of 0 or greater.
  • enabled is a Boolean that disables or enables the cache. 

 

Coming back to your questions:

 

1. Now, a user B access the same page for the first time, would he get the files from the WFE cache or not? Assuming that the content shown the page is exactly the same for both the user i.e. no user specific contennt and it consists of CSS, images, JS files.

If a next after previous user accesses the same WFE and the same assets which were already cached on the specific WFE and assets still have the same ctag and they are not already cached in the browser, then yes, files from the BLOB storage will be used. 

 

2. Now, user A again access the same page i.e. after closing the browser (say in few mins) would he get the files from the WFE cache?

It's likely that a browser cache will be used, depending on max-age parameter passed and browser's specific settings, otherwise, from WFE's BLOB Cache.

Hi Andrew,

 

Thanks, I too had similar thoughts.

 

However, in practice, I am see a different behavior, maybe am missing something, and thats what I want to find out.

 

Scenario (SharePoint 2013 On-Premise):

We have a publishing page that has multiple (approx 10) SharePoint hosted add-in added as client app parts. Each of these app parts load images, JS, CSS which will not change much. Hence we wanted to enable Server side cahche so that these files are cached on the server while users get the benefit of not retreving from the database.

However, what we have observered is that the resources are getting downloaded from the database for each user for the first time although the content on the page is the same for each user i.e. non user specific content is shown on any of these app parts. We would expect that subsequent should get advantage of the server cahce that was cached beacuse of access from the previous user, but thats not happening.

The server blob cache is enabled in the web.config setting the max-size to 10 GB and max-age is set to 24 hrs i.e. 1 day.

How and what should we check?

Yes, have looked at this technet article which describes about how to configure the BLOB cache, and I have set the same as per this article.