RESOLUTION
To resolve these issues, modify the design of the ASP Web application. Typically, you can use the following methods to resolve these issues:
- Remove the ASP code that is not used in the Web application.
- Remove the include files that are not required to process the ASP files.
- Consolidate common functionality into Microsoft Component Object Model (COM) objects.
Note These methods may not resolve all high memory usage and memory fragmentation issues.
MORE INFORMATION
These issues occur because of the way in which the ASP files are cached. The ASP files are cached as templates that consist of the main ASP file and every include file. If two ASP files have the same include file, two copies of the same include file may be in the cache. For example, if both the Main.asp file and the Login.asp file include the CommonFunctions.asp file, the CommonFunctions.asp file is saved in the template for the Main.asp file and in the template for the Login.asp file. Therefore, two copies of the CommonFunctions.asp file are cached in memory. Additionally, if the CommonFunctions.asp file has include files, two copies of those files are cached in memory.
Note By default, the ASP template cache stores up to 500 templates in IIS 6.0. You can configure this setting in the
AspScriptFileCacheSize property in the Metabase.xml file.
The size of the ASP template cache increases significantly when additional ASP files and a potentially large number of include files are added to the cache. The number of include files also increases significantly. If the ASP files do not use the functionality that is provided by the include files, you can remove the
#include statement for the files that are not used.
If the Web application needs the functionality that is provided by multiple include files, you can consolidate the functionality into a COM object. Typically, we recommend that you consolidate the functionality into a COM object when multiple ASP files need the functionality that is provided by five or more include files.
For example, consider the following scenario:
- A Web site hosts 1000 unique ASP files.
- Each ASP file is approximately 150 kilobytes (KB).
- By default, the ASP template cache stores the maximum of 500 templates.
- Every ASP file uses five include files and stores a copy of each include file in the ASP template cache.
- Each include file is approximately 50 KB.
In this scenario, the ASP template cache is approximately 200 megabytes (MB) before any fragmentation occurs. When files are moved in to and out of the ASP template cache to service incoming requests, the ASP template cache becomes fragmented and increases to 400 MB.
If you consolidate the functionality that is provided by the include files into a COM object, a single instance of the code is required. This code can be called when the functionality is needed. In this scenario, the ASP template cache is approximately 75 MB after you consolidate the functionality that is provided by the include files into a COM object. Therefore, you can increase the default ASP template cache size to 1000 templates, and the ASP template cache is only 150 MB.
Note You must modify the main ASP files to use the COM object instead of the include files.
The use of COM objects instead of the include files has many benefits. The benefits include the following:
- Decreased memory usage for the ASP files and for the Web application
- Reduced memory fragmentation
- Faster performance
Note We recommend that you thoroughly test any Web application that you modify to use COM objects before you deploy the Web application in a production environment.
You can use the Debug Diagnostics tool to determine whether these issues affect the performance of the Web server. The Debug Diagnostics tool is part of the IIS Diagnostics Toolkit. For more information about the IIS Diagnostics Toolkit, visit the following Microsoft Web site:
To use the Debug Diagnostics tool to troubleshoot these issues, follow these steps:
- Install the IIS Diagnostics Toolkit.
- Start the Debug Diagnostics tool.
- On the Processes tab, right-click the process that hosts the Web application, and then click Create Full Userdump.
- On the Advanced Analysis tab, click Add Data Files, click the file that you created in step 3, and then click Open.
- Click Memory Pressure Analysis, and then click Start Analysis.
- In the report that is generated, note the memory fragmentation statistics and the ASP cache size statistics.
You can use the Debug Diagnostic tool to view the number of ASP templates that are cached, the size of each ASP template, and the ASP template hierarchy. To do this, follow these steps:
- Install the IIS Diagnostics Toolkit.
- Start the Debug Diagnostics tool.
- On the Processes tab, right-click the process that hosts the Web application, and then click Create Full Userdump.
- On the Advanced Analysis tab, click Add Data Files, click the file that you created in step 3, and then click Open.
- Click Crash/Hang Analyzers, and then click Start Analysis.
- In the report that is generated, note the statistics in the ASP Report section.