SharePoint 2013 BLOB Cache

%3CLINGO-SUB%20id%3D%22lingo-sub-37108%22%20slang%3D%22en-US%22%3ESharePoint%202013%20BLOB%20Cache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-37108%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20have%20a%20question%20that%20wanted%20someone%20to%20clarify%2Fconfirm.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20we%20enable%20BLOB%20cache%20on%20a%20SharePoint%20Server%202013%20WFE%20and%20specify%20the%20file%20types%2C%20then%20those%20file%20types%20will%20be%20cached%20at%20the%20WFE%20server%20at%20the%20location%20specified%20for%20the%20max%20age%20specified%20in%20the%20web.config%20of%20the%20web%20application.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%2C%20now%20a%20user%20A%26nbsp%3Brequests%20a%20page%20for%20the%20first%20time%20i.e.%20assuming%20that%20the%20site%20is%20being%20accessed%20for%20the%20very%20first%20by%20a%20user%2C%20it%20will%20trigger%20and%20download%20the%20files%20from%26nbsp%3BSQL%20Server%20and%26nbsp%3Bin%20the%20WFE%20cache.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EQuestions%3A%3C%2FP%3E%3COL%3E%3CLI%3ENow%2C%26nbsp%3Ba%20user%20B%20access%20the%20same%20page%20for%20the%20first%20time%2C%20would%20he%20get%20the%20files%20from%20the%20WFE%20cache%20or%20not%3F%20Assuming%20that%20the%20content%20shown%20the%20page%20is%20exactly%20the%20same%20for%20both%20the%20user%20i.e.%20no%20user%20specific%20contennt%20and%20it%20consists%20of%20CSS%2C%20images%2C%20JS%20files.%3C%2FLI%3E%3CLI%3ENow%2C%20user%20A%20again%20access%20the%20same%20page%20i.e.%20after%20closing%20the%20browser%20(say%20in%20few%20mins)%20would%20he%20get%20the%20files%20from%20the%20WFE%20cache%3F%3C%2FLI%3E%3C%2FOL%3E%3CP%3EThanks%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-37108%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-37376%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%202013%20BLOB%20Cache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-37376%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20have%20looked%20at%20this%20technet%20article%20which%20describes%20about%20how%20to%20configure%20the%20BLOB%20cache%2C%20and%20I%20have%20set%20the%20same%20as%20per%20this%20article.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-37367%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%202013%20BLOB%20Cache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-37367%22%20slang%3D%22en-US%22%3E%3CP%3EHave%20you%20seen%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fcc261797.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fcc261797.aspx%3C%2FA%3E%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-37326%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%202013%20BLOB%20Cache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-37326%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Andrew%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%20I%20too%20had%20similar%20thoughts.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20in%20practice%2C%20I%20am%20see%20a%20different%20behavior%2C%20maybe%20am%20missing%20something%2C%20and%20thats%20what%20I%20want%20to%20find%20out.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EScenario%20(SharePoint%202013%20On-Premise)%3A%3C%2FP%3E%3CP%3EWe%20have%20a%20publishing%20page%20that%20has%26nbsp%3Bmultiple%20(approx%2010)%26nbsp%3BSharePoint%20hosted%20add-in%20added%20as%20client%20app%20parts.%20Each%20of%20these%26nbsp%3Bapp%20parts%20load%20images%2C%20JS%2C%20CSS%20which%20will%20not%20change%20much.%20Hence%20we%20wanted%20to%20enable%20Server%20side%20cahche%20so%20that%20these%20files%20are%20cached%20on%20the%20server%20while%20users%20get%26nbsp%3Bthe%20benefit%20of%20not%20retreving%20from%20the%20database.%3C%2FP%3E%3CP%3EHowever%2C%20what%20we%20have%20observered%20is%20that%20the%20resources%20are%20getting%20downloaded%20from%20the%20database%26nbsp%3Bfor%20%3CSTRONG%3Eeach%20user%3C%2FSTRONG%3E%20for%20the%20first%20time%20although%20the%20content%20on%20the%20page%20is%20the%20same%20for%20each%20user%20i.e.%20non%20user%20specific%20content%20is%20shown%20on%20any%20of%20these%20app%20parts.%20We%20would%20expect%26nbsp%3Bthat%20subsequent%20should%20get%20advantage%20of%20the%20server%20cahce%20that%20was%20cached%20beacuse%20of%20access%20from%20the%20previous%20user%2C%20but%20thats%20not%20happening.%3C%2FP%3E%3CP%3EThe%20server%20blob%20cache%20is%20enabled%20in%20the%20web.config%20setting%20the%20max-size%20to%2010%20GB%20and%26nbsp%3Bmax-age%20is%20set%20to%2024%20hrs%20i.e.%201%20day.%3C%2FP%3E%3CP%3EHow%20and%20what%20should%20we%20check%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-37161%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%202013%20BLOB%20Cache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-37161%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Devendra%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20is%20an%20old%2C%20but%20still%20relevant%20article%20in%20%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Fspses%2F2012%2F08%2F28%2Fblob-cache-in-sharepoint%2F%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EMSDN%20blogs%3C%2FA%3E%2C%20describing%20SharePoint's%20BLOB%20Caches%20nicely.%20Good%20to%20have%20the%20reference%26nbsp%3Bhere.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%3CPRE%3E%3CBLOBCACHE%3E%3CBR%20%2F%3E%20%20%20%20%20location%3D%22D%3A%5CBlobCache%22%20%3CBR%20%2F%3E%20%20%20%20%20path%3D%22%5C.(gif%7Cjpg%7Cpng%7Ccss%7Cjs)%24%22%20%3CBR%20%2F%3E%20%20%20%20%20maxSize%3D%2210%22%20%3CBR%20%2F%3E%20%20%20%20%20max-age%3D%2286400%22%20%3CBR%20%2F%3E%20%20%20%20%20enabled%3D%22false%22%3CBR%20%2F%3E%2F%26gt%3B%3C%2FBLOBCACHE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3EIn%20the%20preceding%20example%3A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CSTRONG%3Elocation%3C%2FSTRONG%3E%20is%20the%20directory%20where%20the%20cached%20files%20will%20be%20stored%3C%2FLI%3E%3CLI%3E%3CSTRONG%3Epath%3C%2FSTRONG%3E%20specifies%20in%20the%20form%20of%20a%20regular%20expression%20which%20files%20are%20cached%20based%20on%20the%20file%20extension%3C%2FLI%3E%3CLI%3E%3CSTRONG%3EmaxSize%3C%2FSTRONG%3E%20is%20the%20maximum%20allowable%20size%20of%20the%20disk-based%20cache%20in%20gigabytes%3C%2FLI%3E%3CLI%3E%3CSTRONG%3Emax-age%3C%2FSTRONG%3E%20specifies%20the%20maximum%20amount%20of%20time%20in%20seconds%20that%20the%20client%20browser%20caches%20BLOBs%20downloaded%20to%20the%20client%20computer.%20If%20the%20downloaded%20items%20have%20not%20expired%20since%20the%20last%20download%2C%20the%20same%20items%20are%20not%20re-requested%20when%20the%20page%20is%20requested.%20The%20max-age%20attribute%20is%20set%20by%20default%20to%2086400%20seconds%20(that%20is%2C%2024%20hours)%2C%20but%20it%20can%20be%20set%20to%20a%20time%20period%20of%200%20or%20greater.%3C%2FLI%3E%3CLI%3E%3CSTRONG%3Eenabled%3C%2FSTRONG%3E%20is%20a%20Boolean%20that%20disables%20or%20enables%20the%20cache.%26nbsp%3B%3C%2FLI%3E%3C%2FUL%3E%3C%2FBLOCKQUOTE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EComing%20back%20to%20your%20questions%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%3CP%3E1.%20Now%2C%26nbsp%3Ba%20user%20B%20access%20the%20same%20page%20for%20the%20first%20time%2C%20would%20he%20get%20the%20files%20from%20the%20WFE%20cache%20or%20not%3F%20Assuming%20that%20the%20content%20shown%20the%20page%20is%20exactly%20the%20same%20for%20both%20the%20user%20i.e.%20no%20user%20specific%20contennt%20and%20it%20consists%20of%20CSS%2C%20images%2C%20JS%20files.%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3EIf%20a%20next%20after%20previous%20user%20accesses%20the%20same%20WFE%20and%20the%20same%20assets%20which%20were%20already%20cached%20on%20the%20specific%20WFE%20and%20assets%26nbsp%3Bstill%20have%20the%20same%20ctag%20and%20they%20are%20not%20already%20cached%20in%20the%20browser%2C%20then%20yes%2C%20files%20from%20the%20BLOB%20storage%20will%20be%20used.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%3CP%3E2.%20Now%2C%20user%20A%20again%20access%20the%20same%20page%20i.e.%20after%20closing%20the%20browser%20(say%20in%20few%20mins)%20would%20he%20get%20the%20files%20from%20the%20WFE%20cache%3F%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3EIt's%20likely%20that%20a%20browser%20cache%20will%20be%20used%2C%20depending%20on%20max-age%20parameter%20passed%20and%20browser's%20specific%20settings%2C%20otherwise%2C%20from%20WFE's%20BLOB%20Cache.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
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
Highlighted

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.

Highlighted

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?

Highlighted
Highlighted

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.