473,396 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ViewState vs. Database

I'm sure the answer to my question varies depending on the situation, but I
am looking for a general "best practice".

If I have an asp.net application and I load certain data from a database,
should I use ViewState to store and reload the data, or should I load the
data from the database on each postback?

Assume for the sake of this question that I only care about performance, I
don't care about ease of programming.

Jul 10 '08 #1
9 2647
Hi,

From your description, you're wondering tradeoff between storeing database
records in ASP.NET page's viewstate and query them in every request,
correct?

Based on my understanding, if you're using Databound control(such as
Gridview, DataGrid) to display data queried from database, after you
perform databinding, the viewstate will automatically store those necessary
info for the Gridview/DataGrid to display each rows in sequential requests.
However, the database table based structure is not persisted
automatically. Therefore , I'm wondering what you want to do or what's the
reason that you may need to cache/store the entire database table (e.g.
datatable/dataset) into Viewstate?

For general consideration, I think you can consider the following factors:

1. ViewState is only used for store data which need to reuse between the
same page's multiple post. If you request the page(via HTTP GET) again, the
viewstate(stored in previous request) is no longer available. For data
that need to be persisted between multiple page or requests(not only
postback), I think Session State and Application Cache is better.

2. For impaction, since viewstate is persisted as an html hidden field in
page's html source, if the data you want to store is very large, it will
surely increase your page's response content size and that'll make the page
display or postback slowly for low bandwidth clients(for internet
scenaros). And if you cache large data in SessionState or Application
Cache, that will not impact response stream size, but if that is used
frequently, the server-side memory will have some pressure.

3. If the bottleneck is not at the web application and backend database
server(performing data accessing operations such as query data), I
recommend you query the data from database in every request where you need
to display the data. But if the data is large and really static or
unchangable, you can consider using Application Cache to cache them.

#Using the ASP.NET Application Cache to Make Your Applications Scream
http://www.developer.com/net/net/article.php/1477771

#ASP.NET Caching Overview
http://msdn.microsoft.com/en-us/library/ms178597.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>Thread-Topic: ViewState vs. Database
thread-index: AcjiL9LHoL7fpWJYTuakWT7C3nnrKw==
X-WBNR-Posting-Host: 207.46.19.168
From: =?Utf-8?B?TUNN?= <MC*@newsgroup.nospam>
Subject: ViewState vs. Database
Date: Wed, 9 Jul 2008 18:54:00 -0700
>
I'm sure the answer to my question varies depending on the situation, but
I
>am looking for a general "best practice".

If I have an asp.net application and I load certain data from a database,
should I use ViewState to store and reload the data, or should I load the
data from the database on each postback?

Assume for the sake of this question that I only care about performance, I
don't care about ease of programming.

Jul 10 '08 #2
From your description, you're wondering tradeoff between storeing database
records in ASP.NET page's viewstate and query them in every request,
correct?
Yes.
Based on my understanding, if you're using Databound control(such as
Gridview, DataGrid)
Not using datagrid. Using custom display controls. I can choose to
enable/disable viewstate.
3. If the bottleneck is not at the web application and backend database
server(performing data accessing operations such as query data), I
recommend you query the data from database in every request where you need
to display the data. But if the data is large and really static or
unchangable, you can consider using Application Cache to cache them.
That is my point. I don't know where my bottleneck is yet. I'm looking for a
"best practice". Something that works in most scenarios. I can choose to
enable view state and only hit the database once - then reuse the data for
multiple postbacks - this will obviously create a larger html response to the
client. Or I can choose to keep the page size smaller, but hit my database on
each postback - this will be more taxing on the server of course. As a
general rule - which is better? And why?

-------------------
#Using the ASP.NET Application Cache to Make Your Applications Scream
http://www.developer.com/net/net/article.php/1477771

#ASP.NET Caching Overview
http://msdn.microsoft.com/en-us/library/ms178597.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Thread-Topic: ViewState vs. Database
thread-index: AcjiL9LHoL7fpWJYTuakWT7C3nnrKw==
X-WBNR-Posting-Host: 207.46.19.168
From: =?Utf-8?B?TUNN?= <MC*@newsgroup.nospam>
Subject: ViewState vs. Database
Date: Wed, 9 Jul 2008 18:54:00 -0700

I'm sure the answer to my question varies depending on the situation, but
I
am looking for a general "best practice".

If I have an asp.net application and I load certain data from a database,
should I use ViewState to store and reload the data, or should I load the
data from the database on each postback?

Assume for the sake of this question that I only care about performance, I
don't care about ease of programming.

Jul 10 '08 #3
Hi MMC,

Thanks for your quick response.

For the bottleneck issue, I suggest you try the following things:

1. ASP.NET's output trace can print out the time each event finished or any
output statement's time, and you can write out some custom statement in
each event and lookup the time slot in the trace.

2. Visual studio 2005/2008 provide performance profiling tools that can
help us profile application(include desktop and web apps)'s performance.
such as which part takes most time or which part is called most frequently:

#Analyzing Application Performance
http://msdn.microsoft.com/en-us/libr...29(VS.80).aspx

#Visual Studio Profiler Team Blog
http://blogs.msdn.com/profiler/

this is helpful to detect potential bottlenecks in many cases.

For your further question "As a general rule - which is better? And why?",
here is my opinion for your reference:

1. If database server is powerful enough to support frequent query/update
processing or such operations are not quite frequent, I'll always do the
query instead of caching the data. Since that can save webserver memory.

2. If data is quite large and operations are so frequent that may impact
database server, I'll first consider caching data at server-side (such as
in memory cache) rather than use page's viewstate. The reason is as below:

** given anytime, for an application, user experience is the most
important, large page size is certainly big problem for client user
experience.

** also, large page content also impact server memory since such large
data(in form field) is post back to server and write down to client in
every request, so means ASP.NET runtime need to load it into memory
everytime processing page request.

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>From: =?Utf-8?B?TUNN?= <MC*@newsgroup.nospam>
References: <DB**********************************@microsoft.co m>
<lz**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: ViewState vs. Database
Date: Wed, 9 Jul 2008 23:15:00 -0700
40.244.149
>X-Tomcat-NG: microsoft.public.dotnet.general
>From your description, you're wondering tradeoff between storeing
database
>records in ASP.NET page's viewstate and query them in every request,
correct?

Yes.
>Based on my understanding, if you're using Databound control(such as
Gridview, DataGrid)

Not using datagrid. Using custom display controls. I can choose to
enable/disable viewstate.
>3. If the bottleneck is not at the web application and backend database
server(performing data accessing operations such as query data), I
recommend you query the data from database in every request where you
need
>to display the data. But if the data is large and really static or
unchangable, you can consider using Application Cache to cache them.

That is my point. I don't know where my bottleneck is yet. I'm looking for
a
>"best practice". Something that works in most scenarios. I can choose to
enable view state and only hit the database once - then reuse the data for
multiple postbacks - this will obviously create a larger html response to
the
>client. Or I can choose to keep the page size smaller, but hit my database
on
>each postback - this will be more taxing on the server of course. As a
general rule - which is better? And why?

-------------------
>#Using the ASP.NET Application Cache to Make Your Applications Scream
http://www.developer.com/net/net/article.php/1477771

#ASP.NET Caching Overview
http://msdn.microsoft.com/en-us/library/ms178597.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
>suggestions about how we can improve the support we provide to you.
Please
>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
>where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
>up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach
the
>most efficient resolution. The offering is not appropriate for
situations
>that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best
>handled working with a dedicated Microsoft Support Engineer by
contacting
>Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
================================================= =
This posting is provided "AS IS" with no warranties, and confers no
rights.
>>
--------------------
>Thread-Topic: ViewState vs. Database
thread-index: AcjiL9LHoL7fpWJYTuakWT7C3nnrKw==
X-WBNR-Posting-Host: 207.46.19.168
From: =?Utf-8?B?TUNN?= <MC*@newsgroup.nospam>
Subject: ViewState vs. Database
Date: Wed, 9 Jul 2008 18:54:00 -0700
>
I'm sure the answer to my question varies depending on the situation,
but
>I
>am looking for a general "best practice".

If I have an asp.net application and I load certain data from a
database,
>should I use ViewState to store and reload the data, or should I load
the
>data from the database on each postback?

Assume for the sake of this question that I only care about
performance, I
>don't care about ease of programming.


Jul 10 '08 #4
The "best practice" as you will find if you search the web and verify what I
advise is to disable ViewState for every control in the page that is not
absolutely necessary to maintain state in the page. Similarly, disable
ViewState at the page level for all pages that are not critical to maintain
state.

For example the use of a Wizard control with the Previous button will
maintain state and the data entered into the previous step will remain
displayed and available as it is carried back and forth from the server with
every postback. That is usually desired when using this control. Other
situations you have to use your judgment.

This is the best practice you asked about.

"MCM" <MC*@newsgroup.nospamwrote in message
news:DB**********************************@microsof t.com...
I'm sure the answer to my question varies depending on the situation, but
I
am looking for a general "best practice".

If I have an asp.net application and I load certain data from a database,
should I use ViewState to store and reload the data, or should I load the
data from the database on each postback?

Assume for the sake of this question that I only care about performance, I
don't care about ease of programming.
Jul 10 '08 #5
1. If database server is powerful enough to support frequent query/update
processing or such operations are not quite frequent, I'll always do the
query instead of caching the data. Since that can save webserver memory.
So from a performance perspective, saving webserver memory is more important
that reducing the load on the db server?
2. If data is quite large and operations are so frequent that may impact
database server, I'll first consider caching data at server-side (such as
in memory cache) rather than use page's viewstate.
This is an interesting idea. But this seems to contradict #1. So the
question is still where to I want to place the heaviest load - web or db
server?

--------------------------
** given anytime, for an application, user experience is the most
important, large page size is certainly big problem for client user
experience.

** also, large page content also impact server memory since such large
data(in form field) is post back to server and write down to client in
every request, so means ASP.NET runtime need to load it into memory
everytime processing page request.

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: =?Utf-8?B?TUNN?= <MC*@newsgroup.nospam>
References: <DB**********************************@microsoft.co m>
<lz**************@TK2MSFTNGHUB02.phx.gbl>
Subject: RE: ViewState vs. Database
Date: Wed, 9 Jul 2008 23:15:00 -0700
40.244.149
X-Tomcat-NG: microsoft.public.dotnet.general
From your description, you're wondering tradeoff between storeing
database
records in ASP.NET page's viewstate and query them in every request,
correct?
Yes.
Based on my understanding, if you're using Databound control(such as
Gridview, DataGrid)
Not using datagrid. Using custom display controls. I can choose to
enable/disable viewstate.
3. If the bottleneck is not at the web application and backend database
server(performing data accessing operations such as query data), I
recommend you query the data from database in every request where you
need
to display the data. But if the data is large and really static or
unchangable, you can consider using Application Cache to cache them.
That is my point. I don't know where my bottleneck is yet. I'm looking for
a
"best practice". Something that works in most scenarios. I can choose to
enable view state and only hit the database once - then reuse the data for
multiple postbacks - this will obviously create a larger html response to
the
client. Or I can choose to keep the page size smaller, but hit my database
on
each postback - this will be more taxing on the server of course. As a
general rule - which is better? And why?

-------------------
#Using the ASP.NET Application Cache to Make Your Applications Scream
http://www.developer.com/net/net/article.php/1477771

#ASP.NET Caching Overview
http://msdn.microsoft.com/en-us/library/ms178597.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach
the
most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best
handled working with a dedicated Microsoft Support Engineer by
contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
--------------------
Thread-Topic: ViewState vs. Database
thread-index: AcjiL9LHoL7fpWJYTuakWT7C3nnrKw==
X-WBNR-Posting-Host: 207.46.19.168
From: =?Utf-8?B?TUNN?= <MC*@newsgroup.nospam>
Subject: ViewState vs. Database
Date: Wed, 9 Jul 2008 18:54:00 -0700


I'm sure the answer to my question varies depending on the situation,
but
I
am looking for a general "best practice".

If I have an asp.net application and I load certain data from a
database,
should I use ViewState to store and reload the data, or should I load
the
data from the database on each postback?

Assume for the sake of this question that I only care about
performance, I
don't care about ease of programming.




Jul 10 '08 #6
Thanks for your reply MCM,

Not absolute. At least I would prefer that. However, for a specific
application, it much depends on the actual cost of each stage( web client
to server, webserver, server to database server..). And the best way is to
do some profiling and get some idea of the actual cost or bottleneck and do
optimize against the critical point.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

--------------------
>From: =?Utf-8?B?TUNN?= <MC*@newsgroup.nospam>
References: <DB**********************************@microsoft.co m>
<lz**************@TK2MSFTNGHUB02.phx.gbl>
<26**********************************@microsoft.co m>
<uE**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: ViewState vs. Database
Date: Thu, 10 Jul 2008 10:47:02 -0700
>
>1. If database server is powerful enough to support frequent
query/update
>processing or such operations are not quite frequent, I'll always do the
query instead of caching the data. Since that can save webserver memory.

So from a performance perspective, saving webserver memory is more
important
>that reducing the load on the db server?
>2. If data is quite large and operations are so frequent that may impact
database server, I'll first consider caching data at server-side (such
as
>in memory cache) rather than use page's viewstate.

This is an interesting idea. But this seems to contradict #1. So the
question is still where to I want to place the heaviest load - web or db
server?

--------------------------
>** given anytime, for an application, user experience is the most
important, large page size is certainly big problem for client user
experience.

** also, large page content also impact server memory since such large
data(in form field) is post back to server and write down to client in
every request, so means ASP.NET runtime need to load it into memory
everytime processing page request.

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
>suggestions about how we can improve the support we provide to you.
Please
>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>ications.
================================================= =
This posting is provided "AS IS" with no warranties, and confers no
rights.
>>
Jul 11 '08 #7
Hi MCM,

How are you doing?

Have you got any further ideas on this or have you determined which
approach to use? If there is anything else need help, please feel free to
post here.

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: st*****@online.microsoft.com (Steven Cheng [MSFT])
Organization: Microsoft
Date: Fri, 11 Jul 2008 02:09:59 GMT
Subject: RE: ViewState vs. Database
>
Thanks for your reply MCM,

Not absolute. At least I would prefer that. However, for a specific
application, it much depends on the actual cost of each stage( web client
to server, webserver, server to database server..). And the best way is
to
>do some profiling and get some idea of the actual cost or bottleneck and
do
>optimize against the critical point.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

--------------------
>>From: =?Utf-8?B?TUNN?= <MC*@newsgroup.nospam>
References: <DB**********************************@microsoft.co m>
<lz**************@TK2MSFTNGHUB02.phx.gbl>
<26**********************************@microsoft.c om>
<uE**************@TK2MSFTNGHUB02.phx.gbl>
>>Subject: RE: ViewState vs. Database
Date: Thu, 10 Jul 2008 10:47:02 -0700
>>
>>1. If database server is powerful enough to support frequent
query/update
>>processing or such operations are not quite frequent, I'll always do
the
>>query instead of caching the data. Since that can save webserver memory.

So from a performance perspective, saving webserver memory is more
important
>>that reducing the load on the db server?
>>2. If data is quite large and operations are so frequent that may
impact
>>database server, I'll first consider caching data at server-side (such
as
>>in memory cache) rather than use page's viewstate.

This is an interesting idea. But this seems to contradict #1. So the
question is still where to I want to place the heaviest load - web or db
server?
Jul 16 '08 #8
Well, I decided for the best possible user performance, I need to disable
ViewState as much as possible to keep the html smaller. The slowest part of
the network is the outbound data transfer to the client - much slower that
the gig traffic on the internal network. However, from a cost perspective,
building out a SQL cluster is more expensive than adding load balanced web
servers. So rather than making extra db calls, I'm going to try and cache
data on the webserver. This will of course mean a strain on RAM for the
webserver, but that seems like the best performance to cost ratio I can come
up with.

"Steven Cheng [MSFT]" wrote:
Hi MCM,

How are you doing?

Have you got any further ideas on this or have you determined which
approach to use? If there is anything else need help, please feel free to
post here.

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: st*****@online.microsoft.com (Steven Cheng [MSFT])
Organization: Microsoft
Date: Fri, 11 Jul 2008 02:09:59 GMT
Subject: RE: ViewState vs. Database

Thanks for your reply MCM,

Not absolute. At least I would prefer that. However, for a specific
application, it much depends on the actual cost of each stage( web client
to server, webserver, server to database server..). And the best way is
to
do some profiling and get some idea of the actual cost or bottleneck and
do
optimize against the critical point.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

--------------------
>From: =?Utf-8?B?TUNN?= <MC*@newsgroup.nospam>
References: <DB**********************************@microsoft.co m>
<lz**************@TK2MSFTNGHUB02.phx.gbl>
<26**********************************@microsoft.co m>
<uE**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: ViewState vs. Database
Date: Thu, 10 Jul 2008 10:47:02 -0700
>
1. If database server is powerful enough to support frequent
query/update
>processing or such operations are not quite frequent, I'll always do
the
>query instead of caching the data. Since that can save webserver memory.

So from a performance perspective, saving webserver memory is more
important
>that reducing the load on the db server?

2. If data is quite large and operations are so frequent that may
impact
>database server, I'll first consider caching data at server-side (such
as
>in memory cache) rather than use page's viewstate.

This is an interesting idea. But this seems to contradict #1. So the
question is still where to I want to place the heaviest load - web or db
server?

Jul 16 '08 #9
Thanks for your followup.

I'm glad that you've made the decision. If there is anything else we can
help in the future, welcome to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Subject: RE: ViewState vs. Database
Date: Wed, 16 Jul 2008 01:59:33 -0700
>Well, I decided for the best possible user performance, I need to disable
ViewState as much as possible to keep the html smaller. The slowest part
of
>the network is the outbound data transfer to the client - much slower that
the gig traffic on the internal network. However, from a cost perspective,
building out a SQL cluster is more expensive than adding load balanced web
servers. So rather than making extra db calls, I'm going to try and cache
data on the webserver. This will of course mean a strain on RAM for the
webserver, but that seems like the best performance to cost ratio I can
come
>up with.

"Steven Cheng [MSFT]" wrote:
>Hi MCM,

How are you doing?

Have you got any further ideas on this or have you determined which
approach to use? If there is anything else need help, please feel free
to
>post here.

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
>suggestions about how we can improve the support we provide to you.
Please
>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>ications.

This posting is provided "AS IS" with no warranties, and confers no
rights.
>>
--------------------
>From: st*****@online.microsoft.com (Steven Cheng [MSFT])
Organization: Microsoft
Date: Fri, 11 Jul 2008 02:09:59 GMT
Subject: RE: ViewState vs. Database
>
Thanks for your reply MCM,

Not absolute. At least I would prefer that. However, for a specific
application, it much depends on the actual cost of each stage( web
client
>to server, webserver, server to database server..). And the best way
is
>to
>do some profiling and get some idea of the actual cost or bottleneck
and
>do
>optimize against the critical point.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
>suggestions about how we can improve the support we provide to you.
Please
>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

--------------------

From: =?Utf-8?B?TUNN?= <MC*@newsgroup.nospam>
References: <DB**********************************@microsoft.co m>
<lz**************@TK2MSFTNGHUB02.phx.gbl>
<26**********************************@microsoft.c om>
<uE**************@TK2MSFTNGHUB02.phx.gbl>
Subject: RE: ViewState vs. Database
Date: Thu, 10 Jul 2008 10:47:02 -0700
1. If database server is powerful enough to support frequent
query/update
processing or such operations are not quite frequent, I'll always do
the
>>query instead of caching the data. Since that can save webserver
memory.
>>
So from a performance perspective, saving webserver memory is more
important
that reducing the load on the db server?

2. If data is quite large and operations are so frequent that may
impact
>>database server, I'll first consider caching data at server-side
(such
>as
in memory cache) rather than use page's viewstate.

This is an interesting idea. But this seems to contradict #1. So the
question is still where to I want to place the heaviest load - web or
db
>>server?

Jul 17 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
10
by: neo | last post by:
hi, I am studying ASP.NET and have few questions - 1) The session ID and values of controls is stored in VIEWSTATE variable. So now when we put EnableViewState="false" in Page directive and...
1
by: Sky | last post by:
Although I've been using C# for the last month or so, and accepting out of blind faith the ViewState, I do have some nagging questions about it... can you help verify the following statements? ...
4
by: Chuck Ritzke | last post by:
Hi, I've searched the newsgroup and other sources to understand how to handle runtime controls and see I'm not the only one who's confused, but I'm still not quite sure of the best way to handle...
2
by: Bill Yeager | last post by:
I have a grid that I databind with a strongly typed dataset which contains thousands of records retrieved from a database. After the dataset is retrieved from the database, I place it in...
1
by: Simon | last post by:
Hi everyone, I have a quick question that I hope someone can help me with: I've made a user control that contains a text box and some validation functionality. This control has a few extra...
0
by: Don | last post by:
I need some suggests on how to manage the viewState on my page. I have multiple checkBoxLists that are dynamically created and need then synced up with the viewstate. My problem is that on each...
1
by: Irene | last post by:
Hello all! I'm creating a web site in ASP.NET (VB.NET). One of the requirements was to allow users to create orders going through several steps. A must have is to have an option to save the work...
3
by: Gummy | last post by:
Hello, I have an ASPX page on which I place a UserControl 15 times (they only need to be static controls on the page). This UserControl is a set of two listboxes with radiobuttons above the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.