One time about the difference between an ASP variable and a pair-like shutdown and not close test

Source: Internet
Author: User
Tags execution include memory usage resource
Variables for the ASP program, the variables used are global variables, as well as some of the established objects. Good ASP programmers have the habit of releasing them, but releasing and not releasing
How much difference does it have between them? So today it was specially tested.

Test content: The global variable of the test has one, the object is the connection object that uses the connection SQL.
First Test: End program execution without releasing global variables.
Second Test: Releases global variables and ends program execution.
Pre-Test Preparation: Wait for the server to rest for 5 minutes before running the test to ensure the content and CPU have stabilized.
Test hardware and Software: the server for the usual PIII550, memory 256M. Fitted with win2000+iis5.0+sql2000
Client one for Win2000, using IE5.5, open a browse window
Another client is win98,ie5.0, opening two browsing Windows

Total Test Number: Three client cumulative execution to 20000 stop.

First Test report (not released):

Memory footprint at start: 146464K
Memory footprint After starting a client: 146996K CPU resource Occupancy 31-32%
Start two client memory footprint: 147316K CPU Resource Footprint 49-52%
The following memory changes to-> 147304K-> 147328
Start three client memory footprint: 147868K CPU Resource Footprint 59-69%
The following memory changes to-> 147868K-> 147864K-> 147856K-> 147724K-> 147828K
-> 147860K-> 147868K-> 148084K-> 148076K-> 148088K
-> 148040K-> 147940K
Memory footprint at end: 147940K
Memory release after three clients stop a request:
147940K-> 148000K-> 147988K-> 146472K-> 146448K-> 146452K



Second Test report (release):

Memory footprint at start: 146652K
Memory footprint After starting a client: 146996K CPU resource Occupancy 35-38%
Start two client memory footprint: 147700K CPU Resource Footprint 55-62%
Start three client memory footprint: 148252K CPU Resource Footprint 53-71%
The following memory changes to-> 148248K-> 148060K
....
-> 148080K-> 148076K
Memory footprint at end: 147940K
Memory release after three clients stop a request:
148076K-> 147956K-> ...-> 146452

Here are two tests that stabilize the memory difference at the end of the client:

First time: 146464-146716 = 252K
Second time: 146652-146452 = -200k

The first time to consume the memory about 252K, the best server seems to be no longer released
The second time is very strange, to the last memory but save 200K, I do not know why.

Here are two of memory usage when you start and end a test:

First time: 146464-147940 = 3476K
Second time: 146652-148076 = 1324K

Memory usage for the first time is nearly one times more than the second.

This test shows that the release of variables is useful, especially when the system is running for a long time, but also to pay attention to the release of variables, to ensure that the server resources will not be white
White waste to exhaustion.

----------------------------------------------------------

Attached part of the test code test.asp:

<%option Explicit
If Request ("qian") = "Qian" Then
Application ("Testnumer") =0
Response.Write "Reset to 0!"
Response.End
End If
If application ("Testnumer") > 20000 Then
Response.Write "End!! has reached 2000 times. "
Response.End
End If
%>
<!--#include file=inc/setup.asp-->
<!--#include file=inc/popu_fun.asp-->
<title>untitled document</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta http-equiv= "Refresh" content= "0" >

<body bgcolor= "#FFFFFF" text= "#000000" >

</body>

<%dim YP
Application ("Testnumer") = Application ("Testnumer") + 1
Response.Write "Testnumer:" & Application ("Testnumer")
Initdatabase ("YP")
Initdatabase ("YP")
Initdatabase ("YP")
Initdatabase ("YP")
Yp=second (Time)
Set yp=nothing
Closedatabase%>



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.