Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - ViewState vs. Database

Reply
 
Old 07-09-2008   #1 (permalink)
MCM


 
 

ViewState vs. Database

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:
msdnmg@xxxxxx.

==================================================
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.


--------------------
Quote:

>Subject: RE: ViewState vs. Database
>Date: Wed, 16 Jul 2008 01:59:33 -0700
Quote:

>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
Quote:

>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
Quote:

>up with.
>
>"Steven Cheng [MSFT]" wrote:
>
Quote:

>> 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
Quote:
Quote:

>> post here.
>>
>> Sincerely,
>>
>> Steven Cheng
>> Microsoft MSDN Online Support Lead
>>
>>
>> Delighting our customers is our #1 priority. We welcome your comments
and
Quote:
Quote:

>> suggestions about how we can improve the support we provide to you.
Please
Quote:
Quote:

>> 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:
>> msdnmg@xxxxxx.
>>
>> ==================================================
>> Get notification to my posts through email? Please refer to
>>
http://msdn.microsoft.com/subscripti...ult.aspx#notif
Quote:
Quote:

>> ications.
>>
>> This posting is provided "AS IS" with no warranties, and confers no
rights.
Quote:
Quote:

>>
>> --------------------
>>
Quote:

>> >From: stcheng@xxxxxx (Steven Cheng [MSFT])
>> >Organization: Microsoft
>> >Date: Fri, 11 Jul 2008 02:09:59 GMT
>> >Subject: RE: ViewState vs. Database
>>
Quote:

>> >
>> >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
Quote:
Quote:
Quote:

>> >to server, webserver, server to database server..). And the best way
is
Quote:
Quote:

>> to
Quote:

>> >do some profiling and get some idea of the actual cost or bottleneck
and
Quote:
Quote:

>> do
Quote:

>> >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
Quote:
Quote:
Quote:

>> >suggestions about how we can improve the support we provide to you.
Please
Quote:
Quote:
Quote:

>> >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:
>> >msdnmg@xxxxxx
>> >
>> >--------------------
>> >
>> >>From: =?Utf-8?B?TUNN?= <MCM@xxxxxx>
>> >>References: <DB321895-A729-496F-B9B5-423029159B7B@xxxxxx>
>> ><lzALYqj4IHA.4056@xxxxxx>
>> ><26F3D2C0-3938-4A43-9AC5-25180A287D40@xxxxxx>
>> ><uEmi0kn4IHA.1340@xxxxxx>
>> >>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
Quote:

>> >>> query instead of caching the data. Since that can save webserver
memory.
Quote:
Quote:
Quote:

>> >>
>> >>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
Quote:

>> >>> database server, I'll first consider caching data at server-side
(such
Quote:
Quote:
Quote:

>> >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
Quote:
Quote:
Quote:

>> >>server?
>> >>
>>
>>
>

My System SpecsSystem Spec
Old 07-09-2008   #2 (permalink)
Steven Cheng [MSFT]


 
 

RE: ViewState vs. Database

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:
msdnmg@xxxxxx.

==================================================
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.



--------------------
Quote:

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

>
>I'm sure the answer to my question varies depending on the situation, but
I
Quote:

>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.
>
>
My System SpecsSystem Spec
Old 07-10-2008   #3 (permalink)
MCM


 
 

RE: ViewState vs. Database

> From your description, you're wondering tradeoff between storeing database
Quote:

> records in ASP.NET page's viewstate and query them in every request,
> correct?
Yes.
Quote:

> 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.
Quote:

> 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?

-------------------
Quote:

> #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:
> msdnmg@xxxxxx.
>
> ==================================================
> 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.
>
>
>
> --------------------
Quote:

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

> >
> >I'm sure the answer to my question varies depending on the situation, but
> I
Quote:

> >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.
> >
> >
>
>
My System SpecsSystem Spec
Old 07-10-2008   #4 (permalink)
Steven Cheng [MSFT]


 
 

RE: ViewState vs. Database

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:
msdnmg@xxxxxx.

==================================================
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.






--------------------
Quote:

>From: =?Utf-8?B?TUNN?= <MCM@xxxxxx>
>References: <DB321895-A729-496F-B9B5-423029159B7B@xxxxxx>
<lzALYqj4IHA.4056@xxxxxx>
Quote:

>Subject: RE: ViewState vs. Database
>Date: Wed, 9 Jul 2008 23:15:00 -0700
40.244.149
Quote:

>X-Tomcat-NG: microsoft.public.dotnet.general
>
Quote:

>> From your description, you're wondering tradeoff between storeing
database
Quote:
Quote:

>> records in ASP.NET page's viewstate and query them in every request,
>> correct?
>
>Yes.
>
Quote:

>> 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.
>
Quote:

>> 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
Quote:
Quote:

>> 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
Quote:

>"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
Quote:

>client. Or I can choose to keep the page size smaller, but hit my database
on
Quote:

>each postback - this will be more taxing on the server of course. As a
>general rule - which is better? And why?
>
>-------------------
>
Quote:

>> #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
Quote:
Quote:

>> suggestions about how we can improve the support we provide to you.
Please
Quote:
Quote:

>> 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:
>> msdnmg@xxxxxx.
>>
>> ==================================================
>> Get notification to my posts through email? Please refer to
>>
http://msdn.microsoft.com/subscripti...ult.aspx#notif
Quote:
Quote:

>> ications.
>>
>> Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
Quote:
Quote:

>> where an initial response from the community or a Microsoft Support
>> Engineer within 1 business day is acceptable. Please note that each
follow
Quote:
Quote:

>> up response may take approximately 2 business days as the support
>> professional working with you may need further investigation to reach
the
Quote:
Quote:

>> most efficient resolution. The offering is not appropriate for
situations
Quote:
Quote:

>> that require urgent, real-time or phone-based interactions or complex
>> project analysis and dump analysis issues. Issues of this nature are
best
Quote:
Quote:

>> handled working with a dedicated Microsoft Support Engineer by
contacting
Quote:
Quote:

>> 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.
Quote:
Quote:

>>
>>
>>
>> --------------------
Quote:

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

>> >
>> >I'm sure the answer to my question varies depending on the situation,
but
Quote:
Quote:

>> I
Quote:

>> >am looking for a general "best practice".
>> >
>> >If I have an asp.net application and I load certain data from a
database,
Quote:
Quote:
Quote:

>> >should I use ViewState to store and reload the data, or should I load
the
Quote:
Quote:
Quote:

>> >data from the database on each postback?
>> >
>> >Assume for the sake of this question that I only care about
performance, I
Quote:
Quote:
Quote:

>> >don't care about ease of programming.
>> >
>> >
>>
>>
>
My System SpecsSystem Spec
Old 07-10-2008   #5 (permalink)
MCM


 
 

RE: ViewState vs. Database

> 1. If database server is powerful enough to support frequent query/update
Quote:

> 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?
Quote:

> 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?

--------------------------
Quote:

> ** 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:
> msdnmg@xxxxxx.
>
> ==================================================
> 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.
>
>
>
>
>
>
> --------------------
Quote:

> >From: =?Utf-8?B?TUNN?= <MCM@xxxxxx>
> >References: <DB321895-A729-496F-B9B5-423029159B7B@xxxxxx>
> <lzALYqj4IHA.4056@xxxxxx>
Quote:

> >Subject: RE: ViewState vs. Database
> >Date: Wed, 9 Jul 2008 23:15:00 -0700
> 40.244.149
Quote:

> >X-Tomcat-NG: microsoft.public.dotnet.general
> >
Quote:

> >> From your description, you're wondering tradeoff between storeing
> database
Quote:
Quote:

> >> records in ASP.NET page's viewstate and query them in every request,
> >> correct?
> >
> >Yes.
> >
Quote:

> >> 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.
> >
Quote:

> >> 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
Quote:
Quote:

> >> 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
Quote:

> >"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
Quote:

> >client. Or I can choose to keep the page size smaller, but hit my database
> on
Quote:

> >each postback - this will be more taxing on the server of course. As a
> >general rule - which is better? And why?
> >
> >-------------------
> >
Quote:

> >> #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
Quote:
Quote:

> >> suggestions about how we can improve the support we provide to you.
> Please
Quote:
Quote:

> >> 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:
> >> msdnmg@xxxxxx.
> >>
> >> ==================================================
> >> Get notification to my posts through email? Please refer to
> >>
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
Quote:
Quote:

> >> ications.
> >>
> >> Note: The MSDN Managed Newsgroup support offering is for non-urgent
> issues
Quote:
Quote:

> >> where an initial response from the community or a Microsoft Support
> >> Engineer within 1 business day is acceptable. Please note that each
> follow
Quote:
Quote:

> >> up response may take approximately 2 business days as the support
> >> professional working with you may need further investigation to reach
> the
Quote:
Quote:

> >> most efficient resolution. The offering is not appropriate for
> situations
Quote:
Quote:

> >> that require urgent, real-time or phone-based interactions or complex
> >> project analysis and dump analysis issues. Issues of this nature are
> best
Quote:
Quote:

> >> handled working with a dedicated Microsoft Support Engineer by
> contacting
Quote:
Quote:

> >> 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.
Quote:
Quote:

> >>
> >>
> >>
> >> --------------------
> >> >Thread-Topic: ViewState vs. Database
> >> >thread-index: AcjiL9LHoL7fpWJYTuakWT7C3nnrKw==
> >> >X-WBNR-Posting-Host: 207.46.19.168
> >> >From: =?Utf-8?B?TUNN?= <MCM@xxxxxx>
> >> >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
Quote:
Quote:

> >> I
> >> >am looking for a general "best practice".
> >> >
> >> >If I have an asp.net application and I load certain data from a
> database,
Quote:
Quote:

> >> >should I use ViewState to store and reload the data, or should I load
> the
Quote:
Quote:

> >> >data from the database on each postback?
> >> >
> >> >Assume for the sake of this question that I only care about
> performance, I
Quote:
Quote:

> >> >don't care about ease of programming.
> >> >
> >> >
> >>
> >>
> >
>
>
My System SpecsSystem Spec
Old 07-10-2008   #6 (permalink)
Steven Cheng [MSFT]


 
 

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:
msdnmg@xxxxxx.

--------------------
Quote:

>From: =?Utf-8?B?TUNN?= <MCM@xxxxxx>
>References: <DB321895-A729-496F-B9B5-423029159B7B@xxxxxx>
<lzALYqj4IHA.4056@xxxxxx>
<26F3D2C0-3938-4A43-9AC5-25180A287D40@xxxxxx>
<uEmi0kn4IHA.1340@xxxxxx>
Quote:

>Subject: RE: ViewState vs. Database
>Date: Thu, 10 Jul 2008 10:47:02 -0700
Quote:

>
Quote:

>> 1. If database server is powerful enough to support frequent
query/update
Quote:
Quote:

>> 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
Quote:

>that reducing the load on the db server?
>
Quote:

>> 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
Quote:
Quote:

>> 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?
>
>--------------------------
>
Quote:

>> ** 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
Quote:
Quote:

>> suggestions about how we can improve the support we provide to you.
Please
Quote:
Quote:

>> 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:
>> msdnmg@xxxxxx.
>>
>> ==================================================
>> Get notification to my posts through email? Please refer to
>>
http://msdn.microsoft.com/subscripti...ult.aspx#notif
Quote:
Quote:

>> ications.
>> ==================================================
>> This posting is provided "AS IS" with no warranties, and confers no
rights.
Quote:
Quote:

>>
My System SpecsSystem Spec
Old 07-16-2008   #7 (permalink)
Steven Cheng [MSFT]


 
 

RE: ViewState vs. Database

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:
msdnmg@xxxxxx.

==================================================
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.

--------------------
Quote:

>From: stcheng@xxxxxx (Steven Cheng [MSFT])
>Organization: Microsoft
>Date: Fri, 11 Jul 2008 02:09:59 GMT
>Subject: RE: ViewState vs. Database
Quote:

>
>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
Quote:

>do some profiling and get some idea of the actual cost or bottleneck and
do
Quote:

>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:
>msdnmg@xxxxxx
>
>--------------------
>
Quote:

>>From: =?Utf-8?B?TUNN?= <MCM@xxxxxx>
>>References: <DB321895-A729-496F-B9B5-423029159B7B@xxxxxx>
><lzALYqj4IHA.4056@xxxxxx>
><26F3D2C0-3938-4A43-9AC5-25180A287D40@xxxxxx>
><uEmi0kn4IHA.1340@xxxxxx>
Quote:

>>Subject: RE: ViewState vs. Database
>>Date: Thu, 10 Jul 2008 10:47:02 -0700
>
Quote:

>>
Quote:

>>> 1. If database server is powerful enough to support frequent
>query/update
Quote:
Quote:

>>> processing or such operations are not quite frequent, I'll always do
the
Quote:
Quote:
Quote:

>>> query instead of caching the data. Since that can save webserver memory.
>>
>>So from a performance perspective, saving webserver memory is more
>important
Quote:

>>that reducing the load on the db server?
>>
Quote:

>>> 2. If data is quite large and operations are so frequent that may
impact
Quote:
Quote:
Quote:

>>> database server, I'll first consider caching data at server-side (such
>as
Quote:
Quote:

>>> 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?
>>
My System SpecsSystem Spec
Old 07-16-2008   #8 (permalink)
MCM


 
 

RE: ViewState vs. Database

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:
Quote:

> 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:
> msdnmg@xxxxxx.
>
> ==================================================
> 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.
>
> --------------------
>
Quote:

> >From: stcheng@xxxxxx (Steven Cheng [MSFT])
> >Organization: Microsoft
> >Date: Fri, 11 Jul 2008 02:09:59 GMT
> >Subject: RE: ViewState vs. Database
>
Quote:

> >
> >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
Quote:

> >do some profiling and get some idea of the actual cost or bottleneck and
> do
Quote:

> >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:
> >msdnmg@xxxxxx
> >
> >--------------------
> >
Quote:

> >>From: =?Utf-8?B?TUNN?= <MCM@xxxxxx>
> >>References: <DB321895-A729-496F-B9B5-423029159B7B@xxxxxx>
> ><lzALYqj4IHA.4056@xxxxxx>
> ><26F3D2C0-3938-4A43-9AC5-25180A287D40@xxxxxx>
> ><uEmi0kn4IHA.1340@xxxxxx>
Quote:

> >>Subject: RE: ViewState vs. Database
> >>Date: Thu, 10 Jul 2008 10:47:02 -0700
> >
Quote:

> >>
> >>> 1. If database server is powerful enough to support frequent
> >query/update
Quote:

> >>> processing or such operations are not quite frequent, I'll always do
> the
Quote:
Quote:

> >>> query instead of caching the data. Since that can save webserver memory.
> >>
> >>So from a performance perspective, saving webserver memory is more
> >important
Quote:

> >>that reducing the load on the db server?
> >>
> >>> 2. If data is quite large and operations are so frequent that may
> impact
Quote:
Quote:

> >>> database server, I'll first consider caching data at server-side (such
> >as
Quote:

> >>> 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?
> >>
>
>
My System SpecsSystem Spec
Old 07-17-2008   #9 (permalink)
Steven Cheng [MSFT]


 
 

RE: ViewState vs. Database

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:
msdnmg@xxxxxx.

==================================================
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.


--------------------
Quote:

>Subject: RE: ViewState vs. Database
>Date: Wed, 16 Jul 2008 01:59:33 -0700
Quote:

>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
Quote:

>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
Quote:

>up with.
>
>"Steven Cheng [MSFT]" wrote:
>
Quote:

>> 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
Quote:
Quote:

>> post here.
>>
>> Sincerely,
>>
>> Steven Cheng
>> Microsoft MSDN Online Support Lead
>>
>>
>> Delighting our customers is our #1 priority. We welcome your comments
and
Quote:
Quote:

>> suggestions about how we can improve the support we provide to you.
Please
Quote:
Quote:

>> 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:
>> msdnmg@xxxxxx.
>>
>> ==================================================
>> Get notification to my posts through email? Please refer to
>>
http://msdn.microsoft.com/subscripti...ult.aspx#notif
Quote:
Quote:

>> ications.
>>
>> This posting is provided "AS IS" with no warranties, and confers no
rights.
Quote:
Quote:

>>
>> --------------------
>>
Quote:

>> >From: stcheng@xxxxxx (Steven Cheng [MSFT])
>> >Organization: Microsoft
>> >Date: Fri, 11 Jul 2008 02:09:59 GMT
>> >Subject: RE: ViewState vs. Database
>>
Quote:

>> >
>> >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
Quote:
Quote:
Quote:

>> >to server, webserver, server to database server..). And the best way
is
Quote:
Quote:

>> to
Quote:

>> >do some profiling and get some idea of the actual cost or bottleneck
and
Quote:
Quote:

>> do
Quote:

>> >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
Quote:
Quote:
Quote:

>> >suggestions about how we can improve the support we provide to you.
Please
Quote:
Quote:
Quote:

>> >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:
>> >msdnmg@xxxxxx
>> >
>> >--------------------
>> >
>> >>From: =?Utf-8?B?TUNN?= <MCM@xxxxxx>
>> >>References: <DB321895-A729-496F-B9B5-423029159B7B@xxxxxx>
>> ><lzALYqj4IHA.4056@xxxxxx>
>> ><26F3D2C0-3938-4A43-9AC5-25180A287D40@xxxxxx>
>> ><uEmi0kn4IHA.1340@xxxxxx>
>> >>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
Quote:

>> >>> query instead of caching the data. Since that can save webserver
memory.
Quote:
Quote:
Quote:

>> >>
>> >>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
Quote:

>> >>> database server, I'll first consider caching data at server-side
(such
Quote:
Quote:
Quote:

>> >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
Quote:
Quote:
Quote:

>> >>server?
>> >>
>>
>>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
database .NET General
Disable ViewState .NET General
Compacting The Database In WLM Live Mail
Works database 2007 and Office database 2003 .NET General
access database .. PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46