ASP Template Caching (IIS 6.0)

ASP processes the templates or template files that contain ASP scripts. ASP stores these templates in a template cache and then serves the cached templates for subsequent client requests. Caching ASP templates enhances performance and scalability, because cached templates are not compiled each time they are called.

The ASP template cache uses a least-recently-used algorithm for determining which templates are cached. This means that if the cache is full, the template that has been in the cache and has not been requested for the longest amount of time is replaced by the next template to enter the cache. Every time a new template is added to the cache, the template goes to the beginning of the cache. The ASP template cache stores up to 500 templates by default (as determined by the AspScriptFileCacheSize metabase property). Templates are moved to the beginning of the cache when they are requested. In the case where the 501st template is bumped from the cache, the template is written to disk. By default, the ASP disk cache can hold 2,000 templates (as determined by the AspMaxDiskTemplateCacheFiles metabase property). If a template in the disk cache is referenced, the template is moved back to the ASP template cache.

In worker process isolation mode, AspScriptFileCacheSize and AspMaxDiskTemplateCacheFiles are global settings, which means they apply to all ASP pages on the Web server. (They are process-level settings in IIS 5.0 isolation mode.) ASP pages can contain #include files and these #includefiles can make the ASP files very large. The default 500-file limit established by the ASP template cache applies only to ASP pages and not #include files. However, ASP files that contain #include files can grow large enough to cause memory shortages and errors. ASP will flush the ASP template cache if IIS runs out of memory. If the ASP template cache is flushed, each subsequent request to an ASP page will need to be recompiled before it is cached again. In these situations, you might see ASP queuing. If you display the Active Server Pages\In Memory Templates Cached counter in System Monitor and see spikes followed by a severe reduction in the number of cached templates, your ASP pages might be too big. This could cause your system to run out of memory, flush the cache, recompile, and then run out of memory again. To remedy this situation, reduce the size of the ASP template cache to a number less than 500. Table 7.6 lists the preferred or ideal values for ASP template cache counters. For more information about IIS 6.0 counters, see the Performance Counters Reference.

Table 7.6 Preferred Values for ASP Template Cache Counters
Object\CounterPreferred or Ideal Value

Active Server Pages\In Memory Templates Cached

The value of this counter should reflect the number of frequently requested ASP files on your site (also known as your hot set).

Active Server Pages\In Memory Template Cache Hit Rate

As high as possible.

Active Server Pages\Templates Cached

The value of this counter should be close to the value of the AspMaxDiskTemplateCacheFiles metabase property; however, this value represents the total number of templates cached in memory and cached to disk, so this value could be higher than AspMaxDiskTemplateCacheFiles.

Active Server Pages\Template Cache Hits

As high as possible.

Active Server Pages\Template Cache Hit Rate

If this value is low and the Active Server Pages\In Memory Template Cache Hit Rate is high, a majority of user requests are being served from the memory cache. Performance and scalability should show a positive impact by not having to read the template from disk. If the value of Active Server Pages\Templates Cached equals the value of the AspMaxDiskTemplateCacheFiles metabase property, the cache has reached its maximum value. When the cache has reached its maximum value, this value should be high, otherwise the cache is being flushed.

The ASP disk cache begins caching files into a directory when the ASP memory cache is full. Furthermore, a file has to be requested at least twice before it becomes a candidate for the ASP disk cache. The corresponding metabase property, AspMaxDiskTemplateCacheFiles, specifies the maximum number of compiled ASP templates that can be stored. AspDiskTemplateCacheDirectory contains the name of the directory that ASP uses to store compiled ASP templates to disk after overflow of the in-memory cache.

  Important

In order for disk caching to work, ASP needs a properly configured disk cache directory in which to store the compiled ASP files. This means that the Administrators and IIS_WPG groups have Read/Write and Delete permission on the disk cache directory, and the disk cache directory is a local directory on the Web server.

The default location of the disk cache is systemroot\System32\inetsrv\ASP Compiled Templates. In worker process isolation mode, subdirectories under the disk cache directory are created for each application pool. In IIS 5.0 isolation mode, the default disk cache directory is windir\system32\inetsrv\ASP Compiled Templates.

For information about changing the settings for caching ASP templates and creating an ASP disk cache directory, see Configuring ASP Template Caching.



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