Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2006

Tip: Looking for answers? Try searching our database.

Cache object vs Session, Application state for datagrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
marina.sukhnev@thinknet.com - 02 Mar 2006 15:22 GMT
Hi Guys!
I have a question to you,if you know...
What is the best way to cache dataset for web application.
Is it Cahce object, session state or application state.
What a pros and cons? Perfomance,Scalability etc.

Thanks a lot,

Marina
Josh Twist - 02 Mar 2006 18:43 GMT
If you cache something in session state then you'll have one per
session (i.e. one instance per user). If this isn't what you need use
the Cache - it's exactly what it's built to do and comes with heaps of
features like sliding expiration, absolute expiration and is tuned to
work well in a multi-threaded (IIS/ASP.NET) environment.

Josh
http://www.thejoyofcode.com/
marina.sukhnev@thinknet.com - 02 Mar 2006 19:14 GMT
Hi Josh,
Thanks for you reply,
I tried both,Session and Cache,
When I deal with datagrid that bound to dataset that may have about 900
-1000 records and trying to edit,delete,update some rows,very soon I'm
getting out of memory exception. Is 900 rows it too much to handle?
I'm not setting any features for cache or session,just
cache("myds")=ds
session("myds")=ds
Any suggestions?

Thank you,
Marina
Josh Twist - 03 Mar 2006 08:18 GMT
I doubt it's the 900 rows themselves causing you problems (it's not
that many) and if the dataset wasn't cached you'd have one instance
loaded into memory for each request (so potentially using even more
memory on a busy server).

Maybe there is something about the modification of datasets that makes
it chew up memory?? Also, you need to bear in mind that IIS/ASP.NET is
a multithreaded environment so different threads could be accessing the
dataset at the sametime. MSDN has this to say about the thread safety
of datasets: "This type is safe for multithreaded read operations. You
must synchronize any write operations."

Are you synchronising your write operations? This is a pitfall to
beware of, though I'm not sure this is what would be causing your
memory to be chewed up.

I'm afraid DataSets are not something I use in ASP.NET [see links
below] so It's really not an area I'm very strong in. If I was in your
position now I might use the CLR Profiler to see what's happening to
all your memory:
http://msdn.microsoft.com/library/en-us/dnpag/html/scalenethowto13.asp?frame=true

links
http://aspnet.4guysfromrolla.com/articles/050405-1.aspx
http://aspnet.4guysfromrolla.com/articles/051805-1.aspx

Good luck

Josh
http://www.thejoyofcode.com/
marina.sukhnev@thinknet.com - 07 Mar 2006 17:25 GMT
> I doubt it's the 900 rows themselves causing you problems (it's not
> that many) and if the dataset wasn't cached you'd have one instance
[quoted text clipped - 26 lines]
> Josh
> http://www.thejoyofcode.com/

Thanks Josh for your help,
I'll try CLR Profiler...

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.