Speed of response of an asp.net 2.0 web form

H

hemil.deshmukh

Hi Folks,

I have an asp.net 2.0 web page with about 3-4 gridview controls on it.
Each of the gridview controls is bound to a SqlDataSource which calls a
stored procedure. The number of records being fetched by the stored
procedure are not more than 10 as they are being filtered by the
parametrized stored procedure on the database. So the amount of data
being sent back and forth from the client and the server is not
significant. The slowest stored procedure of them takes about 6 s to
run. However, when I run the web page, it takes about 45 s to load
which is unacceptable. I don't need to maintain viewstate and session
state, so I have disabled it. I have used buffering in the pages.

When I run a trace, I find that max amount of time is spent between the
Begin PreRender and End PreRender events as shown below
Trace Information
Category Message From First(s) From Last(s)
aspx.page Begin PreInit
aspx.page End PreInit 0.000442793707021423 0.000443
aspx.page Begin Init 0.000483301648673225 0.000041
aspx.page End Init 0.000588622296967911 0.000105
aspx.page Begin InitComplete 0.000617676268911272 0.000029
aspx.page End InitComplete 0.000644495319935914 0.000027
aspx.page Begin PreLoad 0.000670196910501195 0.000026
aspx.page End PreLoad 0.000729701679962118 0.000060
aspx.page Begin Load 0.00075791755656096 0.000028
aspx.page End Load 0.954709886312367 0.953952
aspx.page Begin LoadComplete 0.954773302193435 0.000063
aspx.page End LoadComplete 0.954820794262958 0.000047
aspx.page Begin PreRender 0.954848172044212 0.000027
aspx.page End PreRender 45.0125610936586 44.057713
aspx.page Begin PreRenderComplete 45.012613334935 0.000052
aspx.page End PreRenderComplete 45.0126435063674 0.000030
aspx.page Begin SaveState 45.0168957227804 0.004252
aspx.page End SaveState 45.0170401545448 0.000144
aspx.page Begin SaveStateComplete 45.0170731196283 0.000033
aspx.page End SaveStateComplete 45.0170996593142 0.000027
aspx.page Begin Render 45.0171261990002 0.000027
aspx.page End Render 45.0217010821208 0.004575


Any ideas as to what I might be doing wrong here? Any suggestions to
improve the speed of the web page ?

Thanks

Hemil.
 
G

Guest

First, don't mess around with buffering, it most likely will buy you nothing.
You have only posted timings but no code so we can only guess what is gong on.
If the data doesn't change for the Gridviews, you can load it once and cache
the datasets / datatables. In this manner the second time the page is
requested all the data will already be there in memory.
But again, getting reasonable amounts of data from a db and binding it to a
control should not take long at all, even if you have six of them.
So, you need to go back and study your code for best-practices patterns.
Make sure all your connections are closed as soon as their work is done.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 
H

hemil.deshmukh

Hi Peter,

There is no code in the code in the codebehind file. The data binding
is in the aspx file.

Sample code for one of the gridview controls pasted below:

<asp:GridView ID="GridViewPersonDetails" runat="server"
AutoGenerateColumns="False"
DataSourceID="SqlDataSourcePersonDetails"
EmptyDataText="No Data" EnableViewState="False" >
<Columns>
<asp:BoundField DataField="Customer ID"
HeaderText="Customer ID" SortExpression="Customer ID" />
<asp:BoundField DataField="Surname"
HeaderText="Surname" SortExpression="Surname" />
<asp:BoundField DataField="Given Names"
HeaderText="Given Names" SortExpression="Given Names" />
<asp:BoundField DataField="Address"
HeaderText="Address" SortExpression="Address" />
<asp:BoundField DataField="Home Phone"
HeaderText="Home Phone" SortExpression="Home Phone" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSourcePersonDetails"
runat="server" ConnectionString="<%$ ConnectionStrings:Connection
String %>"
SelectCommand="rpt_PersonDetails"
SelectCommandType="StoredProcedure" EnableViewState="False"
EnableCaching="True">
<SelectParameters>
<asp:QueryStringParameter Name="PersonID"
QueryStringField="id" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>

Thanks
Hemil.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top