No announcement yet.

Aspx page load time

  • Filter
  • Time
  • Show
Clear All
new posts

  • jon00
    Originally posted by zimmer62 View Post
    I wonder if there is a way to catch the event of garbage collection, and fire off your aspx page loader right after that.
    I have a similar solution to BLGarbage call Memory Flush. This also resets the Garbage Collector and recovers memory used by Homeseer. Because it is a script, you can call both memory flush and ASPX page loader via a single event. The only thing you have to remember is to set the wait for the script to finish for the first one. I actually have a 5 second delay added between the two, just for safety.

    I've received several good comments about memory flush - here is one from my guest book: ....BTW, I used your "garbage collector" script and Wow, no more HS2 reboots. What a difference it made. Thank you for all of your help

    Leave a comment:

  • zimmer62
    I wonder if there is a way to catch the event of garbage collection, and fire off your aspx page loader right after that.

    I know some people are using blades garbage collection plug-in that basically forces GC at certain times. I would think that action would be undesirable as it could happen while you're using a web page, and I'm not sure if .NET would be smart enough to know that it should only clean up stuff that's really old, and leave alone things that are only a few minutes old.

    I think most people will agree that this few second delay is quite annoying. Jon's aspx loader does fix this, just seems to be a round about way of dealing with the underlying problem.

    Leave a comment:

  • jon00
    I do not believe anything more has been done. When you first call a aspx, it is compiled on-the-fly in to memory. Provided this is done and memory is not regained by the NET garbage collector, all future page loads should be faster.

    One workaround solution is to use my aspx page loader (on my site) which will pre-load your pages (i.e. pre-compiled in memory) so that they are ready to go when you want them.

    Leave a comment:

  • bbuck2002
    Was a solution ever found for this issue? I am experiencing a similar delay with the HS web server, and wondered if you were assisted by HomeSeer.

    Also, how would I use "pre-compiled" code on the web server? What tool or format do I need to use to compile my aspx pages?


    Leave a comment:

  • jon00
    As HST do not have the time to monitor all threads on the board, I would submit a help-desk ticket on this with a feature request that compiled pages are stored on the hard drive.

    Leave a comment:

  • mfisher
    As a test, I created a virtual directory in IIS and pointed it to the \Homeseer 2\Html directory.

    When I initially run the same ASPX page (from the exact same location as the HS webserver runs it) the initial compile is about 2 secs. After that, all loads of the page are about 200mS - even several days later.

    In addition, I see that the compiled code is now saved in the \Windows\Microsoft.NET\Framework\v2.0.50737\..... directory.

    So, it does appear that the HS-ASP engine is not cachine the compiled code to storage, but just holding it in memory. Then the .Net Garbage Collector is "cleaning it out of memory" within a few minutes.

    Can anyone at HS-Tech confirm this?
    If indeed this is the case, is precompilation the only solution?

    Leave a comment:

  • mfisher
    jasv, thanks for the pre-compiled suggestion.

    Jon00, thank you for your comments. I tend to agree that it's the GC. However, this machine has 1GB of ram and normally runs around 450mb total phy mem usage.

    Leave a comment:

  • jon00
    I'm no expert either but Homeseer does seem to store compiled aspx in memory and is lost when the Garbage Collector kicks in. When this happens is normally when memory is getting low.

    As for my aspx loader, you can run it as a recurring event and does no harm if already compiled in memory.

    Leave a comment:

  • jasv
    I am not an expert but I did manage to create an ASPx page where only the pre-compiled code was placed on the webserver and thus conceptually eliminating the "delay". I can't give you any scientific proof but it is worth your googling it to see.

    Leave a comment:

  • mfisher

    Thanks for the suggestion. I had a quick look at Jon00's aspx loader page and it appears that it just loads pages at HS startup so that they are precompiled and 'ready to go' when someone access later. (Please correct me if I'm wrong.)

    The problem that I'm experiencing is if the aspx page is not accessed for a while (say 10 minutes) then it has to be recompiled before being rendered. Note that during this time the HS server is mostly sitting idle and not being restarted or changed.

    The page I listed at the beginning of this thread takes about 8 seconds to serve on the first request and under 1 sec on subsequent requests (within 10 minutes of one another.) I enabled the 'trace' feature in the page and found that it takes only 0.34 seconds to render - every time, precomp or not, so I am assuming that the 7.7 second delay is being caused by precompilation.

    I see from my research that aspx pages served using IIS are compiled, the intermediated code is saved to HDD and then the page is rendered. When another request for that page is made, the ASP engine looks for and uses the precompiled code; making the serve time short.

    With the HS ASP server, I do not see that the precompiled code is saved to HDD, so I must assume that it's being held in memory.

    This leads me to ask:
    1) how does the HS ASP engine determine when it's time to discard the precompiled code?
    2) is the pre-comp code just held in memory or saved to HDD?
    3) can the HS ASP engine be forced to 'save it longer'? (maybe using ASP directives?)

    Any insight as to how the HS ASP engine is handling this would be most appreciated!

    Leave a comment:

  • tenholde
    try searching for: Jon00 aspx page loader

    Leave a comment:

  • rmasonjr
    We see that where I work as well. The first load takes a while to compile, subsequent pages are quick, then the process starts over. I think it has to be something with .NET garbage collection and marking some objects as read for GC. I am wondering if there is a Web.config or machine.config setting that will prevent that from happening - havent found the magic bullet yet, tho...

    Leave a comment:

  • mfisher
    started a topic Aspx page load time

    Aspx page load time

    Moving from Asp to Asp.Net and I am experiencing long load times for my pages. Obviously, the first load takes extra time while the page is being compiled, and then all subsequent accesses to the page are quick as expected. However, if I wait a while (say an hour) and access the page, the compile delay occurs again.

    There has been a lot of discussion on the board about aspx page load delays, but I've not seen anything describing the issue I'm seeing.

    Below is the code for one of my pages. On my system, load time for this page during compile is 6 seconds while a refresh is under 1 sec.

    PHP Code:
    <!-- LogNote.aspx mfisher04Jan2009 -->

    Page language="vb" %>

    script runat="server">
    Dim hs As Scheduler.hsapplication
        Dim LogDisplay 
    As String
        Sub Page_Load
    (ByVal Sender As ObjectByVal E As EventArgs)
    ' for use with the HS web server
            hs = Context.Items("Content")
            If hs Is Nothing Then
    maybe running under IIS
    = Global.ASP.global_asax.hs
    If hs Is Nothing Then
    .Write("Could not get access to HomeSeer object, is HomeSeer running?")
    End If
    End If
    Dim LogBuffer() As String
            Dim LogItems
    () As String
    Split(hs.LogGet(), vbCrLf)

    Dim i As Integer
    "<table border=""1"">" vbCrLf
    &= "<td><b>Time</b></td><td><b>Class</b></td><td><b>Entry</b></td>" vbCrLf
    For = (UBound(LogBuffer) - 20To (UBound(LogBuffer) - 1)
    LogItems Split(LogBuffer(i), "~!~")
    LogDisplay &= "<tr><td>" '& Ubound(LogItems) & ": "
                LogDisplay &= LogItems(0) & "</td><td>"
                LogDisplay &= LogItems(1) & "</td><td>"
                LogDisplay &= LogItems(2) & "</td></tr>" & vbCrLf
            LogDisplay &= "</table>" & vbCrLf

            Dim Command As String = StripCrLf(Request.Form.Item("Buttons"))
            Dim LogClass As String = Request.Form.Item("LogClass")
            Dim LogNote As String = Request.Form.Item("LogNote")
            Select Case Command
                Case "Save"
                    If (LogClass <> "") Or (LogNote <> "") Then
                        hs.WriteLog(LogClass, LogNote)
                    End If
            End Select

            Response.Write(hs.GetPageHeader("Log Note", "", "", False, False, Nothing, Nothing, Nothing))
        End Sub

        Function StripCrLf(ByVal Cmd As String) As String
            If InStr(Cmd, vbCrLf) Then
                StripCrLf = Left(Cmd, Len(Cmd) - 2)
                StripCrLf = Cmd
            End If
        End Function


    <form name="lognote" method="post" action="LogNote.aspx">
        <h5>Create an entry in the HomeSeer log.</h5>
        <input class="formtext" type="text" size="20" name="LogClass" value=""/>
        <input class="formtext" type="text" size="60" name="LogNote" value=""/>
        <input class="button" type="submit" name="Buttons" value="Save"/>

        Response.Write("<hr><font size=""30""><b>Last 20 log entries:</b></font><br><br>")
    Any thoughts?
    Last edited by mfisher; January 8, 2009, 10:42 AM.