Introduction
Tips 1: Cache common data on a web server
Tip 2: Cache common data in Application or Session objects
Tips 3: Cache data and HTML on web server disk
Tip 4: Avoid cache of non-flexible components in Application or Session objects
Tip 5: Don't cache database connections in Application or Session objects
Tips 6: Use Session Objects
Tips 7: Encapsulate code in COM object
Tips 8: Get resources later and release resources early
Tip 9: Execution outside the process will sacrifice reliability
Tip 10: Explicitly use options
Tips 11: Use local variables in subroutines and functions
Tips 12: Copy common data to script variables
Tip 13: Avoid redefining arrays
Tips 14: Use Response Buffer
Tip 15: Batch embedded scripts and Response.Write statements
Tip 16: Use Response.IsClientConnected before starting a long task
Tip 17: Use <OBJECT> to tag instantiate objects
Tip 18: TypeLib binding using ADO objects and other components
Tips 19: Utilize browser verification capabilities
Tip 20: Avoid string concatenation in loops
Tip 21: Enable browser and proxy caching
Tip 22: Use Server.Transfer instead of Response.Redirect if possible
Tips 23: Add a slash at the end of the directory URL
Tip 24: Avoid using server variables
--------------------------------------------------------------------------------
Introduction
Performance is a feature. You need to pre-design performance, or rewrite the application later. In other words, what are good strategies to maximize the performance of Active Server Pages (ASP) applications?
This article provides many tips for optimizing ASP applications and the "Visual Basic(R) Script Editor (VBScript). Many pitfalls and flaws are discussed. The suggestions listed in this article have been tested on http://www.microsoft.com and other sites and are working properly. This article assumes that you have a basic understanding of ASP development, including VBScript and/or JScript, ASP Application, ASP Session, and other ASP internal objects (requests, responses, and servers).
The performance of ASP usually depends more than just on the ASP code itself. We do not want to include all the wise quotes in one article, and only list performance-related resources at the end. These links include ASP and non-ASP topics, including "ActiveX(R) Data Object (ADO), "Component Object Model (COM), database, and "Internet Information Server (IIS)" configurations. These are the links we like - please follow them.
Tips 1: Cache common data on a web server
A typical ASP page retrieves data from a backend database and converts the results into Hypertext Markup Language (HTML). Regardless of the speed of the database, it is much faster to retrieve data from memory than to retrieve data from a backend database. Reading data from a local hard drive is also often much faster than retrieving data from a database. Therefore, performance can often be improved by caching data on a web server (in memory or disk).
Caching is a typical space-time trade-off. If you cache the data properly, you will see a surprising improvement in performance. To make the cache work, it must maintain frequently reused data, and recalculating this data is expensive or relatively expensive. If the cache is full of junk data, it is a waste of memory.