Stefan Goßner

Senior Escalation Engineer for SharePoint Products and Technologies

Blob Caching – be careful when flushing the cache!

In the past I have written a post about Blob Caching and some of the limitations when using this method:

In a recent service request my collegue Gyorgy Homolya worked on a performance problem which affected the site always at a specific time at a day. Analyzing some memory dumps showed that requests to the site were blocking each other waiting for files to be written to the blob cache. That means that effectivly only a single request to the site was processed at a time – all others were waiting for the one being executed to finish.

With other words: for this customer we found that the Blob Cache affected the performance in a negative way rather than improving it. But why did this happen?

The reason is outlined in the following technet article:

  • Plan for caching and performance

    Before you enable the BLOB cache, carefully consider the scenario in which you plan to use it. If your site will be used for heavy collaboration, enabling the BLOB cache might temporarily affect the performance of your site while the files to be cached are first written to the disk. After the files have been stored in the cache, site performance will improve, so take this into consideration when you decide whether or not to enable the cache.

The problem occurred because the blob cache of the customer was empty and had to be refilled. Usually this should only happen once and not every day at the same time. So what was special with this customers implementation?

We found that the customer implemented a method to automatically flush the blob cache once a day. Such a method is outlined e.g. in the following articles:

Usually flushing the blob cache should only be necessary in the unlikely situation that the data on the disk is no longer in sync with the data in the database. This should only happen when restoring a backup of a database but not in normal usage scenarios. So an automatic flush of the blob cache should not be necessary.

If it is, you should raise a support case with Microsoft to analyze why the blob cache gets out of sync with the database content.

Implementing an automatic flush of the cache can cause an performance impact which is bigger than disabling blob caching at all!