List Info

Thread: Caching objects in a remote singleton




Caching objects in a remote singleton
user name
2007-02-09 10:57:14
Not sure i'm structuring my app right here.

I'm writing a website, where primarily the data is pulled
from Oracle via
PL/SQL.  The data will rarely change over time.

So my thought was the best way would be to write a remote
object that is
called by the web page to retrieve the data.  The first time
through the
data would be pulled from Oracle.  The second time through,
either by this
user or any other, the user would be pulled from a cache.

Is this the right way of going about it (ie. would use you
"remoting" or
would you use a webservice, or any other way?).  Assuming it
is the right
way, how would you cache the data  in the remote object?  I
was going to use
the "Cache" but this is (I think) a
System.Web.Caching object and I think is
therefore not designed to work within a standard class
library running on
the server (?).

Any thoughts gratefully appreciated.



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

RE: Caching objects in a remote singleton
user name
2007-02-09 15:13:38
You likely won't see great perf gains from this architecture
unless the
database is slammed or the query takes a LONG time to
return.  Why not put
the cache on the webserver(s)?  Then it will be accessed
very quickly in
memory.  If you're concerned about maintaining multiple
copies of the cached
data, there are options that address this including ScaleOut
StateServer,
NCache, or ASP.NET 2.0 SQL Cache Invalidation.

Steve


-----Original Message-----
From: Glenn Smith [mailto:glenn.aspgooglemail.com] 
Sent: Friday, February 09, 2007 11:57 AM
To: aspnet-architectureaspadvice.com
Subject: [aspnet-architecture] Caching objects in a remote
singleton

Not sure i'm structuring my app right here.

I'm writing a website, where primarily the data is pulled
from Oracle via
PL/SQL.  The data will rarely change over time.

So my thought was the best way would be to write a remote
object that is
called by the web page to retrieve the data.  The first time
through the
data would be pulled from Oracle.  The second time through,
either by this
user or any other, the user would be pulled from a cache.

Is this the right way of going about it (ie. would use you
"remoting" or
would you use a webservice, or any other way?).  Assuming it
is the right
way, how would you cache the data  in the remote object?  I
was going to use
the "Cache" but this is (I think) a
System.Web.Caching object and I think is
therefore not designed to work within a standard class
library running on
the server (?).

Any thoughts gratefully appreciated.



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

Re: Caching objects in a remote singleton
user name
2007-02-09 15:24:15
There are so many variables to consider here, but you should know that HttpRuntime.Cache works w/ o w/o a web context, i.e., you can use it in non-ASP.NET apps.
 
My rule is that if your server can handle it and the data is not volatile, cache it.  If it will be hit A LOT (like every request), consider a singleton and put a marker in the Cache w/ a callback to remove/refresh as needed.
 
As for whether or not to use remoting, it's hard to say (I'd generally avoid it), and I'd definitely look into WCF over standard ASP.NET web services (or remoting).  You should look at the WCF Web Service Software Factory.
 
--Ambrose
 
On 2/9/07, Glenn Smith < glenn.aspgooglemail.com">glenn.aspgooglemail.com> wrote:
Not sure i'm structuring my app right here.

I&#39;m writing a website, where primarily the data is pulled from Oracle via
PL/SQL. &nbsp;The data will rarely change over time.

So my thought was the best way would be to write a remote object that is
called by the web page to retrieve the data. ; The first time through the
data would be pulled from Oracle.&nbsp; The second time through, either by this
user or any other, the user would be pulled from a cache.

Is this the right way of going about it (ie. would use you "remoting" or
would you use a webservice, or any other way?).&nbsp; Assuming it is the right
way, how would you cache the data  in the remote object?&nbsp; I was going to use
the "Cache" but this is (I think) a System.Web.Caching object and I think is
therefore not designed to work within a standard class library running on
the server (?).

Any thoughts gratefully appreciated.



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com


Need SQL Advice? http://sqladvice.com Need RegEx Advice? http://regexadvice.com Need XML Advice? http://xmladvice.com
Re: Caching objects in a remote singleton
user name
2007-02-09 15:41:29
Remoting is going to require serialization of the data and
thus there
would go any performance gain.  Doing anything other than a
binary
serialization is most likely going to incur a worst
performance.

You mention you are creating a web site.  Is this going to
be an
ASP.Net website?  If that is the case then you have
excellent caching
support built right in.

What are the standard libraries running on the server?


Doug


Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

RE: Caching objects in a remote singleton
user name
2007-02-09 16:03:37
You can include the System.Web namespace in your class and
use the cache
object.

I would use the caching system built into .NET.  I haven't
checked Oracle's
ODP.NET recently, so I don't know if it supports some type
of oracle
database caching dependency.  

I would not do any type of caching of the data on a separate
physical
server.  If you do that, the network and serialization
latencies (as others
have already mentioned) will probably not deliver the
performance you want
under load and may result in strange errors.

Wally

Wallace B. McClure
http://www.scalab
ledevelopment.com/
http://www.aspnetpodcas
t.com/
Microsoft MVP
AspInsider - http://www.aspinsiders.co
m/
INETA Speaker's Bureau - http://www.ineta.org/
Blog: http://weblogs.asp.net
/wallym/ & http://www.morewally.com/


-----Original Message-----
From: Glenn Smith [mailto:glenn.aspgooglemail.com] 
Sent: Friday, February 09, 2007 11:57 AM
To: aspnet-architectureaspadvice.com
Subject: [aspnet-architecture] Caching objects in a remote
singleton

Not sure i'm structuring my app right here.

I'm writing a website, where primarily the data is pulled
from Oracle via
PL/SQL.  The data will rarely change over time.

So my thought was the best way would be to write a remote
object that is
called by the web page to retrieve the data.  The first time
through the
data would be pulled from Oracle.  The second time through,
either by this
user or any other, the user would be pulled from a cache.

Is this the right way of going about it (ie. would use you
"remoting" or
would you use a webservice, or any other way?).  Assuming it
is the right
way, how would you cache the data  in the remote object?  I
was going to use
the "Cache" but this is (I think) a
System.Web.Caching object and I think is
therefore not designed to work within a standard class
library running on
the server (?).

Any thoughts gratefully appreciated.



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )