Microsoft KB Archive/914156

= When you host a Web application that is mainly composed of ASP files in Internet Information Services, you notice slow performance, or you receive error messages =

Article ID: 914156

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft Internet Information Services 6.0
 * Microsoft Internet Information Services 5.0

-





SYMPTOMS
In Microsoft Internet Information Services (IIS), you host a Web application that is mainly composed of Active Server Pages (ASP) files. When a client computer requests an ASP file, one or more of the following issues occur:  You notice slow performance and increased memory usage on the Web server. The W3wp.exe process, the Inetinfo.exe process, or the Dllhost.exe process that hosts the Web application becomes very large. You receive one or both of the following error messages:

Error message 1

Out of memory

Error message 2

Cannot Create Object





CAUSE
These issues occur when one or both of the following conditions are true:
 * The memory in the host process becomes very large and fragmented. When the memory in the host process becomes fragmented, a block of contiguous memory that is large enough to service the request may not exist. Therefore, the host process cannot allocate the minimum amount of memory, and you receive an error message.
 * Memory is unavailable because of the number of ASP files and of include files that are cached.



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:

http://www.microsoft.com/windowsserver2003/iis/diagnostictools/default.mspx

To use the Debug Diagnostics tool to troubleshoot these issues, follow these steps:
 * 1) Install the IIS Diagnostics Toolkit.
 * 2) Start the Debug Diagnostics tool.
 * 3) On the Processes tab, right-click the process that hosts the Web application, and then click Create Full Userdump.
 * 4) On the Advanced Analysis tab, click Add Data Files, click the file that you created in step 3, and then click Open.
 * 5) Click Memory Pressure Analysis, and then click Start Analysis.
 * 6) 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:
 * 1) Install the IIS Diagnostics Toolkit.
 * 2) Start the Debug Diagnostics tool.
 * 3) On the Processes tab, right-click the process that hosts the Web application, and then click Create Full Userdump.
 * 4) On the Advanced Analysis tab, click Add Data Files, click the file that you created in step 3, and then click Open.
 * 5) Click Crash/Hang Analyzers, and then click Start Analysis.
 * 6) In the report that is generated, note the statistics in the ASP Report section.

Keywords: kbinfo kbtshoot kbprb kbasp KB914156

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.