Re: [Opensymphony-oscache] Cache per server or Cache per data set?

Andres March <[email protected]> Thu, 12 May 2005 08:44:53 -0700
Newsgroups gmane.comp.java.open-symphony.os-cache
Message-ID <[email protected]>
You got most of that  right on but it is alot more than 40 threads.  
This is due to the fact that there would be a jgroups cluster per cache 
(this what should be changed).  Jgroups actually will start up between 
5-10 threads on average to manage the cluster.  So it would be more like 
400 threads.   For example if you use hibernate, this is what their 
oscache provider was doing - creating a cache per mapped table.  We have 
a patch for their provider that uses a single cache for all mapped 
objects but as you say we lose configurability options.

I wouldn't think that losing that fine grain of control should be much 
of a problem but I have never measured the performance impact.  The main 
issue you should be concerned with, since you know you will cluster, is 
if clustered invalidation (what oscache does) is suitable for your app 
or if you will require full replication.  Trust me when I say that this 
is a big decision that has both performance and design impacts.

Cork2005 wrote:

>thanks for the info dres :)
>
>Just to clarify the problem.  I have a single server at the moment and in a few months time will switch to 2 servers.  Thats why I'd like to use a cache now that can later be used clustered.  At the moment I won't use the cluster feature.
>
>So I'm not sure why I would have 40 threads in the example we discussed, I can't see anywhere that OSCache is creating a thread per cache, or did I miss that bit of code?
>
>The reason I need different cache configurations is that I have different data sets that need caching differently.  For example: Currencies and other small data sets I can quite happily load completely into an unlimited cache.  But then I also have a data set that has 400,000 DB records and I only want 4000 in the cache at any one time.  Likewise I have another data set that has 2000 DB records but I only need 50 of these in an LRU cache.  And so on...  If I can't configure them separately then the memory requirements will be too large...  And that's before I start worrying about which caches can't serve stale data and need to be configured for blocking...
>
>Thinking some more about this, if I had the 40 caches we mentioned, do they each have a seperate JGroups with configuration?  Is that were the 40 threads come from?  If so then when I switch to clustering I could always just pair up the same caches across the cluster.  eg CurrencyCache would only be configured via JGroups to talk to the other CurrencyCahce on the other server.  That way the network traffic should be more contained.  Or if the JGroups is configurable per cache then in theory I could just use the same configuration for all the cache instances?
>
>Is the JGroups configuration configurable per cache? seems like its just driven from the single properties file at the moment with no way to change it programmatically? 
>
>The region stuff that you mention sounds like the better solution.
>
>Kind Regards
>
>Peter
>
>---------------------------------------------------------------------
>Posted via Jive Forums
>http://forums.opensymphony.com/thread.jspa?threadID=2130&messageID=6418#6418
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>
>  
>