Compartilhar via


Disk-Based Caching for Binary Large Objects in SharePoint Server 2010 (ECM)

Applies to: SharePoint Server 2010

In this article
Enabling and Modifying Disk-Based Caching
Flushing the Disk-Based Cache
Improvements to the Disk-Based Cache

Disk-based caching controls caching for binary large objects (BLOBs) such as image, sound, and video files. Disk-based caching is fast; it 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. You can use an Stsadm command to flush all BLOB caches associated with a specified Web application on different Web front-end computers on the farm: stsadm –o setproperty –propertyname blobcacheflushcount –propertyvalue 11 –urlhttp://mywebapp::port

Enabling and Modifying Disk-Based Caching

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 that is mapped to the Internet Information Services (IIS) Web site:

<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 that are downloaded to the client computer. If the downloaded items have not expired since the last download, the same items are not requested again 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 value that disables or enables the cache.

Flushing the Disk-Based Cache

  1. On the Site Actions menu, point to Site Settings, and then click Modify All Site Settings.

  2. Under Site Collection Administration, click Site collection object cache.

  3. In the Disk Based Cache Reset section, do one or more of the following:

    • To force the server to reset its disk-based cache, select Force this server to reset its disk based cache.

    • To force all servers to reset their disk-based caches, select Force all servers in the farm to reset their disk based cache.

    Note

    If you select one or more of the check boxes, all entries in the disk caches are flushed immediately when you click OK. If you do not select any of the check boxes, the disk caches are left unchanged and item expiration is managed, with items being removed when they are changed in the site or when the disk size is exceeded.

  4. Click OK.

Improvements to the Disk-Based Cache

Microsoft SharePoint Server 2010 introduces new functionality to the disk-based cache by increasing farm capacity, increasing throughput, and supporting digital media assets.

The primary goal of the disk-based cache is to increase the capacity of the farm by reducing the load on Microsoft SQL Server. The disk-based cache does this by storing the contents of files on the hard drive of the front-end Web servers. When a request for a file that is not cached is handled by a front-end Web server, the disk-based cache gets the file from SQL Server, saves it to disk, and serves the file to the client that requested it. Future requests for the same file that are handled by that front-end Web server are then served from the file that is stored on the disk, instead of being served from SQL Server. Each front-end Web server maintains its own cache.

The disk-based cache also improves server throughput when accessing cached files, because the files can be immediately served back to a client without having to access SQL Server first.

The disk-based cache supports digital asset media in SharePoint Server 2010 by providing HTTP byte range support; the disk-based cache can now serve requests for parts of files. The disk-based cache caches the whole file on disk, but requests that are made for part of a file (for example, the last 5 MB of video) get back only the bytes that are requested, not the entire file. Returning only parts of files saves bandwidth, and more importantly, it enables media players to make "seek" requests to a disk-based cached file. For example, if you decide to skip to near the end of a video that you are watching on Windows Media Player, it calculates which byte range you are seeking and makes a range request for the bytes that it wants.

When managing large files, such as videos and other rich media, SharePoint Server 2010 needs to account for the fact that they take longer to get from SQL Server, and therefore create greater latency for clients. To solve this problem, the disk-based cache downloads the content from SQL Server in small pieces. After the disk-based cache has downloaded a few pieces, it begins sending the file to the client. This approach greatly improves the "time to first byte" (TTFB) experience on the client, because the whole file does not need to be received from SQL Server before the disk-based cache can start to serve the file.

You can further limit bandwidth consumption on your server by using bit-rate throttling, which is the ability to slow down the rate at which files can be downloaded. This functionality is provided by the IIS Media Pack module. The module does not add or remove any SharePoint Server functionality, but it enables more simultaneous connections because each connection uses less bandwidth.

See Also

Concepts

Custom Caching Overview in SharePoint Server 2010 (ECM)

Output Caching and Cache Profiles in SharePoint Server 2010 (ECM)

Object Caching in SharePoint Server 2010 (ECM)

Managing Rich Media Assets in SharePoint Server 2010 (ECM)