Tip 7: Encapsulate code in a COM object
If you have a lot of VBScript or JScript, you can often move your code to a compiled COM object, which can improve performance. The compiled code usually runs faster than the interpreted code. Compiled COM objects can access other COM objects through "early bound", which is a more efficient way to invoke COM objects than "late binding" used by the script. There are some advantages to encapsulating code in COM objects (in addition to performance):
COM objects are useful for separating presentation logic from business logic.
COM objects can ensure that code is reused.
Many developers find that code written in VB, C + +, or Visual J + + is easier to debug than ASP.
COM objects also have drawbacks, including initial development time and the need for different programming techniques. Note that encapsulating a small number of ASPs can cause performance degradation without performance improvements. This situation typically occurs when a small amount of ASP code is encapsulated into a COM object. In this case, the overhead of creating and invoking COM objects exceeds the benefits of compiled code. You should experiment repeatedly to determine what ASP scripts and COM object code combinations produce the best performance. Note that there is a significant improvement in scripting and ADO performance in Windows 2000/iis 5.0 compared to Microsoft Windows Nt®4.0/iis 4.0. Therefore, with the introduction of IIS 5.0, the compilation code has a lower performance advantage than the ASP code. If you are deploying COM components, it is particularly important to test them at a load. In fact, all of the ASP applications should be tested for load.
Tip 8: Get the resources later and release the resources earlier.
Here is a small tip for your reference. In general, it is best to obtain resources later and release resources earlier. This applies to COM objects as well as file handles and other resources. This optimization method is mainly used for ADO connection and recordset. When you are finished using a recordset, say, after displaying a table and its data, you should release it immediately, rather than wait until the page ends. Setting the VBScript variable to nothing is the best practice. Do not let the Recordset go beyond the scope. Also, to release any associated Command or Connection objects (do not forget to call Close () until you set the recordset or connection to = Nothing.) This shortens the time that the database must prepare resources for you and frees the database to connect to the connection pool as soon as possible.
Tip 9: Process performance in exchange for reliability
Both ASP and mts/com+ have configuration options that allow you to balance reliability and performance. When you build and deploy your application, you should know how to balance the performance of both. The ASP option can configure ASP applications to run in one of three ways. In IIS 5.0, the term "isolation level" is introduced to illustrate these options. These three isolation levels are low-level, intermediate, and advanced, respectively:
Low-level isolation: This is supported in all versions of IIS and is the fastest. It runs Asp,inetinfo.exe in Inetinfo.exe is the primary IIS process. If the ASP application crashes, IIS crashes as well. (To restart Iis,web under IIS 4.0 The site administrator should use tools such as Inetmon to monitor the site and, if the server fails, enable the batch file to restart the server.) IIS 5.0 introduces a reliable reboot, which causes the failed server to be restarted automatically. )
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.