Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

ASP engine

  • 09-09-2003 11:40am
    #1
    Closed Accounts Posts: 40


    Can anybody help on this.
    How can a website slow down the asp server.
    I am having problems with my hosting company as follows:

    The entire website is working fine and is loading very well in the browser, but every now and then it gets slow and it throws the Error 500 Script Time out.
    I droped a line to the company and they send me the following reply:

    Yes, we have noticed in the past 2-3 weeks that usage on the
    WebWorldHost server has increased to the point that we are having to restart
    web services at least twice a day to keep the ASP service online. We have
    reviewed the situation and it appears that the besecure2000.com is the root
    of the problem.

    It appears that there are a high number of ISAPI requests on the server
    with less than optimal ASP coding which is causing the ASP engine to crash
    or slow down at times. Here is an example of what I mean:

    2003-09-08 09:18:56 195.133.237.242 - 66.40.23.187 80 GET /faq.asp
    |-|ASP_0147|500_Server_Error 500 179 723 41969
    Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0)
    http://www.besecure2000.com/categories.asp?MainCatID=1&MainCat1ID=185

    2003-09-08 11:35:51 62.7.152.12 - 66.40.23.187 80 GET /cattype.asp
    ID=32|-|ASP_0113|Script_timed_out 500 0 471 121297
    Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1)
    http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=central+locking+kits

    2003-09-08 11:36:42 80.200.149.5 - 66.40.23.187 80 GET /cattype.asp
    ID=57|-|ASP_0113|Script_timed_out 500 0 389 136672
    Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+iOpus-I-M) -

    2003-09-08 11:36:42 62.7.152.12 - 66.40.23.187 80 GET /cattype.asp
    ID=32|-|ASP_0113|Script_timed_out 500 0 471 105594
    Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1)
    http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=central+locking+kits

    2003-09-08 12:04:04 212.219.118.154 - 66.40.23.187 80 GET /cattype.asp
    ID=1|-|ASP_0147|500_Server_Error 500 118 648 164797
    Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0;+Palmer's+College;+Palmers
    +College;+.NET+CLR+1.0.3705;+.NET+CLR+1.1.4322)
    http://www.besecure2000.com/cattype.asp?ID=54

    2003-09-08 12:04:04 212.219.118.154 - 66.40.23.187 80 GET
    /productdetailssmall.asp ProductID=6636|-|ASP_0147|500_Server_Error 500
    118 484 161532
    Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0;+Palmer's+College;+Palmers
    +College;+.NET+CLR+1.0.3705;+.NET+CLR+1.1.4322)
    -

    2003-09-08 13:34:30 80.135.138.148 - 66.40.23.187 80 GET /cattype.asp
    ID=49|-|ASP_0113|Script_timed_out 500 0 474 135281
    Mozilla/4.0+(compatible;+MSIE+5.5;+Windows+98)
    http://www.google.de/search?q=Golf+IV%2BSpoiler&hl=de&lr=&ie=UTF-8&oe=UTF-8&start=50&sa=N

    To fix this problem you will need to download the site and test it
    offline making sure to fix any scripts that are causing Internal Server
    Error's. To increase the performance of the site you should look at getting
    a dedicated server.

    All the pages are ASP coded in Dreamweaver Ultradev + SQL2000
    server as database.

    Any help will be much appreciated cause I don't know how to reply to him, being straight to the point a nice as well.


Comments

  • Closed Accounts Posts: 135 ✭✭dynamic.ie


    I had a look into this before. If you are running on shared hosting systems, you must take into account that others are also using the asp engine. To make your site not use as much resources as required, there are little techniques you can use.

    For example:

    Instead of using:

    Request.Form("somevariable")

    10 times in your code, use:

    strSomeVariable = Request.Form("somevariable")

    at the top of your page and use the strSomeVariable 10 times in your code. It might not seem like much but added to a lot of other techniques, it can speed things up a bit.

    I'm trying to find an article I read on this that might help you out. I'll post when I find it but have a look at some of these pages:

    http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=speed+up+asp+pages

    Best of luck...

    Dave


  • Closed Accounts Posts: 40 lucian


    Thanks for the advice, but I don't really have many forms on my website and most of it is dynamically building from the database (SQL2000) as is based on a query string.

    I had a look at 4GuysFromRolla and they have a good point about ASPTear, but I think I'll be better changing the hosting company then trying to make all the pages Html.

    What I can't understand is WHY he's blaming my website? That website is up and running since 2000.

    Is there anyway I could monitor the server myself?


  • Registered Users, Registered Users 2 Posts: 1,452 ✭✭✭tomED


    Make sure you close all your objects.

    object.close
    set object = nothing

    Also check that none of your script will end in an infite loop.
    If its possible in areas - try not to mix html with asp code.

    So for example,:
    <%
    If a = b Then
    response.write "<HTML>"
    End If
    %>

    Instead of
    <%
    If a = b Then
    %>
    <HTML>
    <% End if %>


    if your provider is telling you its your sites fault - they should also be able to tell you the files in question, why not post an example of some of your code and we might be able to help you more.

    Tom


  • Closed Accounts Posts: 40 lucian


    I sens him an email regarding the files that are causing the problem, until then I think this is one of them the is mentioned in the first post more then once.


    <%
    set rsCatType = Server.CreateObject("ADODB.Recordset")
    rsCatType.ActiveConnection = MM_storeSQL_STRING
    rsCatType.Source = "SELECT * FROM dbo.CatType ORDER BY Type"
    rsCatType.CursorType = 0
    rsCatType.CursorLocation = 2
    rsCatType.LockType = 1
    rsCatType.Open()
    rsCatType_numRows = 0
    %>
    <%
    Dim rsProductsByCatType__MMColParam
    rsProductsByCatType__MMColParam = "0"
    if (Request.QueryString("ID") <> "") then rsProductsByCatType__MMColParam = Request.QueryString("ID")
    %>
    <%
    set rsProductsByCatType = Server.CreateObject("ADODB.Recordset")
    rsProductsByCatType.ActiveConnection = MM_storeSQL_STRING
    rsProductsByCatType.Source = "SELECT ProductID, ProductName, CatType FROM dbo.Products WHERE CatType = " + Replace(rsProductsByCatType__MMColParam, "'", "''") + ";"
    rsProductsByCatType.CursorType = 0
    rsProductsByCatType.CursorLocation = 2
    rsProductsByCatType.LockType = 1
    rsProductsByCatType.Open()
    rsProductsByCatType_numRows = 0
    %>
    <%
    Dim HLooper1__numRows
    HLooper1__numRows = -1
    Dim HLooper1__index
    HLooper1__index = 0
    rsCatType_numRows = rsCatType_numRows + HLooper1__numRows
    %>
    <%
    Dim HLooper2__numRows
    HLooper2__numRows = -1
    Dim HLooper2__index
    HLooper2__index = 0
    rsProductsByCatType_numRows = rsProductsByCatType_numRows + HLooper2__numRows
    %>
    <%
    ' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

    ' create the list of parameters which should not be maintained
    MM_removeList = "&index="
    If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
    MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""

    ' add the URL parameters to the MM_keepURL string
    For Each Item In Request.QueryString
    NextItem = "&" & Item & "="
    If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
    End If
    Next

    ' add the Form variables to the MM_keepForm string
    For Each Item In Request.Form
    NextItem = "&" & Item & "="
    If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
    End If
    Next

    ' create the Form + URL string and remove the intial '&' from each of the strings
    MM_keepBoth = MM_keepURL & MM_keepForm
    if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
    if (MM_keepURL <> "") Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
    if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

    ' a utility function used for adding additional parameters to these strings
    Function MM_joinChar(firstItem)
    If (firstItem <> "") Then
    MM_joinChar = "&"
    Else
    MM_joinChar = ""
    End If
    End Function
    %>
    <link rel="stylesheet" href="page_style.css" type="text/css">
    <script language="JavaScript">
    <!--
    function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
    if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
    }
    window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
    }
    //-->
    </script>
    <table width="519" border="0" cellpadding="0" cellspacing="0" align="center" class="text">
    <tr>
    <td width="242" valign="top" height="13" bgcolor="#FFFF00" ><font color="#000000"><b>Category
    Type</b></font></td>
    <td width="277" valign="top" bgcolor="#FF00FF"><font color="#000000"><b>Products
    By Category<br>
    <% If rsProductsByCatType.EOF And rsProductsByCatType.BOF Then %>
    To view the products click on the Category Type on the Left pane.
    <% End If ' end rsProductsByCatType.EOF And rsProductsByCatType.BOF %>
    </b></font></td>
    </tr>
    <tr>
    <td valign="top" height="23" >
    <table>
    <%
    startrw = 0
    endrw = HLooper1__index
    numberColumns = 1
    numrows = -1
    while((numrows <> 0) AND (Not rsCatType.EOF))
    startrw = endrw + 1
    endrw = endrw + numberColumns
    %>
    <tr align="center" valign="top">
    <%
    While ((startrw <= endrw) AND (Not rsCatType.EOF))
    %>
    <td width="232" height="17" valign="top" align="left" bgcolor="#CCCCCC">
    <a href="cattype.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "ID=" & rsCatType.Fields.Item("ID").Value %>" class="text"><%=(rsCatType.Fields.Item("Type").Value)%></a> </td>
    <%
    startrw = startrw + 1
    rsCatType.MoveNext()
    Wend
    %>
    </tr>
    <%
    numrows=numrows-1
    Wend
    %>
    </table>
    </td>
    <td rowspan="2" valign="top">
    <table height="23">
    <%
    startrw = 0
    endrw = HLooper2__index
    numberColumns = 1
    numrows = -1
    while((numrows <> 0) AND (Not rsProductsByCatType.EOF))
    startrw = endrw + 1
    endrw = endrw + numberColumns
    %>
    <tr align="center" valign="top">
    <td width="261" height="28" valign="top" align="left">
    <% If Not rsProductsByCatType.EOF Or Not rsProductsByCatType.BOF Then %>
    <span class="text"><a href="JavaScript:MM_openBrWindow('productdetailssmall.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "ProductID=" & rsProductsByCatType.Fields.Item("ProductID").Value %>','','location=no,scrollbars=yes','555','600','false')"><%=(rsProductsByCatType.Fields.Item("ProductName").Value)%></a></span>
    <% End If ' end Not rsProductsByCatType.EOF Or NOT rsProductsByCatType.BOF %>
    </td>
    <%
    While ((startrw <= endrw) AND (Not rsProductsByCatType.EOF))
    %>
    <%
    startrw = startrw + 1
    rsProductsByCatType.MoveNext()
    Wend
    %>
    </tr>
    <tr align="center" valign="top">
    <td height="3"></td>
    </tr>
    <%
    numrows=numrows-1
    Wend
    %>
    </table>
    </td>
    </tr>
    <tr>
    <td height="16" ></td>
    </tr>
    <tr>
    <td height="10" ></td>
    <td></td>
    </tr>
    </table>
    </body>
    </html>
    <%
    rsCatType.Close()
    %>
    <%
    rsProductsByCatType.Close()
    %>


  • Registered Users, Registered Users 2 Posts: 2,170 ✭✭✭Serbian


    I hate the way Dreamweaver formats ASP code!

    Just glancing at the code there, there are a bunch of nested While loops and HTML code is mixed in with the ASP. They may not necessarily be the cause of the problem, but there are probably better ways of doing what the code is currently doing. If you are not great at ASP maybe ask around and see if anyone is willing to give you a hand optimising ASP code.

    I do think it is a bit of a cop out on the part of the hosting company to blame your site individually as there are probably 10+ sites on the same box regularly running ASP scripts.


  • Advertisement
  • Closed Accounts Posts: 40 lucian




  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    As tomED suggested you need to destroy your objects in ASP. When you create an object, it grabs a piece of the server’s memory. If you don’t release this memory after using the object (typically at the end of the script) IIS will keep this memory reserved. This is called a memory leak. As more people access the script, more pieces of the server’s memory are reserved and eventually the server runs out of memory and grinds to a halt.

    Looking at the code you just posted, that may well be what is happening, as you don’t bother destroying any of your objects in your code. If traffic has increased substantially on your Web site since its inception in 2000, then the effects of an accumulative memory leak would be far more noticeable now. Another reason that they may be pointing the finger at you only now is that they may also only have realized recently that it was your particular site that was causing problems.


  • Closed Accounts Posts: 40 lucian


    Thanks for this. We are working on it as we speak.
    The entire website was created with Ultradev4, now we are using MX version wich does close the object
    <%
    rsMainCategory.Close()
    Set rsMainCategory = Nothing
    %>
    at the bottom of the page.
    We are also trying to figure out the store procedures for it.

    The site is in the middle of being revamped alltogheter.

    Any other Ideeas are more then welcome and appreciated.

    Thanks everybody for their opinions.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    I suggest you do the same thing with rsProductsByCatType while you're at it.


  • Closed Accounts Posts: 40 lucian


    The entire website will be re-done from scratch.


  • Advertisement
  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Get an experienced coder to do the back-end work next time. Cheaper in the long run, as no doubt you've discovered ;)


  • Closed Accounts Posts: 40 lucian


    The website is up and running.

    Check it out and give us your opinion.

    Besecure 2000


Advertisement