Calculating Load Time in ASP.NET Page

Let's say I want to calculate the time taken to load an ASP.NET page. When the user enters a URL and presses the enter key, the following events occur:

  • The request is sent to the server
  • The server processes the request, executes any logic on the download server side, makes database calls
  • Browser receives response, loads HTML and JS files
  • Browser runs client side logic (Javascript functions on load)
  • The browser displays the page

If I would like to measure the time taken for each of these operations, I understand that I can use the following tools:

  • For (1) use Fiddler to calculate time over the network.
  • For (2) enable tracing to calculate server side processing time.
  • For (3) use Fiddler to calculate the time taken to download
  • For (4) use firebug for timing run by JS functions

Summing up the results from 1 to 4 gives the total time.

I believe this is correct? Is there one tool that does all of this? Is there an easier way

+2


source to share


5 answers


Firebug will actually give you 1s and 3s as well as the Network tab, and it provides nice little split graphical bars that show you the response time components (DNS lookup, server request pending first byte, load time).



There isn't really a single tool that can take measurements on both the client and the server, since the server code runs on the server and the client code runs on the client. You can get close simply by subtracting all other points from the total, but the most accurate server result will really be from the server itself.

+4


source


There is a plugin for FireFox that supports this need:

Page Speed google - this tool will allow you to keep a record of the Internet in real time, and then view each of the requests. How long do they take and which components run in parallel.



Also, if you want to optimize your page, YSlow can provide other advice, although it doesn't give you the one you're asking for.

+1


source


Visual Round Trip Analyzer is a good program that uses NetMon to calculate steps # 1, 2 and 3. This can tell how long your network is taking and processing time on the server.

Step 4 is tough, as different browsers will start rendering content at different times.

0


source


Why don't you just use a browser control in .NET and create your own application to check the time taken from the initial request to the final response?

0


source


For point 2,

in global.asax

Private sw As Stopwatch = Nothing
Private Sub Global_asax_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.BeginRequest
    sw = Stopwatch.StartNew
End Sub

Private Sub Global_asax_EndRequest(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.EndRequest
    If sw IsNot Nothing Then
        sw.Stop()
        Response.Write("<b>took " & sw.Elapsed.TotalSeconds.ToString("0.#######") & " seconds to generate this page</b>")
    End If
End Sub

      

0


source







All Articles