0

I have a asp.net website, there is a searchResult.aspx, it runs a sql script to retrieve data from MS SQL server database, and then put the data into a HTML format, the website has been deployed in IIS7.5 Server. I have implemented both static and dynamic compression, that means all my js, css and aspx page have been compressed before rendered to browser.

Unfortunately the searchResult.aspx return very slow, if search for a big word, like biography, it averagely takes more than 10 seconds to return. and I used firebug Net to trace it, the blocking, DNS Lookup, Connecting and Sending all take no more than 10ms, but the Waiting takes over 10 seconds. So I added some code to the beginning and end of function Page_Load(object sender, EventArgs e) and also the begining and end of HTML body element, like below:

   protected Stopwatch stopwatch = new Stopwatch();
   protected void Page_Load(object sender, EventArgs e)
    {
        stopwatch.Start();
        ....
        stopwatch.Stop();
        timeForSearch = stopwatch.Elapsed.Milliseconds;
     }


    <body>
      <%
       stopwatch.Reset();
        stopwatch.Start();
       %>
       ....


      <%stopwatch.Stop();%>
 <%=timeForSearch%>+<%=stopwatch.Elapsed.Milliseconds%>=<%=stopwatch.Elapsed.Milliseconds + timeForSearch%>

Ok, usually the timeForSearch and time for filling aspx page are totally 1 second, but why the page takes over 10 seconds to load, any help will be appreciated it.


thanks for replying, the aspx page has been gzip to 8.2KB. not a big file

Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
danmiao
  • 747
  • 2
  • 8
  • 17
  • What is the page weight? I by "big word" you mean a term that returns a lot of results. That could mean network travel time or browser render time, or both. – JNappi Mar 21 '12 at 02:59
  • Hi JNappi, thanks for replying, the aspx page has been gzip to 8.2KB. not a big file – danmiao Mar 21 '12 at 03:04

2 Answers2

0

Try to set the Trace property of @Page directive to true.

<%@ Page ... Trace="true" %>

In the "Trace Information" section you will identify which page life-cycle event is demanding more time to execute and perhaps help you to debug.

Are you using Master Pages? Do you have any user controls on your page? User control events occur after their parent's events. I.e., UserControl.Init occurs after Page.Init (but before Page.Load), and UserControl.Load occurs after Page.Load.

If so, you may want to investigate the Page_Load in those controls.

outlookrperson
  • 2,761
  • 7
  • 32
  • 49
  • Thanks rperson, I did what you said and got the detail information about the page life cycle, "Begin Load" takes a small bit time, like 10 ms, but "End Load" takes over 10 seconds, however, you know I put the "Stopwatch" to check the load, it says it takes only 1 second, I was very confused, why. – danmiao Mar 22 '12 at 01:17
  • Are you using Master Pages? Do you have any user controls on your page? User control events occur after their parent's events. I.e., UserControl.Init occurs after Page.Init (but before Page.Load), and UserControl.Load occurs after Page.Load. If so, you may want to investigate the Page_Load in those controls. – outlookrperson Mar 22 '12 at 13:33
  • hi rperson, I do not use master page, and neither user control, it is a just normal aspx page with a sql search retrieve data from db and display. – danmiao Mar 23 '12 at 00:05
0

I thought maybe I fixed it, I disable the IIS log, then the search page can be loaded within 3 to 5 seconds, it seems improve a lot. But I am still thinking about that disabling IIS log is a good choice.

danmiao
  • 747
  • 2
  • 8
  • 17