Blob Cache in SharePoint


1.What is Blob Cache?

Disk-based Caching for Binary Large Objects

Disk-based caching controls caching for binary large objects (BLOBs) such as image, sound, and video files, as well as code fragments. Disk-based caching is extremely fast and eliminates the need for database round trips. BLOBs are retrieved from the database once and stored on the Web client. Further requests are served from the cache and trimmed based on security.

2.Enabling and modifying disk-based caching for SharePoint sites.

Disk-based caching is disabled by default. To enable and customize the disk-based cache, you must modify the following statement in the web.config file for the SharePoint Web application.

By default, it looks like this:
<BlobCache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="10" enabled="false" />

In order to improve the performance of your site, the BlobCache should be enabled.
<BlobCache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="10" enabled="true" />


<BlobCache location="C:\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.

3. Flushing the Disk-based Cache:

We can flush the current site collection object cache. To do this, browse to the following location on the web site,
Site collection administration -> site collection object cache -> disk based cache reset.

If we have multiple WFEs in the farm, each WFE will maintain its own copy of Disk-based Cache. SharePoint does not have a Web user interface (UI) to flush the disk-based cache on all the servers in a farm and neither is there an option to select a specific WFE.

4.The option provided in the Administration page for flushing the cache is only to the flush the cache on the web front end to which you are currently browsing.

if you would like to flush the complete binary large object (BLOB) caches associated with a specific Web Application on different Web front-end computers in a farm, then you can use the STSADM command to do so.

STSADM -o setproperty -propertyname blobcacheflushcount -propertyvalue 11 -url http://mywebapp:port

5.Internals of the blob cache functionality within SharePoint:

After enabling blob cache in web.config, do an IISRESET and browse to the /settings.aspx first, instead of home page (Collaboration portal site).

When we browse to the settings.aspx, it will create the following files change.bin, dump.bin and flushcount.bin (all the files will be 1KB in size).

Browse to the home page now, it will create a folder PUBLISHINGIMAGES, all the images rendered from the database will be stored here and the above bin files will also get updated (we can see the difference in file size).

Every time when a new image file is rendered from the database, the image folder gets a copy of the image. The bin files (index) will get updated with an additional entry for the new file.

Every request from client will check the index file first. It will only check the cache index and not the image folder directly for the image. If the index file does not have an entry for the image, then the request is served from the database. During this time, a copy of the image will be stored in the images folder and the index file also gets updated, so that the next request will not go to the database.

6.What happens I manually delete just the image file in the cache folder or the image file in the cache folder gets corrupted?

We will not see the image on the client page; we get a broken image ‘X’.

7.How are these cache files stored?

Filename.extension.cache is the file naming format.

8.What can I do if the cached file gets corrupted?

Recommendation: We can reset the index file. Site settings -> Site collection object cache -> Check the box for “Force this server to reset its disk based cache”. It will completely delete all the images and reset the bin files back to 1KB, so that next request will go to database and the complete index will get rebuilt.

Workaround: If you do not want to reset the complete index. Find out the missing image and copy just that file to the cache folder, name it as “filename.extension.cache”
Refresh the page now; it should pick up the image.

9.How is the Index file maintained?

Every time when the web.config initializes, the index file is loaded from the blobcache folder to memory. All new entries will keep getting updated in index file when in memory.
IISRESET /stop will flush the updated index file from memory to disc within the blobcache folder.
IISRESET /start will load the index file from blobcache folder to memory.
As long as the application pool is alive the index file will be getting updated in memory itself.

10.Can an Index file get corrupt?

Index file corruption is possible only when IIS crash or the index file is overwritten with wrong information. When IIS tries to load the index file from blobcache to memory and identifies that it is a corrupted file (not a valid file), it will get completely rebuilt (flush) as fresh file (1KB), all the old entries and images will be lost.

11.In a farm environment, is there any way of having all the WFEs’ blob caches synchronized among each other?

No, this cannot be done because SharePoint maintains the index and the cache files individually on each server.

12.In a single WFE environment using web gardening, how does blob caching function? Is there any sync that happens among the working processes?

Web gardening is not supported.

13.What would be the best way of using blob cache in a farm environment (best practices)?

If the requirement is to “centralize” static cached files, then 3rd party content distribution network (CDN) solutions like Akamai need to be used.

What are the limitations of SharePoint and blob caching in a farm environment?
a. Blob caching does not work with Web Gardening.
b. Blob caching does not synchronize data across WFEs – so we might be seeing different versions of the files for a short duration across different WFE servers.

Ported from

Post By: Selvakumar Ganapathi [MSFT]

Comments (12)

  1. Files not get deleted from blobcache says:


    We had observed one old file(2 yrs old) in blobcache. It was not deleted somehow. We have set max-age attribute also. Some one had old link to that file and accessed. It was started appearing in site search.

    What could be the issue ?

  2. Hemant says:

    Include specific folder content in BlobCache SharePoint :

  3. Praveen from NSS-Cognizant-Chennai says:

    Nice Post Selva. Was very useful Indeed. !!

  4. Shashank says:

    Please let me know how to change the location of the Blob cache from C drive to other drives in a existing environment

    1. BlueSky2010 says:

      @Shashank – you can change the path from the Web application’s Web.config file. You can find Web.config path from this thread. Hope this helps!

  5. It is good to be aware of the fact that the use of IIS blob caching for certain file types (in our case .mp4) interferes with auditing in SharePoint 2013. If the users GET a file that will be cached in the IIS blob cache, only the first request for that file will be recorded in the audit database. If there are four web front ends, auditing will show four requests. All subsequent requests for that file will not be audited while the file is in the cache.

    1. BlueSky2010 says:

      Thanks for sharing Christopher – good to know!

  6. BlueSky2010 says:

    We ran into a scenario where in a SharePoint 2013 farm one Web application’s BlobCache somehow got out of Sync (content DB was not restored). Showing old images. Tried Flushing cache following below Technet article but the folder’s content in the file system seems to stay the same. Even though it says script ran successfully – anyone ran into this? Can I delete the contents manually?

    Appreciate any feedback!

    1. Bo George says:

      BlueSky, did you every find out the best method for cleaning up when it gets out of sync? We had this happen as well and I deleted the files which fixed the browser, however, it doesn’t look like they are being re-created.

  7. Naga says:

    Hi Selva,

    In our environment we have alias set up for sql , We are receiving error Cannot connect to SQL Server. Server name not found. Additional error information from SQL Server is included below.

    Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was – [Pre-Login] initialization=12908; handshake=2085;

    When the above error pops up it shows An error occurred in the blob cache. The exception message was ‘Exception from HRESULT: 0x80131904’. Can you please help with the issue is there any issue with blob cache enabled, This is happening on different times and we cannot even when this sis coming up its logging in event error once a day, and some times the error will not be in the event logs

  8. nsp12 says:

    Hi Selva,
    we have SQL alias set up and had sql connection time outs. During SQL timeouts there will be cache error Please help me this, Enabling blob cache cause any time out issues attached log event error logs.
    An error occured in the blob cache. The exception message was ‘Exception from HRESULT: 0x80131904’.

    Cannot connect to SQL Server. Server 3-SQL not found. Additional error information from SQL Server is included below. Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was – [Pre-Login] initialization=12908; handshake=2085
    Appreciate any solution .

  9. Pablo Henrique says:

    Thank you ! awesome contribution
    Could you tell us also if we have a documentation about calculating server requisites when BLOB is activated ?

Skip to main content