Storing application specific information

G

Guest

I have some data that is been retrieved from a call to sql server stored
procedure that I want to store for a period of time in a web farm
architecture. I want to minimize the calls to sql server as much as
possible. Storing it in application cache will result the calls to be made
if the users are bounced from one server to another. But is this the best
resolution or is there any other methodology that I can use which will be
more optimized for my purpose?

Any help on this matter is greatly appreciated.
 
J

Joshua Flanagan

It depends on how the data is used. Is it common to all users, or is
different data retrieved for each user?
If it is common to all users, using the ASP.NET Cache is probably the
best option. Yes, it will be retrieved once for each server in a farm,
but that is a pretty low cost to pay.
If the data is specific to each user, you should probably use
out-of-process Session. You can configure session to use the Session
State service or SQL Server in your web.config file. Programmatically,
you just use the Session object like you normally do. With
out-of-process session, it wont matter which server in the web cluster
the user is on; their data will be available.

Joshua Flanagan
http://flimflan.com/blog
 
G

Guest

Thanks for the reply. The data is not user specific so I was leaning towards
application cache but I was concerned because of the web farm architecture
and hence the data being duplicated on the servers. Have you run across any
documentaion on performance metrics for this? Is State Server ONLY for
session/user specific data?

Thanks
Kan
 
J

Joshua Flanagan

I don't see duplication of the data on 2 servers as a problem, unless
you expect the data to be updated by users during the execution of the
application. Then it becomes a big problem, as you try to keep the
servers in synch. Using session wouldn't help solve that problem either.
I don't know any specific performance documentation, but I'm pretty sure
you would not want to use the State Server for application wide data,
since it would cause the data to be repeated and stored individually for
each user session.
Remember, you usually only want to cache data results when it more
expensive to retrieve them from the original source. If you start
making a bunch of trips to retrieve the cached data, or use a lot of
memory for it (copying the same values to every session on every
server), you are probably hurting yourself more than helping.
I would not be afraid to make a single call to populate the ASP.NET
cache on each server on a web farm.
 
G

Guest

Thanks for the reply. It looks like application cache is the way to go. I
was reading up on it specifically with regards to amount of information that
is ideal to store. I was planning on saving a hashtable with about 50
Key-Value pairs in it. Is this a good way ? Or should serialization of the
data be considered? Have you run into any articles with size limitation for
the application cache?

Appreciate a reply.
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top