File Cache (IIS 6.0)

The IIS file cache stores file contents in memory. If the file is larger than the 256 KB default maximum file size, IIS creates a file handle, passes the handle to HTTP.sys, and then closes the handle. The maximum file size is controlled by the MaxCachedFileSize registry key. For more information about the MaxCachedFileSize registry key, see Global Registry Entries.

The IIS 6.0 file cache uses an algorithm that attempts to cache only frequently requested files. The algorithm requires that a file be requested at least twice in a 10-second activity period, or the file will not be cached. In the case of a request for a Default.htm file, the activity-period algorithm works in this way:

1.

The worker process receives the request for Default.htm.

2.

The worker process checks to see if the file is in the IIS file cache table. At this point, the file has not been cached yet (that is, no cache entry is found).

3.

The IIS file cache checks the activity table to see if Default.htm has been requested within the last 10 seconds. Because the file has not been requested, the file cache enters Default.htm in the activity table and serves out the file handle.

4.

Three seconds later, the worker process receives another request for Default.htm.

5.

The file cache does not find the cache entry in the cache table, but the activity table contains an entry that is within the 10-second activity period.

6.

The file cache again serves out the file handle, but this time the file cache gets the cache entry from the worker process and stores the cache entry in the cache table (the cache table flushes all unused entries every 30 seconds).

7.

A third request for Default.htm is served directly from the file cache.

You can configure the activity period (which is 10 seconds by default) by modifying the ActivityPeriod registry entry. If you set the value of ActivityPeriod to 0, IIS always caches files. The ActivityPeriod registry entry is located in the following subkey:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters

  Caution

Do not edit the registry unless you have no alternative. The registry editor bypasses standard safeguards, allowing settings that can damage your system, or even require you to reinstall Windows. If you must edit the registry, back it up first and see the Registry Reference.

Windows provides file cache change notification at the directory level. This means Windows monitors the parent file directory and informs IIS when a file in the directory or any subdirectory has changed. When IIS gets the change notification, the worker process flushes the file from the IIS file cache.

Table 7.4 describes the preferred or ideal values for file cache counters. For more information about IIS 6.0 counters, see the Performance Counters Reference.

Table 7.4 Preferred Values for File Cache Counters
Object\CounterPreferred or Ideal Value

Web Service Cache\Current Files Cached

Depends on content. A low value can indicate that HTTP.sys is caching a majority of static files, which is ideal. If the content files cannot be cached by HTTP.sys, a high value is good.

Web Service Cache\File Cache Flushes

Note that this counter value represents the number of times the cache was flushed, and not the number of files flushed. This value will continue to increase over time. If you edit files or change files often, this value will increase more rapidly.

Web Service Cache\File Cache Hits

Depends on content. If the content files cannot be cached by HTTP.sys, a high value is good.

Web Service Cache\File Cache Hits%

If the Kernel: Cache Hits % counter is low, this value should be high. If Kernel: Cache Hits % is low and this value is low, examine your file set and determine why your files are not being cached. Note that this counter does not include dynamic content, only static files. If your static files are not being cached, you might want to lengthen the activity period for this cache.

Web Service Cache\File Cache Misses

A file cache miss means the request for the file must go to the hard disk. File cache misses negatively impact performance and scalability. This value should be as low as possible. Also note that kernel cache hits will cause this value to be low.

Web Service Cache\Total Flushed Files

As low as possible. This value will increase if you edit or change content files, which results in a cache flush.

Web Service Cache\Maximum File Cache Memory Usage

The value of this counter and the value of Web Service Cache\Current File Cache Memory Usage should be the same. If the numbers are different, the cache was flushed. If this counter is significantly higher than Web Service Cache\Current File Cache Memory Usage, you might consider recycling the worker process because the application might have a memory leak.

Web Service Cache\Total Files Cached

Ideally, this value will be the same as Web Service Cache\Current Files Cached. If you edit or change your content files and subsequently flush the file cache, this value will decrease.

Related Topics

For more information about editing the registry, see the Registry Reference.



© 2016 Microsoft Corporation. All rights reserved. Contact Us |Terms of Use |Trademarks |Privacy & Cookies
Microsoft