Using ASP on a busy server? Finding that it can't cope? Try our tips for making everything run faster, smoother and altogether more froody.Performance goals vary from application to application. You should set yourgoals to correspond with your expected user traffic. In general, you shouldaim for 20 pages or more per second with less than 30 percent CPUutilization, and response times of 10 seconds or less.
- Retrieving values from collections is relatively slow. Store retrievedvalues in local variables if you need to access them more than once.
- Avoid using server-side
#include directives to include large lists ofconstants.
- Use the new
<METADATA> tag to import type-library constants intoglobal.asa.
- Avoid using
<OBJECT> tags instead.
- Group multiple Response.Write statements, and delimit them with one set of
<% %> delimiters.
- Avoid redimensioning VBScript arrays.
- Use only one scripting language per page.
- Buffered responses (Response.Buffer=True) are faster than unbuffered ones(although they can appear less responsive).
Response.IsClientConnected during the processing of long scripts. Thisproperty determines if the client has disconnected from the server since thelast
Response.Write, and improves application responsiveness during times ofpeak usage.
- Use components to encapsulate business logic rather than complex script. Convert dynamic ASP output to static HTML using the ASP2HTM componentwherever possible. (ASP2HTM is included on the Internet Information Server(IIS) Resource Kit CD.)
- Store commonly requested, unchanging content in memory using anapplication-scope Dictionary object. Avoid using Session_OnEnd event procedures, if possible.
- Disable the Session object on a page-by-page basis with the
<%@EnableSessionState=False %> statement. This declarative allows ASP toprocess scripts concurrently, rather than sequentially.
- Write client scripts that don't require roundtrips to the server. Distributework to the client, such as form input validation. Use the BrowserCapabilities component (MSWC.BrowserType) and customize client-side scriptsto take advantage of the browser, incorporating such technologies as DHTML,client-side script, and ActiveX? controls.
- Focus your optimization efforts on the most common paths through your siteor application. You can determine user behavior with IIS service logs andthe Usage Import and Report Writer component of Site Server Express.
Response.Expires appropriately so that proxy servers can intelligentlycache information that doesn't change often.
- Optimize the use of ADO Connection objects, with ODBC connection pooling andstored procedures.
- Measure system performance with tools such as Task Manager, NetMon, andPerfMon. Measure Web capacity with WCAT. Profile portions of your ASP scriptwith the ASP Tracer component. For more information see the IIS ResourceKit.
- Try to keep one ASP page to One application.Use SQL stored procedures wherever possible.
These tips are culled from MSDN, where there may be even more.