Performance | optimize | Chinese optimize your ASP performance
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
A detailed article on how to streamline code and ASP features to get the fastest execution speed. For a fast-drying user, any
The delay between the next user button and the result appearing on their screens may mean that they will go to other sites? If you are a business
Industry site, which 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 dive
In the performance improvement is through the system change rather than tightening code, an inappropriate idea is that once the system efficiency problems, to the department
The management of the system to upgrade their systems.
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
Very complicated problem. In this article, you will try to explain all the factors that affect ASP performance, and let's take a look at what we
The main thing you 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 for getting information and formatting output, but scripts are also interpreted on a line-by-row basis, so your script
The longer it is, the longer it will take 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 through advanced Windows programming
language or the appropriate COM interface language to convert it into an precompiled component? and register them on the server side. The quick Guide is available in
Http://www.webdevelopersjournal.com/articles/activex_for_asp.html find. Yes, a good activ.
The EX component compiles not only to improve performance, but also to protect your software (scripts), especially when you publish your ASP site in
Third party host on the time.
Because scripts are executed on a row-by-line basis, eliminating redundant scripts or creating more efficient scripts can improve performance. If you are
There are hundreds of lines of code in a single ASP file that you can do well to classify users, transactions, and data services. In fact, if
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. Therefore, if
You define a lot of common methods and definitions in a lengthy inclusion file, and understand that when you include the file, whether you want to
Don't use every method or definition inside, it's all loaded. ASP caches all of the unwind code, which can reduce search efficiency
In this case, the containing file must be split into smaller, modular files. Also understand that the include file is considered separate by the server
Page requests, using too many include files can affect download time.
<!--#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 ' calling procedure Main
</SCRIPT>
If your script is lengthy, use response.isclientconnected. This means that the client is no longer connected to the service
Device, your server CPU can avoid the loop waiting.
<%
' Check if the client is still connected
If not response.isclientconnected Then
' Still connected, ' the handler
Else
' Disconnect
End If
%>
Interspersing ASP and HTML
Does everyone do this? When we output the table, we switch between the ASP and the HTML code, which is a bad learning
Inertial. For example:
<HTML>
<BODY>
<%
Set myconn = Server.CreateObject ("ADODB. Connection ")
Mdbfilepath = Server.MapPath ("Sample.mdb")
MyConn.Open "Driver={microsoft Access Driver (*.mdb)}; Dbq= "& Mdbfilepath &";
Sql_query = "SELECT * FROM Friends"
Set RS = Myconn.execute (sql_query)
While not RS. Eof
%>
<li><%=rs ("Name")%>: <a href= "" >Homepage</A>
<%
Rs. MoveNext
Wend
%>
</BODY>
</HTML>
Another common example is when you use the IF statement:
<%
If not session ("dbopen") Then
%>