Twenty-eight skills to improve ASP performance and appearance

zhaozj2021-02-16  167

Twenty-eight Skills to improve ASP performance and appearance Len cardinal, advanced consultant, Microsoft Consulting Services George V. REILLY Microsoft IIS Performance Lead Adapt from Nancy Cluts Article Developer Technical Engineer Microsoft Corporation 2000 Abstract: This article introduction Optimize ASP Applications and VBScript tips. table of Contents

Tips 1: Cocaine the frequently used data on the web server 2: Cocaine frequently used in the application or session object 3: Cocard the data and HTML on disk on the web server 4: Avoid nonsense Components Cacked in Application or Session Objects 5: Do not use the database connection in Application or Session objects 6: Reasonably use session object skills 7: package code package in COM objects 8: Late get a resource, earlier Release Resource Skills 9: Process External Execution Process with Performance Change Reliability Tips 10: Using Explicit Options Tips 11: Using local variable tips in subroutines and functions 12: Copy the data commonly used to script variables 13: Avoid re-determining the dimension tips of the array 14: Use the response buffer tip 15: Batch Inclusive and response.write statement skills 16: If the page takes a long time to complete, use response.isclientConnected skills before execution 17: Use < Object> Tag Example Object Skills 18: Use TypeLib Binding Tips for ADO and Other Components 19: Using Browser Verification Function Tips 20: Avoid using string tangible tricks in a loop statement 21: Enable browser and proxy cache skills 22: Use Server.Transfer instead of Response.Redirect Tips 23: Rear Slash Tips in Directory URL 24: Avoid Using Server Variable Tips 25: Upgrade to Latest and Experienced Tips 26: Optimizing Web Server Tips 27: Performance Test Tips 28: Reading resource links Introduction Performance is a feature. You must pre-design performance, otherwise you have to rewrite the application later. That is to say, what good strategies can make Active Server Pages (ASP) performance best? This article describes how to optimize ASP applications and Visual Basic? Scripting Edition (VBScript). This article discusses many traps. The recommendations listed herein have been tested in http://www.microsoft.com and other sites, and the effect is very significant. This article assumes that you have developed ASP, including VBScript, and / or JScript, ASP Application, ASP Session, and other ASP inherent objects (Request, Response, and Server) have basically understood. Typically, ASP performance depends primarily on many factors other than ASP code itself. We are not in an article to listen out all the information, and we list the resources related to performance at the end of this article. These links cover ASP and non-ASP topics, including ActiveX® Data Objects (ADOs, Component Object Models, Database, and Internet Information Server (IIS) configuration. These are some links we like - must go see. Tips 1: Retrieve data from the typical ASP page that is often used on the web server, and converts the results into hypertileble language (HTML) on the back-end data store. Regardless of the speed of the database, retrieving data from memory is much faster than retrieving data from backend data storage. Reading data from a local hard drive is usually faster than retrieving data from a database. Therefore, the data can be cached on the web server (stored in memory or disk) to improve performance.

The cache is a traditional way of spatial exchange time. If your cached content is correct, you can see performance. To make the cache valid, you must save the data that are frequently used frequently, and to recalculate these data required (moderate) large overhead. If the cache is some old data, it will cause memory waste. Data that do not change often is a good cache candidate data, because you don't have to worry about the issue of data and database synchronization over time. Combination Box List, Reference Table, DHTML Debris, Extended Markup Language (XML) string, menu item, and site configuration variable (including data source name (DSN), Internet Protocol (IP) address, and web paths) are well cache Candidate content. Note that you can cache the "representation" of the data without causing the data itself. If the ASP page is rare, the overhead of the cache is also large (for example, the entire product catalog), you should consider generating HTML in advance instead of replaying each request. Where is the data can be slow, what caokes strategy? Typically, the data can be cached in the memory or disk of the web server. The next two techniques tell these two methods. Tips 2: Cocaine the frequently used data in Application or session objects ASP Application and Session objects provide a convenient container that makes data cache in memory. You can assign data to the Application and Session objects, which are kept in memory between HTTP calls. The session data is stored separately according to each user, and Application data is shared between all users. When do you load the data into the Application or Session? Typically, the data is loaded when the Application or Session is started. To load data during the Application or Session startup process, the appropriate code should be added to Application_onstart () or session_onstart (). These functions should be in Global.asa, and if not, these functions can be added. This data can also be loaded during the first time. To do this, some code is added (or writing a reusable script function) to check if the data exists, if not, load data. This is a traditional performance technology called "inert calculation" - do not calculate this value before you know that you need a value. For example: (?? EmploymentStatusList) (?? EmploymentStatusList) <% Function GetEmploymentStatusListDim dd = Application If d = ?? Then 'FetchEmploymentStatusList function (not shown)' fetches data from DB, returns an Arrayd = FetchEmploymentStatusList () Application = dEnd IfGetEmploymentStatusList = Dend function%> You can write a similar function for each data block you need. What format should store data? Any variant type can be stored because all script variables are variable. For example, you can store strings, integers, or arrays. Typically, you will save the contents of the ADO record set in one of these variable types. To get data from the ADO recordset, you can manually copy the data to the VBScript variable, one field.

Use an ADO record set for jury function GetRows (), getString () or Save () (ADO 2.5), speed and easier. The details have exceeded the scope discussed herein, but a function is given below, indicating an array of generators using getRows () returns record set: 'get recordset, return as an arrayfunction fetchemploymentStatusListdim RS set RS = CREATEOBJECT (? AdoDB ?? .Recordset) rs.Open select statusName, StatusID from EmployeeStatus ?, _ dsn = employees;? uid = sa;? pwd = ;? FetchEmploymentStatusList = rs.GetRows () Return data as an Arrayrs.CloseSet rs = NothingEnd Function of The above example is further improved, and the HTML can be cached as a list instead of an array. The following is a simple example: 'Get Recordset, return as HTML Option listFunction FetchEmploymentStatusListDim rs, fldName, sSet rs = CreateObject rs.Open select StatusName, StatusID from EmployeeStatus ?, _ dsn = employees; uid (ADODB.Recordset??)?? = SA; PWD = ;? s =?

CopyRight © 2020 All Rights Reserved
Processed: 0.051, SQL: 9