Optimizing the performance of ASP programs

Source: Internet
Author: User
Tags connection pooling error handling include

ASP can quickly execute your dynamic Web pages, but you can also tighten code and database connections to make them perform faster. This is a detailed article on how to streamline code and ASP features to get the fastest execution speed. For an impatient user, any delay between pressing the user button and appearing on their screen may mean that they will go to other sites? If you are a commercial site, this could mean losing potential sales.

We don't have any way to control the bandwidth of our users, but we do get the best performance by optimizing the ASP site. Most of the potential performance improvement is through system change rather than tightening code, an inappropriate idea is that once the system efficiency problems, the System Manager to make comments to upgrade the system.

First, which factor may affect the performance of the ASP? Unfortunately, there are many factors. Here are just a few of them:

Available bandwidth

Speed of processors and other hardware on the server

Other programs running on the server (like those OpenGL screen saver!) )

Database connection mode, connection pooling, database system itself (Oracle better than SQL Server,sql Server better than Access)

The language you are using

Stored procedures are superior to line-SQL statements

Using compilation components instead of VB or JavaScript, good ASP programming experience, such as error handling

Some of the above factors may have been widely noticed by developers with knowledge of IIS, but others may be a very complex issue for them. In this article, we'll try to explain all the factors that affect ASP performance, and let's take a look at the main things we can do in a few milliseconds of shaving.

ASP script Size

Do you have a script page (and other pages) that are longer than the required length? This is something that will degrade the performance of the ASP at the beginning of execution. ASP scripts are useful when it comes to getting information and formatting output, but scripts are also interpreted on a row-by-line basis, so the longer your script is, the longer it takes to execute it.

If your script is huge, what can you do to reduce the length of the script? Here are a few suggestions:

You can convert them to server-side components, that is, to make a VB Dynamic link library dll or convert it to an precompiled component through an advanced Windows programming language or an appropriate COM interface language? and register them on the server side. The quick Guide is available in

Http://www.webdevelopersjournal.com/articles/activex_for_asp.html find. Compiling a well written ActiveX component can greatly improve performance and protect your software (scripts), especially if you publish your ASP site on a third-party host.

Because scripts are executed on a row-by-line basis, eliminating redundant scripts or creating more efficient scripts can improve performance. If you have hundreds of lines of code in a single ASP file, you can do a good job of dividing users, trading and data services. In fact, if you do this, you might find some redundant code: If you need to output a few tables, you can write a generic function to output a table, just call it multiple times.

When you talk about the size of an ASP script, you have to mention the size of the included file. When you use a containing file, the entire containing file is loaded, and when the containing file is included, it is equivalent to writing that part of the code in the ASP file itself. So if you define a lot of common methods and definitions in a lengthy inclusion file, realize that when you include the file, whether you want to use every method or definition inside it, it's all loaded. ASP caches all of the unwind code, which reduces lookup efficiency in this case, the inclusion file must be split into smaller, modular files. Also understand that the inclusion file is considered a separate page request by the server, and using too many include files can affect download times.

<!-- #include file="Header.asp" -->
<!-- #include file="Footer.asp" -->
<SCRIPT language="vbscript" runat="server">

Sub Main()
WriteHeader
WriteBody
WriteFooter
End Sub

Sub WriteBody()
...
End Sub

Main?'调用过程Main
</SCRIPT>

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.